Skip to content

Commit ef6539d

Browse files
committed
Propagate error when requesting drop data
1 parent 35cd3d3 commit ef6539d

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

kitty/dnd.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,13 @@ do_drop_request_data(Window *w, int32_t idx) {
668668
}
669669
const char *mime = w->drop.offerred_mimes[idx - 1];
670670
w->drop.getting_data_for_mime = strdup(mime);
671-
if (w->drop.getting_data_for_mime) request_drop_data(osw, w->id, mime);
671+
if (w->drop.getting_data_for_mime) {
672+
int err = request_drop_data(osw, w->id, mime);
673+
if (err) {
674+
drop_send_error(w, err, "drop data request from OS failed");
675+
return true;
676+
}
677+
}
672678
return false; /* async: completion via drop_dispatch_data */
673679
}
674680

kitty/glfw.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,10 +776,11 @@ register_mimes_for_drop(OSWindow *w, const char **mimes, size_t sz) {
776776
#endif
777777
}
778778

779-
void
779+
int
780780
request_drop_data(OSWindow *w, id_type wid, const char* mime) {
781781
global_state.drop_dest.client_window_data_request = wid;
782-
if (w->handle) glfwRequestDropData(w->handle, mime);
782+
if (w->handle) return glfwRequestDropData(w->handle, mime);
783+
return ENOENT;
783784
}
784785

785786
static void

kitty/state.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ void take_screenshot_of_rectangular_region(OSWindow *os_window, Region region, u
642642
bool current_framebuffer_is_ok(void);
643643
void request_drop_status_update(OSWindow *osw);
644644
void register_mimes_for_drop(OSWindow *w, const char **mimes, size_t sz);
645-
void request_drop_data(OSWindow *w, id_type wid, const char* mime);
645+
int request_drop_data(OSWindow *w, id_type wid, const char* mime);
646646
void cancel_current_drag_source(void);
647647
bool change_drag_image(int idx);
648648
int start_window_drag(Window *w, bool in_test_mode);

0 commit comments

Comments
 (0)