summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java85
1 files changed, 70 insertions, 15 deletions
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 94e31dba50..0094b87af4 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
@@ -177,10 +177,23 @@ int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ eventPtr)
OS.gdk_window_get_origin (window, origin_x, origin_y);
startX = (int) (gdkEvent.x_root - origin_x [0]);
startY = (int) (gdkEvent.y_root - origin_y [0]);
- int x = OS.GTK_WIDGET_X (handle);
- int y = OS.GTK_WIDGET_Y (handle);
- int width = OS.GTK_WIDGET_WIDTH (handle);
- int height = OS.GTK_WIDGET_HEIGHT (handle);
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+ GtkAllocation allocation = new GtkAllocation ();
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ OS.gtk_widget_get_allocation(handle, allocation);
+ x = allocation.x;
+ y = allocation.y;
+ width = allocation.width;
+ height = allocation.height;
+ } else {
+ x = OS.GTK_WIDGET_X (handle);
+ y = OS.GTK_WIDGET_Y (handle);
+ width = OS.GTK_WIDGET_WIDTH (handle);
+ height = OS.GTK_WIDGET_HEIGHT (handle);
+ }
lastX = x;
lastY = y;
Event event = new Event ();
@@ -219,8 +232,17 @@ int /*long*/ gtk_button_release_event (int /*long*/ widget, int /*long*/ eventPt
if (button != 1) return 0;
if (!dragging) return 0;
dragging = false;
- int width = OS.GTK_WIDGET_WIDTH (handle);
- int height = OS.GTK_WIDGET_HEIGHT (handle);
+ int width = 0;
+ int height = 0;
+ GtkAllocation allocation = new GtkAllocation ();
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ OS.gtk_widget_get_allocation(handle, allocation);
+ width = allocation.width;
+ height = allocation.height;
+ } else {
+ width = OS.GTK_WIDGET_WIDTH (handle);
+ height = OS.GTK_WIDGET_HEIGHT (handle);
+ }
Event event = new Event ();
event.time = gdkEvent.time;
event.x = lastX;
@@ -245,8 +267,15 @@ int /*long*/ gtk_focus_in_event (int /*long*/ widget, int /*long*/ event) {
if (result != 0) return result;
// widget could be disposed at this point
if (handle != 0) {
+ GtkAllocation allocation = new GtkAllocation ();
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ OS.gtk_widget_get_allocation(handle, allocation);
+ lastX = allocation.x;
+ lastY = allocation.y;
+ } else {
lastX = OS.GTK_WIDGET_X (handle);
lastY = OS.GTK_WIDGET_Y (handle);
+ }
}
return 0;
}
@@ -272,12 +301,25 @@ int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ eventPtr) {
if (keyval == OS.GDK_Left ||keyval == OS.GDK_Right) break;
yChange = keyval == OS.GDK_Up ? -stepSize : stepSize;
}
-
- int width = OS.GTK_WIDGET_WIDTH (handle);
- int height = OS.GTK_WIDGET_HEIGHT (handle);
+ int width = 0;
+ int height = 0;
int parentBorder = 0;
- int parentWidth = OS.GTK_WIDGET_WIDTH (parent.handle);
- int parentHeight = OS.GTK_WIDGET_HEIGHT (parent.handle);
+ int parentWidth = 0;
+ int parentHeight = 0;
+ GtkAllocation allocation = new GtkAllocation ();
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ OS.gtk_widget_get_allocation(handle, allocation);
+ width = allocation.width;
+ height = allocation.height;
+ OS.gtk_widget_get_allocation(parent.handle, allocation);
+ parentWidth = allocation.width;
+ parentHeight = allocation.height;
+ } else {
+ width = OS.GTK_WIDGET_WIDTH (handle);
+ height = OS.GTK_WIDGET_HEIGHT (handle);
+ parentWidth = OS.GTK_WIDGET_WIDTH (parent.handle);
+ parentHeight = OS.GTK_WIDGET_HEIGHT (parent.handle);
+ }
int newX = lastX, newY = lastY;
if ((style & SWT.VERTICAL) != 0) {
newX = Math.min (Math.max (0, lastX + xChange - parentBorder - startX), parentWidth - width);
@@ -347,10 +389,23 @@ int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ eventPtr
eventState = gdkEvent.state;
}
if ((eventState & OS.GDK_BUTTON1_MASK) == 0) return 0;
- int x = OS.GTK_WIDGET_X (handle);
- int y = OS.GTK_WIDGET_Y (handle);
- int width = OS.GTK_WIDGET_WIDTH (handle);
- int height = OS.GTK_WIDGET_HEIGHT (handle);
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+ GtkAllocation allocation = new GtkAllocation ();
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ OS.gtk_widget_get_allocation(handle, allocation);
+ x = allocation.x;
+ y = allocation.y;
+ width = allocation.width;
+ height = allocation.height;
+ } else {
+ x = OS.GTK_WIDGET_X (handle);
+ y = OS.GTK_WIDGET_Y (handle);
+ width = OS.GTK_WIDGET_WIDTH (handle);
+ height = OS.GTK_WIDGET_HEIGHT (handle);
+ }
int parentBorder = 0;
int parentWidth = OS.GTK_WIDGET_WIDTH (parent.handle);
int parentHeight = OS.GTK_WIDGET_HEIGHT (parent.handle);