From 3f0082a9dda60432b8b759e09f19b495d9d5275c Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Mon, 8 Jun 2009 11:10:27 +0200 Subject: Linux middle mouse button paste/primary selection support and gtk clipboard handler (fixes crashbug using synergy mouse-keyboard-clipboard-sharing over lan) modified: linden/doc/contributions.txt modified: linden/indra/llui/llclipboard.cpp modified: linden/indra/llui/llclipboard.h modified: linden/indra/llui/llfloater.cpp modified: linden/indra/llui/llfloater.h modified: linden/indra/llui/lllineeditor.cpp modified: linden/indra/llui/lllineeditor.h modified: linden/indra/llui/lltexteditor.cpp modified: linden/indra/llui/lltexteditor.h modified: linden/indra/llui/llview.cpp modified: linden/indra/llui/llview.h modified: linden/indra/llwindow/CMakeLists.txt new file: linden/indra/llwindow/llmousehandler.cpp modified: linden/indra/llwindow/llmousehandler.h modified: linden/indra/llwindow/llwindow.cpp modified: linden/indra/llwindow/llwindow.h modified: linden/indra/llwindow/llwindowsdl.cpp modified: linden/indra/llwindow/llwindowsdl.h modified: linden/indra/newview/lltool.cpp modified: linden/indra/newview/lltool.h modified: linden/indra/newview/llviewertexteditor.cpp modified: linden/indra/newview/llviewertexteditor.h modified: linden/indra/newview/llviewerwindow.cpp modified: linden/indra/newview/llviewerwindow.h (cherry picked from commit 594f4830922f4294dda432fa748935adffaeed8f) --- linden/indra/newview/llviewertexteditor.cpp | 79 ++++++++++++----------------- 1 file changed, 32 insertions(+), 47 deletions(-) (limited to 'linden/indra/newview/llviewertexteditor.cpp') 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) BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL handled = FALSE; - - // let scrollbar have first dibs - handled = LLView::childrenHandleMouseUp(x, y, mask) != NULL; - - // Used to enable I Agree checkbox if the user scrolled through entire text - BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); - if (mOnScrollEndCallback && was_scrolled_to_bottom) - { - mOnScrollEndCallback(mOnScrollEndData); - } - - if( !handled && mTakesNonScrollClicks) - { - if( mIsSelecting ) - { - // Finish selection - if( y > getTextRect().mTop ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() - 1 ); - } - else - if( y < getTextRect().mBottom ) - { - mScrollbar->setDocPos( mScrollbar->getDocPos() + 1 ); - } - - setCursorAtLocalPos( x, y, TRUE ); - endSelection(); - - updateScrollFromCursor(); - } - - if( !hasSelection() ) - { - handleMouseUpOverSegment( x, y, mask ); - } - - handled = TRUE; - } - - // Delay cursor flashing - resetKeystrokeTimer(); + BOOL handled = FALSE; - if( hasMouseCapture() ) + if( hasMouseCapture() ) { if (mDragItem) { @@ -956,8 +914,15 @@ BOOL LLViewerTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) } } mDragItem = NULL; - gFocusMgr.setMouseCapture( NULL ); - handled = TRUE; + } + + handled = LLTextEditor::handleMouseUp(x,y,mask); + + // Used to enable I Agree checkbox if the user scrolled through entire text + BOOL was_scrolled_to_bottom = (mScrollbar->getDocPos() == mScrollbar->getDocPosMax()); + if (mOnScrollEndCallback && was_scrolled_to_bottom) + { + mOnScrollEndCallback(mOnScrollEndData); } return handled; @@ -999,6 +964,24 @@ BOOL LLViewerTextEditor::handleRightMouseDown(S32 x, S32 y, MASK mask) return handled; } +BOOL LLViewerTextEditor::handleMiddleMouseDown(S32 x, S32 y, MASK mask) +{ + BOOL handled = FALSE; + handled = childrenHandleMiddleMouseDown(x, y, mask) != NULL; + if (!handled) + { + handled = LLTextEditor::handleMiddleMouseDown(x, y, mask); + } + return handled; +} + +BOOL LLViewerTextEditor::handleMiddleMouseUp(S32 x, S32 y, MASK mask) +{ + BOOL handled = childrenHandleMiddleMouseUp(x, y, mask) != NULL; + + return handled; +} + BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) { BOOL handled = FALSE; @@ -1021,7 +1004,6 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) } } } - setCursorAtLocalPos( x, y, FALSE ); deselect(); @@ -1059,6 +1041,9 @@ BOOL LLViewerTextEditor::handleDoubleClick(S32 x, S32 y, MASK mask) // delay cursor flashing resetKeystrokeTimer(); + // take selection to 'primary' clipboard + updatePrimary(); + handled = TRUE; } return handled; -- cgit v1.1