mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 13:37:02 +03:00
When we get a motion notify event, only set of a drag in the core if the mouse has moved at least 5px from where it was pressed.
svn path=/trunk/netsurf/; revision=11076
This commit is contained in:
parent
b067265bd3
commit
ad7283780d
@ -25,6 +25,7 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "desktop/tree.h"
|
||||
#include "desktop/tree_url_node.h"
|
||||
@ -41,6 +42,7 @@ struct nsgtk_treeview {
|
||||
GtkDrawingArea *drawing_area;
|
||||
int mouse_pressed_x;
|
||||
int mouse_pressed_y;
|
||||
int last_x, last_y;
|
||||
browser_mouse_state mouse_state;
|
||||
struct tree *tree;
|
||||
};
|
||||
@ -265,6 +267,11 @@ gboolean nsgtk_tree_window_button_press_event(GtkWidget *widget,
|
||||
if (event->state & GDK_MOD1_MASK)
|
||||
tw->mouse_state |= BROWSER_MOUSE_MOD_3;
|
||||
|
||||
/* Record where we pressed, for use when determining whether to start
|
||||
* a drag in motion notify events. */
|
||||
tw->last_x = event->x;
|
||||
tw->last_y = event->y;
|
||||
|
||||
tree_mouse_action(tree, tw->mouse_state, event->x, event->y);
|
||||
|
||||
return TRUE;
|
||||
@ -335,6 +342,17 @@ gboolean nsgtk_tree_window_motion_notify_event(GtkWidget *widget,
|
||||
struct nsgtk_treeview *tw = (struct nsgtk_treeview *) g;
|
||||
struct tree *tree = tw->tree;
|
||||
|
||||
if ((abs(event->x - tw->last_x) < 5) &&
|
||||
(abs(event->y - tw->last_y) < 5)) {
|
||||
/* Mouse hasn't moved far enough from press coordinate for this
|
||||
* to be considered a drag. */
|
||||
return FALSE;
|
||||
} else {
|
||||
/* This is a drag, ensure it's always treated as such, even if
|
||||
* we drag back over the press location */
|
||||
tw->last_x = INT_MIN;
|
||||
tw->last_y = INT_MIN;
|
||||
}
|
||||
|
||||
/* Handle modifiers being removed */
|
||||
if (tw->mouse_state & BROWSER_MOUSE_MOD_1 && !shift)
|
||||
|
Loading…
Reference in New Issue
Block a user