diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-08-01 13:34:00 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-08-01 13:34:00 -0400 |
commit | e20456e4917934e3819ddfffb95073320e334578 (patch) | |
tree | 655b358b38ef8207307782fd50a213a28bdf8005 | |
parent | c6e846c2a1f2f65f82baf98b5937ac087d800678 (diff) | |
download | eclipse.platform.swt-e20456e4917934e3819ddfffb95073320e334578.tar.gz eclipse.platform.swt-e20456e4917934e3819ddfffb95073320e334578.tar.xz eclipse.platform.swt-e20456e4917934e3819ddfffb95073320e334578.zip |
add gtk_widhet_get_mapped() helper function to simply code
5 files changed, 17 insertions, 39 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 cea75adf1d..3cdfdd5a5d 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 @@ -2314,14 +2314,8 @@ int /*long*/ fixedMapProc (int /*long*/ widget) { int /*long*/ widgets = widgetList; while (widgets != 0) { int /*long*/ child = OS.g_list_data (widgets); - if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { - if (OS.GTK_WIDGET_VISIBLE (child) && OS.gtk_widget_get_child_visible (child) && !OS.gtk_widget_get_mapped (child)) { - OS.gtk_widget_map (child); - } - }else{ - if (OS.GTK_WIDGET_VISIBLE (child) && OS.gtk_widget_get_child_visible (child) && !OS.GTK_WIDGET_MAPPED (child)) { - OS.gtk_widget_map (child); - } + if (OS.GTK_WIDGET_VISIBLE (child) && OS.gtk_widget_get_child_visible (child) && !gtk_widget_get_mapped (child)) { + OS.gtk_widget_map (child); } widgets = OS.g_list_next (widgets); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java index 2a8379d756..70c058ee71 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java @@ -193,11 +193,7 @@ static int checkStyle (int style) { } void _setVisible (boolean visible) { - if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { - if(visible == OS.gtk_widget_get_mapped(handle)) return; - }else{ - if (visible == OS.GTK_WIDGET_MAPPED (handle)) return; - } + if (visible == gtk_widget_get_mapped (handle)) return; if (visible) { sendEvent (SWT.Show); if (getItemCount () != 0) { @@ -376,14 +372,8 @@ void fixMenus (Decorations newParent) { /*public*/ Rectangle getBounds () { checkWidget(); - if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { - if (!OS.gtk_widget_get_mapped (handle)){ - return new Rectangle (0, 0, 0, 0); - } - }else{ - if (!OS.GTK_WIDGET_MAPPED (handle)) { - return new Rectangle (0, 0, 0, 0); - } + if (!gtk_widget_get_mapped (handle)) { + return new Rectangle (0, 0, 0, 0); } int /*long*/ window = OS.GTK_WIDGET_WINDOW (handle); int [] origin_x = new int [1], origin_y = new int [1]; @@ -649,11 +639,7 @@ public boolean getVisible () { } } } - if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { - return OS.gtk_widget_get_mapped(handle); - }else{ - return OS.GTK_WIDGET_MAPPED (handle); - } + return gtk_widget_get_mapped (handle); } int /*long*/ gtk_hide (int /*long*/ widget) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java index 7350dddf1e..5ea35ee1c4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java @@ -319,14 +319,8 @@ int /*long*/ getAccelGroup () { /*public*/ Rectangle getBounds () { checkWidget(); - if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { - if (!OS.gtk_widget_get_mapped (handle)) { - return new Rectangle (0, 0, 0, 0); - } - }else{ - if (!OS.GTK_WIDGET_MAPPED (handle)) { - return new Rectangle (0, 0, 0, 0); - } + if (!gtk_widget_get_mapped (handle)) { + return new Rectangle (0, 0, 0, 0); } int x = OS.GTK_WIDGET_X (handle); int y = OS.GTK_WIDGET_Y (handle); 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 66262e3473..2a62e480cc 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 @@ -2005,11 +2005,7 @@ public void setVisible (boolean visible) { updateModal (); } showWithParent = visible; - if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { - if (OS.gtk_widget_get_mapped(shellHandle) == visible) return; - }else{ - if ((OS.GTK_WIDGET_MAPPED (shellHandle) == visible)) return; - } + if (gtk_widget_get_mapped (shellHandle) == visible) return; if (visible) { if (center && !moved) { center (); 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..778e9bb987 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 @@ -898,6 +898,14 @@ int /*long*/ gtk_visibility_notify_event (int /*long*/ widget, int /*long*/ even return 0; } +boolean gtk_widget_get_mapped (int /*long*/ widget) { + if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { + return OS.gtk_widget_get_mapped (widget); + } else { + return OS.GTK_WIDGET_MAPPED (widget); + } +} + int /*long*/ gtk_window_state_event (int /*long*/ widget, int /*long*/ event) { return 0; } |