mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-23 08:47:47 +02:00
Move dnd escape code encoding into dnd.c
This commit is contained in:
@@ -1904,6 +1904,15 @@ subdir_data_for_drag(
|
|||||||
}
|
}
|
||||||
#undef mi
|
#undef mi
|
||||||
|
|
||||||
|
void
|
||||||
|
drag_offer_start_to_child(Window *w, int32_t cell_x, int32_t cell_y, int32_t pixel_x, int32_t pixel_y) {
|
||||||
|
char buf[256];
|
||||||
|
int header_size = snprintf(
|
||||||
|
buf, sizeof(buf), "%d;t=o:x=%d:y=%d:X=%d:Y=%d", DND_CODE, cell_x, cell_y, pixel_x, pixel_y);
|
||||||
|
queue_payload_to_child(
|
||||||
|
w->id, w->drag_source.client_id, &w->drag_source.pending, buf, header_size, NULL, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drag_remote_file_data(
|
drag_remote_file_data(
|
||||||
Window *w, int32_t x, int32_t y, int32_t X, int32_t Y, bool has_more, const uint8_t *payload, size_t payload_sz
|
Window *w, int32_t x, int32_t y, int32_t X, int32_t Y, bool has_more, const uint8_t *payload, size_t payload_sz
|
||||||
|
|||||||
@@ -37,3 +37,4 @@ void drag_process_item_data(Window *w, size_t idx, int has_more, const uint8_t *
|
|||||||
void drag_remote_file_data(Window *w, int32_t x, int32_t y, int32_t X, int32_t Y, bool has_more, const uint8_t *payload, size_t payload_sz);
|
void drag_remote_file_data(Window *w, int32_t x, int32_t y, int32_t X, int32_t Y, bool has_more, const uint8_t *payload, size_t payload_sz);
|
||||||
void drag_start_offerring(Window *w, const char *client_machine_id, size_t sz);
|
void drag_start_offerring(Window *w, const char *client_machine_id, size_t sz);
|
||||||
void drag_stop_offerring(Window *w);
|
void drag_stop_offerring(Window *w);
|
||||||
|
void drag_offer_start_to_child(Window *w, int32_t cell_x, int32_t cell_y, int32_t pixel_x, int32_t pixel_y);
|
||||||
|
|||||||
@@ -684,9 +684,8 @@ HANDLER(handle_move_event) {
|
|||||||
if (w->drag_source.initial_left_press.at && distance(w->mouse_pos.global_x, w->mouse_pos.global_y, w->drag_source.initial_left_press.x, w->drag_source.initial_left_press.y) > OPT(drag_threshold)) {
|
if (w->drag_source.initial_left_press.at && distance(w->mouse_pos.global_x, w->mouse_pos.global_y, w->drag_source.initial_left_press.x, w->drag_source.initial_left_press.y) > OPT(drag_threshold)) {
|
||||||
zero_at_ptr(&w->drag_source.initial_left_press);
|
zero_at_ptr(&w->drag_source.initial_left_press);
|
||||||
if (w->drag_source.can_offer) {
|
if (w->drag_source.can_offer) {
|
||||||
snprintf(mouse_event_buf, sizeof(mouse_event_buf), "%d;t=o:x=%d:y=%d:X=%d:Y=%d",
|
drag_offer_start_to_child(
|
||||||
DND_CODE, w->mouse_pos.cell_x, w->mouse_pos.cell_y, (int)w->mouse_pos.global_x, (int)w->mouse_pos.global_y);
|
w, w->mouse_pos.cell_x, w->mouse_pos.cell_y, (int)w->mouse_pos.global_x, (int)w->mouse_pos.global_y);
|
||||||
write_escape_code_to_child(screen, ESC_OSC, mouse_event_buf);
|
|
||||||
debug("Sent drag start event to child\n");
|
debug("Sent drag start event to child\n");
|
||||||
} else if (w->drag_source.potential_url_drag.active) {
|
} else if (w->drag_source.potential_url_drag.active) {
|
||||||
w->drag_source.potential_url_drag.active = false;
|
w->drag_source.potential_url_drag.active = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user