summaryrefslogtreecommitdiff
path: root/src/drivers/X11
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-01-16 18:49:26 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-01-16 18:49:41 +0100
commit8213ba94aa2b1a83f7da8b603935811c05c7def5 (patch)
treedbcef06f4d4b32ab55abe126726c1000027a2070 /src/drivers/X11
parent0f335ab4409943ff59dd0c542e9a3c9947c911d7 (diff)
Improve Fl_GTK_Native_File_Chooser_Driver in relation to FLTK windows.
Implement a new way to make the GTK file-chooser window modal-like by preventing any event processing by other FLTK windows. The new way is also no longer X11-specific.
Diffstat (limited to 'src/drivers/X11')
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.H5
-rw-r--r--src/drivers/X11/Fl_X11_Screen_Driver.cxx42
-rw-r--r--src/drivers/X11/Fl_X11_System_Driver.H3
-rw-r--r--src/drivers/X11/Fl_X11_System_Driver.cxx16
4 files changed, 4 insertions, 62 deletions
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.H b/src/drivers/X11/Fl_X11_Screen_Driver.H
index 8a82486fa..7d665dbb4 100644
--- a/src/drivers/X11/Fl_X11_Screen_Driver.H
+++ b/src/drivers/X11/Fl_X11_Screen_Driver.H
@@ -2,7 +2,7 @@
// Definition of X11 Screen interface
// for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010-2018 by Bill Spitzak and others.
+// Copyright 2010-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -103,9 +103,6 @@ public:
// --- compute dimensions of an Fl_Offscreen
virtual void offscreen_size(Fl_Offscreen o, int &width, int &height);
virtual void default_icons(const Fl_RGB_Image *icons[], int count);
-#if HAVE_DLSYM && HAVE_DLFCN_H
- virtual void make_transient(void *ptr_gtk, void *gtk_window, Fl_Window *win);
-#endif
};
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
index 717132d1c..beb30df83 100644
--- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx
@@ -1,7 +1,7 @@
//
// Definition of X11 Screen interface
//
-// Copyright 1998-2020 by Bill Spitzak and others.
+// Copyright 1998-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -1399,43 +1399,3 @@ void Fl_X11_Screen_Driver::desktop_scale_factor()
}
#endif // USE_XFT
-
-#if HAVE_DLSYM && HAVE_DLFCN_H
-void Fl_X11_Screen_Driver::make_transient(void *ptr_gtk, void *gtkw_window, Fl_Window *win) {
- typedef int gboolean;
- typedef struct _GdkDrawable GdkWindow;
- typedef struct _GtkWidget GtkWidget;
-
- typedef unsigned long (*XX_gdk_x11_window_get_type)();
- static XX_gdk_x11_window_get_type fl_gdk_x11_window_get_type = NULL;
-
- typedef gboolean (*XX_g_type_check_instance_is_a)(void *type_instance, unsigned long iface_type);
- static XX_g_type_check_instance_is_a fl_g_type_check_instance_is_a = NULL;
-
- typedef Window (*gdk_to_X11_t)(GdkWindow*);
- static gdk_to_X11_t fl_gdk_to_X11 = NULL;
-
- typedef GdkWindow* (*XX_gtk_widget_get_window)(GtkWidget *);
- static XX_gtk_widget_get_window fl_gtk_widget_get_window = NULL;
-
- if (!fl_gdk_to_X11) {
- fl_gdk_to_X11 = (gdk_to_X11_t)dlsym(ptr_gtk, "gdk_x11_drawable_get_xid");
- if (!fl_gdk_to_X11) fl_gdk_to_X11 = (gdk_to_X11_t)dlsym(ptr_gtk, "gdk_x11_window_get_xid");
- if (!fl_gdk_to_X11) return;
- fl_gdk_x11_window_get_type = (XX_gdk_x11_window_get_type)dlsym(ptr_gtk, "gdk_x11_window_get_type");
- fl_g_type_check_instance_is_a = (XX_g_type_check_instance_is_a)dlsym(ptr_gtk, "g_type_check_instance_is_a");
- fl_gtk_widget_get_window = (XX_gtk_widget_get_window)dlsym(ptr_gtk, "gtk_widget_get_window");
- if (!fl_gtk_widget_get_window) return;
- }
- GdkWindow* gdkw = fl_gtk_widget_get_window((GtkWidget*)gtkw_window);
-
- // Make sure the Dialog is an X11 window because it's not on Wayland.
- // Until we find how to make a wayland window transient for an X11 window,
- // we make the GTK window transient only when it's X11-based.
- if ( (!fl_gdk_x11_window_get_type) || (!fl_g_type_check_instance_is_a) ||
- fl_g_type_check_instance_is_a(gdkw, fl_gdk_x11_window_get_type()) ) {
- Window xw = fl_gdk_to_X11(gdkw); // get the X11 ref of the GTK window
- if (xw) XSetTransientForHint(fl_display, xw, fl_xid(win)); // set the GTK window transient for the last FLTK win
- }
-}
-#endif //HAVE_DLSYM && HAVE_DLFCN_H
diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H
index 69649bc36..146a48e83 100644
--- a/src/drivers/X11/Fl_X11_System_Driver.H
+++ b/src/drivers/X11/Fl_X11_System_Driver.H
@@ -2,7 +2,7 @@
// Definition of Posix system driver
// for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010-2018 by Bill Spitzak and others.
+// Copyright 2010-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -64,7 +64,6 @@ public:
virtual void add_fd(int fd, Fl_FD_Handler cb, void* = 0);
virtual void remove_fd(int, int when);
virtual void remove_fd(int);
- virtual void emulate_modal_dialog();
};
#endif /* FL_X11_SYSTEM_DRIVER_H */
diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx
index 30dfe8bcf..7868ae3a1 100644
--- a/src/drivers/X11/Fl_X11_System_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_System_Driver.cxx
@@ -2,7 +2,7 @@
// Definition of Posix system driver
// for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010-2020 by Bill Spitzak and others.
+// Copyright 2010-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -618,18 +618,4 @@ void Fl_X11_System_Driver::own_colormap() {
#endif // USE_COLORMAP
}
-
-void Fl_X11_System_Driver::emulate_modal_dialog() {
- while (XEventsQueued(fl_display, QueuedAfterReading)) { // emulate modal dialog
- XEvent xevent;
- XNextEvent(fl_display, &xevent);
- Window xid = xevent.xany.window;
- if (xevent.type == ConfigureNotify) xid = xevent.xmaprequest.window;
- if (!fl_find(xid)) continue; // skip events to non-FLTK windows
- // process Expose and ConfigureNotify events
- if ( xevent.type == Expose || xevent.type == ConfigureNotify ) fl_handle(xevent);
- }
- Fl::flush(); // do the drawings needed after Expose events
-}
-
#endif // !defined(FL_DOXYGEN)