[Xfce4-commits] [xfce/xfdesktop] 04/13: Prevent accidental double clicks in single click mode (Bug #10720)
noreply at xfce.org
noreply at xfce.org
Tue Mar 3 18:21:01 CET 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfdesktop.
commit 1cf3a422ac21ac5e408f967d5424af9be914488f
Author: Thaddaeus Tintenfisch <thad.fisch at gmail.com>
Date: Thu Feb 26 00:27:09 2015 +0100
Prevent accidental double clicks in single click mode (Bug #10720)
Signed-off-by: Eric Koegel <eric.koegel at gmail.com>
---
src/xfdesktop-icon-view.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/xfdesktop-icon-view.c b/src/xfdesktop-icon-view.c
index 6167cf7..a6a5cce 100644
--- a/src/xfdesktop-icon-view.c
+++ b/src/xfdesktop-icon-view.c
@@ -145,7 +145,8 @@ struct _XfdesktopIconViewPrivate
definitely_dragging:1,
allow_rubber_banding:1,
definitely_rubber_banding:1,
- control_click:1;
+ control_click:1,
+ double_click:1;
gint press_start_x;
gint press_start_y;
GdkRectangle band_rect;
@@ -850,6 +851,14 @@ xfdesktop_icon_view_add_move_binding(GtkBindingSet *binding_set,
}
static gboolean
+xfdesktop_icon_view_get_single_click(XfdesktopIconView *icon_view)
+{
+ g_return_val_if_fail(XFDESKTOP_IS_ICON_VIEW(icon_view), FALSE);
+
+ return icon_view->priv->single_click;
+}
+
+static gboolean
xfdesktop_icon_view_button_press(GtkWidget *widget,
GdkEventButton *evt,
gpointer user_data)
@@ -956,6 +965,13 @@ xfdesktop_icon_view_button_press(GtkWidget *widget,
}
}
} else if(evt->type == GDK_2BUTTON_PRESS) {
+ /* filter this event in single click mode */
+ if(xfdesktop_icon_view_get_single_click(icon_view)) {
+ icon_view->priv->double_click = TRUE;
+ xfdesktop_icon_view_unselect_all(icon_view);
+ return TRUE;
+ }
+
/* be sure to cancel any pending drags that might have snuck through.
* this shouldn't happen, but it does sometimes (bug 3426). */
icon_view->priv->maybe_begin_drag = FALSE;
@@ -981,14 +997,6 @@ xfdesktop_icon_view_button_press(GtkWidget *widget,
return FALSE;
}
-static gboolean
-xfdesktop_icon_view_get_single_click(XfdesktopIconView *icon_view)
-{
- g_return_val_if_fail(XFDESKTOP_IS_ICON_VIEW(icon_view), FALSE);
-
- return icon_view->priv->single_click;
-}
-
static gint
xfdesktop_icon_view_get_tooltip_size(XfdesktopIconView *icon_view)
{
@@ -1027,7 +1035,8 @@ xfdesktop_icon_view_button_release(GtkWidget *widget,
&& !(evt->state & GDK_SHIFT_MASK)
&& !(evt->state & GDK_CONTROL_MASK)
&& !icon_view->priv->definitely_dragging
- && !icon_view->priv->definitely_rubber_banding) {
+ && !icon_view->priv->definitely_rubber_banding
+ && !icon_view->priv->double_click) {
/* Find out if we clicked on an icon */
icon_l = g_list_find_custom(icon_view->priv->icons, evt,
(GCompareFunc)xfdesktop_check_icon_clicked);
@@ -1079,6 +1088,7 @@ xfdesktop_icon_view_button_release(GtkWidget *widget,
if(evt->button == 1 || evt->button == 3) {
DBG("unsetting stuff");
icon_view->priv->control_click = FALSE;
+ icon_view->priv->double_click = FALSE;
icon_view->priv->maybe_begin_drag = FALSE;
icon_view->priv->definitely_dragging = FALSE;
if(icon_view->priv->definitely_rubber_banding) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list