summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Heidrich <fheidric>2011-01-20 16:43:33 +0000
committerFelipe Heidrich <fheidric>2011-01-20 16:43:33 +0000
commit13344c79de4fc1eb07ffda86acb835ae0f732c21 (patch)
treeb0cbf7d37614ef0bcac8911eef2ecc952909c238
parent1f174a766b5476ad0c84e8e12dd476b60439aa7a (diff)
downloadeclipse.platform.swt-13344c79de4fc1eb07ffda86acb835ae0f732c21.tar.gz
eclipse.platform.swt-13344c79de4fc1eb07ffda86acb835ae0f732c21.tar.xz
eclipse.platform.swt-13344c79de4fc1eb07ffda86acb835ae0f732c21.zip
formatting + fix findTouchSource + fix releaseDisplay
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java44
1 files changed, 19 insertions, 25 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index b3a1b5c06b..8f5e3cf619 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.swt.widgets;
+
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.win32.*;
import org.eclipse.swt.*;
@@ -251,7 +252,7 @@ public class Display extends Device {
int lastX, lastY;
/* Touch state */
- TouchSource[] touchSources;
+ TouchSource [] touchSources;
/* Tool Tips */
int nextToolTipId;
@@ -1429,31 +1430,25 @@ public static Display findDisplay (Thread thread) {
}
}
-TouchSource findTouchSource(int /*long*/ touchDevice, Monitor sourceMonitor) {
+TouchSource findTouchSource (int /*long*/ touchDevice, Monitor monitor) {
if (touchSources == null) touchSources = new TouchSource [4];
- int index = 0;
int length = touchSources.length;
- TouchSource source = null;
-
- while (index < length) {
- if (touchSources[index] != null && touchSources[index].handle == touchDevice) {
- source = touchSources[index];
- break;
+ for (int i=0; i<length; i++) {
+ if (touchSources [i] != null && touchSources [i].handle == touchDevice) {
+ return touchSources [i];
}
+ }
+ int index = 0;
+ while (index < length) {
+ if (touchSources [index] == null) break;
index++;
}
-
- if (source != null) return source;
-
if (index == length) {
- TouchSource [] newList = new TouchSource [length + 4];
- System.arraycopy(touchSources, 0, newList, 0, length);
- touchSources = newList;
+ TouchSource [] newTouchSources = new TouchSource [length + 4];
+ System.arraycopy (touchSources, 0, newTouchSources, 0, length);
+ touchSources = newTouchSources;
}
-
- source = new TouchSource(touchDevice, true, sourceMonitor.getBounds());
- touchSources [index] = source;
- return source;
+ return touchSources [index] = new TouchSource (touchDevice, true, monitor.getBounds ());
}
/**
@@ -2823,12 +2818,9 @@ public void internal_dispose_GC (int /*long*/ hDC, GCData data) {
*
* @since 3.7
*/
-public boolean isTouchEnabled() {
- int value = OS.GetSystemMetrics(OS.SM_DIGITIZER);
- if ((value & (OS.NID_READY | OS.NID_MULTI_INPUT)) != 0) {
- return true;
- }
- return false;
+public boolean isTouchEnabled () {
+ int value = OS.GetSystemMetrics (OS.SM_DIGITIZER);
+ return (value & (OS.NID_READY | OS.NID_MULTI_INPUT)) != 0;
}
boolean isXMouseActive () {
@@ -3917,6 +3909,8 @@ void releaseDisplay () {
clickRect = null;
hdr = null;
plvfi = null;
+ monitors = null;
+ touchSources = null;
/* Release handles */
threadId = 0;