Fix initialisation of hybrid Wayland/X11 platform

Also, terminate Wayland drag-and-drop operation after Fl::pushed(0).
This commit is contained in:
ManoloFLTK 2022-11-07 09:02:22 +01:00
parent 089584da9f
commit 38536d8918
2 changed files with 4 additions and 4 deletions

View File

@ -76,7 +76,7 @@ void write_data_source_cb(FL_SOCKET fd, data_source_write_struct *data) {
static void data_source_handle_send(void *data, struct wl_data_source *source, const char *mime_type, int fd) {
fl_intptr_t rank = (fl_intptr_t)data;
//fprintf(stderr, "data_source_handle_send: %s fd=%d l=%d\n", mime_type, fd, fl_selection_length[1]);
if (!Fl::pushed()) { close(fd); }
if (!Fl::pushed()) { close(fd); wl_data_source_destroy(source); }
else if (strcmp(mime_type, wld_plain_text_clipboard) == 0 || strcmp(mime_type, "text/plain") == 0 || strcmp(mime_type, "image/bmp") == 0) {
data_source_write_struct *write_data = new data_source_write_struct;
write_data->rest = fl_selection_length[rank];

View File

@ -134,9 +134,9 @@ Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int
Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() {
#if FLTK_USE_X11
if (!Fl_Screen_Driver::system_driver) Fl::system_driver();
if (Fl_Wayland_Screen_Driver::wl_display) {
#if FLTK_USE_X11
if (attempt_wayland()) {
return new Fl_Wayland_Screen_Driver();
}
@ -162,7 +162,7 @@ Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w)
Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off)
{
#if FLTK_USE_X11
if (!Fl_Wayland_Screen_Driver::wl_display)
if (!attempt_wayland())
return new Fl_Xlib_Image_Surface_Driver(w, h, high_res, off);
#endif
return new Fl_Wayland_Image_Surface_Driver(w, h, high_res, off);