< prev index next >

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

Print this page




 392         lastX = x;
 393         lastY = y;
 394         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 395         if ((flags & ALL_MK_BUTTONS) != 0) {
 396             m_mouseButtonClickAllowed = 0;
 397         } else {
 398             SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, ::JVM_CurrentTimeMillis(NULL, 0), x, y,
 399                            AwtComponent::GetJavaModifiers(), 0, JNI_FALSE,
 400                            java_awt_event_MouseEvent_NOBUTTON, &msg);
 401         }
 402     }
 403     return mrConsume;
 404 }
 405 
 406 MsgRouting AwtTrayIcon::WmBalloonUserClick(UINT flags, int x, int y)
 407 {
 408     if (AwtComponent::GetJavaModifiers() & java_awt_event_InputEvent_BUTTON1_DOWN_MASK) {
 409         MSG msg;
 410         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 411         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 412                         AwtComponent::GetJavaModifiers(), &msg);
 413     }
 414     return mrConsume;
 415 }
 416 
 417 MsgRouting AwtTrayIcon::WmKeySelect(UINT flags, int x, int y)
 418 {
 419     static jlong lastKeySelectTime = 0;
 420     jlong now = ::JVM_CurrentTimeMillis(NULL, 0);
 421 
 422     // If a user selects a notify icon with the ENTER key,
 423     // Shell 5.0 sends double NIN_KEYSELECT notification.
 424     if (lastKeySelectTime != now) {
 425         MSG msg;
 426         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 427         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 428                         AwtComponent::GetJavaModifiers(), &msg);
 429     }
 430     lastKeySelectTime = now;
 431 
 432     return mrConsume;
 433 }
 434 
 435 MsgRouting AwtTrayIcon::WmSelect(UINT flags, int x, int y)
 436 {
 437 
 438     // If a user click on a notify icon with the mouse,
 439     // Shell 5.0 sends NIN_SELECT notification on every click.
 440     // To be compatible with JDK6.0 only second click is important.
 441     if (clickCount == 2) {
 442         MSG msg;
 443         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 444         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 445                         AwtComponent::GetJavaModifiers(), &msg);
 446     }
 447     return mrConsume;
 448 }
 449 
 450 MsgRouting AwtTrayIcon::WmContextMenu(UINT flags, int x, int y)
 451 {
 452     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 453     jobject peer = GetPeer(env);
 454     if (peer != NULL) {
 455         JNU_CallMethodByName(env, NULL, peer, "showPopupMenu",
 456                              "(II)V", x, y);
 457     }
 458     return mrConsume;
 459 }
 460 
 461 /*
 462  * Adds all icons we already have to taskbar.
 463  * We use this method on taskbar recreation (see 6369062).
 464  */
 465 MsgRouting AwtTrayIcon::WmTaskbarCreated() {




 392         lastX = x;
 393         lastY = y;
 394         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 395         if ((flags & ALL_MK_BUTTONS) != 0) {
 396             m_mouseButtonClickAllowed = 0;
 397         } else {
 398             SendMouseEvent(java_awt_event_MouseEvent_MOUSE_MOVED, ::JVM_CurrentTimeMillis(NULL, 0), x, y,
 399                            AwtComponent::GetJavaModifiers(), 0, JNI_FALSE,
 400                            java_awt_event_MouseEvent_NOBUTTON, &msg);
 401         }
 402     }
 403     return mrConsume;
 404 }
 405 
 406 MsgRouting AwtTrayIcon::WmBalloonUserClick(UINT flags, int x, int y)
 407 {
 408     if (AwtComponent::GetJavaModifiers() & java_awt_event_InputEvent_BUTTON1_DOWN_MASK) {
 409         MSG msg;
 410         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 411         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 412                         AwtComponent::GetActionModifiers(), &msg);
 413     }
 414     return mrConsume;
 415 }
 416 
 417 MsgRouting AwtTrayIcon::WmKeySelect(UINT flags, int x, int y)
 418 {
 419     static jlong lastKeySelectTime = 0;
 420     jlong now = ::JVM_CurrentTimeMillis(NULL, 0);
 421 
 422     // If a user selects a notify icon with the ENTER key,
 423     // Shell 5.0 sends double NIN_KEYSELECT notification.
 424     if (lastKeySelectTime != now) {
 425         MSG msg;
 426         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 427         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 428                         AwtComponent::GetActionModifiers(), &msg);
 429     }
 430     lastKeySelectTime = now;
 431 
 432     return mrConsume;
 433 }
 434 
 435 MsgRouting AwtTrayIcon::WmSelect(UINT flags, int x, int y)
 436 {
 437 
 438     // If a user click on a notify icon with the mouse,
 439     // Shell 5.0 sends NIN_SELECT notification on every click.
 440     // To be compatible with JDK6.0 only second click is important.
 441     if (clickCount == 2) {
 442         MSG msg;
 443         AwtComponent::InitMessage(&msg, lastMessage, flags, MAKELPARAM(x, y), x, y);
 444         SendActionEvent(java_awt_event_ActionEvent_ACTION_PERFORMED, ::JVM_CurrentTimeMillis(NULL, 0),
 445                         AwtComponent::GetActionModifiers(), &msg);
 446     }
 447     return mrConsume;
 448 }
 449 
 450 MsgRouting AwtTrayIcon::WmContextMenu(UINT flags, int x, int y)
 451 {
 452     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
 453     jobject peer = GetPeer(env);
 454     if (peer != NULL) {
 455         JNU_CallMethodByName(env, NULL, peer, "showPopupMenu",
 456                              "(II)V", x, y);
 457     }
 458     return mrConsume;
 459 }
 460 
 461 /*
 462  * Adds all icons we already have to taskbar.
 463  * We use this method on taskbar recreation (see 6369062).
 464  */
 465 MsgRouting AwtTrayIcon::WmTaskbarCreated() {


< prev index next >