comparison dwt/widgets/Display.d @ 246:fd9c62a2998e

Updater SWT 3.4M7 to 3.4
author Frank Benoit <benoit@tionex.de>
date Tue, 01 Jul 2008 10:15:59 +0200
parents 43b41c7fe84a
children b3dbd786541a
comparison
equal deleted inserted replaced
245:d8c3d4a4f2b0 246:fd9c62a2998e
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2000, 2007 IBM Corporation and others. 2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials 3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0 4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at 5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html 6 * http://www.eclipse.org/legal/epl-v10.html
7 * 7 *
129 * @see #asyncExec 129 * @see #asyncExec
130 * @see #wake 130 * @see #wake
131 * @see #readAndDispatch 131 * @see #readAndDispatch
132 * @see #sleep 132 * @see #sleep
133 * @see Device#dispose 133 * @see Device#dispose
134 * @see <a href="http://www.eclipse.org/swt/snippets/#display">Display snippets</a>
135 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
134 */ 136 */
135 137
136 public class Display : Device { 138 public class Display : Device {
137 139
138 /** 140 /**
742 //if (!isValidClass (getClass ())) error (DWT.ERROR_INVALID_SUBCLASS); 744 //if (!isValidClass (getClass ())) error (DWT.ERROR_INVALID_SUBCLASS);
743 } 745 }
744 746
745 override protected void checkDevice () { 747 override protected void checkDevice () {
746 if (thread is null) error (DWT.ERROR_WIDGET_DISPOSED); 748 if (thread is null) error (DWT.ERROR_WIDGET_DISPOSED);
747 if (thread !is Thread.getThis ()) error (DWT.ERROR_THREAD_INVALID_ACCESS); 749 if (thread !is Thread.getThis ()) {
750 /*
751 * Bug in IBM JVM 1.6. For some reason, under
752 * conditions that are yet to be full understood,
753 * Thread.currentThread() is either returning null
754 * or a different instance from the one that was
755 * saved when the Display was created. This is
756 * possibly a JIT problem because modifying this
757 * method to print logging information when the
758 * error happens seems to fix the problem. The
759 * fix is to use operating system calls to verify
760 * that the current thread is not the Display thread.
761 *
762 * NOTE: Despite the fact that Thread.currentThread()
763 * is used in other places, the failure has not been
764 * observed in all places where it is called.
765 */
766 if (threadId !is OS.GetCurrentThreadId ()) {
767 error (DWT.ERROR_THREAD_INVALID_ACCESS);
768 }
769 }
748 if (isDisposed ()) error (DWT.ERROR_DEVICE_DISPOSED); 770 if (isDisposed ()) error (DWT.ERROR_DEVICE_DISPOSED);
749 } 771 }
750 772
751 static void checkDisplay (Thread thread, bool multiple) { 773 static void checkDisplay (Thread thread, bool multiple) {
752 synchronized (Device.classinfo) { 774 synchronized (Device.classinfo) {
2052 if (control !is null) { 2074 if (control !is null) {
2053 auto hHeap = OS.GetProcessHeap (); 2075 auto hHeap = OS.GetProcessHeap ();
2054 MSG* keyMsg = cast(MSG*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, MSG.sizeof); 2076 MSG* keyMsg = cast(MSG*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, MSG.sizeof);
2055 *keyMsg = *msg; 2077 *keyMsg = *msg;
2056 OS.PostMessage (hwndMessage, SWT_KEYMSG, wParam, cast(int)keyMsg); 2078 OS.PostMessage (hwndMessage, SWT_KEYMSG, wParam, cast(int)keyMsg);
2057 msg.message = OS.WM_NULL; 2079 switch ((int)/*64*/msg.wParam) {
2058 //OS.MoveMemory (lParam, msg, MSG.sizeof); 2080 case OS.VK_SHIFT:
2081 case OS.VK_MENU:
2082 case OS.VK_CONTROL:
2083 case OS.VK_CAPITAL:
2084 case OS.VK_NUMLOCK:
2085 case OS.VK_SCROLL:
2086 break;
2087 default:
2088 msg.message = OS.WM_NULL;
2089 //OS.MoveMemory (lParam, msg, MSG.sizeof);
2090 }
2059 } 2091 }
2060 }
2061 default: 2092 default:
2093 }
2062 } 2094 }
2063 } 2095 }
2064 return OS.CallNextHookEx (msgHook, code, wParam, lParam); 2096 return OS.CallNextHookEx (msgHook, code, wParam, lParam);
2065 } 2097 }
2066 2098
3018 } 3050 }
3019 } 3051 }
3020 default: 3052 default:
3021 } 3053 }
3022 } 3054 }
3055 switch ((int)/*64*/keyMsg.wParam) {
3056 case OS.VK_SHIFT:
3057 case OS.VK_MENU:
3058 case OS.VK_CONTROL:
3059 case OS.VK_CAPITAL:
3060 case OS.VK_NUMLOCK:
3061 case OS.VK_SCROLL:
3062 consumed = true;
3063 }
3023 if (consumed) { 3064 if (consumed) {
3024 auto hHeap = OS.GetProcessHeap (); 3065 auto hHeap = OS.GetProcessHeap ();
3025 OS.HeapFree (hHeap, 0, cast(void*)lParam); 3066 OS.HeapFree (hHeap, 0, cast(void*)lParam);
3026 } else { 3067 } else {
3027 OS.PostMessage (embeddedHwnd, SWT_KEYMSG, wParam, lParam); 3068 OS.PostMessage (embeddedHwnd, SWT_KEYMSG, wParam, lParam);
3790 * Removes the listener from the collection of listeners who will 3831 * Removes the listener from the collection of listeners who will
3791 * be notified when an event of the given type occurs. The event type 3832 * be notified when an event of the given type occurs. The event type
3792 * is one of the event constants defined in class <code>DWT</code>. 3833 * is one of the event constants defined in class <code>DWT</code>.
3793 * 3834 *
3794 * @param eventType the type of event to listen for 3835 * @param eventType the type of event to listen for
3795 * @param listener the listener which should no longer be notified when the event occurs 3836 * @param listener the listener which should no longer be notified
3796 * 3837 *
3797 * @exception IllegalArgumentException <ul> 3838 * @exception IllegalArgumentException <ul>
3798 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li> 3839 * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
3799 * </ul> 3840 * </ul>
3800 * @exception DWTException <ul> 3841 * @exception DWTException <ul>