diff options
author | Felipe Heidrich <fheidric> | 2003-06-04 22:48:48 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2003-06-04 22:48:48 +0000 |
commit | cba29376201520c26d3b45846791dcbc33d488a5 (patch) | |
tree | 2013afce9a5539c1f68798c923d83b327ca4df06 | |
parent | 89a6b59e55d16b8e16bfbfbd1a50027069629eaf (diff) | |
download | eclipse.platform.swt-cba29376201520c26d3b45846791dcbc33d488a5.tar.gz eclipse.platform.swt-cba29376201520c26d3b45846791dcbc33d488a5.tar.xz eclipse.platform.swt-cba29376201520c26d3b45846791dcbc33d488a5.zip |
38388
13 files changed, 165 insertions, 92 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java index 7ee4c98c72..8112f2762f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/OS.java @@ -823,6 +823,7 @@ public class OS { public static final int XmNdropTransfers = malloc ("dropTransfers", 4); public static final int XmNshowArrows = malloc ("showArrows", 4); public static final int XmNspotLocation = malloc ("spotLocation", 4); + public static final int XmNarea = malloc ("area", 4); // public static final int XNFocusWindow = malloc ("focusWindow", 4); // public static final int XNInputStyle = malloc ("inputStyle", 4); // public static final int XNClientWindow = malloc ("clientWindow", 4); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java index ce725318c7..9136992ac2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java @@ -222,6 +222,12 @@ void createScrolledHandle (int parentHandle) { OS.gtk_container_add (parentHandle, handle); } OS.gtk_widget_show (handle); + if (imHandle != 0) { + int window = OS.GTK_WIDGET_WINDOW (handle); + if (window != 0) { + OS.gtk_im_context_set_client_window (imHandle, window); + } + } if ((style & SWT.NO_REDRAW_RESIZE) != 0) { OS.gtk_widget_set_redraw_on_allocate (handle, false); @@ -555,7 +561,6 @@ void releaseHandle () { void releaseWidget () { releaseChildren (); - if (imHandle != 0) OS.gtk_im_context_reset (imHandle); super.releaseWidget (); if (imHandle != 0) OS.g_object_unref (imHandle); imHandle = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java index c77b091913..2bbf3d66d1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java @@ -157,11 +157,11 @@ void hookEvents () { OS.g_signal_connect_after (eventHandle, OS.enter_notify_event, windowProc3, ENTER_NOTIFY_EVENT); OS.g_signal_connect_after (eventHandle, OS.leave_notify_event, windowProc3, LEAVE_NOTIFY_EVENT); OS.g_signal_connect_after (eventHandle, OS.expose_event, windowProc3, EXPOSE_EVENT); + OS.g_signal_connect_after (handle, OS.realize, windowProc2, REALIZE); int imHandle = imHandle (); if (imHandle != 0) { int topHandle = topHandle (); - OS.g_signal_connect (handle, OS.map_event, windowProc3, MAP_EVENT); - OS.g_signal_connect (topHandle, OS.hide, windowProc2, HIDE); + OS.g_signal_connect (handle, OS.unrealize, windowProc2, UNREALIZE); OS.g_signal_connect (imHandle, OS.commit, windowProc3, COMMIT); OS.g_signal_connect (imHandle, OS.preedit_changed, windowProc2, PREEDIT_CHANGED); } @@ -1735,12 +1735,6 @@ int gtk_focus_out_event (int widget, int event) { return 0; } -int gtk_hide (int widget) { - int imHandle = imHandle (); - if (imHandle != 0) OS.gtk_im_context_reset (imHandle); - return 0; -} - int gtk_key_press_event (int widget, int event) { if (!hasFocus ()) return 0; int imHandle = imHandle (); @@ -1779,12 +1773,6 @@ int gtk_leave_notify_event (int widget, int event) { return 0; } -int gtk_map_event (int widget, int event) { - int imHandle = imHandle (); - if (imHandle != 0) OS.gtk_im_context_set_client_window (imHandle, paintWindow ()); - return 0; -} - int gtk_motion_notify_event (int widget, int event) { Display display = getDisplay (); if (hooks (SWT.DragDetect)) { @@ -1819,11 +1807,26 @@ int gtk_preedit_changed (int imcontext) { return 0; } +int gtk_realize (int widget) { + int imHandle = imHandle (); + if (imHandle != 0) { + int window = OS.GTK_WIDGET_WINDOW (paintHandle ()); + OS.gtk_im_context_set_client_window (imHandle, window); + } + return 0; +} + int gtk_show_help (int widget, int helpType) { sendHelpEvent (helpType); return 0; } +int gtk_unrealize (int widget) { + int imHandle = imHandle (); + if (imHandle != 0) OS.gtk_im_context_set_client_window (imHandle, 0); + return 0; +} + /** * Invokes platform specific functionality to allocate a new GC handle. * <p> @@ -2083,6 +2086,11 @@ void releaseWidget () { Display display = getDisplay (); display.removeMouseHoverTimeout (handle); super.releaseWidget (); + int imHandle = imHandle (); + if (imHandle != 0) { + OS.gtk_im_context_reset (imHandle); + OS.gtk_im_context_set_client_window (imHandle, 0); + } toolTipText = null; parent = null; menu = null; @@ -2490,13 +2498,8 @@ public void setVisible (boolean visible) { * By observation, a widget that is not realized will * not respond to a mnemonic. The fix is to unrealize * the widget hierarchy every time a widget is hidden. - * - * Note: Controls who have an IM context associated cannot - * call gtk_widget_unrealize() because it forces the widget to - * be remapped. */ - int imHandle = imHandle (); - if (imHandle == 0) OS.gtk_widget_unrealize (topHandle); + OS.gtk_widget_unrealize (topHandle); sendEvent (SWT.Hide); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java index 56de5dbbfe..a7c975fca5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java @@ -146,13 +146,6 @@ int gtk_realize (int widget) { return 0; } -void hookEvents () { - super.hookEvents (); - Display display = getDisplay (); - int windowProc2 = display.windowProc2; - OS.g_signal_connect_after (handle, OS.realize, windowProc2, REALIZE); -} - void releaseWidget () { super.releaseWidget (); if (timerId != 0) OS.gtk_timeout_remove (timerId); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java index dac71f6280..2680b6e1c3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java @@ -113,7 +113,8 @@ public abstract class Widget { static final int SWITCH_PAGE = 35; static final int TOGGLED = 36; static final int UNMAP_EVENT = 37; - static final int VALUE_CHANGED = 38; + static final int UNREALIZE = 38; + static final int VALUE_CHANGED = 39; /** * Prevents uninitialized instances from being created outside the package. @@ -643,6 +644,10 @@ int gtk_unmap_event (int widget, int event) { return 0; } +int gtk_unrealize (int widget) { + return 0; +} + int gtk_value_changed (int adjustment) { return 0; } @@ -1138,6 +1143,7 @@ int windowProc (int handle, int user_data) { case SELECT: return gtk_select (handle); case SHOW: return gtk_show (handle); case VALUE_CHANGED: return gtk_value_changed (handle); + case UNREALIZE: return gtk_unrealize (handle); default: return 0; } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java index 7be6a59f57..f97c14e007 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Button.java @@ -743,8 +743,8 @@ void updateShadows () { OS.XtSetValues (handle, argList2, argList2.length / 2); } } -int xFocusIn () { - super.xFocusIn (); +int xFocusIn (XFocusChangeEvent xEvent) { + super.xFocusIn (xEvent); // widget could be disposed at this point if (handle == 0) return 0; if ((style & SWT.PUSH) != 0) { @@ -752,8 +752,8 @@ int xFocusIn () { } return 0; } -int xFocusOut () { - super.xFocusOut (); +int xFocusOut (XFocusChangeEvent xEvent) { + super.xFocusOut (xEvent); // widget could be disposed at this point if (handle == 0) return 0; if ((style & SWT.PUSH) != 0 && getDefault ()) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java index 070aa6abd4..866cc880b3 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Canvas.java @@ -96,9 +96,9 @@ public Caret getCaret () { short [] getIMCaretPos () { if (caret == null) return super.getIMCaretPos (); - int width = caret.width; - if (width <= 0) width = 2; - return new short[]{(short) (caret.x + width), (short) (caret.y + caret.height)}; + int x = caret.x + (caret.width <= 0 ? 2 : caret.width); + int y = caret.y + getFontAscent(); + return new short[]{(short) x, (short) y}; } void redrawWidget (int x, int y, int width, int height, boolean all) { boolean isFocus = caret != null && caret.isFocusCaret (); @@ -229,12 +229,21 @@ void updateCaret () { if (caret == null) return; if (!OS.IsDBLocale) return; short [] point = getIMCaretPos (); - int ptr = OS.XtMalloc (4); - OS.memmove (ptr, point, 4); - int[] argList = {OS.XmNspotLocation, ptr}; + int ptr1 = OS.XtMalloc (4); + OS.memmove (ptr1, point, 4); + int [] argList1 = {OS.XmNwidth, 0, OS.XmNheight, 0}; + OS.XtGetValues (handle, argList1, argList1.length / 2); + short [] rect = new short[]{0, 0, (short) argList1 [1], (short) argList1 [3]}; + int ptr2 = OS.XtMalloc (8); + OS.memmove (ptr2, rect, 8); + int [] argList2 = {OS.XmNspotLocation, ptr1, OS.XmNarea, ptr2}; + OS.XmImSetValues (handle, argList2, argList2.length / 2); int focusHandle = focusHandle (); - OS.XmImSetValues (focusHandle, argList, argList.length / 2); - if (ptr != 0) OS.XtFree (ptr); + if (handle != focusHandle) { + OS.XmImSetValues (focusHandle, argList2, argList2.length / 2); + } + if (ptr1 != 0) OS.XtFree (ptr1); + if (ptr2 != 0) OS.XtFree (ptr2); } int XExposure (int w, int client_data, int call_data, int continue_to_dispatch) { boolean isFocus = caret != null && caret.isFocusCaret (); @@ -243,13 +252,13 @@ int XExposure (int w, int client_data, int call_data, int continue_to_dispatch) if (isFocus) caret.setFocus (); return result; } -int xFocusIn () { - int result = super.xFocusIn (); +int xFocusIn (XFocusChangeEvent xEvent) { + int result = super.xFocusIn (xEvent); if (caret != null) caret.setFocus (); return result; } -int xFocusOut () { - int result = super.xFocusOut (); +int xFocusOut (XFocusChangeEvent xEvent) { + int result = super.xFocusOut (xEvent); if (caret != null) caret.killFocus (); return result; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java index 9ba355d43c..b12ad3d08b 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Caret.java @@ -354,9 +354,12 @@ public void setFont (Font font) { } this.font = font; if (isVisible && parent.hasFocus()) { - int focusHandle = parent.focusHandle (); int [] argList = {OS.XmNfontList, font.handle}; - OS.XmImSetValues (focusHandle, argList, argList.length / 2); + OS.XmImSetValues (handle, argList, argList.length / 2); + int focusHandle = parent.focusHandle (); + if (handle != focusHandle) { + OS.XmImSetValues (focusHandle, argList, argList.length / 2); + } } } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java index eb2b05187b..c904c3c8db 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Composite.java @@ -180,7 +180,8 @@ void createHandle (int index) { createScrolledHandle (parentHandle); } if ((style & SWT.NO_FOCUS) == 0) { - focusHandle = OS.XmCreateDrawingArea (handle, null, null, 0); + int [] argList = {OS.XmNtraversalOn, 0}; + focusHandle = OS.XmCreateDrawingArea (handle, null, argList, argList.length / 2); if (focusHandle == 0) error (SWT.ERROR_NO_HANDLES); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java index 01cad3fbe6..c6d1b00c6e 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Control.java @@ -432,8 +432,11 @@ void createWidget (int index) { * on a German locale. */ if (!hasIMSupport()) { + OS.XmImRegister (handle, 0); int focusHandle = focusHandle (); - OS.XmImRegister (focusHandle, 0); + if (handle != focusHandle) { + OS.XmImRegister (focusHandle, 0); + } } /* @@ -539,7 +542,18 @@ public boolean forceFocus () { Decorations shell = menuShell (); shell.setSavedFocus (this); shell.bringToTop (false); - return XmProcessTraversal (focusHandle (), OS.XmTRAVERSE_CURRENT); + int focusHandle = focusHandle (); + if (handle != focusHandle) { + int [] argList1 = {OS.XmNnumChildren, 0}; + OS.XtGetValues (handle, argList1, argList1.length / 2); + if (argList1 [1] > 1) { + int [] argList2 = {OS.XmNtraversalOn, 1}; + OS.XtSetValues (focusHandle, argList2, argList2.length / 2); + } else { + focusHandle = handle; + } + } + return XmProcessTraversal (focusHandle, OS.XmTRAVERSE_CURRENT); } /** @@ -991,7 +1005,6 @@ boolean hasIMSupport() { return false; } void hookEvents () { - int focusHandle = focusHandle (); int windowProc = getDisplay ().windowProc; OS.XtAddEventHandler (handle, OS.ButtonPressMask, false, windowProc, BUTTON_PRESS); OS.XtAddEventHandler (handle, OS.ButtonReleaseMask, false, windowProc, BUTTON_RELEASE); @@ -1000,9 +1013,15 @@ void hookEvents () { OS.XtAddEventHandler (handle, OS.LeaveWindowMask, false, windowProc, LEAVE_WINDOW); OS.XtInsertEventHandler (handle, OS.ExposureMask, false, windowProc, EXPOSURE, OS.XtListTail); OS.XtAddCallback (handle, OS.XmNhelpCallback, windowProc, HELP_CALLBACK); - OS.XtAddEventHandler (focusHandle, OS.KeyPressMask, false, windowProc, KEY_PRESS); - OS.XtAddEventHandler (focusHandle, OS.KeyReleaseMask, false, windowProc, KEY_RELEASE); - OS.XtInsertEventHandler (focusHandle, OS.FocusChangeMask, false, windowProc, FOCUS_CHANGE, OS.XtListTail); + OS.XtAddEventHandler (handle, OS.KeyPressMask, false, windowProc, KEY_PRESS); + OS.XtAddEventHandler (handle, OS.KeyReleaseMask, false, windowProc, KEY_RELEASE); + OS.XtInsertEventHandler (handle, OS.FocusChangeMask, false, windowProc, FOCUS_CHANGE, OS.XtListTail); + int focusHandle = focusHandle (); + if (handle != focusHandle) { + OS.XtAddEventHandler (focusHandle, OS.KeyPressMask, false, windowProc, KEY_PRESS); + OS.XtAddEventHandler (focusHandle, OS.KeyReleaseMask, false, windowProc, KEY_RELEASE); + OS.XtInsertEventHandler (focusHandle, OS.FocusChangeMask, false, windowProc, FOCUS_CHANGE, OS.XtListTail); + } } int hoverProc (int id) { return hoverProc (id, true); @@ -1255,9 +1274,13 @@ public void moveBelow (Control control) { } void overrideTranslations () { Display display = getDisplay (); + OS.XtOverrideTranslations (handle, display.tabTranslations); + OS.XtOverrideTranslations (handle, display.arrowTranslations); int focusHandle = focusHandle (); - OS.XtOverrideTranslations (focusHandle, display.tabTranslations); - OS.XtOverrideTranslations (focusHandle, display.arrowTranslations); + if (handle != focusHandle) { + OS.XtOverrideTranslations (focusHandle, display.tabTranslations); + OS.XtOverrideTranslations (focusHandle, display.arrowTranslations); + } } /** * Causes the receiver to be resized to its preferred size. @@ -1376,8 +1399,11 @@ void releaseWidget () { } menu = null; if (!hasIMSupport()) { + OS.XmImUnregister (handle); int focusHandle = focusHandle (); - OS.XmImUnregister (focusHandle); + if (handle != focusHandle) { + OS.XmImUnregister (focusHandle); + } } parent = null; layoutData = null; @@ -1613,7 +1639,7 @@ void sendIMKeyEvent (int type, XKeyEvent xEvent) { */ byte [] buffer = new byte [512]; int [] status = new int [1], unused = new int [1]; - int focusHandle = focusHandle (); + int focusHandle = OS.XtWindowToWidget (xEvent.display, xEvent.window); int length = OS.XmImMbLookupString (focusHandle, xEvent, buffer, buffer.length, unused, status); if (status [0] == OS.XBufferOverflow) { buffer = new byte [length]; @@ -1736,6 +1762,20 @@ boolean setBounds (int x, int y, int width, int height, boolean move, boolean re boolean sameExtent = (width == argList [5]) && (height == argList [7]); if (sameOrigin && sameExtent) return false; OS.XtConfigureWidget (topHandle, x, y, width, height, argList [9]); + if (OS.IsDBLocale && !hasIMSupport ()) { + int [] argList1 = {OS.XmNwidth, 0, OS.XmNheight, 0}; + OS.XtGetValues (handle, argList1, argList1.length / 2); + short [] rect = new short[]{0, 0, (short) argList1 [1], (short) argList1 [3]}; + int ptr = OS.XtMalloc (8); + OS.memmove (ptr, rect, 8); + int [] argList2 = {OS.XmNarea, ptr}; + OS.XmImSetValues (handle, argList2, argList2.length / 2); + int focusHandle = focusHandle (); + if (handle != focusHandle) { + OS.XmImSetValues (focusHandle, argList2, argList2.length / 2); + } + if (ptr != 0) OS.XtFree (ptr); + } if (!sameOrigin) sendEvent (SWT.Move); if (!sameExtent) sendEvent (SWT.Resize); return true; @@ -1960,8 +2000,11 @@ public void setFont (Font font) { int [] argList2 = {OS.XmNfontList, font.handle}; OS.XtSetValues (fontHandle, argList2, argList2.length / 2); if (!hasIMSupport()) { + OS.XmImSetValues (handle, argList2, argList2.length / 2); int focusHandle = focusHandle (); - OS.XmImSetValues (focusHandle, argList2, argList2.length / 2); + if (handle != focusHandle) { + OS.XmImSetValues (focusHandle, argList2, argList2.length / 2); + } } /* Restore the widget size */ @@ -2746,7 +2789,7 @@ int XFocusChange (int w, int client_data, int call_data, int continue_to_dispatc switch (xEvent.type) { case OS.FocusIn: { Shell shell = getShell (); - xFocusIn (); + xFocusIn (xEvent); // widget could be disposed at this point /* @@ -2764,7 +2807,7 @@ int XFocusChange (int w, int client_data, int call_data, int continue_to_dispatc Shell shell = getShell (); Display display = getDisplay (); - xFocusOut (); + xFocusOut (xEvent); // widget could be disposed at this point /* @@ -2784,35 +2827,44 @@ int XFocusChange (int w, int client_data, int call_data, int continue_to_dispatc } return 0; } -int xFocusIn () { +int xFocusIn (XFocusChangeEvent xEvent) { if (!hasIMSupport()) { - short [] point = getIMCaretPos (); - int ptr = OS.XtMalloc (4); - OS.memmove (ptr, point, 4); - /* - * Bug in Motif. On Linux Japanese only, XmImSetFocusValues() causes - * a GP when the XmNfontList resources does not containt a FontSet. - * The fix is to call XmImSetValues() to set the values and then call - * XmImSetFocusValues() with no parameters to set the IME focus. - */ - int[] argList = { -// OS.XmNforeground, getForegroundPixel(), -// OS.XmNbackground, getBackgroundPixel(), - OS.XmNspotLocation, ptr, - OS.XmNfontList, font.handle, - }; - int focusHandle = focusHandle (); - OS.XmImSetValues (focusHandle, argList, argList.length / 2); + int focusHandle = OS.XtWindowToWidget (xEvent.display, xEvent.window); + if (OS.IsDBLocale) { + short [] point = getIMCaretPos (); + int ptr1 = OS.XtMalloc (4); + OS.memmove (ptr1, point, 4); + int [] argList1 = {OS.XmNwidth, 0, OS.XmNheight, 0}; + OS.XtGetValues (handle, argList1, argList1.length / 2); + short [] rect = new short[]{0, 0, (short) argList1 [1], (short) argList1 [3]}; + int ptr2 = OS.XtMalloc (8); + OS.memmove (ptr2, rect, 8); + /* + * Bug in Motif. On Linux Japanese only, XmImSetFocusValues() causes + * a GP when the XmNfontList resources does not containt a FontSet. + * The fix is to call XmImSetValues() to set the values and then call + * XmImSetFocusValues() with no parameters to set the IME focus. + */ + int[] argList = { +// OS.XmNforeground, getForegroundPixel(), +// OS.XmNbackground, getBackgroundPixel(), + OS.XmNspotLocation, ptr1, + OS.XmNarea, ptr2, + OS.XmNfontList, font.handle, + }; + OS.XmImSetValues (focusHandle, argList, argList.length / 2); + if (ptr1 != 0) OS.XtFree (ptr1); + if (ptr2 != 0) OS.XtFree (ptr2); + } OS.XmImSetFocusValues (focusHandle, null, 0); - if (ptr != 0) OS.XtFree (ptr); } sendEvent (SWT.FocusIn); // widget could be disposed at this point return 0; } -int xFocusOut () { +int xFocusOut (XFocusChangeEvent xEvent) { if (!hasIMSupport()) { - int focusHandle = focusHandle (); + int focusHandle = OS.XtWindowToWidget (xEvent.display, xEvent.window); OS.XmImUnsetFocus (focusHandle); } Display display = getDisplay(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java index 3f7976f4cc..412bdf8314 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Label.java @@ -480,8 +480,8 @@ public void setText (String string) { OS.XtSetValues (handle, argList, argList.length / 2); if (xmString != 0) OS.XmStringFree (xmString); } -int xFocusOut () { - int result = super.xFocusOut (); +int xFocusOut (XFocusChangeEvent xEvent) { + int result = super.xFocusOut (xEvent); if (handle == 0) return result; int [] argList = new int [] {OS.XmNtraversalOn, 0}; OS.XtGetValues (handle, argList, argList.length / 2); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java index c61142aa97..8996f459c3 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Sash.java @@ -265,8 +265,8 @@ int XButtonRelease (int w, int client_data, int call_data, int continue_to_dispa /* widget could be disposed here */ return result; } -int xFocusIn () { - int result = super.xFocusIn (); +int xFocusIn (XFocusChangeEvent xEvent) { + int result = super.xFocusIn (xEvent); if (handle == 0) return result; int [] argList = {OS.XmNx, 0, OS.XmNy, 0}; OS.XtGetValues (handle, argList, argList.length / 2); @@ -275,8 +275,8 @@ int xFocusIn () { return result; } -int xFocusOut () { - int result = super.xFocusOut (); +int xFocusOut (XFocusChangeEvent xEvent) { + int result = super.xFocusOut (xEvent); if (handle == 0) return result; int [] argList = new int [] {OS.XmNtraversalOn, 0}; OS.XtSetValues (handle, argList, argList.length / 2); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java index ace977f36f..38d4e1ea4b 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/widgets/Text.java @@ -1444,8 +1444,8 @@ int traversalCode (int key, XKeyEvent xEvent) { } return bits; } -int xFocusIn () { - super.xFocusIn (); +int xFocusIn (XFocusChangeEvent xEvent) { + super.xFocusIn (xEvent); // widget could be disposed at this point if (handle == 0) return 0; if ((style & SWT.READ_ONLY) != 0) return 0; @@ -1454,8 +1454,8 @@ int xFocusIn () { OS.XtSetValues (handle, argList, argList.length / 2); return 0; } -int xFocusOut () { - super.xFocusOut (); +int xFocusOut (XFocusChangeEvent xEvent) { + super.xFocusOut (xEvent); // widget could be disposed at this point if (handle == 0) return 0; if ((style & SWT.READ_ONLY) != 0) return 0; |