< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Toolkit.cpp

Print this page




 304     m_hGetMessageHook = 0;
 305     m_hMouseLLHook = 0;
 306     m_lastWindowUnderMouse = NULL;
 307     m_timer = 0;
 308 
 309     m_cmdIDs = new AwtCmdIDList();
 310     m_pModalDialog = NULL;
 311     m_peer = NULL;
 312     m_dllHandle = NULL;
 313 
 314     m_displayChanged = FALSE;
 315     m_embedderProcessID = 0;
 316 
 317     // XXX: keyboard mapping should really be moved out of AwtComponent
 318     AwtComponent::InitDynamicKeyMapTable();
 319 
 320     // initialize kb state array
 321     ::GetKeyboardState(m_lastKeyboardState);
 322 
 323     m_waitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);

 324     eventNumber = 0;
 325 }
 326 
 327 AwtToolkit::~AwtToolkit() {
 328 /*
 329  *  The code has been moved to AwtToolkit::Dispose() method.
 330  */
 331 }
 332 
 333 HWND AwtToolkit::CreateToolkitWnd(LPCTSTR name)
 334 {
 335     HWND hwnd = CreateWindow(
 336         szAwtToolkitClassName,
 337         (LPCTSTR)name,                    /* window name */
 338         WS_DISABLED,                      /* window style */
 339         -1, -1,                           /* position of window */
 340         0, 0,                             /* width and height */
 341         NULL, NULL,                       /* hWndParent and hWndMenu */
 342         GetModuleHandle(),
 343         NULL);                            /* lpParam */


2646             } else {
2647                 swprintf(szVer + l, 128, L" (Windows XP)");
2648             }
2649         } else {
2650             swprintf(szVer + l, 128, L" (Windows 2000)");
2651         }
2652     } else {
2653         swprintf(szVer + l, 128, L" (Unknown)");
2654     }
2655 
2656     return JNU_NewStringPlatform(env, szVer);
2657 
2658     CATCH_BAD_ALLOC_RET(NULL);
2659 }
2660 
2661 JNIEXPORT jboolean JNICALL
2662 Java_sun_awt_windows_WToolkit_syncNativeQueue(JNIEnv *env, jobject self, jlong timeout)
2663 {
2664     AwtToolkit & tk = AwtToolkit::GetInstance();
2665     DWORD eventNumber = tk.eventNumber;

2666     tk.PostMessage(WM_SYNC_WAIT, 0, 0);
2667     ::WaitForSingleObject(tk.m_waitEvent, INFINITE);





2668     DWORD newEventNumber = tk.eventNumber;
2669     return (newEventNumber - eventNumber) > 2;
2670 }
2671 
2672 } /* extern "C" */
2673 
2674 /* Convert a Windows desktop color index into an RGB value. */
2675 COLORREF DesktopColor2RGB(int colorIndex) {
2676     DWORD sysColor = ::GetSysColor(colorIndex);
2677     return ((GetRValue(sysColor)<<16) | (GetGValue(sysColor)<<8) |
2678             (GetBValue(sysColor)) | 0xff000000);
2679 }
2680 
2681 
2682 /*
2683  * Class:     sun_awt_SunToolkit
2684  * Method:    closeSplashScreen
2685  * Signature: ()V
2686  */
2687 extern "C" JNIEXPORT void JNICALL




 304     m_hGetMessageHook = 0;
 305     m_hMouseLLHook = 0;
 306     m_lastWindowUnderMouse = NULL;
 307     m_timer = 0;
 308 
 309     m_cmdIDs = new AwtCmdIDList();
 310     m_pModalDialog = NULL;
 311     m_peer = NULL;
 312     m_dllHandle = NULL;
 313 
 314     m_displayChanged = FALSE;
 315     m_embedderProcessID = 0;
 316 
 317     // XXX: keyboard mapping should really be moved out of AwtComponent
 318     AwtComponent::InitDynamicKeyMapTable();
 319 
 320     // initialize kb state array
 321     ::GetKeyboardState(m_lastKeyboardState);
 322 
 323     m_waitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
 324     isInDoDragDropLoop = FALSE;
 325     eventNumber = 0;
 326 }
 327 
 328 AwtToolkit::~AwtToolkit() {
 329 /*
 330  *  The code has been moved to AwtToolkit::Dispose() method.
 331  */
 332 }
 333 
 334 HWND AwtToolkit::CreateToolkitWnd(LPCTSTR name)
 335 {
 336     HWND hwnd = CreateWindow(
 337         szAwtToolkitClassName,
 338         (LPCTSTR)name,                    /* window name */
 339         WS_DISABLED,                      /* window style */
 340         -1, -1,                           /* position of window */
 341         0, 0,                             /* width and height */
 342         NULL, NULL,                       /* hWndParent and hWndMenu */
 343         GetModuleHandle(),
 344         NULL);                            /* lpParam */


2647             } else {
2648                 swprintf(szVer + l, 128, L" (Windows XP)");
2649             }
2650         } else {
2651             swprintf(szVer + l, 128, L" (Windows 2000)");
2652         }
2653     } else {
2654         swprintf(szVer + l, 128, L" (Unknown)");
2655     }
2656 
2657     return JNU_NewStringPlatform(env, szVer);
2658 
2659     CATCH_BAD_ALLOC_RET(NULL);
2660 }
2661 
2662 JNIEXPORT jboolean JNICALL
2663 Java_sun_awt_windows_WToolkit_syncNativeQueue(JNIEnv *env, jobject self, jlong timeout)
2664 {
2665     AwtToolkit & tk = AwtToolkit::GetInstance();
2666     DWORD eventNumber = tk.eventNumber;
2667     if (!tk.isInDoDragDropLoop) {
2668         tk.PostMessage(WM_SYNC_WAIT, 0, 0);
2669         while (WAIT_TIMEOUT == ::WaitForSingleObject(tk.m_waitEvent, 2)) {
2670             if (tk.isInDoDragDropLoop) {
2671                 break;
2672             }
2673         }
2674     }
2675     DWORD newEventNumber = tk.eventNumber;
2676     return (newEventNumber - eventNumber) > 2;
2677 }
2678 
2679 } /* extern "C" */
2680 
2681 /* Convert a Windows desktop color index into an RGB value. */
2682 COLORREF DesktopColor2RGB(int colorIndex) {
2683     DWORD sysColor = ::GetSysColor(colorIndex);
2684     return ((GetRValue(sysColor)<<16) | (GetGValue(sysColor)<<8) |
2685             (GetBValue(sysColor)) | 0xff000000);
2686 }
2687 
2688 
2689 /*
2690  * Class:     sun_awt_SunToolkit
2691  * Method:    closeSplashScreen
2692  * Signature: ()V
2693  */
2694 extern "C" JNIEXPORT void JNICALL


< prev index next >