summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt
diff options
context:
space:
mode:
authorSteve Northover <steve>2003-04-25 22:29:04 +0000
committerSteve Northover <steve>2003-04-25 22:29:04 +0000
commit13e42c55598cc244c3f75c845c9557bee124d6ed (patch)
tree1be52ebce188326be7751e60afcf7ee341055dc8 /bundles/org.eclipse.swt
parent5caada230d93f40d780eb3d8def0d9244f2580ff (diff)
downloadeclipse.platform.swt-13e42c55598cc244c3f75c845c9557bee124d6ed.tar.gz
eclipse.platform.swt-13e42c55598cc244c3f75c845c9557bee124d6ed.tar.xz
eclipse.platform.swt-13e42c55598cc244c3f75c845c9557bee124d6ed.zip
Display!
Diffstat (limited to 'bundles/org.eclipse.swt')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java4
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java33
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java8
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java2
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java11
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java3
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java5
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java1
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java9
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java6
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java26
24 files changed, 41 insertions, 137 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java
index 1cddc56a71..684ee5f4f7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Button.java
@@ -208,7 +208,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int parentHandle = parent.parentingHandle ();
/* ARROW button */
@@ -402,7 +401,7 @@ public String getText () {
void hookEvents () {
super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_ACTIVATE, windowProc, OS.Pt_CB_ACTIVATE);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java
index 916e7e05e1..ac37baa144 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Caret.java
@@ -132,12 +132,6 @@ public Rectangle getBounds () {
return new Rectangle (x, y, width, height);
}
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
/**
* Returns the font that the receiver will use to paint textual information.
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
index c38dc1f1d6..b68f3a7cf4 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Combo.java
@@ -203,7 +203,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int clazz = display.PtComboBox;
int parentHandle = parent.parentingHandle ();
int textFlags = (style & SWT.READ_ONLY) != 0 ? 0 : OS.Pt_EDITABLE;
@@ -477,7 +476,6 @@ public void cut () {
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.TEXT_FONT;
}
@@ -754,7 +752,7 @@ boolean hasFocus () {
void hookEvents () {
super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_SELECTION, windowProc, OS.Pt_CB_SELECTION);
OS.PtAddCallback (handle, OS.Pt_CB_TEXT_CHANGED, windowProc, OS.Pt_CB_TEXT_CHANGED);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
index 1eb7e9a095..2c2f78584b 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Composite.java
@@ -184,7 +184,6 @@ void createScrollBars () {
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.TITLE_FONT;
}
@@ -199,7 +198,6 @@ void createScrolledHandle (int parentHandle) {
};
scrolledHandle = OS.PtCreateWidget (OS.PtContainer (), parentHandle, args.length / 3, args);
if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
- Display display = getDisplay ();
if ((style & SWT.H_SCROLL) != 0 && (style & SWT.V_SCROLL) != 0) {
etches = OS.Pt_TOP_OUTLINE | OS.Pt_LEFT_OUTLINE;
args = new int [] {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
index 270bf4299a..b10ecedea3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Control.java
@@ -469,17 +469,14 @@ void createWidget (int index) {
}
int defaultBackground () {
- Display display = getDisplay ();
return display.WIDGET_BACKGROUND;
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.TEXT_FONT;
}
int defaultForeground () {
- Display display = getDisplay ();
return display.WIDGET_FOREGROUND;
}
@@ -591,7 +588,7 @@ public Color getBackground () {
checkWidget();
int [] args = {OS.Pt_ARG_FILL_COLOR, 0, 0};
OS.PtGetResources (handle, args.length / 3, args);
- return Color.photon_new (getDisplay (), args [1]);
+ return Color.photon_new (display, args [1]);
}
/**
@@ -625,7 +622,7 @@ public Font getFont () {
font = new byte [length + 1];
OS.memmove (font, ptr, length);
}
- return Font.photon_new (getDisplay (), font);
+ return Font.photon_new (display, font);
}
/**
@@ -642,7 +639,7 @@ public Color getForeground () {
checkWidget();
int [] args = {OS.Pt_ARG_COLOR, 0, 0};
OS.PtGetResources (handle, args.length / 3, args);
- return Color.photon_new (getDisplay (), args [1]);
+ return Color.photon_new (display, args [1]);
}
/**
@@ -694,22 +691,6 @@ public Rectangle getBounds () {
}
/**
- * Returns the display that the receiver was created on.
- *
- * @return the receiver's display
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
-public Display getDisplay () {
- Composite parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
-/**
* Returns <code>true</code> if the receiver is enabled, and
* <code>false</code> otherwise. A disabled control is typically
* not selectable from the user interface and draws with an
@@ -902,7 +883,7 @@ boolean hasFocus () {
}
void hookEvents () {
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
int focusHandle = focusHandle ();
OS.PtAddFilterCallback (handle, OS.Ph_EV_KEY, windowProc, OS.Ph_EV_KEY);
OS.PtAddEventHandler (handle, OS.Ph_EV_BUT_PRESS, windowProc, OS.Ph_EV_BUT_PRESS);
@@ -941,7 +922,7 @@ public int internal_new_GC (GCData data) {
int [] args = {OS.Pt_ARG_COLOR, 0, 0, OS.Pt_ARG_FILL_COLOR, 0, 0};
OS.PtGetResources (handle, args.length / 3, args);
- data.device = getDisplay ();
+ data.device = display;
data.widget = handle;
data.topWidget = topHandle ();
data.foreground = args [1];
@@ -989,7 +970,6 @@ public boolean isEnabled () {
}
public boolean isFocusAncestor () {
- Display display = getDisplay ();
Control control = display.getFocusControl ();
while (control != null && control != this) {
control = control.parent;
@@ -1441,7 +1421,6 @@ int Ph_EV_KEY (int widget, int info) {
Event event = new Event ();
event.time = ev.timestamp;
setKeyState (event, ke);
- Display display = getDisplay ();
if (type == SWT.KeyDown) {
display.lastKey = event.keyCode;
display.lastAscii = event.character;
@@ -1513,7 +1492,6 @@ int Pt_CB_LOST_FOCUS (int widget, int info) {
* events.
*/
if (!shell.isDisposed ()) {
- Display display = shell.getDisplay ();
Control control = display.getFocusControl ();
if (control == null || shell != control.getShell () ) {
shell.setActiveControl (null);
@@ -2058,7 +2036,6 @@ void setBackgroundPixel (int pixel) {
}
void setDefaultFont () {
- Display display = getDisplay ();
if (display.defaultFont != null) setFont (defaultFont ());
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
index 5bb513f066..09f3c23632 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Display.java
@@ -902,7 +902,7 @@ public Shell [] getShells () {
Shell [] shells = WidgetTable.shells ();
for (int i=0; i<shells.length; i++) {
Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
+ if (!shell.isDisposed () && this == shell.display) {
count++;
}
}
@@ -911,7 +911,7 @@ public Shell [] getShells () {
Shell [] result = new Shell [count];
for (int i=0; i<shells.length; i++) {
Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
+ if (!shell.isDisposed () && this == shell.display) {
result [index++] = shell;
}
}
@@ -1505,7 +1505,7 @@ protected void release () {
for (int i=0; i<shells.length; i++) {
Shell shell = shells [i];
if (!shell.isDisposed ()) {
- if (this == shell.getDisplay ()) shell.dispose ();
+ if (this == shell.display) shell.dispose ();
}
}
while (readAndDispatch ()) {};
@@ -2004,7 +2004,7 @@ public void update() {
Shell[] shells = WidgetTable.shells ();
for (int i=0; i<shells.length; i++) {
Shell shell = shells [i];
- if (!shell.isDisposed () && this == shell.getDisplay ()) {
+ if (!shell.isDisposed () && this == shell.display) {
shell.update ();
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
index e5569ee6cb..126a68cd89 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Group.java
@@ -112,7 +112,6 @@ protected void checkSubclass () {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int clazz = display.PtContainer;
int parentHandle = parent.parentingHandle ();
int [] args = {
@@ -123,7 +122,6 @@ void createHandle (int index) {
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.GROUP_FONT;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java
index ff9b34c4d3..b084c7b0d6 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Label.java
@@ -128,7 +128,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
OS.memmove (font, args [4], length);
String string = text;
if (wHint != SWT.DEFAULT) {
- Display display = getDisplay ();
string = display.wrapText (text, font, wHint);
}
byte [] buffer = Converter.wcsToMbcs (null, string, false);
@@ -177,7 +176,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int parentHandle = parent.parentingHandle ();
if ((style & SWT.SEPARATOR) != 0) {
@@ -433,7 +431,6 @@ public void setText (String string) {
if ((style & SWT.BORDER) != 0) border = 2;
int width = args [4];
width -= (args [7] * 2) + args [10] + args [13] + border * 2;
- Display display = getDisplay ();
if (mnemonic != '\0') string = new String (unicode);
string = display.wrapText (string, font, width);
buffer = Converter.wcsToMbcs (null, string, true);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java
index bbeefd09da..77b9e22348 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/List.java
@@ -219,7 +219,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int clazz = display.PtList;
int parentHandle = parent.parentingHandle ();
int mode = OS.Pt_SELECTION_MODE_SINGLE | OS.Pt_SELECTION_MODE_AUTO;
@@ -247,17 +246,14 @@ void createHandle (int index) {
}
int defaultBackground () {
- Display display = getDisplay ();
return display.LIST_BACKGROUND;
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.LIST_FONT;
}
int defaultForeground () {
- Display display = getDisplay ();
return display.LIST_FOREGROUND;
}
@@ -635,7 +631,7 @@ public int getTopIndex () {
void hookEvents () {
super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_SELECTION, windowProc, OS.Pt_CB_SELECTION);
OS.PtAddCallback (handle, OS.Pt_CB_ACTIVATE, windowProc, OS.Pt_CB_ACTIVATE);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java
index f2b14ae330..4342b33e22 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Menu.java
@@ -257,12 +257,6 @@ public MenuItem getDefaultItem () {
return defaultItem;
}
-public Display getDisplay () {
- Decorations parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
/**
* Returns <code>true</code> if the receiver is enabled, and
* <code>false</code> otherwise. A disabled control is typically
@@ -487,7 +481,7 @@ public boolean getVisible () {
}
void hookEvents () {
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_REALIZED, windowProc, OS.Pt_CB_REALIZED);
OS.PtAddCallback (handle, OS.Pt_CB_UNREALIZED, windowProc, OS.Pt_CB_UNREALIZED);
}
@@ -774,6 +768,7 @@ public void setVisible (boolean visible) {
if ((style & SWT.POP_UP) == 0) return;
if (visible == OS.PtWidgetIsRealized (handle)) return;
if (visible) {
+ display.runDeferredEvents ();
sendEvent (SWT.Show);
if (getItemCount () != 0) {
PhPoint_t pt = new PhPoint_t ();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java
index 643285b4ae..4fa03ec93e 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/MenuItem.java
@@ -123,7 +123,6 @@ void addAccelerator () {
if ((accelerator & SWT.SHIFT) != 0) keyMods |= OS.Pk_KM_Shift;
if ((accelerator & SWT.CONTROL) != 0) keyMods |= OS.Pk_KM_Ctrl;
int key = (accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CONTROL));
- Display display = getDisplay ();
int keyCode = Display.untranslateKey (key);
if (keyCode != 0) key = keyCode;
else key = Character.toLowerCase ((char)key);
@@ -277,12 +276,6 @@ public int getAccelerator () {
return accelerator;
}
-public Display getDisplay () {
- Menu parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
/**
* Returns <code>true</code> if the receiver is enabled, and
* <code>false</code> otherwise. A disabled control is typically
@@ -372,7 +365,7 @@ public boolean getSelection () {
void hookEvents () {
if ((style & SWT.SEPARATOR) != 0) return;
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
if ((style & SWT.CASCADE) != 0) {
OS.PtAddCallback (handle, OS.Pt_CB_ARM, windowProc, OS.Pt_CB_ARM);
}
@@ -533,7 +526,6 @@ void removeAccelerator () {
if ((accelerator & SWT.SHIFT) != 0) keyMods |= OS.Pk_KM_Shift;
if ((accelerator & SWT.CONTROL) != 0) keyMods |= OS.Pk_KM_Ctrl;
int key = (accelerator & ~(SWT.ALT | SWT.SHIFT | SWT.CONTROL));
- Display display = getDisplay ();
int keyCode = Display.untranslateKey (key);
if (keyCode != 0) key = keyCode;
else key = Character.toLowerCase ((char)key);
@@ -656,7 +648,6 @@ public void setImage (Image image) {
* PtMenuButton, it can never be removed. The fix is to set it to
* a small blank image.
*/
- Display display = getDisplay ();
imageHandle = copyPhImage (display.nullImage);
}
int [] args = {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
index b20c211758..14847222b9 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ProgressBar.java
@@ -103,7 +103,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int clazz = display.PtProgress;
int parentHandle = parent.parentingHandle ();
int gaugeFlags = (style & SWT.INDETERMINATE) != 0 ? OS.Pt_GAUGE_INDETERMINATE : 0;
@@ -118,7 +117,6 @@ void createHandle (int index) {
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.GAUGE_FONT;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
index 40689a86de..80d387227d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Sash.java
@@ -125,7 +125,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= GRAB | HANDLE;
- Display display = getDisplay ();
int clazz = display.PtContainer;
int parentHandle = parent.parentingHandle ();
int cursor = ((style & SWT.HORIZONTAL) != 0) ? OS.Ph_CURSOR_DRAG_VERTICAL : OS.Ph_CURSOR_DRAG_HORIZONTAL;
@@ -139,7 +138,6 @@ void createHandle (int index) {
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.TITLE_FONT;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
index 0376b99796..417eee277d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Scale.java
@@ -129,8 +129,7 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
}
void createHandle (int index) {
- state |= HANDLE;
- Display display = getDisplay ();
+ state |= HANDLE;
int clazz = display.PtSlider;
int parentHandle = parent.parentingHandle ();
int [] args = {
@@ -146,7 +145,6 @@ void createHandle (int index) {
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.GAUGE_FONT;
}
@@ -241,7 +239,7 @@ public int getSelection () {
void hookEvents () {
super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_SLIDER_MOVE, windowProc, OS.Pt_CB_SLIDER_MOVE);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java
index d8cc814c69..c4242e68db 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ScrollBar.java
@@ -143,7 +143,6 @@ public void addSelectionListener (SelectionListener listener) {
void createHandle (int index) {
state |= HANDLE;
if (handle != 0) return;
- Display display = getDisplay ();
int parentHandle = parent.scrolledHandle;
int orientation, sizeArg, size, basicFlags;
if ((style & SWT.HORIZONTAL) != 0) {
@@ -171,12 +170,6 @@ void createHandle (int index) {
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
}
-public Display getDisplay () {
- Scrollable parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
/**
* Returns <code>true</code> if the receiver is enabled, and
* <code>false</code> otherwise. A disabled control is typically
@@ -366,7 +359,7 @@ public boolean getVisible () {
}
void hookEvents () {
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_SCROLL_MOVE, windowProc, OS.Pt_CB_SCROLL_MOVE);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java
index fbfb526adb..51110a4bdb 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Shell.java
@@ -101,7 +101,6 @@ import org.eclipse.swt.events.*;
*/
public class Shell extends Decorations {
int shellHandle;
- Display display;
Menu activeMenu;
int blockedList;
Control lastActive;
@@ -311,7 +310,7 @@ public Shell (Shell parent) {
* @see SWT#SYSTEM_MODAL
*/
public Shell (Shell parent, int style) {
- this (parent != null ? parent.getDisplay () : null, parent, style, 0);
+ this (parent != null ? parent.display : null, parent, style, 0);
}
public static Shell photon_new (Display display, int handle) {
@@ -530,11 +529,6 @@ public Rectangle getBounds () {
return new Rectangle (area.pos_x, area.pos_y, width, height);
}
-public Display getDisplay () {
- if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return display;
-}
-
/**
* Returns the receiver's input method editor mode. This
* will be the result of bitwise OR'ing together one or
@@ -646,7 +640,7 @@ public Point getSize () {
void hookEvents () {
super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (shellHandle, OS.Pt_CB_WINDOW, windowProc, OS.Pt_CB_WINDOW);
OS.PtAddCallback (shellHandle, OS.Pt_CB_RESIZE, windowProc, OS.Pt_CB_RESIZE);
}
@@ -775,7 +769,6 @@ void releaseWidget () {
if (blockedList != 0) OS.PtUnblockWindows (blockedList);
blockedList = 0;
lastActive = null;
- display = null;
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
index 42bd8eb85d..78895eadd7 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Slider.java
@@ -145,7 +145,6 @@ public void addSelectionListener (SelectionListener listener) {
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget();
- Display display = getDisplay ();
int border = getBorderWidth () * 2;
int width = display.SCROLLBAR_WIDTH + border, height = width * 5;
if ((style & SWT.HORIZONTAL) != 0) {
@@ -165,7 +164,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int clazz = display.PtScrollbar;
int parentHandle = parent.parentingHandle ();
int [] args = {
@@ -180,7 +178,6 @@ void createHandle (int index) {
}
byte [] defaultFont () {
- Display display = getDisplay ();
return display.GAUGE_FONT;
}
@@ -300,7 +297,7 @@ public int getThumb () {
void hookEvents () {
super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_SCROLL_MOVE, windowProc, OS.Pt_CB_SCROLL_MOVE);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java
index 99cda662fa..a1ee97f527 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabFolder.java
@@ -168,7 +168,6 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int parentHandle = parent.parentingHandle ();
int [] args = {
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
@@ -388,7 +387,7 @@ public int getSelectionIndex () {
void hookEvents () {
super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_PG_PANEL_SWITCHING, windowProc, OS.Pt_CB_PG_PANEL_SWITCHING);
OS.PtAddCallback (handle, OS.Pt_CB_REALIZED, windowProc, OS.Pt_CB_REALIZED);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java
index c18042f013..ec3cbd1487 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/TabItem.java
@@ -126,12 +126,6 @@ public Control getControl () {
return control;
}
-public Display getDisplay () {
- TabFolder parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
/**
* Returns the receiver's parent, which must be a <code>TabFolder</code>.
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
index f3ee966cd2..a4f5041eea 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Text.java
@@ -162,7 +162,6 @@ public void clearSelection () {
}
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int parentHandle = parent.parentingHandle ();
boolean hasBorder = (style & SWT.BORDER) != 0;
int textFlags = (style & SWT.READ_ONLY) != 0 ? 0 : OS.Pt_EDITABLE;
@@ -375,12 +374,10 @@ void deregister () {
}
int defaultBackground () {
- Display display = getDisplay ();
return display.TEXT_BACKGROUND;
}
int defaultForeground () {
- Display display = getDisplay ();
return display.TEXT_FOREGROUND;
}
@@ -812,7 +809,7 @@ public int getTopPixel () {
void hookEvents () {
super.hookEvents ();
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddCallback (handle, OS.Pt_CB_MODIFY_VERIFY, windowProc, OS.Pt_CB_MODIFY_VERIFY);
OS.PtAddCallback (handle, OS.Pt_CB_TEXT_CHANGED, windowProc, OS.Pt_CB_TEXT_CHANGED);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java
index 925b6d5747..aa54c867e1 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolBar.java
@@ -152,7 +152,6 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
void createHandle (int index) {
state |= HANDLE;
- Display display = getDisplay ();
int parentHandle = parent.parentingHandle ();
int [] args = {
OS.Pt_ARG_RESIZE_FLAGS, 0, OS.Pt_RESIZE_XY_BITS,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
index 8c1248602d..5acbb8ba8d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/ToolItem.java
@@ -327,12 +327,6 @@ public Image getDisabledImage () {
return disabledImage;
}
-public Display getDisplay () {
- ToolBar parent = this.parent;
- if (parent == null) error (SWT.ERROR_WIDGET_DISPOSED);
- return parent.getDisplay ();
-}
-
/**
* Returns <code>true</code> if the receiver is enabled, and
* <code>false</code> otherwise. A disabled control is typically
@@ -451,7 +445,7 @@ boolean hasFocus () {
void hookEvents () {
super.hookEvents ();
if ((style & SWT.SEPARATOR) != 0) return;
- int windowProc = getDisplay ().windowProc;
+ int windowProc = display.windowProc;
OS.PtAddEventHandler (handle, OS.Ph_EV_BOUNDARY, windowProc, OS.Ph_EV_BOUNDARY);
OS.PtAddCallback (button, OS.Pt_CB_ACTIVATE, windowProc, OS.Pt_CB_ACTIVATE);
if ((style & SWT.DROP_DOWN) != 0) {
@@ -640,7 +634,6 @@ public void setControl (Control control) {
}
void setDefaultFont () {
- Display display = getDisplay ();
if (display.defaultFont != null) setFont (parent.defaultFont ());
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java
index 373ddc8cf6..fec82cf7c3 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Tracker.java
@@ -37,7 +37,6 @@ import org.eclipse.swt.events.*;
*/
public class Tracker extends Widget {
Composite parent;
- Display display;
boolean tracking, stippled;
Rectangle [] rectangles, proportions;
int resizeCursor, clientCursor, clientBitmap;
@@ -128,7 +127,6 @@ public Tracker (Display display, int style) {
public Tracker (Composite parent, int style) {
super (parent, checkStyle (style));
this.parent = parent;
- display = parent.getDisplay ();
}
/**
@@ -340,10 +338,6 @@ void drawRectangles (Rectangle [] rects) {
OS.PgDestroyGC (phGC);
}
-public Display getDisplay () {
- return display;
-}
-
/**
* Returns the bounds that are being drawn, expressed relative to the parent
* widget. If the parent is a <code>Display</code> then these are screen
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
index a99307de65..ff579a776d 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Widget.java
@@ -43,8 +43,13 @@ import org.eclipse.swt.events.*;
* @see #checkSubclass
*/
public abstract class Widget {
+ /**
+ * the handle to the resource
+ * (Warning: This field is platform dependent)
+ */
public int handle;
int style, state;
+ Display display;
EventTable eventTable;
Object data;
@@ -107,6 +112,7 @@ public Widget (Widget parent, int style) {
checkSubclass ();
checkParent (parent);
this.style = style;
+ display = parent.display;
}
static int checkBits (int style, int int0, int int1, int int2, int int3, int int4, int int5) {
@@ -153,8 +159,7 @@ void checkOrientation (Widget parent) {
void checkParent (Widget parent) {
if (parent == null) error (SWT.ERROR_NULL_ARGUMENT);
- if (!parent.isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (parent.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
+ parent.checkWidget ();
}
/**
@@ -213,8 +218,10 @@ protected void checkSubclass () {
* </ul>
*/
protected void checkWidget () {
- if (!isValidThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
- if (isDisposed ()) error (SWT.ERROR_WIDGET_DISPOSED);
+ Display display = this.display;
+ if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ if (display.thread != Thread.currentThread ()) error (SWT.ERROR_THREAD_INVALID_ACCESS);
+ if ((state & DISPOSED) != 0) error (SWT.ERROR_WIDGET_DISPOSED);
}
int copyPhImage(int image) {
@@ -317,7 +324,6 @@ int createToolTip (String string, int handle, byte [] font) {
int shellHandle = OS.PtFindDisjoint (handle);
byte [] buffer = Converter.wcsToMbcs (null, string, true);
- Display display = getDisplay ();
int fill = display.INFO_BACKGROUND;
int text_color = display.INFO_FOREGROUND;
int toolTipHandle = OS.PtInflateBalloon (shellHandle, handle, OS.Pt_BALLOON_RIGHT, buffer, font, fill, text_color);
@@ -418,7 +424,6 @@ static void error (int code) {
}
boolean filters (int eventType) {
- Display display = getDisplay ();
return display.filters (eventType);
}
@@ -501,7 +506,11 @@ public Object getData (String key) {
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
-public abstract Display getDisplay ();
+public Display getDisplay () {
+ Display display = this.display;
+ if (display == null) error (SWT.ERROR_WIDGET_DISPOSED);
+ return display;
+}
String getName () {
String string = getClass ().getName ();
@@ -725,6 +734,7 @@ void register () {
void releaseHandle () {
handle = 0;
state |= DISPOSED;
+ display = null;
}
void releaseResources () {
@@ -820,7 +830,6 @@ public void removeDisposeListener (DisposeListener listener) {
}
void replaceMnemonic (int mnemonic, boolean normal, boolean alt) {
- Display display = getDisplay ();
int [] args = {OS.Pt_ARG_ACCEL_KEY, 0, 0};
OS.PtGetResources (handle, args.length / 3, args);
if (args [1] != 0) {
@@ -868,7 +877,6 @@ void sendEvent (int eventType, Event event) {
}
void sendEvent (int eventType, Event event, boolean send) {
- Display display = getDisplay ();
if (eventTable == null && !display.filters (eventType)) {
return;
}