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.
This commit is contained in:
@@ -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);
|
||||
@@ -2975,6 +2976,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)
|
||||
{
|
||||
|
||||
@@ -251,6 +251,8 @@ private:
|
||||
void _HandleInputMethodLocationRequest();
|
||||
void _CancelInputMethod();
|
||||
|
||||
void _UpdateModifiers();
|
||||
|
||||
void _NextState(State* state);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user