From a9028b5c1772057c96ddbb3acfd89b0a65ad6ab3 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 19:47:33 +0200 Subject: [PATCH 01/29] Add some missing clothing entries to the viewer and pie menus --- .../skins/default/xui/en-us/menu_pie_self.xml | 5 +++++ .../skins/default/xui/en-us/menu_viewer.xml | 22 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/indra/newview/skins/default/xui/en-us/menu_pie_self.xml b/indra/newview/skins/default/xui/en-us/menu_pie_self.xml index ee6c1bd8a..9ae376800 100644 --- a/indra/newview/skins/default/xui/en-us/menu_pie_self.xml +++ b/indra/newview/skins/default/xui/en-us/menu_pie_self.xml @@ -54,6 +54,11 @@ + + + + diff --git a/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/indra/newview/skins/default/xui/en-us/menu_viewer.xml index 4a49daede..04a5fd94f 100644 --- a/indra/newview/skins/default/xui/en-us/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en-us/menu_viewer.xml @@ -196,11 +196,25 @@ - + + + + + + + + + - - - + + + + From 9ec40dbcac49ec276fa382ea943a16e3142c6e62 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 19:53:03 +0200 Subject: [PATCH 02/29] Slight modification of the wrapper to let qt find its optional plugins in the pathname --- indra/newview/linux_tools/wrapper.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 34cb59877..64f14a7c8 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -116,10 +116,13 @@ fi export VIEWER_BINARY='singularity-do-not-run-directly' BINARY_TYPE=$(expr match "$(file -b bin/$VIEWER_BINARY)" '\(.*executable\)') +QPP=qt4/plugins/imageformats/ if [ "${BINARY_TYPE}" == "ELF 64-bit LSB executable" ]; then - export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib64:"`pwd`"/lib32:"${LD_LIBRARY_PATH}"' + QTPLUGINS=/usr/lib64/$QPP:/lib64/$QPP:/usr/local/lib64/$QPP + export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib64:"`pwd`"/lib32:$QTPLUGINS:"${LD_LIBRARY_PATH}"' else - export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:"${LD_LIBRARY_PATH}"' + QTPLUGINS=/usr/lib/$QPP:/lib/$QPP:/usr/local/lib/$QPP + export SL_ENV='LD_LIBRARY_PATH="`pwd`"/lib:$QTPLUGINS:"${LD_LIBRARY_PATH}"' fi export SL_CMD='$LL_WRAPPER bin/$VIEWER_BINARY' From 4b98d69c2fad0095475861ff2eb5c53bdbd9f004 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 19:55:25 +0200 Subject: [PATCH 03/29] Fix the mouse flickering problem inherited by Ascent --- indra/newview/lltoolpie.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index e26e039e4..9fd7f75c8 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -659,8 +659,6 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) */ - gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); - LLViewerObject *object = NULL; LLViewerObject *parent = NULL; // object = gViewerWindow->getHoverPick().getObject(); From 5009b0544e9915dd33ac467019945cc7f201b229 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 19:58:47 +0200 Subject: [PATCH 04/29] Adaptation of the CoolViewer patch that allows Linux users to paste by middle-clicking. --- indra/llui/lltexteditor.cpp | 6 + indra/llwindow/CMakeLists.txt | 1 + indra/llwindow/llmousehandler.h | 21 +- indra/llwindow/llwindowsdl.cpp | 59 ++++ indra/llwindow/llwindowsdl.h | 6 + indra/newview/lltool.cpp | 14 + indra/newview/lltool.h | 3 + indra/newview/llviewerwindow.cpp | 483 ++++++++----------------------- indra/newview/llviewerwindow.h | 7 +- 9 files changed, 230 insertions(+), 370 deletions(-) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 3326524cb..42b8972c8 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -2418,6 +2418,12 @@ BOOL LLTextEditor::handleEditKey(const KEY key, const MASK mask) } } + if( handled ) + { + // take selection to 'primary' clipboard + updatePrimary(); + } + return handled; } diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 710789fc4..e73b97a99 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -45,6 +45,7 @@ set(llwindows_HEADER_FILES set(viewer_SOURCE_FILES llwindow.cpp + llmousehandler.cpp ) set(viewer_HEADER_FILES diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h index f3a2edd8a..7bd0f2eeb 100644 --- a/indra/llwindow/llmousehandler.h +++ b/indra/llwindow/llmousehandler.h @@ -33,9 +33,10 @@ #ifndef 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. // 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_ALWAYS, } 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 handleMouseUp(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 handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual BOOL handleMiddleMouseUp(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 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 EShowToolTip getShowToolTip() { return SHOW_IF_NOT_BLOCKED; }; virtual const std::string& getName() const = 0; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 94177e6d5..2c58592fc 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1282,6 +1282,49 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text) 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 BOOL LLWindowSDL::isClipboardTextAvailable() @@ -1298,6 +1341,22 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) { 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 LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions) diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 2363c510d..bf346d868 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -80,9 +80,15 @@ public: /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); /*virtual*/ void setMouseClipping( BOOL b ); + /*virtual*/ BOOL isClipboardTextAvailable(); /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); /*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*/ F32 getGamma(); /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index da9f3c5bd..b1fad8627 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -126,6 +126,20 @@ BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) 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) { // by default, didn't handle it diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index 249088fd3..f954a8c24 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -57,6 +57,9 @@ public: // Virtual functions inherited from LLMouseHandler virtual BOOL handleMouseDown(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 handleScrollWheel(S32 x, S32 y, S32 clicks); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 96c88bbbb..f35d448c7 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -601,47 +601,84 @@ bool LLViewerWindow::shouldShowToolTipFor(LLMouseHandler *mh) 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 y = pos.mY; x = llround((F32)x / mDisplayScale.mV[VX]); 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) { // stop ALT-key access to menu 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 - mWindow->captureMouse(); + if (down) + { + mWindow->captureMouse(); + } + else + { + mWindow->releaseMouse(); + } // Indicate mouse was active gMouseIdleTimer.reset(); // 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) { gHoverView->cancelHover(); } // 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(); @@ -652,10 +689,9 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask mouse_captor->screenPointToLocal( x, y, &local_x, &local_y ); 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->handleMouseDown(local_x, local_y, mask); + return mouse_captor->handleAnyMouseClick(local_x, local_y, mask, clicktype, down); } // 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; 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 - { - gFocusMgr.setTopCtrl(NULL); - } + handled = top_ctrl->pointInView(local_x, local_y) && top_ctrl->handleMouseUp(local_x, local_y, mask); } // 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) { - llinfos << "Left Mouse Down" << LLView::sMouseHandlerMessage << llendl; + llinfos << buttonname << " Mouse " << buttonstatestr << " " << LLView::sMouseHandlerMessage << llendl; } return TRUE; } 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 (gDisconnected) + if (down) { - 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 - // boxes that might have keyboard focus to relinquish it, and hence - // cause a commit to update their value. JC - gFocusMgr.setKeyboardFocus(NULL); - return TRUE; + mWindow->releaseMouse(); + + LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); + if( !handled ) + { + 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) { - S32 x = pos.mX; - S32 y = pos.mY; - x = llround((F32)x / mDisplayScale.mV[VX]); - y = llround((F32)y / mDisplayScale.mV[VY]); - - 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); + // try handling as a double-click first, then a single-click if that + // wasn't handled. + BOOL down = TRUE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_DOUBLELEFT,down) || + handleMouseDown(window, pos, mask); } BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { - S32 x = pos.mX; - S32 y = pos.mY; - 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; + BOOL down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_LEFT,down); } @@ -886,89 +800,11 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK LLView::sMouseHandlerMessage.clear(); - if (gDebugClicks) - { - llinfos << "ViewerWindow right mouse down at " << x << "," << y << llendl; - } + BOOL down = TRUE; + BOOL handle = handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); + 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 // 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) { - S32 x = pos.mX; - S32 y = pos.mY; - 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 down = FALSE; + return handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_RIGHT,down); } BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = TRUE; gVoiceClient->middleMouseState(true); + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); // Always handled as far as the OS is concerned. return TRUE; @@ -1084,7 +838,9 @@ BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MAS BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask) { + BOOL down = FALSE; gVoiceClient->middleMouseState(false); + handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down); // Always handled as far as the OS is concerned. return TRUE; @@ -1463,6 +1219,7 @@ LLViewerWindow::LLViewerWindow( mWindowRect(0, height, width, 0), mVirtualWindowRect(0, height, width, 0), mLeftMouseDown(FALSE), + mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), mToolTip(NULL), mToolTipBlocked(FALSE), diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index dec5a177c..773c0aa93 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -48,6 +48,7 @@ #include "lltimer.h" #include "llstat.h" #include "llalertdialog.h" +#include "llmousehandler.h" #include "llnotifications.h" class LLView; @@ -59,7 +60,6 @@ class LLVelocityBar; class LLTextBox; class LLImageRaw; class LLHUDIcon; -class LLMouseHandler; class AIFilePicker; #define PICK_HALF_WIDTH 5 @@ -84,7 +84,7 @@ public: static bool isFlora(LLViewerObject* object); - typedef enum e_pick_type + typedef enum { PICK_OBJECT, PICK_FLORA, @@ -154,6 +154,7 @@ public: /*virtual*/ BOOL handleTranslatedKeyUp(KEY key, MASK mask); /*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 handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down); /*virtual*/ BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); /*virtual*/ BOOL handleCloseRequest(LLWindow *window); @@ -216,6 +217,7 @@ public: LLCoordGL getCurrentMouseDelta() const { return mCurrentMouseDelta; } LLStat * getMouseVelocityStat() { return &mMouseVelocityStat; } BOOL getLeftMouseDown() const { return mLeftMouseDown; } + BOOL getMiddleMouseDown() const { return mMiddleMouseDown; } BOOL getRightMouseDown() const { return mRightMouseDown; } const LLPickInfo& getLastPick() const { return mLastPick; } @@ -392,6 +394,7 @@ protected: LLCoordGL mCurrentMouseDelta; //amount mouse moved this frame LLStat mMouseVelocityStat; BOOL mLeftMouseDown; + BOOL mMiddleMouseDown; BOOL mRightMouseDown; LLProgressView *mProgressView; From 3b168065d51d5288b54bb2135dfe4f9146e54050 Mon Sep 17 00:00:00 2001 From: Player Dagostino Date: Tue, 2 Aug 2011 20:01:20 +0200 Subject: [PATCH 05/29] Another port of a great patch from CoolViewer that lets users set the maximum number of actual visible avatars when impostors are on. --- indra/newview/llfloaterhardwaresettings.cpp | 53 +++++++++++++++---- indra/newview/llfloaterhardwaresettings.h | 12 ++--- indra/newview/llpaneldisplay.cpp | 16 ++++++ indra/newview/llpaneldisplay.h | 2 + indra/newview/llviewermenu.cpp | 4 -- .../xui/en-us/floater_hardware_settings.xml | 37 +++++++++++-- .../xui/en-us/panel_preferences_graphics1.xml | 19 ++++--- 7 files changed, 111 insertions(+), 32 deletions(-) diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 23da0629b..30fa5a305 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -47,27 +47,25 @@ #include "pipeline.h" LLFloaterHardwareSettings* LLFloaterHardwareSettings::sHardwareSettings = NULL; +BOOL LLFloaterHardwareSettings::sUseStreamVBOexists = FALSE; LLFloaterHardwareSettings::LLFloaterHardwareSettings() : LLFloater(std::string("Hardware Settings Floater")) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_hardware_settings.xml"); - - // load it up - initCallbacks(); } LLFloaterHardwareSettings::~LLFloaterHardwareSettings() { } -void LLFloaterHardwareSettings::onClickHelp(void* data) -{ - const char* xml_alert = "HardwareSettingsHelpButton"; - LLNotifications::instance().add(xml_alert); -} - -void LLFloaterHardwareSettings::initCallbacks(void) +void LLFloaterHardwareSettings::onCommitCheckBoxVBO(LLUICtrl* ctrl, void* user_data) { + LLFloaterHardwareSettings* self = (LLFloaterHardwareSettings*)user_data; + if (self && sUseStreamVBOexists) + { + gSavedSettings.setBOOL("RenderUseStreamVBO", self->childGetValue("stream_vbo").asBoolean()); + self->refreshEnabledState(); + } } // menu maintenance functions @@ -77,6 +75,10 @@ void LLFloaterHardwareSettings::refresh() LLPanel::refresh(); mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable"); + if (sUseStreamVBOexists) + { + mUseStreamVBO = gSavedSettings.getBOOL("RenderUseStreamVBO"); + } mUseFBO = gSavedSettings.getBOOL("RenderUseFBO"); mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic"); mFSAASamples = gSavedSettings.getU32("RenderFSAASamples"); @@ -96,6 +98,7 @@ void LLFloaterHardwareSettings::refreshEnabledState() childSetMinValue("GrapicsCardTextureMemory", min_tex_mem); childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem); + bool vbo_ok = true; mLastVBOState = LLVertexBuffer::sEnableVBOs; if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || !gGLManager.mHasVertexBufferObject) @@ -103,6 +106,23 @@ void LLFloaterHardwareSettings::refreshEnabledState() childSetEnabled("vbo", FALSE); //Streaming VBOs -Shyotl childSetEnabled("vbo_stream", FALSE); + vbo_ok = false; + } + + if (sUseStreamVBOexists) + { + childSetVisible("stream_vbo", true); + childSetEnabled("stream_vbo", vbo_ok && childGetValue("vbo") && + LLFeatureManager::getInstance()->isFeatureAvailable("RenderUseStreamVBO")); + } + else + { + childSetVisible("stream_vbo", false); + } + + if (!LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")) + { + childSetEnabled("occlusion", false); } else { @@ -115,7 +135,7 @@ void LLFloaterHardwareSettings::refreshEnabledState() childSetEnabled("gamma", !gPipeline.canUseWindLightShaders()); childSetEnabled("(brightness, lower is brighter)", !gPipeline.canUseWindLightShaders()); childSetEnabled("fog", !gPipeline.canUseWindLightShaders()); - + childSetVisible("note", gPipeline.canUseWindLightShaders()); } // static instance of it @@ -173,6 +193,13 @@ BOOL LLFloaterHardwareSettings::postBuild() { childSetAction("OK", onBtnOK, this); + sUseStreamVBOexists = gSavedSettings.controlExists("RenderUseStreamVBO"); + if (sUseStreamVBOexists) + { + childSetCommitCallback("vbo", onCommitCheckBoxVBO, this); + childSetCommitCallback("stream_vbo", onCommitCheckBoxVBO, this); + } + refresh(); return TRUE; @@ -202,6 +229,10 @@ void LLFloaterHardwareSettings::apply() void LLFloaterHardwareSettings::cancel() { gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO); + if (sUseStreamVBOexists) + { + gSavedSettings.setBOOL("RenderUseStreamVBO", mUseStreamVBO); + } gSavedSettings.setBOOL("RenderUseFBO", mUseFBO); gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso); gSavedSettings.setU32("RenderFSAASamples", mFSAASamples); diff --git a/indra/newview/llfloaterhardwaresettings.h b/indra/newview/llfloaterhardwaresettings.h index 0d78d67a2..804b26dd9 100644 --- a/indra/newview/llfloaterhardwaresettings.h +++ b/indra/newview/llfloaterhardwaresettings.h @@ -49,14 +49,11 @@ public: virtual BOOL postBuild(); - /// initialize all the callbacks for the menu - void initCallbacks(void); - /// one and one instance only static LLFloaterHardwareSettings* instance(); - /// callback for the menus help button - static void onClickHelp(void* data); + /// callback for the VBO-related settings checkboxes + static void onCommitCheckBoxVBO(LLUICtrl* ctrl, void* user_data); /// OK button static void onBtnOK( void* userdata ); @@ -87,11 +84,12 @@ public: /// refresh the enabled values void refreshEnabledState(); -protected: +private: LLSliderCtrl* mCtrlVideoCardMem; //Retained values for cancel/reset BOOL mUseVBO; + BOOL mUseStreamVBO; BOOL mUseFBO; BOOL mUseAniso; U32 mFSAASamples; @@ -101,9 +99,9 @@ protected: BOOL mProbeHardwareOnStartup; bool mLastVBOState; //track changes to LLVertexBuffer::sEnableVBOs every frame. Bleh. -private: // one instance on the inside static LLFloaterHardwareSettings* sHardwareSettings; + static BOOL sUseStreamVBOexists; }; #endif diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index c7aeabcce..b5b69bcfc 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -260,6 +260,9 @@ BOOL LLPanelDisplay::postBuild() // Avatar Render Mode mCtrlAvatarCloth = getChild("AvatarCloth"); mCtrlAvatarImpostors = getChild("AvatarImpostors"); + mCtrlAvatarImpostors->setCommitCallback(&LLPanelDisplay::onVertexShaderEnable); + mCtrlAvatarImpostors->setCallbackUserData(this); + mCtrlNonImpostors = getChild("AvatarMaxVisible"); //---------------------------------------------------------------------------- // radio set for lighting detail @@ -417,6 +420,7 @@ void LLPanelDisplay::refresh() // avatar settings mAvatarImpostors = gSavedSettings.getBOOL("RenderUseImpostors"); + mNonImpostors = gSavedSettings.getS32("RenderAvatarMaxVisible"); mAvatarCloth = gSavedSettings.getBOOL("RenderAvatarCloth"); // Draw distance @@ -514,6 +518,9 @@ void LLPanelDisplay::refreshEnabledState() //GI won't do anything with shadows off, but disabling it here is less than intuitive. Ignore shadow setting for now. mCtrlDeferredGI->setEnabled(mCtrlShadowDetail->getEnabled()/* && gSavedSettings.getS32("RenderShadowDetail") > 0*/); + // Disable max non-impostors slider if avatar impostors are off + mCtrlNonImpostors->setEnabled(gSavedSettings.getBOOL("RenderUseImpostors")); + // Vertex Shaders // mCtrlShaderEnable->setEnabled(LLFeatureManager::getInstance()->isFeatureAvailable("VertexShaderEnable")); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0a @@ -612,6 +619,7 @@ void LLPanelDisplay::disableUnavailableSettings() { mCtrlAvatarImpostors->setEnabled(FALSE); mCtrlAvatarImpostors->setValue(FALSE); + mCtrlNonImpostors->setEnabled(FALSE); } // disabled deferred if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred")) @@ -654,6 +662,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden) llassert(mCtrlAvatarVP != NULL); llassert(mCtrlShaderEnable != NULL); llassert(mCtrlAvatarImpostors != NULL); + llassert(mCtrlNonImpostors != NULL); llassert(mCtrlAvatarCloth != NULL); llassert(mRadioLightingDetail2 != NULL); @@ -702,6 +711,7 @@ void LLPanelDisplay::setHiddenGraphicsState(bool isHidden) mCtrlAvatarVP->setVisible(!isHidden); mCtrlShaderEnable->setVisible(!isHidden); mCtrlAvatarImpostors->setVisible(!isHidden); + mCtrlNonImpostors->setVisible(!isHidden); mCtrlAvatarCloth->setVisible(!isHidden); mRadioLightingDetail2->setVisible(!isHidden); @@ -752,6 +762,7 @@ void LLPanelDisplay::cancel() gSavedSettings.setS32("RenderShadowDetail", mShadowDetail); gSavedSettings.setBOOL("RenderUseImpostors", mAvatarImpostors); + gSavedSettings.setS32("RenderAvatarMaxVisible", mNonImpostors); gSavedSettings.setBOOL("RenderAvatarCloth", mAvatarCloth); gSavedSettings.setBOOL("RenderLocalLights", mLocalLights); @@ -994,6 +1005,11 @@ void LLPanelDisplay::onVertexShaderEnable(LLUICtrl* self, void* data) void LLPanelDisplay::setHardwareDefaults(void* user_data) { LLFeatureManager::getInstance()->applyRecommendedSettings(); + LLControlVariable* controlp = gSavedSettings.getControl("RenderAvatarMaxVisible"); + if (controlp) + { + controlp->resetToDefault(true); + } LLFloaterPreference::refreshEnabledGraphics(); } diff --git a/indra/newview/llpaneldisplay.h b/indra/newview/llpaneldisplay.h index a36311390..5631a7ca9 100644 --- a/indra/newview/llpaneldisplay.h +++ b/indra/newview/llpaneldisplay.h @@ -106,6 +106,7 @@ protected: LLSliderCtrl *mCtrlSkyFactor; // LOD for terrain LLSliderCtrl *mCtrlMaxParticle; // Max Particle LLSliderCtrl *mCtrlPostProcess; // Max Particle + LLSliderCtrl *mCtrlNonImpostors; // Max non-impostors LLCheckBoxCtrl *mCtrlBumpShiny; LLCheckBoxCtrl *mCtrlWindLight; @@ -162,6 +163,7 @@ protected: S32 mShadowDetail; BOOL mAvatarImpostors; + S32 mNonImpostors; BOOL mAvatarCloth; S32 mAvatarMode; BOOL mLocalLights; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 90cff3cdc..572cbc741 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1524,10 +1524,6 @@ void init_debug_rendering_menu(LLMenuGL* menu) 'R', MASK_CONTROL|MASK_SHIFT)); LLMenuItemCheckGL* item; - item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT); - item->setEnabled(gGLManager.mHasOcclusionQuery && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")); - menu->append(item); - item = new LLMenuItemCheckGL("Debug GL", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDebugGL"); menu->append(item); diff --git a/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml b/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml index 21ba6b168..347c69a6b 100644 --- a/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml +++ b/indra/newview/skins/default/xui/en-us/floater_hardware_settings.xml @@ -1,7 +1,7 @@ - Enable VBO: + Vertex Buffer Object: + + + + + Occlusion: + + + + + Note: the Gamma and Fog Distance Ratio settings are unavailable (since useless) when the + Atmospheric Shaders are enabled. + +