Commit 8333dfde authored by Michael Natterer's avatar Michael Natterer 😴

Add some #if GTK_CHECK_VERSION (2, 24, 0) for creating foreign window

so we don't use deprecated API and make the gtk3 port simpler.
parent 2827819f
......@@ -865,6 +865,33 @@ gimp_window_transient_realized (GtkWidget *window,
}
/* similar to what we have in libgimp/gimpui.c */
static GdkWindow *
gimp_get_foreign_window (guint32 window)
{
#if GTK_CHECK_VERSION (2, 24, 0)
#ifdef GDK_WINDOWING_X11
return gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#ifdef GDK_WINDOWING_WIN32
return gdk_win32_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#else /* ! GTK_CHECK_VERSION (2, 24, 0) */
#ifndef GDK_NATIVE_WINDOW_POINTER
return gdk_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#endif /* GTK_CHECK_VERSION (2, 24, 0) */
return NULL;
}
void
gimp_window_set_transient_for (GtkWindow *window,
guint32 parent_ID)
......@@ -879,9 +906,7 @@ gimp_window_set_transient_for (GtkWindow *window,
#ifndef GDK_WINDOWING_WIN32
GdkWindow *parent;
parent = gdk_window_foreign_new_for_display (gdk_display_get_default (),
parent_ID);
parent = gimp_get_foreign_window (parent_ID);
if (! parent)
return;
......
......@@ -20,6 +20,14 @@
#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_WIN32
#include <gdk/gdkwin32.h>
#endif
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "libgimpmodule/gimpmodule.h"
#include "gimp.h"
......@@ -138,6 +146,33 @@ gimp_ui_init (const gchar *prog_name,
gimp_ui_initialized = TRUE;
}
static GdkWindow *
gimp_ui_get_foreign_window (guint32 window)
{
#if GTK_CHECK_VERSION (2, 24, 0)
#ifdef GDK_WINDOWING_X11
return gdk_x11_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#ifdef GDK_WINDOWING_WIN32
return gdk_win32_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#else /* ! GTK_CHECK_VERSION (2, 24, 0) */
#ifndef GDK_NATIVE_WINDOW_POINTER
return gdk_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
#endif /* GTK_CHECK_VERSION (2, 24, 0) */
return NULL;
}
/**
* gimp_ui_get_display_window:
* @gdisp_ID: a #GimpDisplay ID.
......@@ -158,16 +193,13 @@ gimp_ui_init (const gchar *prog_name,
GdkWindow *
gimp_ui_get_display_window (guint32 gdisp_ID)
{
#ifndef GDK_NATIVE_WINDOW_POINTER
GdkNativeWindow window;
guint32 window;
g_return_val_if_fail (gimp_ui_initialized, NULL);
window = gimp_display_get_window_handle (gdisp_ID);
if (window)
return gdk_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
return gimp_ui_get_foreign_window (window);
return NULL;
}
......@@ -191,16 +223,13 @@ gimp_ui_get_display_window (guint32 gdisp_ID)
GdkWindow *
gimp_ui_get_progress_window (void)
{
#ifndef GDK_NATIVE_WINDOW_POINTER
GdkNativeWindow window;
guint32 window;
g_return_val_if_fail (gimp_ui_initialized, NULL);
window = gimp_progress_get_window_handle ();
if (window)
return gdk_window_foreign_new_for_display (gdk_display_get_default (),
window);
#endif
return gimp_ui_get_foreign_window (window);
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment