hrev45846 adds 1 changeset to branch 'master' old head: 8832917f2c44f719acff0909010f8e639e8838ab new head: 8a8a325a1e68b83f1eb4960cc9842778554c83bd overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=8a8a325+%5E8832917 ---------------------------------------------------------------------------- 8a8a325: Terminal: work-around missing/out-of-order modifiers events ... more aggressively than before: * Only use modifiers(). * Before forwarding any relevant event to the active state, first check whether the modifiers have changed. While the issues should really be fixed where they originate (app server?), this hopefully fixes all situations where the hyperlink mode gets stuck. [ Ingo Weinhold <ingo_weinhold@xxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev45846 Commit: 8a8a325a1e68b83f1eb4960cc9842778554c83bd URL: http://cgit.haiku-os.org/haiku/commit/?id=8a8a325 Author: Ingo Weinhold <ingo_weinhold@xxxxxx> Date: Mon May 20 00:30:12 2013 UTC ---------------------------------------------------------------------------- 2 files changed, 28 insertions(+), 12 deletions(-) src/apps/terminal/TermView.cpp | 38 ++++++++++++++++++++++++++------------ src/apps/terminal/TermView.h | 2 ++ ---------------------------------------------------------------------------- diff --git a/src/apps/terminal/TermView.cpp b/src/apps/terminal/TermView.cpp index 610208e..393f0a1 100644 --- a/src/apps/terminal/TermView.cpp +++ b/src/apps/terminal/TermView.cpp @@ -1156,7 +1156,8 @@ void TermView::AttachedToWindow() { fMouseButtons = 0; - fModifiers = modifiers(); + + _UpdateModifiers(); // update the terminal size because it may have changed while the TermView // was detached from the window. On such conditions FrameResized was not @@ -1380,14 +1381,9 @@ TermView::WindowActivated(bool active) _Deactivate(); } - fActiveState->WindowActivated(active); + _UpdateModifiers(); - if (active) { - int32 oldModifiers = fModifiers; - fModifiers = modifiers(); - if (fModifiers != oldModifiers) - fActiveState->ModifiersChanged(oldModifiers, fModifiers); - } + fActiveState->WindowActivated(active); } @@ -1409,6 +1405,8 @@ TermView::MakeFocus(bool focusState) void TermView::KeyDown(const char *bytes, int32 numBytes) { + _UpdateModifiers(); + fActiveState->KeyDown(bytes, numBytes); } @@ -1601,10 +1599,7 @@ TermView::MessageReceived(BMessage *msg) case B_MODIFIERS_CHANGED: { - int32 oldModifiers = fModifiers; - fModifiers = msg->GetInt32("modifiers", 0); - if (fModifiers != oldModifiers) - fActiveState->ModifiersChanged(oldModifiers, fModifiers); + _UpdateModifiers(); break; } @@ -2376,6 +2371,8 @@ TermView::MouseDown(BPoint where) if (!IsFocus()) MakeFocus(); + _UpdateModifiers(); + BMessage* currentMessage = Window()->CurrentMessage(); int32 buttons = currentMessage->GetInt32("buttons", 0); @@ -2389,6 +2386,8 @@ TermView::MouseDown(BPoint where) void TermView::MouseMoved(BPoint where, uint32 transit, const BMessage *message) { + _UpdateModifiers(); + fActiveState->MouseMoved(where, transit, message, fModifiers); } @@ -2396,6 +2395,8 @@ TermView::MouseMoved(BPoint where, uint32 transit, const BMessage *message) void TermView::MouseUp(BPoint where) { + _UpdateModifiers(); + int32 buttons = Window()->CurrentMessage()->GetInt32("buttons", 0); fActiveState->MouseUp(where, buttons); @@ -2976,6 +2977,19 @@ TermView::_CancelInputMethod() void +TermView::_UpdateModifiers() +{ + // TODO: This method is a general work-around for missing or out-of-order + // B_MODIFIERS_CHANGED messages. This should really be fixed where it is + // broken (app server?). + int32 oldModifiers = fModifiers; + fModifiers = modifiers(); + if (fModifiers != oldModifiers && fActiveState != NULL) + fActiveState->ModifiersChanged(oldModifiers, fModifiers); +} + + +void TermView::_NextState(State* state) { if (state != fActiveState) { diff --git a/src/apps/terminal/TermView.h b/src/apps/terminal/TermView.h index a1ab24e..53f7e70 100644 --- a/src/apps/terminal/TermView.h +++ b/src/apps/terminal/TermView.h @@ -251,6 +251,8 @@ private: void _HandleInputMethodLocationRequest(); void _CancelInputMethod(); + void _UpdateModifiers(); + void _NextState(State* state); private: