Fix for repeating in some instances, e.g. pidgin.
This commit is contained in:
1 parent
4d29f2bb23
commit
b232c1eebb
20 files changed
+921
-7
No files matched your search
@@ -32,6 +32,7 @@ type Activity struct {
|
||||
// may be waiting for application settings after ordinary input has aged out.
|
||||
TitleInterruptionSequence uint64
|
||||
PlainCharacterArrow bool
|
||||
PlainEnter bool
|
||||
Selecting bool
|
||||
Intent Intent
|
||||
Sequence uint64
|
||||
@@ -55,6 +56,7 @@ type IntentTracker struct {
|
||||
intent Intent
|
||||
clipboard ClipboardAction
|
||||
plainCharacterArrow bool
|
||||
plainEnter bool
|
||||
selecting bool
|
||||
at time.Time
|
||||
}
|
||||
@@ -78,6 +80,7 @@ func (tracker *IntentTracker) Observe(event Event) {
|
||||
tracker.clipboard = NoClipboardAction
|
||||
tracker.selecting = false
|
||||
tracker.plainCharacterArrow = false
|
||||
tracker.plainEnter = false
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -127,6 +130,9 @@ func (tracker *IntentTracker) Observe(event Event) {
|
||||
tracker.plainCharacterArrow = (name == "Left" || name == "Right") && !ctrl && !shift && !alt &&
|
||||
!tracker.held["Super_L"] && !tracker.held["Super_R"] &&
|
||||
!tracker.held["ISO_Level3_Shift"] && !tracker.held["ISO_Level5_Shift"]
|
||||
tracker.plainEnter = (name == "Return" || name == "Enter") && !ctrl && !shift && !alt &&
|
||||
!tracker.held["Super_L"] && !tracker.held["Super_R"] &&
|
||||
!tracker.held["ISO_Level3_Shift"] && !tracker.held["ISO_Level5_Shift"]
|
||||
tracker.selecting = shift && (intent == CharacterIntent || intent == WordIntent || intent == LineIntent)
|
||||
tracker.intent, tracker.at = intent, time.Now()
|
||||
}
|
||||
@@ -141,6 +147,7 @@ func (tracker *IntentTracker) Reset() {
|
||||
tracker.intent, tracker.at = OtherIntent, time.Time{}
|
||||
tracker.clipboard, tracker.selecting = NoClipboardAction, false
|
||||
tracker.plainCharacterArrow = false
|
||||
tracker.plainEnter = false
|
||||
}
|
||||
|
||||
func (tracker *IntentTracker) RecentInput() Activity {
|
||||
@@ -149,6 +156,6 @@ func (tracker *IntentTracker) RecentInput() Activity {
|
||||
if time.Since(tracker.at) > time.Second {
|
||||
return Activity{InputSequence: tracker.sequence, TitleInterruptionSequence: tracker.titleInterruptionSequence}
|
||||
}
|
||||
return Activity{PlainCharacterArrow: tracker.plainCharacterArrow, InputSequence: tracker.sequence, Intent: tracker.intent, Sequence: tracker.sequence, Clipboard: tracker.clipboard, Selecting: tracker.selecting,
|
||||
return Activity{PlainCharacterArrow: tracker.plainCharacterArrow, PlainEnter: tracker.plainEnter, InputSequence: tracker.sequence, Intent: tracker.intent, Sequence: tracker.sequence, Clipboard: tracker.clipboard, Selecting: tracker.selecting,
|
||||
TitleInterruptionSequence: tracker.titleInterruptionSequence}
|
||||
}
|
||||
Reference in new issue
Block a user