diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-10-29 15:14:02 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-10-29 15:14:02 -0400 |
commit | f6f8b39e420fb7bf6e250ec98861255c3d1dcccc (patch) | |
tree | e33766263201d8f1c1199e84c292e3c433497570 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java | |
parent | 8bf1fff41667314189dd27ded2919d7617ab7d0d (diff) | |
download | eclipse.platform.swt-f6f8b39e420fb7bf6e250ec98861255c3d1dcccc.tar.gz eclipse.platform.swt-f6f8b39e420fb7bf6e250ec98861255c3d1dcccc.tar.xz eclipse.platform.swt-f6f8b39e420fb7bf6e250ec98861255c3d1dcccc.zip |
filterProc never called on GTK3 for Focus events - no activeShell - no keyboard events
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java index b71470f2b2..78f0178187 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java @@ -840,8 +840,13 @@ void hookEvents () { OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [MAP_EVENT], 0, display.shellMapProcClosure, false); OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [ENTER_NOTIFY_EVENT], 0, display.closures [ENTER_NOTIFY_EVENT], false); OS.g_signal_connect_closure (shellHandle, OS.move_focus, display.closures [MOVE_FOCUS], false); - long /*int*/ window = gtk_widget_get_window (shellHandle); - OS.gdk_window_add_filter (window, display.filterProc, shellHandle); + if (OS.GTK_VERSION < OS.VERSION (3, 0, 0)) { + long /*int*/ window = gtk_widget_get_window (shellHandle); + OS.gdk_window_add_filter (window, display.filterProc, shellHandle); + } else { + OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [FOCUS_IN_EVENT], 0, display.closures [FOCUS_IN_EVENT], false); + OS.g_signal_connect_closure_by_id (shellHandle, display.signalIds [FOCUS_OUT_EVENT], 0, display.closures [FOCUS_OUT_EVENT], false); + } if (isCustomResize ()) { int mask = OS.GDK_POINTER_MOTION_MASK | OS.GDK_BUTTON_RELEASE_MASK | OS.GDK_BUTTON_PRESS_MASK | OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK; OS.gtk_widget_add_events (shellHandle, mask); @@ -1286,6 +1291,30 @@ long /*int*/ gtk_focus (long /*int*/ widget, long /*int*/ directionType) { return super.gtk_focus (widget, directionType); } +long /*int*/ gtk_focus_in_event (long /*int*/ widget, long /*int*/ event) { + if (widget != shellHandle) { + return super.gtk_focus_in_event (widget, event); + } + display.activeShell = this; + display.activePending = false; + sendEvent (SWT.Activate); + return 0; +} + +long /*int*/ gtk_focus_out_event (long /*int*/ widget, long /*int*/ event) { + if (widget != shellHandle) { + return super.gtk_focus_out_event (widget, event); + } + Display display = this.display; + sendEvent (SWT.Deactivate); + setActiveControl (null); + if (display.activeShell == this) { + display.activeShell = null; + display.activePending = false; + } + return 0; +} + long /*int*/ gtk_leave_notify_event (long /*int*/ widget, long /*int*/ event) { if (widget == shellHandle) { if (isCustomResize ()) { @@ -2428,8 +2457,10 @@ void releaseWidget () { tooltipsHandle = 0; if (group != 0) OS.g_object_unref (group); group = modalGroup = 0; - long /*int*/ window = gtk_widget_get_window (shellHandle); - OS.gdk_window_remove_filter(window, display.filterProc, shellHandle); + if (OS.GTK_VERSION < OS.VERSION(3, 0, 0)) { + long /*int*/ window = gtk_widget_get_window (shellHandle); + OS.gdk_window_remove_filter(window, display.filterProc, shellHandle); + } lastActive = null; } |