aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/lltool.cpp15
-rw-r--r--linden/indra/newview/lltool.h3
-rw-r--r--linden/indra/newview/llviewertexteditor.cpp79
-rw-r--r--linden/indra/newview/llviewertexteditor.h2
-rw-r--r--linden/indra/newview/llviewerwindow.cpp479
-rw-r--r--linden/indra/newview/llviewerwindow.h9
6 files changed, 169 insertions, 418 deletions
diff --git a/linden/indra/newview/lltool.cpp b/linden/indra/newview/lltool.cpp
index 99dbe31..9dfd86b 100644
--- a/linden/indra/newview/lltool.cpp
+++ b/linden/indra/newview/lltool.cpp
@@ -64,7 +64,6 @@ LLTool::~LLTool()
64 } 64 }
65} 65}
66 66
67
68BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask) 67BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask)
69{ 68{
70 if (gDebugClicks) 69 if (gDebugClicks)
@@ -124,6 +123,20 @@ BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask)
124 // llinfos << "LLTool::handleRightMouseDown" << llendl; 123 // llinfos << "LLTool::handleRightMouseDown" << llendl;
125 return FALSE; 124 return FALSE;
126} 125}
126
127BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask)
128{
129 // by default, didn't handle it
130 // llinfos << "LLTool::handleMiddleMouseDown" << llendl;
131 return FALSE;
132}
133
134BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask)
135{
136 // by default, didn't handle it
137 // llinfos << "LLTool::handleMiddleMouseUp" << llendl;
138 return FALSE;
139}
127 140
128BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) 141BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen)
129{ 142{
diff --git a/linden/indra/newview/lltool.h b/linden/indra/newview/lltool.h
index cf97fb4..73463ba 100644
--- a/linden/indra/newview/lltool.h
+++ b/linden/indra/newview/lltool.h
@@ -56,6 +56,9 @@ public:
56 // Virtual functions inherited from LLMouseHandler 56 // Virtual functions inherited from LLMouseHandler
57 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); 57 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
58 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 58 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
59 virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
60 virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask);
61
59 virtual BOOL handleHover(S32 x, S32 y, MASK mask); 62 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
60 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); 63 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
61 virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); 64 virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
diff --git a/linden/indra/newview/llviewertexteditor.cpp b/linden/indra/newview/llviewertexteditor.cpp
index 3e2cc19..54b7743 100644
--- a/linden/indra/newview/llviewertexteditor.cpp
+++ b/linden/indra/newview/llviewertexteditor.cpp
@@ -893,51 +893,9 @@ BOOL LLViewerTextEditor::handleHover(S32 x, S32 y, MASK mask)
893 893
894BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) 894BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
895{ 895{
896 BOOL handled = FALSE; 896 BOOL handled = FALSE;
897
898 // let scrollbar have first dibs
899 handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL;
900
901 // Used to enable I Agree checkbox if the user scrolled through entire text
902 BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax());
903 if (mOnScrollEndCallback && was_scrolled_to_bottom)
904 {
905 mOnScrollEndCallback(mOnScrollEndData);
906 }
907
908 if( !handled && mTakesNonScrollClicks)
909 {
910 if( mIsSelecting )
911 {
912 // Finish selection
913 if( y > getTextRect().mTop )
914 {
915 mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 );
916 }
917 else
918 if( y < getTextRect().mBottom )
919 {
920 mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 );
921 }
922
923 setCursorAtLocalPos( x, y, TRUE );
924 endSelection();
925
926 updateScrollFromCursor();
927 }
928
929 if( !hasSelection() )
930 {
931 handleMouseUpOverSegment( x, y, mask );
932 }
933
934 handled = TRUE;
935 }
936
937 // Delay cursor flashing
938 resetKeystrokeTimer();
939 897
940 if( hasMouseCapture() ) 898 if( hasMouseCapture() )
941 { 899 {
942 if (mDragItem) 900 if (mDragItem)
943 { 901 {
@@ -956,8 +914,15 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
956 } 914 }
957 } 915 }
958 mDragItem = NULL; 916 mDragItem = NULL;
959 gFocusMgr.setMouseCapture( NULL ); 917 }
960 handled = TRUE; 918
919 handled = LLTextEditor::handleMouseUp(x,y,mask);
920
921 // Used to enable I Agree checkbox if the user scrolled through entire text
922 BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax());
923 if (mOnScrollEndCallback && was_scrolled_to_bottom)
924 {
925 mOnScrollEndCallback(mOnScrollEndData);
961 } 926 }
962 927
963 return handled; 928 return handled;
@@ -999,6 +964,24 @@ BOOL LLViewerTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask)
999 return handled; 964 return handled;
1000} 965}
1001 966
967BOOL LLViewerTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask)
968{
969 BOOL handled = FALSE;
970 handled = childrenHandleMiddleMouseDown(x, y, mask) != NULL;
971 if (!handled)
972 {
973 handled = LLTextEditor::handleMiddleMouseDown(x, y, mask);
974 }
975 return handled;
976}
977
978BOOL LLViewerTextEditor::handleMiddleMouseUp(S32 x, S32 y, MASK mask)
979{
980 BOOL handled = childrenHandleMiddleMouseUp(x, y, mask) != NULL;
981
982 return handled;
983}
984
1002BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) 985BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
1003{ 986{
1004 BOOL handled = FALSE; 987 BOOL handled = FALSE;
@@ -1021,7 +1004,6 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
1021 } 1004 }
1022 } 1005 }
1023 } 1006 }
1024
1025 1007
1026 setCursorAtLocalPos( x, y, FALSE ); 1008 setCursorAtLocalPos( x, y, FALSE );
1027 deselect(); 1009 deselect();
@@ -1059,6 +1041,9 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
1059 // delay cursor flashing 1041 // delay cursor flashing
1060 resetKeystrokeTimer(); 1042 resetKeystrokeTimer();
1061 1043
1044 // take selection to 'primary' clipboard
1045 updatePrimary();
1046
1062 handled = TRUE; 1047 handled = TRUE;
1063 } 1048 }
1064 return handled; 1049 return handled;
diff --git a/linden/indra/newview/llviewertexteditor.h b/linden/indra/newview/llviewertexteditor.h
index 4cd5850..062808a 100644
--- a/linden/indra/newview/llviewertexteditor.h
+++ b/linden/indra/newview/llviewertexteditor.h
@@ -58,6 +58,8 @@ public:
58 // mousehandler overrides 58 // mousehandler overrides
59 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); 59 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
60 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); 60 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
61 virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
62 virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask);
61 virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); 63 virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
62 virtual BOOL handleHover(S32 x, S32 y, MASK mask); 64 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
63 virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask ); 65 virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask );
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp
index 7e6c24f..3b23bb9 100644
--- a/linden/indra/newview/llviewerwindow.cpp
+++ b/linden/indra/newview/llviewerwindow.cpp
@@ -547,19 +547,42 @@ bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh)
547 return false; 547 return false;
548} 548}
549 549
550BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) 550BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
551{ 551{
552 std::string buttonname;
553 std::string buttonstatestr;
554 BOOL handled = FALSE;
552 S32 x = pos.mX; 555 S32 x = pos.mX;
553 S32 y = pos.mY; 556 S32 y = pos.mY;
554 x = llround((F32)x / mDisplayScale.mV[VX]); 557 x = llround((F32)x / mDisplayScale.mV[VX]);
555 y = llround((F32)y / mDisplayScale.mV[VY]); 558 y = llround((F32)y / mDisplayScale.mV[VY]);
556 559
557 LLView::sMouseHandlerMessage.clear(); 560 if (down)
558 561 buttonstatestr = "down" ;
559 if (gDebugClicks) 562 else
563 buttonstatestr = "up" ;
564
565 switch (clicktype)
560 { 566 {
561 llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl; 567 case LLMouseHandler::CLICK_LEFT:
568 mLeftMouseDown = down;
569 buttonname = "Left";
570 break;
571 case LLMouseHandler::CLICK_RIGHT:
572 mRightMouseDown = down;
573 buttonname = "Right";
574 break;
575 case LLMouseHandler::CLICK_MIDDLE:
576 mMiddleMouseDown = down;
577 buttonname = "Middle";
578 break;
579 case LLMouseHandler::CLICK_DOUBLELEFT:
580 mLeftMouseDown = down;
581 buttonname = "Left Double Click";
582 break;
562 } 583 }
584
585 LLView::sMouseHandlerMessage.clear();
563 586
564 if (gMenuBarView) 587 if (gMenuBarView)
565 { 588 {
@@ -567,7 +590,10 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
567 gMenuBarView->resetMenuTrigger(); 590 gMenuBarView->resetMenuTrigger();
568 } 591 }
569 592
570 mLeftMouseDown = TRUE; 593 if (gDebugClicks)
594 {
595 llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl;
596 }
571 597
572 // Make sure we get a coresponding mouseup event, even if the mouse leaves the window 598 // Make sure we get a coresponding mouseup event, even if the mouse leaves the window
573 mWindow->captureMouse(); 599 mWindow->captureMouse();
@@ -576,9 +602,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
576 gMouseIdleTimer.reset(); 602 gMouseIdleTimer.reset();
577 603
578 // Hide tooltips on mousedown 604 // Hide tooltips on mousedown
579 mToolTipBlocked = TRUE; 605 mToolTipBlocked = down;
580 606
581 // Also hide hover info on mousedown 607 // Also hide hover info on mousedown/mouseup
582 if (gHoverView) 608 if (gHoverView)
583 { 609 {
584 gHoverView->cancelHover(); 610 gHoverView->cancelHover();
@@ -587,7 +613,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
587 // Don't let the user move the mouse out of the window until mouse up. 613 // Don't let the user move the mouse out of the window until mouse up.
588 if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() ) 614 if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
589 { 615 {
590 mWindow->setMouseClipping(TRUE); 616 mWindow->setMouseClipping(down);
591 } 617 }
592 618
593 LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture(); 619 LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
@@ -598,10 +624,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
598 mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); 624 mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
599 if (LLView::sDebugMouseHandling) 625 if (LLView::sDebugMouseHandling)
600 { 626 {
601 llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; 627 llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl;
602 } 628 }
603 629 return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down);
604 return mouse_captor->handleMouseDown(local_x, local_y, mask);
605 } 630 }
606 631
607 // Topmost view gets a chance before the hierarchy 632 // Topmost view gets a chance before the hierarchy
@@ -610,215 +635,95 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
610 { 635 {
611 S32 local_x, local_y; 636 S32 local_x, local_y;
612 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y ); 637 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
613 if (top_ctrl->pointInView(local_x, local_y)) 638 if (down)
614 { 639 {
615 return top_ctrl->handleMouseDown(local_x, local_y, mask); 640 if (top_ctrl->pointInView(local_x, local_y))
616 } 641 {
617 else 642 return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ;
618 { 643 }
619 gFocusMgr.setTopCtrl(NULL); 644 else
645 {
646 gFocusMgr.setTopCtrl(NULL);
647 }
620 } 648 }
621 } 649 else
650 handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask);
622 651
652
653 }
623 // Give the UI views a chance to process the click 654 // Give the UI views a chance to process the click
624 if( mRootView->handleMouseDown(x, y, mask) ) 655 if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) )
625 { 656 {
626 if (LLView::sDebugMouseHandling) 657 if (LLView::sDebugMouseHandling)
627 { 658 {
628 llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; 659 llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl;
629 } 660 }
630 return TRUE; 661 return TRUE;
631 } 662 }
632 else if (LLView::sDebugMouseHandling) 663 else if (LLView::sDebugMouseHandling)
633 { 664 {
634 llinfos << "Left Mouse Down not handled by view" << llendl; 665 llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl;
635 }
636
637 if (gDisconnected)
638 {
639 return FALSE;
640 }
641
642 if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) )
643 {
644 // This is necessary to force clicks in the world to cause edit
645 // boxes that might have keyboard focus to relinquish it, and hence
646 // cause a commit to update their value. JC
647 gFocusMgr.setKeyboardFocus(NULL);
648 return TRUE;
649 }
650
651 return FALSE;
652}
653
654BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask)
655{
656 S32 x = pos.mX;
657 S32 y = pos.mY;
658 x = llround((F32)x / mDisplayScale.mV[VX]);
659 y = llround((F32)y / mDisplayScale.mV[VY]);
660
661 LLView::sMouseHandlerMessage.clear();
662
663 if (gDebugClicks)
664 {
665 llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl;
666 } 666 }
667 667 if (down)
668 mLeftMouseDown = TRUE;
669
670 // Hide tooltips
671 if( mToolTip )
672 { 668 {
673 mToolTip->setVisible( FALSE ); 669 if (gDisconnected)
674 }
675
676 LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
677 if( mouse_captor )
678 {
679 S32 local_x;
680 S32 local_y;
681 mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
682 if (LLView::sDebugMouseHandling)
683 { 670 {
684 llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl; 671 return FALSE;
685 }
686
687 return mouse_captor->handleDoubleClick(local_x, local_y, mask);
688 }
689
690 // Check for hit on UI.
691 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
692 if (top_ctrl)
693 {
694 S32 local_x, local_y;
695 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
696 if (top_ctrl->pointInView(local_x, local_y))
697 {
698 return top_ctrl->handleDoubleClick(local_x, local_y, mask);
699 } 672 }
700 else 673
674 if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) )
701 { 675 {
702 gFocusMgr.setTopCtrl(NULL); 676 // This is necessary to force clicks in the world to cause edit
677 // boxes that might have keyboard focus to relinquish it, and hence
678 // cause a commit to update their value. JC
679 gFocusMgr.setKeyboardFocus(NULL);
680 return TRUE;
703 } 681 }
704 } 682 }
705 683 else
706 if (mRootView->handleDoubleClick(x, y, mask))
707 { 684 {
708 if (LLView::sDebugMouseHandling) 685
686 mWindow->releaseMouse();
687
688 LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
689 if( !handled )
709 { 690 {
710 llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; 691 handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down);
692 }
693
694
695
696 if( !handled )
697 {
698 if (tool)
699 {
700 handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down);
701 }
711 } 702 }
712 return TRUE;
713 }
714 else if (LLView::sDebugMouseHandling)
715 {
716 llinfos << "Left Mouse Down not handled by view" << llendl;
717 } 703 }
718 704
719 // Why is this here? JC 9/3/2002 705 return (!down);
720 if (gNoRender) 706}
721 {
722 return TRUE;
723 }
724 707
725 if(LLToolMgr::getInstance()->getCurrentTool()->handleDoubleClick( x, y, mask ) ) 708BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
726 { 709{
727 return TRUE; 710 BOOL down = TRUE;
728 } 711 return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down);
712}
729 713
730 // if we got this far and nothing handled a double click, pass a normal mouse down 714BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask)
731 return handleMouseDown(window, pos, mask); 715{
716 // try handling as a double-click first, then a single-click if that
717 // wasn't handled.
718 BOOL down = TRUE;
719 return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_DOUBLELEFT,down) ||
720 handleMouseDown(window, pos, mask);
732} 721}
733 722
734BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) 723BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
735{ 724{
736 S32 x = pos.mX; 725 BOOL down = FALSE;
737 S32 y = pos.mY; 726 return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down);
738 x = llround((F32)x / mDisplayScale.mV[VX]);
739 y = llround((F32)y / mDisplayScale.mV[VY]);
740
741 LLView::sMouseHandlerMessage.clear();
742
743 if (gDebugClicks)
744 {
745 llinfos << "ViewerWindow left mouse up" << llendl;
746 }
747
748 mLeftMouseDown = FALSE;
749
750 // Indicate mouse was active
751 gMouseIdleTimer.reset();
752
753 // Hide tooltips on mouseup
754 if( mToolTip )
755 {
756 mToolTip->setVisible( FALSE );
757 }
758
759 // Also hide hover info on mouseup
760 if (gHoverView) gHoverView->cancelHover();
761
762 BOOL handled = FALSE;
763
764 mWindow->releaseMouse();
765
766 LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
767
768 if( tool->clipMouseWhenDown() )
769 {
770 mWindow->setMouseClipping(FALSE);
771 }
772
773 LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
774 if( mouse_captor )
775 {
776 S32 local_x;
777 S32 local_y;
778 mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
779 if (LLView::sDebugMouseHandling)
780 {
781 llinfos << "Left Mouse Up handled by captor " << mouse_captor->getName() << llendl;
782 }
783
784 return mouse_captor->handleMouseUp(local_x, local_y, mask);
785 }
786
787 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
788 if (top_ctrl)
789 {
790 S32 local_x, local_y;
791 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
792 handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask);
793 }
794
795 if( !handled )
796 {
797 handled = mRootView->handleMouseUp(x, y, mask);
798 }
799
800 if (LLView::sDebugMouseHandling)
801 {
802 if (handled)
803 {
804 llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl;
805 }
806 else
807 {
808 llinfos << "Left Mouse Up not handled by view" << llendl;
809 }
810 }
811
812 if( !handled )
813 {
814 if (tool)
815 {
816 handled = tool->handleMouseUp(x, y, mask);
817 }
818 }
819
820 // Always handled as far as the OS is concerned.
821 return TRUE;
822} 727}
823 728
824 729
@@ -829,91 +734,10 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
829 x = llround((F32)x / mDisplayScale.mV[VX]); 734 x = llround((F32)x / mDisplayScale.mV[VX]);
830 y = llround((F32)y / mDisplayScale.mV[VY]); 735 y = llround((F32)y / mDisplayScale.mV[VY]);
831 736
832 LLView::sMouseHandlerMessage.clear(); 737 BOOL down = TRUE;
833 738 BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down);
834 if (gDebugClicks) 739 if (handle)
835 { 740 return handle;
836 llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl;
837 }
838
839 if (gMenuBarView)
840 {
841 // stop ALT-key access to menu
842 gMenuBarView->resetMenuTrigger();
843 }
844
845 mRightMouseDown = TRUE;
846
847 // Make sure we get a coresponding mouseup event, even if the mouse leaves the window
848 mWindow->captureMouse();
849
850 // Hide tooltips
851 if( mToolTip )
852 {
853 mToolTip->setVisible( FALSE );
854 }
855
856 // Also hide hover info on mousedown
857 if (gHoverView)
858 {
859 gHoverView->cancelHover();
860 }
861
862 // Don't let the user move the mouse out of the window until mouse up.
863 if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
864 {
865 mWindow->setMouseClipping(TRUE);
866 }
867
868 LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
869 if( mouse_captor )
870 {
871 S32 local_x;
872 S32 local_y;
873 mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
874 if (LLView::sDebugMouseHandling)
875 {
876 llinfos << "Right Mouse Down handled by captor " << mouse_captor->getName() << llendl;
877 }
878 return mouse_captor->handleRightMouseDown(local_x, local_y, mask);
879 }
880
881 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
882 if (top_ctrl)
883 {
884 S32 local_x, local_y;
885 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
886 if (top_ctrl->pointInView(local_x, local_y))
887 {
888 return top_ctrl->handleRightMouseDown(local_x, local_y, mask);
889 }
890 else
891 {
892 gFocusMgr.setTopCtrl(NULL);
893 }
894 }
895
896 if( mRootView->handleRightMouseDown(x, y, mask) )
897 {
898 if (LLView::sDebugMouseHandling)
899 {
900 llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl;
901 }
902 return TRUE;
903 }
904 else if (LLView::sDebugMouseHandling)
905 {
906 llinfos << "Right Mouse Down not handled by view" << llendl;
907 }
908
909 if(LLToolMgr::getInstance()->getCurrentTool()->handleRightMouseDown( x, y, mask ) )
910 {
911 // This is necessary to force clicks in the world to cause edit
912 // boxes that might have keyboard focus to relinquish it, and hence
913 // cause a commit to update their value. JC
914 gFocusMgr.setKeyboardFocus(NULL);
915 return TRUE;
916 }
917 741
918 // *HACK: this should be rolled into the composite tool logic, not 742 // *HACK: this should be rolled into the composite tool logic, not
919 // hardcoded at the top level. 743 // hardcoded at the top level.
@@ -931,107 +755,27 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
931 755
932BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) 756BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
933{ 757{
934 S32 x = pos.mX; 758 BOOL down = FALSE;
935 S32 y = pos.mY; 759 return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down);
936 x = llround((F32)x / mDisplayScale.mV[VX]);
937 y = llround((F32)y / mDisplayScale.mV[VY]);
938
939 LLView::sMouseHandlerMessage.clear();
940
941 // Don't care about caps lock for mouse events.
942 if (gDebugClicks)
943 {
944 llinfos << "ViewerWindow right mouse up" << llendl;
945 }
946
947 mRightMouseDown = FALSE;
948
949 // Indicate mouse was active
950 gMouseIdleTimer.reset();
951
952 // Hide tooltips on mouseup
953 if( mToolTip )
954 {
955 mToolTip->setVisible( FALSE );
956 }
957
958 // Also hide hover info on mouseup
959 if (gHoverView) gHoverView->cancelHover();
960
961 BOOL handled = FALSE;
962
963 mWindow->releaseMouse();
964
965 LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
966
967 if( tool->clipMouseWhenDown() )
968 {
969 mWindow->setMouseClipping(FALSE);
970 }
971
972 LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
973 if( mouse_captor )
974 {
975 S32 local_x;
976 S32 local_y;
977 mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
978 if (LLView::sDebugMouseHandling)
979 {
980 llinfos << "Right Mouse Up handled by captor " << mouse_captor->getName() << llendl;
981 }
982 return mouse_captor->handleRightMouseUp(local_x, local_y, mask);
983 }
984
985 LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
986 if (top_ctrl)
987 {
988 S32 local_x, local_y;
989 top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
990 handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask);
991 }
992
993 if( !handled )
994 {
995 handled = mRootView->handleRightMouseUp(x, y, mask);
996 }
997
998 if (LLView::sDebugMouseHandling)
999 {
1000 if (handled)
1001 {
1002 llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl;
1003 }
1004 else
1005 {
1006 llinfos << "Right Mouse Up not handled by view" << llendl;
1007 }
1008 }
1009
1010 if( !handled )
1011 {
1012 if (tool)
1013 {
1014 handled = tool->handleRightMouseUp(x, y, mask);
1015 }
1016 }
1017
1018 // Always handled as far as the OS is concerned.
1019 return TRUE;
1020} 760}
1021 761
1022BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) 762BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
1023{ 763{
764 BOOL down = TRUE;
1024 gVoiceClient->middleMouseState(true); 765 gVoiceClient->middleMouseState(true);
1025 766 handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
1026 // Always handled as far as the OS is concerned. 767
768 // Always handled as far as the OS is concerned.
1027 return TRUE; 769 return TRUE;
1028} 770}
1029 771
1030BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) 772BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
1031{ 773{
774 BOOL down = FALSE;
1032 gVoiceClient->middleMouseState(false); 775 gVoiceClient->middleMouseState(false);
1033 776 handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
1034 // Always handled as far as the OS is concerned. 777
778 // Always handled as far as the OS is concerned.
1035 return TRUE; 779 return TRUE;
1036} 780}
1037 781
@@ -1404,6 +1148,7 @@ LLViewerWindow::LLViewerWindow(
1404 mWindowRect(0, height, width, 0), 1148 mWindowRect(0, height, width, 0),
1405 mVirtualWindowRect(0, height, width, 0), 1149 mVirtualWindowRect(0, height, width, 0),
1406 mLeftMouseDown(FALSE), 1150 mLeftMouseDown(FALSE),
1151 mMiddleMouseDown(FALSE),
1407 mRightMouseDown(FALSE), 1152 mRightMouseDown(FALSE),
1408 mToolTip(NULL), 1153 mToolTip(NULL),
1409 mToolTipBlocked(FALSE), 1154 mToolTipBlocked(FALSE),
diff --git a/linden/indra/newview/llviewerwindow.h b/linden/indra/newview/llviewerwindow.h
index ab2dd4e..40368f8 100644
--- a/linden/indra/newview/llviewerwindow.h
+++ b/linden/indra/newview/llviewerwindow.h
@@ -47,6 +47,7 @@
47#include "lltimer.h" 47#include "lltimer.h"
48#include "llstat.h" 48#include "llstat.h"
49#include "llalertdialog.h" 49#include "llalertdialog.h"
50#include "llmousehandler.h"
50 51
51class LLView; 52class LLView;
52class LLViewerObject; 53class LLViewerObject;
@@ -57,7 +58,6 @@ class LLVelocityBar;
57class LLTextBox; 58class LLTextBox;
58class LLImageRaw; 59class LLImageRaw;
59class LLHUDIcon; 60class LLHUDIcon;
60class LLMouseHandler;
61 61
62#define PICK_HALF_WIDTH 5 62#define PICK_HALF_WIDTH 5
63#define PICK_DIAMETER (2 * PICK_HALF_WIDTH + 1) 63#define PICK_DIAMETER (2 * PICK_HALF_WIDTH + 1)
@@ -81,7 +81,7 @@ public:
81 81
82 static bool isFlora(LLViewerObject* object); 82 static bool isFlora(LLViewerObject* object);
83 83
84 typedef enum e_pick_type 84 typedef enum
85 { 85 {
86 PICK_OBJECT, 86 PICK_OBJECT,
87 PICK_FLORA, 87 PICK_FLORA,
@@ -150,6 +150,7 @@ public:
150 /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask); 150 /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask);
151 /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); 151 /*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
152 /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended 152 /*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended
153 /*virtual*/ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
153 /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); 154 /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
154 /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); 155 /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
155 /*virtual*/ BOOL handleCloseRequest(LLWindow *window); 156 /*virtual*/ BOOL handleCloseRequest(LLWindow *window);
@@ -212,6 +213,7 @@ public:
212 LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } 213 LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; }
213 LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; } 214 LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; }
214 BOOL getLeftMouseDown() const { return mLeftMouseDown; } 215 BOOL getLeftMouseDown() const { return mLeftMouseDown; }
216 BOOL getMiddleMouseDown() const { return mMiddleMouseDown; }
215 BOOL getRightMouseDown() const { return mRightMouseDown; } 217 BOOL getRightMouseDown() const { return mRightMouseDown; }
216 218
217 const LLPickInfo& getLastPick() const { return mLastPick; } 219 const LLPickInfo& getLastPick() const { return mLastPick; }
@@ -279,7 +281,7 @@ public:
279 281
280 // snapshot functionality. 282 // snapshot functionality.
281 // perhaps some of this should move to llfloatershapshot? -MG 283 // perhaps some of this should move to llfloatershapshot? -MG
282 typedef enum e_snapshot_type 284 typedef enum
283 { 285 {
284 SNAPSHOT_TYPE_COLOR, 286 SNAPSHOT_TYPE_COLOR,
285 SNAPSHOT_TYPE_DEPTH, 287 SNAPSHOT_TYPE_DEPTH,
@@ -397,6 +399,7 @@ protected:
397 LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame 399 LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame
398 LLStat mMouseVelocityStat; 400 LLStat mMouseVelocityStat;
399 BOOL mLeftMouseDown; 401 BOOL mLeftMouseDown;
402 BOOL mMiddleMouseDown;
400 BOOL mRightMouseDown; 403 BOOL mRightMouseDown;
401 404
402 LLProgressView *mProgressView; 405 LLProgressView *mProgressView;