diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-08-27 15:37:40 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-08-27 15:38:42 -0400 |
commit | 9effcc166dfa61e54b0f9bb76b17f1175f53b69b (patch) | |
tree | 4067e33bd1e51787f534cc6d4887914a337e4961 /bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java | |
parent | a3a1752d4cca52a10819bc086957df9ad04a0a87 (diff) | |
download | eclipse.platform.swt-9effcc166dfa61e54b0f9bb76b17f1175f53b69b.tar.gz eclipse.platform.swt-9effcc166dfa61e54b0f9bb76b17f1175f53b69b.tar.xz eclipse.platform.swt-9effcc166dfa61e54b0f9bb76b17f1175f53b69b.zip |
Bug 386401 - Use gtk_widget_get_allocation in newer GTK+
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java | 21 |
1 files changed, 8 insertions, 13 deletions
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 13425ad071..1ee867b046 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 @@ -338,7 +338,7 @@ Point getLocation () { int y = this.y; if (item != null) { int /*long*/ itemHandle = item.handle; - if(OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { + if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { GdkRectangle area = new GdkRectangle (); OS.gtk_status_icon_get_geometry (itemHandle, 0, area, 0); x = area.x + area.width / 2; @@ -348,8 +348,10 @@ Point getLocation () { int /*long*/ window = gtk_widget_get_window (itemHandle); int [] px = new int [1], py = new int [1]; OS.gdk_window_get_origin (window, px, py); - x = px [0] + OS.GTK_WIDGET_WIDTH (itemHandle) / 2; - y = py [0] + OS.GTK_WIDGET_HEIGHT (itemHandle) / 2; + GtkAllocation allocation = new GtkAllocation (); + gtk_widget_get_allocation (itemHandle, allocation); + x = px [0] + allocation.width / 2; + y = py [0] + allocation.height / 2; } } if (x == -1 || y == -1) { @@ -590,17 +592,10 @@ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) { int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (widget)); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); - int w = 0; - int h = 0; GtkAllocation widgetAllocation = new GtkAllocation (); - if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) { - OS.gtk_widget_get_allocation (widget, widgetAllocation); - w = widgetAllocation.width; - h = widgetAllocation.height; - } else { - w = OS.GTK_WIDGET_WIDTH (widget); - h = OS.GTK_WIDGET_HEIGHT (widget); - } + gtk_widget_get_allocation (widget, widgetAllocation); + int w = widgetAllocation.width; + int h = widgetAllocation.height; if (dest.height < y + h) y -= h; if (dest.width < x + w) x -= w; OS.gtk_window_move (widget, x, y); |