diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org')
8 files changed, 47 insertions, 13 deletions
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 91407953dd..79f61985a5 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 @@ -336,7 +336,7 @@ void hookEvents () { int /*long*/ hoverProc (int /*long*/ widget) { int [] x = new int [1], y = new int [1], mask = new int [1]; - OS.gdk_window_get_pointer (0, x, y, mask); + gdk_window_get_device_position (0, x, y, mask); sendMouseEvent (SWT.MouseHover, 0, /*time*/0, x [0], y [0], false, mask [0]); /* Always return zero in order to cancel the hover timer */ return 0; @@ -2248,7 +2248,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean quit = true; } int [] newX = new int [1], newY = new int [1]; - OS.gdk_window_get_pointer (gdkMotionEvent.window, newX, newY, null); + gdk_window_get_device_position (gdkMotionEvent.window, newX, newY, null); break; } case OS.GDK_KEY_PRESS: @@ -3105,7 +3105,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) { if (gdkEvent.is_hint != 0) { int [] pointer_x = new int [1], pointer_y = new int [1], mask = new int [1]; int /*long*/ window = eventWindow (); - OS.gdk_window_get_pointer (window, pointer_x, pointer_y, mask); + gdk_window_get_device_position (window, pointer_x, pointer_y, mask); x = pointer_x [0]; y = pointer_y [0]; state = mask [0]; @@ -3117,7 +3117,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) { int /*long*/ gtk_popup_menu (int /*long*/ widget) { if (!hasFocus()) return 0; int [] x = new int [1], y = new int [1]; - OS.gdk_window_get_pointer (0, x, y, null); + gdk_window_get_device_position (0, x, y, null); return showMenu (x [0], y [0], SWT.MENU_KEYBOARD) ? 1 : 0; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java index d478017676..1d29c8305c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java @@ -1514,7 +1514,7 @@ int /*long*/ filterProc (int /*long*/ xEvent, int /*long*/ gdkEvent, int /*long* public Point getCursorLocation () { checkDevice (); int [] x = new int [1], y = new int [1]; - OS.gdk_window_get_pointer (0, x, y, null); + gdk_window_get_device_position (0, x, y, null); return new Point (x [0], y [0]); } @@ -4397,4 +4397,21 @@ int /*long*/ windowTimerProc (int /*long*/ handle) { return widget.timerProc (handle); } +int /*long*/ gdk_window_get_device_position (int /*long*/ window, int[] x, int[] y, int[] mask) { + if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) { + int /*long*/ display = 0; + if( window != 0) { + display = OS.gdk_window_get_display (window); + } else { + window = OS.gdk_get_default_root_window (); + display = OS.gdk_window_get_display (window); + } + int /*long*/ device_manager = OS.gdk_display_get_device_manager (display); + int /*long*/ pointer = OS.gdk_device_manager_get_client_pointer (device_manager); + return OS.gdk_window_get_device_position(window, pointer, x, y, mask); + } else { + return OS.gdk_window_get_pointer (window, x, y, mask); + } +} + } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java index dbc04e8c55..a440e89117 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java @@ -343,7 +343,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ eventPtr int eventX, eventY, eventState; if (gdkEvent.is_hint != 0) { int [] pointer_x = new int [1], pointer_y = new int [1], mask = new int [1]; - OS.gdk_window_get_pointer (gdkEvent.window, pointer_x, pointer_y, mask); + gdk_window_get_device_position (gdkEvent.window, pointer_x, pointer_y, mask); eventX = pointer_x [0]; eventY = pointer_y [0]; eventState = mask [0]; 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 5f1a5416bc..d24d63bfff 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 @@ -2153,7 +2153,7 @@ void showWidget () { int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { int offset = 16; int [] x = new int [1], y = new int [1]; - OS.gdk_window_get_pointer (0, x, y, null); + gdk_window_get_device_position (0, x, y, null); y [0] += offset; int /*long*/ screen = OS.gdk_screen_get_default (); if (screen != 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java index 742d742ead..fce3c0cad2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java @@ -957,7 +957,7 @@ public void setEnabled (boolean enabled) { * button if the pointer is within its bounds. */ int [] x = new int [1], y = new int [1]; - OS.gdk_window_get_pointer (parent.paintWindow (), x, y, null); + gdk_window_get_device_position (parent.paintWindow (), x, y, null); if (getBounds ().contains (x [0], y [0])) { OS.gtk_widget_hide (handle); OS.gtk_widget_show (handle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java index 2dd7b19b88..f01a1e64c4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java @@ -356,7 +356,7 @@ Point getLocation () { } if (x == -1 || y == -1) { int [] px = new int [1], py = new int [1]; - OS.gdk_window_get_pointer (0, px, py, null); + gdk_window_get_device_position (0, px, py, null); x = px [0]; y = py [0]; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java index 17f929b3db..1c763b9527 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java @@ -203,7 +203,7 @@ Point adjustMoveCursor () { * actual location of the pointer after it has been moved. */ int [] actualX = new int [1], actualY = new int [1], state = new int [1]; - OS.gdk_window_get_pointer (window, actualX, actualY, state); + gdk_window_get_device_position (window, actualX, actualY, state); return new Point (actualX [0], actualY [0]); } @@ -236,7 +236,7 @@ Point adjustResizeCursor () { * actual location of the pointer after it has been moved. */ int [] actualX = new int [1], actualY = new int [1], state = new int [1]; - OS.gdk_window_get_pointer (window, actualX, actualY, state); + gdk_window_get_device_position (window, actualX, actualY, state); return new Point (actualX [0], actualY [0]); } @@ -523,7 +523,7 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ eventPtr int /*long*/ gtk_mouse (int eventType, int /*long*/ widget, int /*long*/ eventPtr) { int [] newX = new int [1], newY = new int [1]; - OS.gdk_window_get_pointer (window, newX, newY, null); + gdk_window_get_device_position (window, newX, newY, null); if (oldX != newX [0] || oldY != newY [0]) { Rectangle [] oldRectangles = rectangles; Rectangle [] rectsToErase = new Rectangle [rectangles.length]; @@ -672,7 +672,7 @@ public boolean open () { update (); drawRectangles (rectangles); int [] oldX = new int [1], oldY = new int [1], state = new int [1]; - OS.gdk_window_get_pointer (window, oldX, oldY, state); + gdk_window_get_device_position (window, oldX, oldY, state); /* * if exactly one of UP/DOWN is specified as a style then set the cursor 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 afe1444725..f8893270f0 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 @@ -1866,6 +1866,23 @@ int gdk_pointer_grab (int /*long*/ window, int grab_ownership, boolean owner_eve } } +int /*long*/ gdk_window_get_device_position (int /*long*/ window, int[] x, int[] y, int[] mask) { + if (OS.GTK_VERSION >= OS.VERSION (3, 0, 0)) { + int /*long*/ display = 0; + if( window != 0) { + display = OS.gdk_window_get_display (window); + } else { + window = OS.gdk_get_default_root_window (); + display = OS.gdk_window_get_display (window); + } + int /*long*/ device_manager = OS.gdk_display_get_device_manager (display); + int /*long*/ pointer = OS.gdk_device_manager_get_client_pointer (device_manager); + return OS.gdk_window_get_device_position(window, pointer, x, y, mask); + } else { + return OS.gdk_window_get_pointer (window, x, y, mask); + } +} + /** * Returns a string containing a concise, human-readable * description of the receiver. |