imquartz: fix regression introduced by commit 4ba1fb

In the preceding fix, the checks involving GDK_IS_QUARTZ_WINDOW macros
were left out. These checks are in fact crucial, because these functions
are sometimes called with non-quartz functions as the original comments
in the code do indicate. Therefore, reintroduce these checks. This
fixes a crash in GIMP.
This commit is contained in:
Kristian Rietveld
2016-07-18 22:00:48 +02:00
parent 6b8e20a05c
commit 899147d6d0
2 changed files with 11 additions and 0 deletions

View File

@ -68,6 +68,8 @@ gdk_quartz_window_get_nsview (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_val_if_fail (GDK_WINDOW_IS_QUARTZ (window), NULL);
if (GDK_WINDOW_DESTROYED (window))
return NULL;

View File

@ -194,6 +194,9 @@ quartz_filter_keypress (GtkIMContext *context,
if (!qc->client_window)
return FALSE;
if (!gdk_quartz_window_is_quartz (qc->client_window))
return gtk_im_context_filter_keypress (qc->slave, event);
nsview = gdk_quartz_window_get_nsview (qc->client_window);
win = (GdkWindow *)[ (GdkQuartzView *)nsview gdkWindow];
GTK_NOTE (MISC, g_print ("client_window: %p, win: %p, nsview: %p\n",
@ -243,6 +246,9 @@ discard_preedit (GtkIMContext *context)
if (!qc->client_window)
return;
if (!gdk_quartz_window_is_quartz (qc->client_window))
return;
NSView *nsview = gdk_quartz_window_get_nsview (qc->client_window);
if (!nsview)
return;
@ -313,6 +319,9 @@ quartz_set_cursor_location (GtkIMContext *context, GdkRectangle *area)
if (!qc->client_window)
return;
if (!gdk_quartz_window_is_quartz (qc->client_window))
return;
if (!qc->focused)
return;