diff options
-rw-r--r-- | indra/llui/llbutton.cpp | 57 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/sidepanel_inventory.xml | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/widgets/button.xml | 1 |
4 files changed, 39 insertions, 25 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 637024e513..7b015bd576 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -100,7 +100,8 @@ LLButton::Params::Params() hover_glow_amount("hover_glow_amount"), commit_on_return("commit_on_return", true), use_draw_context_alpha("use_draw_context_alpha", true), - badge("badge") + badge("badge"), + handle_right_mouse("handle_right_mouse") { addSynonym(is_toggle, "toggle"); held_down_delay.seconds = 0.5f; @@ -162,7 +163,8 @@ LLButton::LLButton(const LLButton::Params& p) mMouseDownSignal(NULL), mMouseUpSignal(NULL), mHeldDownSignal(NULL), - mUseDrawContextAlpha(p.use_draw_context_alpha) + mUseDrawContextAlpha(p.use_draw_context_alpha), + mHandleRightMouse(p.handle_right_mouse) { static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>()); @@ -457,7 +459,7 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if (!childrenHandleRightMouseDown(x, y, mask)) + if (mHandleRightMouse && !childrenHandleRightMouseDown(x, y, mask)) { // Route future Mouse messages here preemptively. (Release on mouse up.) gFocusMgr.setMouseCapture( this ); @@ -470,37 +472,42 @@ BOOL LLButton::handleRightMouseDown(S32 x, S32 y, MASK mask) // if (pointInView(x, y)) // { // } + // send the mouse down signal + LLUICtrl::handleRightMouseDown(x,y,mask); + // *TODO: Return result of LLUICtrl call above? Should defer to base class + // but this might change the mouse handling of existing buttons in a bad way + // if they are not mouse opaque. } - // send the mouse down signal - LLUICtrl::handleRightMouseDown(x,y,mask); - // *TODO: Return result of LLUICtrl call above? Should defer to base class - // but this might change the mouse handling of existing buttons in a bad way - // if they are not mouse opaque. + return TRUE; } BOOL LLButton::handleRightMouseUp(S32 x, S32 y, MASK mask) { - // We only handle the click if the click both started and ended within us - if( hasMouseCapture() ) + if (mHandleRightMouse) { - // Always release the mouse - gFocusMgr.setMouseCapture( NULL ); + // We only handle the click if the click both started and ended within us + if( hasMouseCapture() ) + { + // Always release the mouse + gFocusMgr.setMouseCapture( NULL ); -// if (pointInView(x, y)) -// { -// mRightMouseUpSignal(this, x,y,mask); -// } - } - else - { - childrenHandleRightMouseUp(x, y, mask); + // if (pointInView(x, y)) + // { + // mRightMouseUpSignal(this, x,y,mask); + // } + } + else + { + childrenHandleRightMouseUp(x, y, mask); + } + + // send the mouse up signal + LLUICtrl::handleRightMouseUp(x,y,mask); + // *TODO: Return result of LLUICtrl call above? Should defer to base class + // but this might change the mouse handling of existing buttons in a bad way. + // if they are not mouse opaque. } - // send the mouse up signal - LLUICtrl::handleRightMouseUp(x,y,mask); - // *TODO: Return result of LLUICtrl call above? Should defer to base class - // but this might change the mouse handling of existing buttons in a bad way. - // if they are not mouse opaque. return TRUE; } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 5880a0e1f2..5968916006 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -129,6 +129,8 @@ public: Optional<LLBadge::Params> badge; + Optional<bool> handle_right_mouse; + Params(); }; @@ -359,6 +361,8 @@ private: bool mForcePressedState; LLFrameTimer mFlashingTimer; + + bool mHandleRightMouse; }; // Build time optimization, generate once in .cpp file diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index 9a91f90f79..1fedd6aab8 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -76,6 +76,7 @@ image_unselected="MarketplaceBtn_Off" image_selected="MarketplaceBtn_Selected" halign="left" + handle_right_mouse="false" follows="top|left|right" is_toggle="true" tab_stop="false" @@ -154,6 +155,7 @@ <button label="Merchant Outbox" is_toggle="true" + handle_right_mouse="false" name="outbox_btn" follows="top|left|right" image_unselected="MarketplaceBtn_Off" diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml index 16241ed84e..302014eb24 100644 --- a/indra/newview/skins/default/xui/en/widgets/button.xml +++ b/indra/newview/skins/default/xui/en/widgets/button.xml @@ -25,5 +25,6 @@ pad_bottom="3" height="23" scale_image="true" + handle_right_mouse="true" use_draw_context_alpha="true"> </button> |