app, libgimp: protect a bit GDK X Window calls.

The GDK_WINDOWING_X11 build-time macro check is not enough as GDK can be
built with both X11 and Wayland backends. We need to add a runtime check
of the type of display.
This commit is contained in:
Jehan 2020-06-21 12:54:13 +02:00
parent 9545406034
commit 33520a547d
2 changed files with 6 additions and 4 deletions

View file

@ -913,8 +913,9 @@ static GdkWindow *
gimp_get_foreign_window (guint32 window)
{
#ifdef GDK_WINDOWING_X11
return gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
window);
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
return gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#ifdef GDK_WINDOWING_WIN32

View file

@ -178,8 +178,9 @@ static GdkWindow *
gimp_ui_get_foreign_window (guint32 window)
{
#ifdef GDK_WINDOWING_X11
return gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
window);
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
return gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#ifdef GDK_WINDOWING_WIN32