From 161c8e5edcf4c5c192393bd5f03e01a2c6e927de Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 26 Sep 2014 23:29:38 +0200 Subject: [PATCH] Editbox selection should be stopped when the mouse button goes up, even if it happens outside of the box. --- code/nel/src/gui/group_editbox.cpp | 21 +++++++++++---------- code/nel/src/gui/widget_manager.cpp | 6 ++++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/code/nel/src/gui/group_editbox.cpp b/code/nel/src/gui/group_editbox.cpp index 751d9241b..c18c69134 100644 --- a/code/nel/src/gui/group_editbox.cpp +++ b/code/nel/src/gui/group_editbox.cpp @@ -1320,6 +1320,16 @@ namespace NLGUI } } + // if click, and not frozen, then get the focus + if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen) + { + _SelectingText = false; + if (_SelectCursorPos == _CursorPos) + _CurrSelection = NULL; + + return true; + } + if (!isIn(eventDesc.getX(), eventDesc.getY())) return false; @@ -1329,6 +1339,7 @@ namespace NLGUI _SelectingText = true; stopParentBlink(); CWidgetManager::getInstance()->setCaptureKeyboard (this); + CWidgetManager::getInstance()->setCapturePointerLeft (this); // set the right cursor position uint newCurPos; bool cursorAtPreviousLineEnd; @@ -1356,16 +1367,6 @@ namespace NLGUI return true; } - // if click, and not frozen, then get the focus - if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouseleftup && !_Frozen) - { - _SelectingText = false; - if (_SelectCursorPos == _CursorPos) - _CurrSelection = NULL; - - return true; - } - if (eventDesc.getEventTypeExtended() == NLGUI::CEventDescriptorMouse::mouserightdown) { CWidgetManager::getInstance()->setCapturePointerRight(this); diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 18a1f066f..a448603c0 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -2539,6 +2539,12 @@ namespace NLGUI { if ( getCapturePointerLeft() != NULL) { + if( !handled ) + { + CCtrlBase *c = getCapturePointerLeft(); + c->handleEvent( evnt ); + } + setCapturePointerLeft(NULL); handled = true; }