diff options
author | Alexander Kurtakov | 2015-04-02 15:44:13 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2015-04-02 15:44:13 +0000 |
commit | 5d750d3a048d5a00d24e71c7fe781836f0aa812b (patch) | |
tree | 17ed2e0493f22a0945f2450920342b529a28eb50 /bundles | |
parent | aaa61c23bbc3a20f6214223f6b037abd0bc8d9c9 (diff) | |
download | eclipse.platform.swt-5d750d3a048d5a00d24e71c7fe781836f0aa812b.tar.gz eclipse.platform.swt-5d750d3a048d5a00d24e71c7fe781836f0aa812b.tar.xz eclipse.platform.swt-5d750d3a048d5a00d24e71c7fe781836f0aa812b.zip |
Bug 463830 - Remove Widget.gtk_widget_get_visible
Call OS.gtk_widget_get_visible directly now that GTK 2.18 is no longer
supported.
Change-Id: I5e1ed44661e30d3eaff08b524fe1f320b4bc539a
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles')
10 files changed, 34 insertions, 50 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 da1d665fae..5b6e017649 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 @@ -185,7 +185,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 && gtk_widget_get_visible (labelHandle); + boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && OS.gtk_widget_get_visible (labelHandle); if (wrap) { int borderWidth = OS.gtk_container_get_border_width (handle); int[] focusWidth = new int[1]; @@ -215,7 +215,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) { } } int imageWidth = 0, imageHeight = 0; - if (gtk_widget_get_visible (imageHandle)) { + if (OS.gtk_widget_get_visible (imageHandle)) { GtkRequisition requisition = new GtkRequisition (); gtk_widget_get_preferred_size (imageHandle, requisition); imageWidth = requisition.width; @@ -715,7 +715,7 @@ void _setAlignment (int alignment) { style &= ~(SWT.LEFT | SWT.RIGHT | SWT.CENTER); style |= alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER); /* Alignment not honoured when image and text are visible */ - boolean bothVisible = gtk_widget_get_visible (labelHandle) && gtk_widget_get_visible (imageHandle); + boolean bothVisible = OS.gtk_widget_get_visible (labelHandle) && OS.gtk_widget_get_visible (imageHandle); if (bothVisible) { if ((style & (SWT.RADIO | SWT.CHECK)) != 0) alignment = SWT.LEFT; if ((style & (SWT.PUSH | SWT.TOGGLE)) != 0) alignment = SWT.CENTER; @@ -839,7 +839,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 && gtk_widget_get_visible (labelHandle); + boolean wrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && OS.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); /* @@ -865,7 +865,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize OS.pango_layout_get_pixel_size (labelLayout, w, h); OS.pango_layout_set_width (labelLayout, pangoWidth); int imageWidth = 0; - if (gtk_widget_get_visible (imageHandle)) { + if (OS.gtk_widget_get_visible (imageHandle)) { GtkRequisition requisition = new GtkRequisition (); gtk_widget_get_preferred_size (imageHandle, requisition); imageWidth = requisition.width; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java index afe72b8076..690f989b73 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java @@ -985,7 +985,7 @@ public String [] getItems () { */ public boolean getListVisible () { checkWidget (); - return popupHandle != 0 && gtk_widget_get_visible (popupHandle); + return popupHandle != 0 && OS.gtk_widget_get_visible (popupHandle); } @Override 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 0c6f30d747..d0a6d38c02 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 @@ -921,7 +921,7 @@ void moveHandle (int x, int y) { * * NOTE: There is no API in GTK 3 to only set the GTK_VISIBLE bit. */ - boolean reset = gtk_widget_get_visible (parentHandle); + boolean reset = OS.gtk_widget_get_visible (parentHandle); gtk_widget_set_visible (parentHandle, false); OS.gtk_fixed_move (parentHandle, topHandle, x, y); gtk_widget_set_visible (parentHandle, reset); @@ -2445,7 +2445,7 @@ long /*int*/ fixedMapProc (long /*int*/ widget) { long /*int*/ widgets = widgetList; while (widgets != 0) { long /*int*/ child = OS.g_list_data (widgets); - if (gtk_widget_get_visible (child) && OS.gtk_widget_get_child_visible (child) && !gtk_widget_get_mapped (child)) { + if (OS.gtk_widget_get_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); @@ -3725,7 +3725,7 @@ public void redraw () { void redraw (boolean all) { // checkWidget(); - if (!gtk_widget_get_visible (topHandle ())) return; + if (!OS.gtk_widget_get_visible (topHandle ())) return; redrawWidget (0, 0, 0, 0, true, all, false); } @@ -3761,7 +3761,7 @@ void redraw (boolean all) { */ public void redraw (int x, int y, int width, int height, boolean all) { checkWidget(); - if (!gtk_widget_get_visible (topHandle ())) return; + if (!OS.gtk_widget_get_visible (topHandle ())) return; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - width - x; redrawWidget (x, y, width, height, false, all, false); } @@ -4396,7 +4396,7 @@ public void setEnabled (boolean enabled) { } else { restackWindow (enableWindow, gtk_widget_get_window (topHandle), true); } - if (gtk_widget_get_visible (topHandle)) OS.gdk_window_show_unraised (enableWindow); + if (OS.gtk_widget_get_visible (topHandle)) OS.gdk_window_show_unraised (enableWindow); } } if (fixFocus) fixFocus (control); @@ -5520,7 +5520,7 @@ public void update () { void update (boolean all, boolean flush) { // checkWidget(); - if (!gtk_widget_get_visible (topHandle ())) return; + if (!OS.gtk_widget_get_visible (topHandle ())) return; if (!gtk_widget_get_realized (handle)) return; long /*int*/ window = paintWindow (); if (flush) display.flushExposes (window, all); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java index 5dd3614e03..551d7146d3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java @@ -11,9 +11,9 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; /** * Instances of this class represent a selectable user interface object @@ -443,7 +443,7 @@ void resizeControl (int yScroll) { */ ScrollBar vBar = parent.verticalBar; if (vBar != null) { - if (gtk_widget_get_visible (vBar.handle)) { + if (OS.gtk_widget_get_visible (vBar.handle)) { OS.gtk_widget_get_allocation (parent.scrolledHandle, allocation); width = allocation.width - parent.vScrollBarWidth () - 2 * parent.spacing; } 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 0c543b0dbe..3d05a182e4 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 @@ -131,7 +131,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 && gtk_widget_get_visible (labelHandle); + boolean fixWrap = labelHandle != 0 && (style & SWT.WRAP) != 0 && OS.gtk_widget_get_visible (labelHandle); if (fixWrap || frameHandle != 0) forceResize (); if (fixWrap) { long /*int*/ labelLayout = OS.gtk_label_get_layout (labelHandle); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java index 943311e9f5..882faf540a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java @@ -11,18 +11,10 @@ package org.eclipse.swt.widgets; -import org.eclipse.swt.SWT; -import org.eclipse.swt.SWTException; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.internal.gtk.GdkEvent; -import org.eclipse.swt.internal.gtk.GdkEventButton; -import org.eclipse.swt.internal.gtk.GtkAdjustment; -import org.eclipse.swt.internal.gtk.GtkAllocation; -import org.eclipse.swt.internal.gtk.GtkRequisition; -import org.eclipse.swt.internal.gtk.OS; +import org.eclipse.swt.*; +import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.gtk.*; /** * Instances of this class are selectable user interface @@ -461,9 +453,9 @@ public boolean getVisible () { int [] hsp = new int [1], vsp = new int [1]; OS.gtk_scrolled_window_get_policy (scrolledHandle, hsp, vsp); if ((style & SWT.HORIZONTAL) != 0) { - return hsp [0] != OS.GTK_POLICY_NEVER && gtk_widget_get_visible (handle); + return hsp [0] != OS.GTK_POLICY_NEVER && OS.gtk_widget_get_visible (handle); } else { - return vsp [0] != OS.GTK_POLICY_NEVER && gtk_widget_get_visible (handle); + return vsp [0] != OS.GTK_POLICY_NEVER && OS.gtk_widget_get_visible (handle); } } 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 fded51ca0f..40f2c414f3 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 @@ -12,8 +12,8 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.*; -import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.graphics.*; +import org.eclipse.swt.internal.gtk.*; /** * This class is the abstract superclass of all classes which @@ -281,7 +281,7 @@ long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) { if (OS.gdk_event_get_scroll_deltas (eventPtr, delta_x, delta_y)) { if (delta_x [0] != 0) { scrollBar = horizontalBar; - if (scrollBar != null && !gtk_widget_get_visible (scrollBar.handle) && scrollBar.getEnabled()) { + if (scrollBar != null && !OS.gtk_widget_get_visible (scrollBar.handle) && scrollBar.getEnabled()) { GtkAdjustment adjustment = new GtkAdjustment (); gtk_adjustment_get (scrollBar.adjustmentHandle, adjustment); double delta = Math.pow(adjustment.page_size, 2.0 / 3.0) * delta_x [0]; @@ -293,7 +293,7 @@ long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) { } if (delta_y [0] != 0) { scrollBar = verticalBar; - if (scrollBar != null && !gtk_widget_get_visible (scrollBar.handle) && scrollBar.getEnabled()) { + if (scrollBar != null && !OS.gtk_widget_get_visible (scrollBar.handle) && scrollBar.getEnabled()) { GtkAdjustment adjustment = new GtkAdjustment (); gtk_adjustment_get (scrollBar.adjustmentHandle, adjustment); double delta = Math.pow(adjustment.page_size, 2.0 / 3.0) * delta_y [0]; @@ -310,7 +310,7 @@ long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) { } else { scrollBar = horizontalBar; } - if (scrollBar != null && !gtk_widget_get_visible (scrollBar.handle) && scrollBar.getEnabled()) { + if (scrollBar != null && !OS.gtk_widget_get_visible (scrollBar.handle) && scrollBar.getEnabled()) { GtkAdjustment adjustment = new GtkAdjustment (); gtk_adjustment_get (scrollBar.adjustmentHandle, adjustment); /* Calculate wheel delta to match GTK+ 2.4 and higher */ 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 ab0cca3a1e..6b1ccd2035 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 @@ -523,7 +523,7 @@ void adjustTrim () { } void bringToTop (boolean force) { - if (!gtk_widget_get_visible (shellHandle)) return; + if (!OS.gtk_widget_get_visible (shellHandle)) return; Display display = this.display; Shell activeShell = display.activeShell; if (activeShell == this) return; @@ -1124,7 +1124,7 @@ public Point getSize () { @Override public boolean getVisible () { checkWidget(); - return gtk_widget_get_visible (shellHandle); + return OS.gtk_widget_get_visible (shellHandle); } /** 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 cae71f3f87..49047aa6ca 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 @@ -12,11 +12,11 @@ package org.eclipse.swt.widgets; import org.eclipse.swt.*; +import org.eclipse.swt.events.*; +import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.cairo.*; import org.eclipse.swt.internal.gtk.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.internal.cairo.Cairo; /** * Instances of this class represent popup windows that are used @@ -446,7 +446,7 @@ public String getText () { */ public boolean getVisible () { checkWidget (); - if ((style & SWT.BALLOON) != 0) return gtk_widget_get_visible (handle); + if ((style & SWT.BALLOON) != 0) return OS.gtk_widget_get_visible (handle); return false; } @@ -701,7 +701,7 @@ public void setLocation (int x, int y) { this.x = x; this.y = y; if ((style & SWT.BALLOON) != 0) { - if (gtk_widget_get_visible (handle)) configure (); + if (OS.gtk_widget_get_visible (handle)) configure (); } } @@ -759,7 +759,7 @@ public void setMessage (String string) { OS.pango_layout_set_auto_dir (layoutMessage, false); OS.pango_layout_set_wrap (layoutMessage, OS.PANGO_WRAP_WORD_CHAR); } - if (gtk_widget_get_visible (handle)) configure (); + if (OS.gtk_widget_get_visible (handle)) configure (); } /** @@ -798,7 +798,7 @@ public void setText (String string) { OS.pango_attr_list_unref (attrList); OS.pango_layout_set_wrap (layoutText, OS.PANGO_WRAP_WORD_CHAR); } - if (gtk_widget_get_visible (handle)) configure (); + if (OS.gtk_widget_get_visible (handle)) configure (); } /** 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 a0afd411d2..804a924d42 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 @@ -1755,14 +1755,6 @@ long /*int*/ sizeRequestProc (long /*int*/ handle, long /*int*/ arg0, long /*int return 0; } -boolean gtk_widget_get_visible (long /*int*/ 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 (long /*int*/ widget) { if (OS.GTK_VERSION >= OS.VERSION (2, 20, 0)) { return OS.gtk_widget_get_realized (widget); |