diff options
author | Steve Northover | 2004-05-17 20:28:09 +0000 |
---|---|---|
committer | Steve Northover | 2004-05-17 20:28:09 +0000 |
commit | 89eb385b1da972fcbe2914fa0139ceb359ab6ba8 (patch) | |
tree | 9c578f7ec5016bca148e0adca73abcd45c5bb7d8 | |
parent | 2bc9349b1671db3901b3a0a2100c146cb9301ffe (diff) | |
download | eclipse.platform.swt-89eb385b1da972fcbe2914fa0139ceb359ab6ba8.tar.gz eclipse.platform.swt-89eb385b1da972fcbe2914fa0139ceb359ab6ba8.tar.xz eclipse.platform.swt-89eb385b1da972fcbe2914fa0139ceb359ab6ba8.zip |
62477
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java | 50 | ||||
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java | 12 |
2 files changed, 38 insertions, 24 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 caa6f2d51c..39f76f0dc4 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 @@ -544,7 +544,8 @@ void hookEvents () { OS.g_signal_connect (shellHandle, OS.size_allocate, windowProc3, SIZE_ALLOCATE); OS.g_signal_connect (shellHandle, OS.configure_event, windowProc3, CONFIGURE_EVENT); OS.g_signal_connect (shellHandle, OS.delete_event, windowProc3, DELETE_EVENT); - OS.g_signal_connect (shellHandle, OS.event_after, windowProc3, EVENT_AFTER); + OS.g_signal_connect (shellHandle, OS.focus_in_event, windowProc3, FOCUS_IN_EVENT); + OS.g_signal_connect (shellHandle, OS.focus_out_event, windowProc3, FOCUS_OUT_EVENT); OS.g_signal_connect (shellHandle, OS.map_event, shellMapProc, 0); } @@ -694,27 +695,6 @@ int /*long*/ gtk_delete_event (int /*long*/ widget, int /*long*/ event) { return 1; } -int /*long*/ gtk_event_after (int /*long*/ widget, int /*long*/ event) { - int /*long*/ result = super.gtk_event_after (widget, event); - if (widget == shellHandle) { - GdkEvent gdkEvent = new GdkEvent (); - OS.memmove (gdkEvent, event, GdkEvent.sizeof); - if (gdkEvent.type == OS.GDK_FOCUS_CHANGE) { - GdkEventFocus focusEvent = new GdkEventFocus (); - OS.memmove (focusEvent, event, GdkEventFocus.sizeof); - hasFocus = focusEvent.in != 0; - if (hasFocus) { - postEvent (SWT.Activate); - if (tooltipsHandle != 0) OS.gtk_tooltips_enable (tooltipsHandle); - } else { - postEvent (SWT.Deactivate); - if (tooltipsHandle != 0) OS.gtk_tooltips_disable (tooltipsHandle); - } - } - } - return result; -} - int /*long*/ gtk_focus (int /*long*/ widget, int /*long*/ directionType) { switch ((int)/*64*/directionType) { case OS.GTK_DIR_TAB_FORWARD: @@ -732,6 +712,32 @@ int /*long*/ gtk_focus (int /*long*/ widget, int /*long*/ directionType) { return super.gtk_focus (widget, directionType); } +int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) { + int /*long*/ result = super.gtk_focus_in_event (widget, event); + // widget could be disposed at this point + if (handle == 0) return 0; + if (widget == shellHandle) { + if (tooltipsHandle != 0) OS.gtk_tooltips_enable (tooltipsHandle); + hasFocus = true; + sendEvent (SWT.Activate); + return 0; + } + return result; +} + +int /*long*/ gtk_focus_out_event (int /*long*/ widget, int /*long*/ event) { + int /*long*/ result = super.gtk_focus_out_event (widget, event); + // widget could be disposed at this point + if (handle == 0) return 0; + if (widget == shellHandle) { + if (tooltipsHandle != 0) OS.gtk_tooltips_disable (tooltipsHandle); + hasFocus = false; + sendEvent (SWT.Deactivate); + return 0; + } + return result; +} + int /*long*/ gtk_map_event (int /*long*/ widget, int /*long*/ event) { minimized = false; sendEvent (SWT.Deiconify); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java index 23e38b5476..00fe972b9b 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Shell.java @@ -1510,10 +1510,18 @@ int XFocusChange (int w, int client_data, int call_data, int continue_to_dispatc case OS.NotifyNonlinearVirtual: { switch (xEvent.type) { case OS.FocusIn: - postEvent (SWT.Activate); + if (display.postFocusOut) { + postEvent (SWT.Activate); + } else { + sendEvent (SWT.Activate); + } break; case OS.FocusOut: - postEvent (SWT.Deactivate); + if (display.postFocusOut) { + postEvent (SWT.Deactivate); + } else { + sendEvent (SWT.Deactivate); + } break; } } |