Re: Tweaks to held-key activation



This patch ditches the arbitrary threshold and just uses your repeat rate
delay.

---------- Fri, 8 Apr 2011 02:04:26 -0700 ----------
David Schneider <dnschneid gmail com> wrote:

> Pressing another key cancels the held state.  It would do very bad things
> if you hit another key without letting go of the held one.
> 
> ---------- Fri, 8 Apr 2011 01:02:41 -0700 ----------
> David Schneider <dnschneid gmail com> wrote:
> 
> > As mentioned in a completely unrelated bug report, the hold-key activation
> > of actions is sort of useless as is.
> > I've found that when using it, the end result is that you accidentally spew
> > whatever key you were holding into the launched app.  Not helpful.
> > 
> > This patch changes it so that the action activates upon release (if you
> > held it long enough).  For visual feedback, when you've held it long enough
> > the current matchview turns to the active color.
> > 
> > Maybe it's more useful now; but maybe not.
>From 14b3abf7d11b4452ee47edc3b3ed875c92663ff1 Mon Sep 17 00:00:00 2001
From: David Schneider <dnschneid gmail com>
Date: Fri, 8 Apr 2011 02:40:10 -0700
Subject: [PATCH] Held threshold is now repeat rate threshold.

---
 kupfer/ui/browser.py |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/kupfer/ui/browser.py b/kupfer/ui/browser.py
index cf8ffc5..e16a17b 100644
--- a/kupfer/ui/browser.py
+++ b/kupfer/ui/browser.py
@@ -977,7 +977,6 @@ class Interface (gobject.GObject):
 		self._latest_input_timer = scheduler.Timer()
 		self._slow_input_interval = 2
 		self._key_press_time = None
-		self._key_press_interval = 0.8
 		self._key_press_repeat_threshold = 0.02
 		self._key_pressed = None
 		self._key_held = False
@@ -1157,10 +1156,9 @@ class Interface (gobject.GObject):
 		if ((not text_mode) and self._key_pressed == keyv and
 				keyv not in self.keys_sensible and
 				curtime - self._key_press_time > self._key_press_repeat_threshold):
-			if curtime - self._key_press_time > self._key_press_interval:
-				if not self._key_held:
-					self._key_held_feedback(True)
-					self._key_held = True
+			if not self._key_held:
+				self._key_held_feedback(True)
+				self._key_held = True
 			return True
 		else:
 			self._key_press_time = curtime
-- 
1.7.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]