< prev index next >

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

Print this page




 394      * Windows sends WM_MOUSEMOVE if mouse is motionless
 395      */
 396     if (lastComp != this || x != lastX || y != lastY) {
 397         lastComp = this;
 398         lastX = x;
 399         lastY = y;
 400         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 401         if ((flags & ALL_MK_BUTTONS) != 0) {
 402             m_mouseButtonClickAllowed = 0;
 403         } else {
 404             SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, ::JVM_CurrentTimeMillis(NULL, 0), x, y,
 405                            AwtComponent::GetJavaModifiers(), 0, JNI_FALSE,
 406                            java_awt_event_MouseEvent_NOBUTTON, &msg);
 407         }
 408     }
 409     return mrConsume;
 410 }
 411 
 412 MsgRouting AwtTrayIcon::WmBalloonUserClick(UINT flags, int x, int y)
 413 {
 414     if (AwtComponent::GetJavaModifiers() & java_awt_event_InputEvent_BUTTON1_DOWN_MASK) {




 415         MSG msg;
 416         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 417         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 418                         AwtComponent::GetActionModifiers(), &msg);
 419     }
 420     return mrConsume;
 421 }
 422 
 423 MsgRouting AwtTrayIcon::WmKeySelect(UINT flags, int x, int y)
 424 {
 425     static jlong lastKeySelectTime = 0;
 426     jlong now = ::JVM_CurrentTimeMillis(NULL, 0);
 427 
 428     // If a user selects a notify icon with the ENTER key,
 429     // Shell 5.0 sends double NIN_KEYSELECT notification.
 430     if (lastKeySelectTime != now) {
 431         MSG msg;
 432         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 433         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 434                         AwtComponent::GetActionModifiers(), &msg);
 435     }
 436     lastKeySelectTime = now;
 437 
 438     return mrConsume;
 439 }




 394      * Windows sends WM_MOUSEMOVE if mouse is motionless
 395      */
 396     if (lastComp != this || x != lastX || y != lastY) {
 397         lastComp = this;
 398         lastX = x;
 399         lastY = y;
 400         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 401         if ((flags & ALL_MK_BUTTONS) != 0) {
 402             m_mouseButtonClickAllowed = 0;
 403         } else {
 404             SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, ::JVM_CurrentTimeMillis(NULL, 0), x, y,
 405                            AwtComponent::GetJavaModifiers(), 0, JNI_FALSE,
 406                            java_awt_event_MouseEvent_NOBUTTON, &msg);
 407         }
 408     }
 409     return mrConsume;
 410 }
 411 
 412 MsgRouting AwtTrayIcon::WmBalloonUserClick(UINT flags, int x, int y)
 413 {
 414     // The windows api GetKeyState() when read would provide the key state of the requrested key 
 415     // but it is not guaranteed to receive the same as it is stored in the thread message queue and 
 416     // unless the thread runs faster. 
 417     // Event NIN_BALLOONUSERCLICK is received only upon left mouse click. Hence the additional check
 418     // is not required.
 419     MSG msg;
 420     AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 421     SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 422                     AwtComponent::GetActionModifiers(), &msg);

 423     return mrConsume;
 424 }
 425 
 426 MsgRouting AwtTrayIcon::WmKeySelect(UINT flags, int x, int y)
 427 {
 428     static jlong lastKeySelectTime = 0;
 429     jlong now = ::JVM_CurrentTimeMillis(NULL, 0);
 430 
 431     // If a user selects a notify icon with the ENTER key,
 432     // Shell 5.0 sends double NIN_KEYSELECT notification.
 433     if (lastKeySelectTime != now) {
 434         MSG msg;
 435         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 436         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 437                         AwtComponent::GetActionModifiers(), &msg);
 438     }
 439     lastKeySelectTime = now;
 440 
 441     return mrConsume;
 442 }


< prev index next >