Adaptation of the CoolViewer patch that allows Linux users to paste by middle-clicking.
This commit is contained in:
@@ -2418,6 +2418,12 @@ BOOL LLTextEditor::handleEditKey(const KEY key, const MASK mask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( handled )
|
||||||
|
{
|
||||||
|
// take selection to 'primary' clipboard
|
||||||
|
updatePrimary();
|
||||||
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ set(llwindows_HEADER_FILES
|
|||||||
|
|
||||||
set(viewer_SOURCE_FILES
|
set(viewer_SOURCE_FILES
|
||||||
llwindow.cpp
|
llwindow.cpp
|
||||||
|
llmousehandler.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(viewer_HEADER_FILES
|
set(viewer_HEADER_FILES
|
||||||
|
|||||||
@@ -33,9 +33,10 @@
|
|||||||
#ifndef LL_MOUSEHANDLER_H
|
#ifndef LL_MOUSEHANDLER_H
|
||||||
#define LL_MOUSEHANDLER_H
|
#define LL_MOUSEHANDLER_H
|
||||||
|
|
||||||
#include "llstring.h"
|
#include "linden_common.h"
|
||||||
|
#include "llrect.h"
|
||||||
|
|
||||||
// Abstract interface.
|
// Mostly-abstract interface.
|
||||||
// Intended for use via multiple inheritance.
|
// Intended for use via multiple inheritance.
|
||||||
// A class may have as many interfaces as it likes, but never needs to inherit one more than once.
|
// A class may have as many interfaces as it likes, but never needs to inherit one more than once.
|
||||||
|
|
||||||
@@ -49,13 +50,23 @@ public:
|
|||||||
SHOW_IF_NOT_BLOCKED,
|
SHOW_IF_NOT_BLOCKED,
|
||||||
SHOW_ALWAYS,
|
SHOW_ALWAYS,
|
||||||
} EShowToolTip;
|
} EShowToolTip;
|
||||||
|
typedef enum {
|
||||||
|
CLICK_LEFT,
|
||||||
|
CLICK_MIDDLE,
|
||||||
|
CLICK_RIGHT,
|
||||||
|
CLICK_DOUBLELEFT
|
||||||
|
} EClickType;
|
||||||
|
virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EClickType clicktype, BOOL down);
|
||||||
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0;
|
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0;
|
||||||
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0;
|
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0;
|
||||||
virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
|
virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0;
|
||||||
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
|
virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0;
|
||||||
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0;
|
|
||||||
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0;
|
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0;
|
||||||
virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0;
|
virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0;
|
||||||
|
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0;
|
||||||
|
|
||||||
|
virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0;
|
||||||
|
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0;
|
||||||
virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0;
|
virtual BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) = 0;
|
||||||
virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; };
|
virtual EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; };
|
||||||
virtual const std::string& getName() const = 0;
|
virtual const std::string& getName() const = 0;
|
||||||
|
|||||||
@@ -1282,6 +1282,49 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text)
|
|||||||
return FALSE; // failure
|
return FALSE; // failure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL LLWindowSDL::isPrimaryTextAvailable()
|
||||||
|
{
|
||||||
|
if (ll_try_gtk_init())
|
||||||
|
{
|
||||||
|
GtkClipboard * const clipboard =
|
||||||
|
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||||
|
return gtk_clipboard_wait_is_text_available(clipboard) ?
|
||||||
|
TRUE : FALSE;
|
||||||
|
}
|
||||||
|
return FALSE; // failure
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &text)
|
||||||
|
{
|
||||||
|
if (ll_try_gtk_init())
|
||||||
|
{
|
||||||
|
GtkClipboard * const clipboard =
|
||||||
|
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||||
|
gchar * const data = gtk_clipboard_wait_for_text(clipboard);
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
text = LLWString(utf8str_to_wstring(data));
|
||||||
|
g_free(data);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE; // failure
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text)
|
||||||
|
{
|
||||||
|
if (ll_try_gtk_init())
|
||||||
|
{
|
||||||
|
const std::string utf8 = wstring_to_utf8str(text);
|
||||||
|
GtkClipboard * const clipboard =
|
||||||
|
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||||
|
gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length());
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE; // failure
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
BOOL LLWindowSDL::isClipboardTextAvailable()
|
BOOL LLWindowSDL::isClipboardTextAvailable()
|
||||||
@@ -1298,6 +1341,22 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
|
|||||||
{
|
{
|
||||||
return FALSE; // unsupported
|
return FALSE; // unsupported
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL LLWindowSDL::isPrimaryTextAvailable()
|
||||||
|
{
|
||||||
|
return FALSE; // unsupported
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst)
|
||||||
|
{
|
||||||
|
return FALSE; // unsupported
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s)
|
||||||
|
{
|
||||||
|
return FALSE; // unsupported
|
||||||
|
}
|
||||||
|
|
||||||
#endif // LL_GTK
|
#endif // LL_GTK
|
||||||
|
|
||||||
LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
|
LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
|
||||||
|
|||||||
@@ -80,9 +80,15 @@ public:
|
|||||||
/*virtual*/ void captureMouse();
|
/*virtual*/ void captureMouse();
|
||||||
/*virtual*/ void releaseMouse();
|
/*virtual*/ void releaseMouse();
|
||||||
/*virtual*/ void setMouseClipping( BOOL b );
|
/*virtual*/ void setMouseClipping( BOOL b );
|
||||||
|
|
||||||
/*virtual*/ BOOL isClipboardTextAvailable();
|
/*virtual*/ BOOL isClipboardTextAvailable();
|
||||||
/*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst);
|
/*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst);
|
||||||
/*virtual*/ BOOL copyTextToClipboard(const LLWString & src);
|
/*virtual*/ BOOL copyTextToClipboard(const LLWString & src);
|
||||||
|
|
||||||
|
/*virtual*/ BOOL isPrimaryTextAvailable();
|
||||||
|
/*virtual*/ BOOL pasteTextFromPrimary(LLWString &dst);
|
||||||
|
/*virtual*/ BOOL copyTextToPrimary(const LLWString & src);
|
||||||
|
|
||||||
/*virtual*/ void flashIcon(F32 seconds);
|
/*virtual*/ void flashIcon(F32 seconds);
|
||||||
/*virtual*/ F32 getGamma();
|
/*virtual*/ F32 getGamma();
|
||||||
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
||||||
|
|||||||
@@ -126,6 +126,20 @@ BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask)
|
||||||
|
{
|
||||||
|
// by default, didn't handle it
|
||||||
|
// llinfos << "LLTool::handleMiddleMouseDown" << llendl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask)
|
||||||
|
{
|
||||||
|
// by default, didn't handle it
|
||||||
|
// llinfos << "LLTool::handleMiddleMouseUp" << llendl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen)
|
BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen)
|
||||||
{
|
{
|
||||||
// by default, didn't handle it
|
// by default, didn't handle it
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ public:
|
|||||||
// Virtual functions inherited from LLMouseHandler
|
// Virtual functions inherited from LLMouseHandler
|
||||||
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
|
||||||
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
|
||||||
|
virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask);
|
||||||
|
virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask);
|
||||||
|
|
||||||
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
|
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
|
||||||
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
|
virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
|
||||||
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
|
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
|
||||||
|
|||||||
@@ -601,47 +601,84 @@ bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
|
BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down)
|
||||||
{
|
{
|
||||||
|
std::string buttonname;
|
||||||
|
std::string buttonstatestr;
|
||||||
|
BOOL handled = FALSE;
|
||||||
S32 x = pos.mX;
|
S32 x = pos.mX;
|
||||||
S32 y = pos.mY;
|
S32 y = pos.mY;
|
||||||
x = llround((F32)x / mDisplayScale.mV[VX]);
|
x = llround((F32)x / mDisplayScale.mV[VX]);
|
||||||
y = llround((F32)y / mDisplayScale.mV[VY]);
|
y = llround((F32)y / mDisplayScale.mV[VY]);
|
||||||
|
|
||||||
LLView::sMouseHandlerMessage.clear();
|
if (down)
|
||||||
|
buttonstatestr = "down";
|
||||||
|
else
|
||||||
|
buttonstatestr = "up";
|
||||||
|
|
||||||
if (gDebugClicks)
|
switch (clicktype)
|
||||||
{
|
{
|
||||||
llinfos << "ViewerWindow left mouse down at " << x << "," << y << llendl;
|
case LLMouseHandler::CLICK_LEFT:
|
||||||
|
mLeftMouseDown = down;
|
||||||
|
buttonname = "Left";
|
||||||
|
break;
|
||||||
|
case LLMouseHandler::CLICK_RIGHT:
|
||||||
|
mRightMouseDown = down;
|
||||||
|
buttonname = "Right";
|
||||||
|
break;
|
||||||
|
case LLMouseHandler::CLICK_MIDDLE:
|
||||||
|
mMiddleMouseDown = down;
|
||||||
|
buttonname = "Middle";
|
||||||
|
break;
|
||||||
|
case LLMouseHandler::CLICK_DOUBLELEFT:
|
||||||
|
mLeftMouseDown = down;
|
||||||
|
buttonname = "Left Double Click";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLView::sMouseHandlerMessage.clear();
|
||||||
|
|
||||||
if (gMenuBarView)
|
if (gMenuBarView)
|
||||||
{
|
{
|
||||||
// stop ALT-key access to menu
|
// stop ALT-key access to menu
|
||||||
gMenuBarView->resetMenuTrigger();
|
gMenuBarView->resetMenuTrigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
mLeftMouseDown = TRUE;
|
if (gDebugClicks)
|
||||||
|
{
|
||||||
|
llinfos << "ViewerWindow " << buttonname << " mouse " << buttonstatestr << " at " << x << "," << y << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure we get a coresponding mouseup event, even if the mouse leaves the window
|
// Make sure we get a coresponding mouseup event, even if the mouse leaves the window
|
||||||
mWindow->captureMouse();
|
if (down)
|
||||||
|
{
|
||||||
|
mWindow->captureMouse();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mWindow->releaseMouse();
|
||||||
|
}
|
||||||
|
|
||||||
// Indicate mouse was active
|
// Indicate mouse was active
|
||||||
gMouseIdleTimer.reset();
|
gMouseIdleTimer.reset();
|
||||||
|
|
||||||
// Hide tooltips on mousedown
|
// Hide tooltips on mousedown
|
||||||
mToolTipBlocked = TRUE;
|
if (down)
|
||||||
|
{
|
||||||
|
mToolTipBlocked = TRUE;
|
||||||
|
mToolTip->setVisible(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
// Also hide hover info on mousedown
|
// Also hide hover info on mousedown/mouseup
|
||||||
if (gHoverView)
|
if (gHoverView)
|
||||||
{
|
{
|
||||||
gHoverView->cancelHover();
|
gHoverView->cancelHover();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't let the user move the mouse out of the window until mouse up.
|
// Don't let the user move the mouse out of the window until mouse up.
|
||||||
if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
|
if (LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown())
|
||||||
{
|
{
|
||||||
mWindow->setMouseClipping(TRUE);
|
mWindow->setMouseClipping(down);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
|
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
|
||||||
@@ -652,10 +689,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
|
|||||||
mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
|
mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
|
||||||
if (LLView::sDebugMouseHandling)
|
if (LLView::sDebugMouseHandling)
|
||||||
{
|
{
|
||||||
llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl;
|
llinfos << buttonname << " Mouse " << buttonstatestr << " handled by captor " << mouse_captor->getName() << llendl;
|
||||||
}
|
}
|
||||||
|
return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down);
|
||||||
return mouse_captor->handleMouseDown(local_x, local_y, mask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Topmost view gets a chance before the hierarchy
|
// Topmost view gets a chance before the hierarchy
|
||||||
@@ -664,216 +700,94 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
|
|||||||
{
|
{
|
||||||
S32 local_x, local_y;
|
S32 local_x, local_y;
|
||||||
top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
|
top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
|
||||||
if (top_ctrl->pointInView(local_x, local_y))
|
|
||||||
|
if (down)
|
||||||
{
|
{
|
||||||
return top_ctrl->handleMouseDown(local_x, local_y, mask);
|
if (top_ctrl->pointInView(local_x, local_y))
|
||||||
}
|
{
|
||||||
|
return top_ctrl->handleAnyMouseClick(local_x, local_y, mask, clicktype, down) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gFocusMgr.setTopCtrl(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask);
|
||||||
gFocusMgr.setTopCtrl(NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give the UI views a chance to process the click
|
// Give the UI views a chance to process the click
|
||||||
if( mRootView->handleMouseDown(x, y, mask) )
|
if( mRootView->handleAnyMouseClick(x, y, mask, clicktype, down) )
|
||||||
{
|
{
|
||||||
if (LLView::sDebugMouseHandling)
|
if (LLView::sDebugMouseHandling)
|
||||||
{
|
{
|
||||||
llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl;
|
llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (LLView::sDebugMouseHandling)
|
else if (LLView::sDebugMouseHandling)
|
||||||
{
|
{
|
||||||
llinfos << "Left Mouse Down not handled by view" << llendl;
|
llinfos << buttonname << " Mouse " << buttonstatestr << " not handled by view" << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not allow tool manager to handle mouseclicks if we have disconnected
|
if (down)
|
||||||
if (gDisconnected)
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
// Do not allow tool manager to handle mouseclicks if we have disconnected
|
||||||
}
|
if (gDisconnected)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if(LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask ) )
|
if(LLToolMgr::getInstance()->getCurrentTool()->handleAnyMouseClick( x, y, mask, clicktype, down ) )
|
||||||
|
{
|
||||||
|
// This is necessary to force clicks in the world to cause edit
|
||||||
|
// boxes that might have keyboard focus to relinquish it, and hence
|
||||||
|
// cause a commit to update their value. JC
|
||||||
|
gFocusMgr.setKeyboardFocus(NULL);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// This is necessary to force clicks in the world to cause edit
|
mWindow->releaseMouse();
|
||||||
// boxes that might have keyboard focus to relinquish it, and hence
|
|
||||||
// cause a commit to update their value. JC
|
LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
|
||||||
gFocusMgr.setKeyboardFocus(NULL);
|
if( !handled )
|
||||||
return TRUE;
|
{
|
||||||
|
handled = mRootView->handleAnyMouseClick(x, y, mask, clicktype, down);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !handled )
|
||||||
|
{
|
||||||
|
if (tool)
|
||||||
|
{
|
||||||
|
handled = tool->handleAnyMouseClick(x, y, mask, clicktype, down);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return (!down);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||||
|
{
|
||||||
|
BOOL down = TRUE;
|
||||||
|
return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask)
|
BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||||
{
|
{
|
||||||
S32 x = pos.mX;
|
// try handling as a double-click first, then a single-click if that
|
||||||
S32 y = pos.mY;
|
// wasn't handled.
|
||||||
x = llround((F32)x / mDisplayScale.mV[VX]);
|
BOOL down = TRUE;
|
||||||
y = llround((F32)y / mDisplayScale.mV[VY]);
|
return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_DOUBLELEFT,down) ||
|
||||||
|
handleMouseDown(window, pos, mask);
|
||||||
LLView::sMouseHandlerMessage.clear();
|
|
||||||
|
|
||||||
if (gDebugClicks)
|
|
||||||
{
|
|
||||||
llinfos << "ViewerWindow left mouse double-click at " << x << "," << y << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLeftMouseDown = TRUE;
|
|
||||||
|
|
||||||
// Hide tooltips
|
|
||||||
if( mToolTip )
|
|
||||||
{
|
|
||||||
mToolTip->setVisible( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
|
|
||||||
if( mouse_captor )
|
|
||||||
{
|
|
||||||
S32 local_x;
|
|
||||||
S32 local_y;
|
|
||||||
mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
|
|
||||||
if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
llinfos << "Left Mouse Down handled by captor " << mouse_captor->getName() << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mouse_captor->handleDoubleClick(local_x, local_y, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for hit on UI.
|
|
||||||
LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
|
|
||||||
if (top_ctrl)
|
|
||||||
{
|
|
||||||
S32 local_x, local_y;
|
|
||||||
top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
|
|
||||||
if (top_ctrl->pointInView(local_x, local_y))
|
|
||||||
{
|
|
||||||
return top_ctrl->handleDoubleClick(local_x, local_y, mask);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gFocusMgr.setTopCtrl(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mRootView->handleDoubleClick(x, y, mask))
|
|
||||||
{
|
|
||||||
if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
llinfos << "Left Mouse Down not handled by view" << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Why is this here? JC 9/3/2002
|
|
||||||
if (gNoRender)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(LLToolMgr::getInstance()->getCurrentTool()->handleDoubleClick( x, y, mask ) )
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we got this far and nothing handled a double click, pass a normal mouse down
|
|
||||||
return handleMouseDown(window, pos, mask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||||
{
|
{
|
||||||
S32 x = pos.mX;
|
BOOL down = FALSE;
|
||||||
S32 y = pos.mY;
|
return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down);
|
||||||
x = llround((F32)x / mDisplayScale.mV[VX]);
|
|
||||||
y = llround((F32)y / mDisplayScale.mV[VY]);
|
|
||||||
|
|
||||||
LLView::sMouseHandlerMessage.clear();
|
|
||||||
|
|
||||||
if (gDebugClicks)
|
|
||||||
{
|
|
||||||
llinfos << "ViewerWindow left mouse up" << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLeftMouseDown = FALSE;
|
|
||||||
|
|
||||||
// Indicate mouse was active
|
|
||||||
gMouseIdleTimer.reset();
|
|
||||||
|
|
||||||
// Hide tooltips on mouseup
|
|
||||||
if( mToolTip )
|
|
||||||
{
|
|
||||||
mToolTip->setVisible( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also hide hover info on mouseup
|
|
||||||
if (gHoverView) gHoverView->cancelHover();
|
|
||||||
|
|
||||||
BOOL handled = FALSE;
|
|
||||||
|
|
||||||
mWindow->releaseMouse();
|
|
||||||
|
|
||||||
LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
|
|
||||||
|
|
||||||
if( tool->clipMouseWhenDown() )
|
|
||||||
{
|
|
||||||
mWindow->setMouseClipping(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
|
|
||||||
if( mouse_captor )
|
|
||||||
{
|
|
||||||
S32 local_x;
|
|
||||||
S32 local_y;
|
|
||||||
mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
|
|
||||||
if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
llinfos << "Left Mouse Up handled by captor " << mouse_captor->getName() << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mouse_captor->handleMouseUp(local_x, local_y, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
|
|
||||||
if (top_ctrl)
|
|
||||||
{
|
|
||||||
S32 local_x, local_y;
|
|
||||||
top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
|
|
||||||
handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !handled )
|
|
||||||
{
|
|
||||||
handled = mRootView->handleMouseUp(x, y, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
if (handled)
|
|
||||||
{
|
|
||||||
llinfos << "Left Mouse Up" << LLView::sMouseHandlerMessage << llendl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llinfos << "Left Mouse Up not handled by view" << llendl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !handled )
|
|
||||||
{
|
|
||||||
if (tool)
|
|
||||||
{
|
|
||||||
handled = tool->handleMouseUp(x, y, mask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always handled as far as the OS is concerned.
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -886,89 +800,11 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
|
|||||||
|
|
||||||
LLView::sMouseHandlerMessage.clear();
|
LLView::sMouseHandlerMessage.clear();
|
||||||
|
|
||||||
if (gDebugClicks)
|
BOOL down = TRUE;
|
||||||
{
|
BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down);
|
||||||
llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl;
|
if (handle)
|
||||||
}
|
return handle;
|
||||||
|
|
||||||
if (gMenuBarView)
|
|
||||||
{
|
|
||||||
// stop ALT-key access to menu
|
|
||||||
gMenuBarView->resetMenuTrigger();
|
|
||||||
}
|
|
||||||
|
|
||||||
mRightMouseDown = TRUE;
|
|
||||||
|
|
||||||
// Make sure we get a coresponding mouseup event, even if the mouse leaves the window
|
|
||||||
mWindow->captureMouse();
|
|
||||||
|
|
||||||
// Hide tooltips
|
|
||||||
if( mToolTip )
|
|
||||||
{
|
|
||||||
mToolTip->setVisible( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also hide hover info on mousedown
|
|
||||||
if (gHoverView)
|
|
||||||
{
|
|
||||||
gHoverView->cancelHover();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't let the user move the mouse out of the window until mouse up.
|
|
||||||
if( LLToolMgr::getInstance()->getCurrentTool()->clipMouseWhenDown() )
|
|
||||||
{
|
|
||||||
mWindow->setMouseClipping(TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
|
|
||||||
if( mouse_captor )
|
|
||||||
{
|
|
||||||
S32 local_x;
|
|
||||||
S32 local_y;
|
|
||||||
mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
|
|
||||||
if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
llinfos << "Right Mouse Down handled by captor " << mouse_captor->getName() << llendl;
|
|
||||||
}
|
|
||||||
return mouse_captor->handleRightMouseDown(local_x, local_y, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
|
|
||||||
if (top_ctrl)
|
|
||||||
{
|
|
||||||
S32 local_x, local_y;
|
|
||||||
top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
|
|
||||||
if (top_ctrl->pointInView(local_x, local_y))
|
|
||||||
{
|
|
||||||
return top_ctrl->handleRightMouseDown(local_x, local_y, mask);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gFocusMgr.setTopCtrl(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mRootView->handleRightMouseDown(x, y, mask) )
|
|
||||||
{
|
|
||||||
if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
llinfos << "Right Mouse Down" << LLView::sMouseHandlerMessage << llendl;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
llinfos << "Right Mouse Down not handled by view" << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(LLToolMgr::getInstance()->getCurrentTool()->handleRightMouseDown( x, y, mask ) )
|
|
||||||
{
|
|
||||||
// This is necessary to force clicks in the world to cause edit
|
|
||||||
// boxes that might have keyboard focus to relinquish it, and hence
|
|
||||||
// cause a commit to update their value. JC
|
|
||||||
gFocusMgr.setKeyboardFocus(NULL);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *HACK: this should be rolled into the composite tool logic, not
|
// *HACK: this should be rolled into the composite tool logic, not
|
||||||
// hardcoded at the top level.
|
// hardcoded at the top level.
|
||||||
@@ -986,97 +822,15 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
|
|||||||
|
|
||||||
BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||||
{
|
{
|
||||||
S32 x = pos.mX;
|
BOOL down = FALSE;
|
||||||
S32 y = pos.mY;
|
return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down);
|
||||||
x = llround((F32)x / mDisplayScale.mV[VX]);
|
|
||||||
y = llround((F32)y / mDisplayScale.mV[VY]);
|
|
||||||
|
|
||||||
LLView::sMouseHandlerMessage.clear();
|
|
||||||
|
|
||||||
// Don't care about caps lock for mouse events.
|
|
||||||
if (gDebugClicks)
|
|
||||||
{
|
|
||||||
llinfos << "ViewerWindow right mouse up" << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
mRightMouseDown = FALSE;
|
|
||||||
|
|
||||||
// Indicate mouse was active
|
|
||||||
gMouseIdleTimer.reset();
|
|
||||||
|
|
||||||
// Hide tooltips on mouseup
|
|
||||||
if( mToolTip )
|
|
||||||
{
|
|
||||||
mToolTip->setVisible( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also hide hover info on mouseup
|
|
||||||
if (gHoverView) gHoverView->cancelHover();
|
|
||||||
|
|
||||||
BOOL handled = FALSE;
|
|
||||||
|
|
||||||
mWindow->releaseMouse();
|
|
||||||
|
|
||||||
LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
|
|
||||||
|
|
||||||
if( tool->clipMouseWhenDown() )
|
|
||||||
{
|
|
||||||
mWindow->setMouseClipping(FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLMouseHandler* mouse_captor = gFocusMgr.getMouseCapture();
|
|
||||||
if( mouse_captor )
|
|
||||||
{
|
|
||||||
S32 local_x;
|
|
||||||
S32 local_y;
|
|
||||||
mouse_captor->screenPointToLocal( x, y, &local_x, &local_y );
|
|
||||||
if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
llinfos << "Right Mouse Up handled by captor " << mouse_captor->getName() << llendl;
|
|
||||||
}
|
|
||||||
return mouse_captor->handleRightMouseUp(local_x, local_y, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
|
|
||||||
if (top_ctrl)
|
|
||||||
{
|
|
||||||
S32 local_x, local_y;
|
|
||||||
top_ctrl->screenPointToLocal( x, y, &local_x, &local_y );
|
|
||||||
handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleRightMouseUp(local_x, local_y, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !handled )
|
|
||||||
{
|
|
||||||
handled = mRootView->handleRightMouseUp(x, y, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LLView::sDebugMouseHandling)
|
|
||||||
{
|
|
||||||
if (handled)
|
|
||||||
{
|
|
||||||
llinfos << "Right Mouse Up" << LLView::sMouseHandlerMessage << llendl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llinfos << "Right Mouse Up not handled by view" << llendl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !handled )
|
|
||||||
{
|
|
||||||
if (tool)
|
|
||||||
{
|
|
||||||
handled = tool->handleRightMouseUp(x, y, mask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always handled as far as the OS is concerned.
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
|
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||||
{
|
{
|
||||||
|
BOOL down = TRUE;
|
||||||
gVoiceClient->middleMouseState(true);
|
gVoiceClient->middleMouseState(true);
|
||||||
|
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
|
||||||
|
|
||||||
// Always handled as far as the OS is concerned.
|
// Always handled as far as the OS is concerned.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1084,7 +838,9 @@ BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MAS
|
|||||||
|
|
||||||
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||||
{
|
{
|
||||||
|
BOOL down = FALSE;
|
||||||
gVoiceClient->middleMouseState(false);
|
gVoiceClient->middleMouseState(false);
|
||||||
|
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
|
||||||
|
|
||||||
// Always handled as far as the OS is concerned.
|
// Always handled as far as the OS is concerned.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1463,6 +1219,7 @@ LLViewerWindow::LLViewerWindow(
|
|||||||
mWindowRect(0, height, width, 0),
|
mWindowRect(0, height, width, 0),
|
||||||
mVirtualWindowRect(0, height, width, 0),
|
mVirtualWindowRect(0, height, width, 0),
|
||||||
mLeftMouseDown(FALSE),
|
mLeftMouseDown(FALSE),
|
||||||
|
mMiddleMouseDown(FALSE),
|
||||||
mRightMouseDown(FALSE),
|
mRightMouseDown(FALSE),
|
||||||
mToolTip(NULL),
|
mToolTip(NULL),
|
||||||
mToolTipBlocked(FALSE),
|
mToolTipBlocked(FALSE),
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "lltimer.h"
|
#include "lltimer.h"
|
||||||
#include "llstat.h"
|
#include "llstat.h"
|
||||||
#include "llalertdialog.h"
|
#include "llalertdialog.h"
|
||||||
|
#include "llmousehandler.h"
|
||||||
#include "llnotifications.h"
|
#include "llnotifications.h"
|
||||||
|
|
||||||
class LLView;
|
class LLView;
|
||||||
@@ -59,7 +60,6 @@ class LLVelocityBar;
|
|||||||
class LLTextBox;
|
class LLTextBox;
|
||||||
class LLImageRaw;
|
class LLImageRaw;
|
||||||
class LLHUDIcon;
|
class LLHUDIcon;
|
||||||
class LLMouseHandler;
|
|
||||||
class AIFilePicker;
|
class AIFilePicker;
|
||||||
|
|
||||||
#define PICK_HALF_WIDTH 5
|
#define PICK_HALF_WIDTH 5
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
|
|
||||||
static bool isFlora(LLViewerObject* object);
|
static bool isFlora(LLViewerObject* object);
|
||||||
|
|
||||||
typedef enum e_pick_type
|
typedef enum
|
||||||
{
|
{
|
||||||
PICK_OBJECT,
|
PICK_OBJECT,
|
||||||
PICK_FLORA,
|
PICK_FLORA,
|
||||||
@@ -154,6 +154,7 @@ public:
|
|||||||
/*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask);
|
/*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask);
|
||||||
/*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
|
/*virtual*/ void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
|
||||||
/*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended
|
/*virtual*/ BOOL handleUnicodeChar(llwchar uni_char, MASK mask); // NOT going to handle extended
|
||||||
|
/*virtual*/ BOOL handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down);
|
||||||
/*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
/*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||||
/*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
/*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||||
/*virtual*/ BOOL handleCloseRequest(LLWindow *window);
|
/*virtual*/ BOOL handleCloseRequest(LLWindow *window);
|
||||||
@@ -216,6 +217,7 @@ public:
|
|||||||
LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; }
|
LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; }
|
||||||
LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; }
|
LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; }
|
||||||
BOOL getLeftMouseDown() const { return mLeftMouseDown; }
|
BOOL getLeftMouseDown() const { return mLeftMouseDown; }
|
||||||
|
BOOL getMiddleMouseDown() const { return mMiddleMouseDown; }
|
||||||
BOOL getRightMouseDown() const { return mRightMouseDown; }
|
BOOL getRightMouseDown() const { return mRightMouseDown; }
|
||||||
|
|
||||||
const LLPickInfo& getLastPick() const { return mLastPick; }
|
const LLPickInfo& getLastPick() const { return mLastPick; }
|
||||||
@@ -392,6 +394,7 @@ protected:
|
|||||||
LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame
|
LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame
|
||||||
LLStat mMouseVelocityStat;
|
LLStat mMouseVelocityStat;
|
||||||
BOOL mLeftMouseDown;
|
BOOL mLeftMouseDown;
|
||||||
|
BOOL mMiddleMouseDown;
|
||||||
BOOL mRightMouseDown;
|
BOOL mRightMouseDown;
|
||||||
|
|
||||||
LLProgressView *mProgressView;
|
LLProgressView *mProgressView;
|
||||||
|
|||||||
Reference in New Issue
Block a user