[totem] Only popup controls when mouse moves a certain distance
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] Only popup controls when mouse moves a certain distance
- Date: Thu, 2 Sep 2010 18:29:05 +0000 (UTC)
commit aa769696289b1498e2c0cec00bc0f117ebf9f8d8
Author: Ralf Ebert <info ralfebert de>
Date: Sat Jan 2 06:31:44 2010 +0100
Only popup controls when mouse moves a certain distance
Only show the fullscreen popups when the mouse moves more
than 30 pixels (or events) within 200 msecs.
https://bugzilla.gnome.org/show_bug.cgi?id=331241
src/totem-fullscreen.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/src/totem-fullscreen.c b/src/totem-fullscreen.c
index 1d4e537..8a5ae3a 100644
--- a/src/totem-fullscreen.c
+++ b/src/totem-fullscreen.c
@@ -39,6 +39,8 @@
#include "gsd-media-keys-window.h"
#define FULLSCREEN_POPUP_TIMEOUT 5
+#define FULLSCREEN_MOTION_TIME 200 /* in milliseconds */
+#define FULLSCREEN_MOTION_NUM_EVENTS 30
static void totem_fullscreen_dispose (GObject *object);
static void totem_fullscreen_finalize (GObject *object);
@@ -70,6 +72,8 @@ struct _TotemFullscreenPrivate {
gboolean popup_in_progress;
gboolean pointer_on_control;
guint motion_handler_id;
+ guint motion_start_time;
+ guint motion_num_events;
GtkBuilder *xml;
};
@@ -294,7 +298,25 @@ G_MODULE_EXPORT gboolean
totem_fullscreen_motion_notify (GtkWidget *widget, GdkEventMotion *event,
TotemFullscreen *fs)
{
- if (!fs->priv->pointer_on_control)
+ guint motion_delay;
+
+ /* Only after FULLSCREEN_MOTION_NUM_EVENTS motion events,
+ in FULLSCREEN_MOTION_TIME milliseconds will we show
+ the popups */
+ motion_delay = event->time - fs->priv->motion_start_time;
+
+ if (fs->priv->motion_start_time == 0 ||
+ motion_delay < 0 ||
+ motion_delay > FULLSCREEN_MOTION_SEQUENCE_WINDOW_MS) {
+ fs->priv->motion_start_time = event->time;
+ fs->priv->motion_num_events = 0;
+ return FALSE;
+ }
+
+ fs->priv->motion_num_events++;
+
+ if (!fs->priv->pointer_on_control &&
+ fs->priv->motion_num_events > FULLSCREEN_MOTION_NUM_EVENTS)
totem_fullscreen_show_popups (fs, TRUE);
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]