< prev index next >

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

Print this page




 288 jmethodID AwtToolkit::insetsMID;
 289 
 290 /************************************************************************
 291  * AwtToolkit methods
 292  */
 293 
 294 AwtToolkit::AwtToolkit() {
 295     m_localPump = FALSE;
 296     m_mainThreadId = 0;
 297     m_toolkitHWnd = NULL;
 298     m_inputMethodHWnd = NULL;
 299     m_verbose = FALSE;
 300     m_isActive = TRUE;
 301     m_isDisposed = FALSE;
 302 
 303     m_vmSignalled = FALSE;
 304 
 305     m_isDynamicLayoutSet = FALSE;
 306     m_areExtraMouseButtonsEnabled = TRUE;
 307 




 308     m_verifyComponents = FALSE;
 309     m_breakOnError = FALSE;
 310 
 311     m_breakMessageLoop = FALSE;
 312     m_messageLoopResult = 0;
 313 
 314     m_lastMouseOver = NULL;
 315     m_mouseDown = FALSE;
 316 
 317     m_hGetMessageHook = 0;
 318     m_hMouseLLHook = 0;
 319     m_lastWindowUnderMouse = NULL;
 320     m_timer = 0;
 321 
 322     m_cmdIDs = new AwtCmdIDList();
 323     m_pModalDialog = NULL;
 324     m_peer = NULL;
 325     m_dllHandle = NULL;
 326 
 327     m_displayChanged = FALSE;


 500     tk.m_localPump = localPump;
 501     tk.m_mainThreadId = ::GetCurrentThreadId();
 502 
 503     /*
 504      * Create the one-and-only toolkit window.  This window isn't
 505      * displayed, but is used to route messages to this thread.
 506      */
 507     tk.m_toolkitHWnd = tk.CreateToolkitWnd(TEXT("theAwtToolkitWindow"));
 508     DASSERT(tk.m_toolkitHWnd != NULL);
 509 
 510     /*
 511      * Setup a GetMessage filter to watch all messages coming out of our
 512      * queue from PreProcessMsg().
 513      */
 514     tk.m_hGetMessageHook = ::SetWindowsHookEx(WH_GETMESSAGE,
 515                                               (HOOKPROC)GetMessageFilter,
 516                                               0, tk.m_mainThreadId);
 517 
 518     awt_dnd_initialize();
 519 















 520     return TRUE;
 521 }
 522 
 523 BOOL AwtToolkit::Dispose() {
 524     DTRACE_PRINTLN("In AwtToolkit::Dispose()");
 525 
 526     AwtToolkit& tk = AwtToolkit::GetInstance();
 527 
 528     if (!tk.m_isActive || tk.m_mainThreadId != ::GetCurrentThreadId()) {
 529         return FALSE;
 530     }
 531 
 532     tk.m_isActive = FALSE;
 533 
 534     // dispose Direct3D-related resources. This should be done
 535     // before AwtObjectList::Cleanup() as the d3d will attempt to
 536     // shutdown when the last of its windows is disposed of
 537     D3DInitializer::GetInstance().Clean();
 538 
 539     AwtObjectList::Cleanup();
 540 
 541     awt_dnd_uninitialize();
 542     awt_clipboard_uninitialize((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2));
 543 



 544     if (tk.m_inputMethodHWnd != NULL) {
 545         ::SendMessage(tk.m_inputMethodHWnd, WM_IME_CONTROL, IMC_OPENSTATUSWINDOW, 0);
 546     }
 547     tk.m_inputMethodHWnd = NULL;
 548 
 549     // wait for any messages to be processed, in particular,
 550     // all WM_AWT_DELETEOBJECT messages that delete components; no
 551     // new messages will appear as all the windows except toolkit
 552     // window are unsubclassed and destroyed
 553     MSG msg;
 554     while (::GetMessage(&msg, NULL, 0, 0)) {
 555         ::TranslateMessage(&msg);
 556         ::DispatchMessage(&msg);
 557     }
 558 
 559     AwtFont::Cleanup();
 560 
 561     HWND toolkitHWndToDestroy = tk.m_toolkitHWnd;
 562     tk.m_toolkitHWnd = 0;
 563     VERIFY(::DestroyWindow(toolkitHWndToDestroy) != NULL);


2806  * Signature: (Z)V
2807  */
2808 extern "C" JNIEXPORT void JNICALL Java_sun_awt_windows_WToolkit_setExtraMouseButtonsEnabledNative
2809 (JNIEnv *env, jclass self, jboolean enable){
2810     TRY;
2811     AwtToolkit::GetInstance().setExtraMouseButtonsEnabled(enable);
2812     CATCH_BAD_ALLOC;
2813 }
2814 
2815 void AwtToolkit::setExtraMouseButtonsEnabled(BOOL enable) {
2816     m_areExtraMouseButtonsEnabled = enable;
2817 }
2818 
2819 JNIEXPORT jint JNICALL Java_sun_awt_windows_WToolkit_getNumberOfButtonsImpl
2820 (JNIEnv *, jobject self) {
2821     return AwtToolkit::GetNumberOfButtons();
2822 }
2823 
2824 UINT AwtToolkit::GetNumberOfButtons() {
2825     return MOUSE_BUTTONS_WINDOWS_SUPPORTED;





















2826 }


 288 jmethodID AwtToolkit::insetsMID;
 289 
 290 /************************************************************************
 291  * AwtToolkit methods
 292  */
 293 
 294 AwtToolkit::AwtToolkit() {
 295     m_localPump = FALSE;
 296     m_mainThreadId = 0;
 297     m_toolkitHWnd = NULL;
 298     m_inputMethodHWnd = NULL;
 299     m_verbose = FALSE;
 300     m_isActive = TRUE;
 301     m_isDisposed = FALSE;
 302 
 303     m_vmSignalled = FALSE;
 304 
 305     m_isDynamicLayoutSet = FALSE;
 306     m_areExtraMouseButtonsEnabled = TRUE;
 307 
 308     m_isWin8OrLater = FALSE;
 309     m_pEnableMouseInPointerHandle = NULL;
 310     m_pGetPointerInfoHandle = NULL;
 311 
 312     m_verifyComponents = FALSE;
 313     m_breakOnError = FALSE;
 314 
 315     m_breakMessageLoop = FALSE;
 316     m_messageLoopResult = 0;
 317 
 318     m_lastMouseOver = NULL;
 319     m_mouseDown = FALSE;
 320 
 321     m_hGetMessageHook = 0;
 322     m_hMouseLLHook = 0;
 323     m_lastWindowUnderMouse = NULL;
 324     m_timer = 0;
 325 
 326     m_cmdIDs = new AwtCmdIDList();
 327     m_pModalDialog = NULL;
 328     m_peer = NULL;
 329     m_dllHandle = NULL;
 330 
 331     m_displayChanged = FALSE;


 504     tk.m_localPump = localPump;
 505     tk.m_mainThreadId = ::GetCurrentThreadId();
 506 
 507     /*
 508      * Create the one-and-only toolkit window.  This window isn't
 509      * displayed, but is used to route messages to this thread.
 510      */
 511     tk.m_toolkitHWnd = tk.CreateToolkitWnd(TEXT("theAwtToolkitWindow"));
 512     DASSERT(tk.m_toolkitHWnd != NULL);
 513 
 514     /*
 515      * Setup a GetMessage filter to watch all messages coming out of our
 516      * queue from PreProcessMsg().
 517      */
 518     tk.m_hGetMessageHook = ::SetWindowsHookEx(WH_GETMESSAGE,
 519                                               (HOOKPROC)GetMessageFilter,
 520                                               0, tk.m_mainThreadId);
 521 
 522     awt_dnd_initialize();
 523 
 524     /*
 525      * Initialization of the touch related variables.
 526      */
 527     tk.m_isWin8OrLater = IS_WIN8;
 528 
 529     if (tk.m_isWin8OrLater) {
 530         HMODULE hUser32Dll = ::LoadLibrary(_T("user32.dll"));
 531         if (hUser32Dll != NULL) {
 532             tk.m_pEnableMouseInPointerHandle = (EnableMouseInPointerHandleFunc)
 533                 ::GetProcAddress(hUser32Dll, "EnableMouseInPointer");
 534             tk.m_pGetPointerInfoHandle = (GetPointerInfoHandleFunc)
 535                 ::GetProcAddress(hUser32Dll, "GetPointerInfo");
 536         }
 537     }
 538 
 539     return TRUE;
 540 }
 541 
 542 BOOL AwtToolkit::Dispose() {
 543     DTRACE_PRINTLN("In AwtToolkit::Dispose()");
 544 
 545     AwtToolkit& tk = AwtToolkit::GetInstance();
 546 
 547     if (!tk.m_isActive || tk.m_mainThreadId != ::GetCurrentThreadId()) {
 548         return FALSE;
 549     }
 550 
 551     tk.m_isActive = FALSE;
 552 
 553     // dispose Direct3D-related resources. This should be done
 554     // before AwtObjectList::Cleanup() as the d3d will attempt to
 555     // shutdown when the last of its windows is disposed of
 556     D3DInitializer::GetInstance().Clean();
 557 
 558     AwtObjectList::Cleanup();
 559 
 560     awt_dnd_uninitialize();
 561     awt_clipboard_uninitialize((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2));
 562 
 563     m_pEnableMouseInPointerHandle = NULL;
 564     m_pGetPointerInfoHandle = NULL;
 565 
 566     if (tk.m_inputMethodHWnd != NULL) {
 567         ::SendMessage(tk.m_inputMethodHWnd, WM_IME_CONTROL, IMC_OPENSTATUSWINDOW, 0);
 568     }
 569     tk.m_inputMethodHWnd = NULL;
 570 
 571     // wait for any messages to be processed, in particular,
 572     // all WM_AWT_DELETEOBJECT messages that delete components; no
 573     // new messages will appear as all the windows except toolkit
 574     // window are unsubclassed and destroyed
 575     MSG msg;
 576     while (::GetMessage(&msg, NULL, 0, 0)) {
 577         ::TranslateMessage(&msg);
 578         ::DispatchMessage(&msg);
 579     }
 580 
 581     AwtFont::Cleanup();
 582 
 583     HWND toolkitHWndToDestroy = tk.m_toolkitHWnd;
 584     tk.m_toolkitHWnd = 0;
 585     VERIFY(::DestroyWindow(toolkitHWndToDestroy) != NULL);


2828  * Signature: (Z)V
2829  */
2830 extern "C" JNIEXPORT void JNICALL Java_sun_awt_windows_WToolkit_setExtraMouseButtonsEnabledNative
2831 (JNIEnv *env, jclass self, jboolean enable){
2832     TRY;
2833     AwtToolkit::GetInstance().setExtraMouseButtonsEnabled(enable);
2834     CATCH_BAD_ALLOC;
2835 }
2836 
2837 void AwtToolkit::setExtraMouseButtonsEnabled(BOOL enable) {
2838     m_areExtraMouseButtonsEnabled = enable;
2839 }
2840 
2841 JNIEXPORT jint JNICALL Java_sun_awt_windows_WToolkit_getNumberOfButtonsImpl
2842 (JNIEnv *, jobject self) {
2843     return AwtToolkit::GetNumberOfButtons();
2844 }
2845 
2846 UINT AwtToolkit::GetNumberOfButtons() {
2847     return MOUSE_BUTTONS_WINDOWS_SUPPORTED;
2848 }
2849 
2850 bool AwtToolkit::IsWin8OrLater() {
2851     return m_isWin8OrLater;
2852 }
2853 
2854 BOOL AwtToolkit::TIEnableMouseInPointer(BOOL enable) {
2855     if (m_pEnableMouseInPointerHandle == NULL) {
2856         return FALSE;
2857     }
2858 
2859     return m_pEnableMouseInPointerHandle(enable);
2860 }
2861 
2862 BOOL AwtToolkit::TIGetPointerInfo(UINT32 pointerID, POINTER_INFO *pointerInfo)
2863 {
2864     if (m_pGetPointerInfoHandle == NULL) {
2865         return FALSE;
2866     }
2867 
2868     return m_pGetPointerInfoHandle(pointerID, pointerInfo);
2869 }
< prev index next >