[gtk/gtk-3-24] [IMQuartz] Get the GdkWindow from the NSKeyEvent.



commit ee0e59e6cf18d2a70bd5398189340eea74989753
Author: John Ralls <jralls ceridwen us>
Date:   Sun Jan 13 15:55:51 2019 -0800

    [IMQuartz] Get the GdkWindow from the NSKeyEvent.
    
    Instead of from the IMContextQuartz's client window because the former
    is the event window where the text will be inserted. In some cases
    they're different and the text may be discarded (because the client
    window isn't editable) or misplaced.
    
    Fixes Bug 707945.

 modules/input/imquartz.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/modules/input/imquartz.c b/modules/input/imquartz.c
index 46ceafe194..bc2d895775 100644
--- a/modules/input/imquartz.c
+++ b/modules/input/imquartz.c
@@ -190,11 +190,6 @@ quartz_filter_keypress (GtkIMContext *context,
   if (!GDK_IS_QUARTZ_WINDOW (qc->client_window))
     return FALSE;
 
-  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",
-                          qc->client_window, win, nsview));
-
   NSEvent *nsevent = gdk_quartz_event_get_nsevent ((GdkEvent *)event);
 
   if (!nsevent)
@@ -206,6 +201,12 @@ quartz_filter_keypress (GtkIMContext *context,
         return gtk_im_context_filter_keypress (qc->slave, event);
     }
 
+  nsview = gdk_quartz_window_get_nsview (qc->client_window);
+
+  win = (GdkWindow *)[(GdkQuartzView *)[[nsevent window] contentView] gdkWindow];
+  GTK_NOTE (MISC, g_print ("client_window: %p, win: %p, nsview: %p\n",
+                           qc->client_window, win, nsview));
+
   if (event->type == GDK_KEY_RELEASE)
     return FALSE;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]