comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets/Display.d @ 19:52184e4b815c

no more direct tango.core.Thread. Rename JThread to java.lang.Thread.
author Frank Benoit <benoit@tionex.de>
date Wed, 18 Mar 2009 10:55:25 +0100
parents 950d84783eac
children d46287db17ed
comparison
equal deleted inserted replaced
18:735224fcc45f 19:52184e4b815c
46 import org.eclipse.swt.widgets.Listener; 46 import org.eclipse.swt.widgets.Listener;
47 import org.eclipse.swt.widgets.Widget; 47 import org.eclipse.swt.widgets.Widget;
48 import org.eclipse.swt.widgets.TrayItem; 48 import org.eclipse.swt.widgets.TrayItem;
49 49
50 import java.lang.all; 50 import java.lang.all;
51 import tango.core.Thread; 51 import java.lang.Thread;
52 52
53 /** 53 /**
54 * Instances of this class are responsible for managing the 54 * Instances of this class are responsible for managing the
55 * connection between SWT and the underlying operating 55 * connection between SWT and the underlying operating
56 * system. Their most important function is to implement 56 * system. Their most important function is to implement
737 //if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS); 737 //if (!isValidClass (getClass ())) error (SWT.ERROR_INVALID_SUBCLASS);
738 } 738 }
739 739
740 override protected void checkDevice () { 740 override protected void checkDevice () {
741 if (thread is null) error (SWT.ERROR_WIDGET_DISPOSED); 741 if (thread is null) error (SWT.ERROR_WIDGET_DISPOSED);
742 if (thread !is Thread.getThis ()) { 742 if (thread !is Thread.currentThread ()) {
743 /* 743 /*
744 * Bug in IBM JVM 1.6. For some reason, under 744 * Bug in IBM JVM 1.6. For some reason, under
745 * conditions that are yet to be full understood, 745 * conditions that are yet to be full understood,
746 * Thread.currentThread() is either returning null 746 * Thread.currentThread() is either returning null
747 * or a different instance from the one that was 747 * or a different instance from the one that was
828 * 828 *
829 * @see #init 829 * @see #init
830 */ 830 */
831 override protected void create (DeviceData data) { 831 override protected void create (DeviceData data) {
832 checkSubclass (); 832 checkSubclass ();
833 checkDisplay (thread = Thread.getThis (), true); 833 checkDisplay (thread = Thread.currentThread (), true);
834 createDisplay (data); 834 createDisplay (data);
835 register (this); 835 register (this);
836 if (Default is null) Default = this; 836 if (Default is null) Default = this;
837 } 837 }
838 838
1453 * 1453 *
1454 * @return the current display 1454 * @return the current display
1455 */ 1455 */
1456 public static Display getCurrent () { 1456 public static Display getCurrent () {
1457 static_this(); 1457 static_this();
1458 return findDisplay (Thread.getThis ()); 1458 return findDisplay (Thread.currentThread ());
1459 } 1459 }
1460 1460
1461 int getClickCount (int type, int button, HWND hwnd, int lParam) { 1461 int getClickCount (int type, int button, HWND hwnd, int lParam) {
1462 switch (type) { 1462 switch (type) {
1463 case SWT.MouseDown: 1463 case SWT.MouseDown:
2711 } 2711 }
2712 return xMouseActive; 2712 return xMouseActive;
2713 } 2713 }
2714 2714
2715 bool isValidThread () { 2715 bool isValidThread () {
2716 return thread is Thread.getThis (); 2716 return thread is Thread.currentThread ();
2717 } 2717 }
2718 2718
2719 /** 2719 /**
2720 * Maps a point from one coordinate system to another. 2720 * Maps a point from one coordinate system to another.
2721 * When the control is null, coordinates are mapped to 2721 * When the control is null, coordinates are mapped to
4541 * @see #sleep 4541 * @see #sleep
4542 */ 4542 */
4543 public void wake () { 4543 public void wake () {
4544 synchronized (Device.classinfo) { 4544 synchronized (Device.classinfo) {
4545 if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED); 4545 if (isDisposed ()) error (SWT.ERROR_DEVICE_DISPOSED);
4546 if (thread is Thread.getThis ()) return; 4546 if (thread is Thread.currentThread ()) return;
4547 wakeThread (); 4547 wakeThread ();
4548 } 4548 }
4549 } 4549 }
4550 4550
4551 void wakeThread () { 4551 void wakeThread () {
4633 * consecutive WM_NCHITTEST messages to the same control without 4633 * consecutive WM_NCHITTEST messages to the same control without
4634 * another message (normally WM_SETCURSOR) in between. 4634 * another message (normally WM_SETCURSOR) in between.
4635 */ 4635 */
4636 if (msg is OS.WM_NCHITTEST) { 4636 if (msg is OS.WM_NCHITTEST) {
4637 if (hitCount++ >= 1024) { 4637 if (hitCount++ >= 1024) {
4638 try {Thread.sleep (0.001);} catch (Exception t) {} 4638 try {Thread.sleep (1);} catch (Exception t) {}
4639 } 4639 }
4640 } else { 4640 } else {
4641 hitCount = 0; 4641 hitCount = 0;
4642 } 4642 }
4643 if (lastControl !is null && lastHwnd is hwnd) { 4643 if (lastControl !is null && lastHwnd is hwnd) {