summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ProgressBar.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java32
9 files changed, 49 insertions, 18 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 77d5d6b13d..44ae37a16b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -184,7 +184,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
OS.gtk_widget_set_size_request (boxHandle, -1, -1);
}
Point size;
- boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && (OS.GTK_WIDGET_FLAGS (labelHandle) & OS.GTK_VISIBLE) != 0;
+ boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && gtk_widget_get_visible (labelHandle);
if (wrap) {
int borderWidth = OS.gtk_container_get_border_width (handle);
int[] focusWidth = new int[1];
@@ -207,7 +207,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
GtkBorder innerBorder = getBorder (OS.inner_border, handle, INNER_BORDER);
trimWidth += innerBorder.left + innerBorder.right;
trimHeight += innerBorder.top + innerBorder.bottom;
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) != 0) {
+ if (gtk_widget_get_can_default (handle)) {
GtkBorder defaultBorder = getBorder (OS.default_border, handle, DEFAULT_BORDER);
trimWidth += defaultBorder.left + defaultBorder.right;
trimHeight += defaultBorder.top + defaultBorder.bottom;
@@ -243,7 +243,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
OS.gtk_widget_set_size_request (boxHandle, reqWidth [0], reqHeight [0]);
}
if (wHint != SWT.DEFAULT || hHint != SWT.DEFAULT) {
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) != 0) {
+ if (gtk_widget_get_can_default (handle)) {
GtkBorder border = getBorder (OS.default_border, handle, DEFAULT_BORDER);
if (wHint != SWT.DEFAULT) size.x += border.left + border.right;
if (hHint != SWT.DEFAULT) size.y += border.top + border.bottom;
@@ -730,7 +730,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
* resized to the preferred size but it still
* won't draw properly.
*/
- boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && (OS.GTK_WIDGET_FLAGS (labelHandle) & OS.GTK_VISIBLE) != 0;
+ boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && gtk_widget_get_visible (labelHandle);
if (wrap) OS.gtk_widget_set_size_request (boxHandle, -1, -1);
int result = super.setBounds (x, y, width, height, move, resize);
/*
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 7404d61334..2f923ac12d 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
@@ -351,7 +351,7 @@ int /*long*/ paintHandle () {
int /*long*/ topHandle = topHandle ();
int /*long*/ paintHandle = handle;
while (paintHandle != topHandle) {
- if ((OS.GTK_WIDGET_FLAGS (paintHandle) & OS.GTK_NO_WINDOW) == 0) break;
+ if (gtk_widget_get_has_window (paintHandle)) break;
paintHandle = OS.gtk_widget_get_parent (paintHandle);
}
return paintHandle;
@@ -822,11 +822,10 @@ void moveHandle (int x, int y) {
* NOTE: Because every widget in SWT has an X window, the new and
* old bounds of the child are correctly redrawn.
*/
- int flags = OS.GTK_WIDGET_FLAGS (parentHandle);
OS.GTK_WIDGET_UNSET_FLAGS (parentHandle, OS.GTK_VISIBLE);
OS.gtk_fixed_move (parentHandle, topHandle, x, y);
- if ((flags & OS.GTK_VISIBLE) != 0) {
- OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_VISIBLE);
+ if (gtk_widget_get_visible (parentHandle)) {
+ OS.GTK_WIDGET_SET_FLAGS (parentHandle, OS.GTK_VISIBLE);
}
}
@@ -2313,7 +2312,7 @@ int /*long*/ fixedMapProc (int /*long*/ widget) {
}
OS.g_list_free (widgetList);
}
- if ((OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) == 0) {
+ if (gtk_widget_get_has_window (widget)) {
OS.gdk_window_show_unraised (OS.GTK_WIDGET_WINDOW (widget));
}
return 0;
@@ -3491,7 +3490,7 @@ void redrawChildren () {
}
void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean all, boolean trim) {
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
+ if (!gtk_widget_get_realized(handle)) return;
int /*long*/ window = paintWindow ();
GdkRectangle rect = new GdkRectangle ();
if (redrawAll) {
@@ -4307,7 +4306,7 @@ public void setRedraw (boolean redraw) {
}
} else {
if (drawCount++ == 0) {
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) != 0) {
+ if (gtk_widget_get_realized (handle)) {
int /*long*/ window = paintWindow ();
Rectangle rect = getBounds ();
GdkWindowAttr attributes = new GdkWindowAttr ();
@@ -5057,7 +5056,7 @@ public void update () {
void update (boolean all, boolean flush) {
// checkWidget();
if (!OS.GTK_WIDGET_VISIBLE (topHandle ())) return;
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
+ if (!gtk_widget_get_realized (handle)) return;
int /*long*/ window = paintWindow ();
if (flush) display.flushExposes (window, all);
OS.gdk_window_process_updates (window, all);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index 3bceccdeaf..2eb232ea0d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -129,7 +129,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
* The fix is to use pango layout directly instead of the label size request
* to calculate its preferred size.
*/
- boolean fixWrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && (OS.GTK_WIDGET_FLAGS (labelHandle) & OS.GTK_VISIBLE) != 0;
+ boolean fixWrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && gtk_widget_get_visible (labelHandle);
if (fixWrap || frameHandle != 0) forceResize ();
if (fixWrap) {
int /*long*/ labelLayout = OS.gtk_label_get_layout (labelHandle);
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 ad416a46ce..52ae587d70 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
@@ -287,7 +287,7 @@ void updateBar (int selection, int minimum, int maximum) {
* fix is to update the progress bar state only when realized and restore
* the state when the progress bar becomes realized.
*/
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
+ if (gtk_widget_get_realized (handle)) return;
double fraction = minimum == maximum ? 1 : (double)(selection - minimum) / (maximum - minimum);
OS.gtk_progress_bar_set_fraction (handle, fraction);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
index 5f63d5d518..261114a3d7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -357,7 +357,7 @@ void redrawBackgroundImage () {
void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean all, boolean trim) {
super.redrawWidget (x, y, width, height, redrawAll, all, trim);
- if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) == 0) return;
+ if (!OS.gtk_widget_get_realized (handle)) return;
if (!trim) return;
int /*long*/ topHandle = topHandle (), paintHandle = paintHandle ();
if (topHandle == paintHandle) return;
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 deed81c947..19c042e0c2 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
@@ -2490,7 +2490,7 @@ void setToolTipText (int /*long*/ rootWidget, int /*long*/ tipWidget, String str
*/
boolean set = true;
if (tipWindow != 0) {
- if ((OS.GTK_WIDGET_FLAGS (tipWidget) & (OS.GTK_REALIZED | OS.GTK_VISIBLE)) != 0) {
+ if (gtk_widget_get_visible (tipWidget) | gtk_widget_get_realized (tipWidget)) {
int [] x = new int [1], y = new int [1];
int /*long*/ window = OS.gdk_window_at_pointer (x, y);
if (window != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
index 9042ad2475..a7fba59163 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java
@@ -697,7 +697,7 @@ public Rectangle getTextBounds (int index) {
}
void redraw () {
- if ((OS.GTK_WIDGET_FLAGS (parent.handle) & OS.GTK_REALIZED) != 0) {
+ if (gtk_widget_get_realized (parent.handle)) {
int /*long*/ parentHandle = parent.handle;
int /*long*/ path = OS.gtk_tree_model_get_path (parent.modelHandle, handle);
GdkRectangle rect = new GdkRectangle ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
index 43277b1721..608876b4e9 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java
@@ -1052,7 +1052,7 @@ public int indexOf (TreeItem item) {
void redraw () {
int /*long*/ parentHandle = parent.handle;
- if ((OS.GTK_WIDGET_FLAGS (parentHandle) & OS.GTK_REALIZED) != 0) {
+ if (gtk_widget_get_realized (parentHandle)) {
int /*long*/ path = OS.gtk_tree_model_get_path (parent.modelHandle, handle);
GdkRectangle rect = new GdkRectangle ();
OS.gtk_tree_view_get_cell_area (parentHandle, path, 0, rect);
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 eb3bbcd8c5..99ece170e0 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
@@ -1674,6 +1674,38 @@ int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long
return 0;
}
+boolean gtk_widget_get_visible (int /*long*/ widget) {
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ return OS.gtk_widget_get_visible (widget);
+ } else {
+ return (OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_VISIBLE) != 0;
+ }
+}
+
+boolean gtk_widget_get_realized (int /*long*/ widget) {
+ if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) {
+ return OS.gtk_widget_get_realized (widget);
+ } else {
+ return (OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_REALIZED) != 0;
+ }
+}
+
+boolean gtk_widget_get_can_default (int /*long*/ widget){
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ return OS.gtk_widget_get_can_default (widget);
+ } else {
+ return (OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_CAN_DEFAULT) != 0;
+ }
+}
+
+boolean gtk_widget_get_has_window (int /*long*/ widget) {
+ if (OS.GTK_VERSION >= OS.VERSION (2, 18, 0)) {
+ return OS.gtk_widget_get_has_window (widget);
+ } else {
+ return (OS.GTK_WIDGET_FLAGS (widget) & OS.GTK_NO_WINDOW) == 0;
+ }
+}
+
/**
* Returns a string containing a concise, human-readable
* description of the receiver.