Merge branch 'wip/carlosg/input-fixes' into 'master'

Some input fixes

See merge request GNOME/gtk!1757
This commit is contained in:
Matthias Clasen 2020-04-25 00:29:33 +00:00
commit b54178e6a4
10 changed files with 58 additions and 12 deletions

View File

@ -339,6 +339,7 @@ drawing_area_init (DrawingArea *area)
gtk_widget_add_controller (GTK_WIDGET (area), GTK_EVENT_CONTROLLER (gesture));
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
area->brush_size = 1;
}
static GtkWidget *

View File

@ -2313,6 +2313,22 @@ gdk_wayland_seat_remove_touch (GdkWaylandSeat *seat,
g_hash_table_remove (seat->touches, GUINT_TO_POINTER (id));
}
void
gdk_wayland_seat_clear_touchpoints (GdkWaylandSeat *seat,
GdkSurface *surface)
{
GHashTableIter iter;
GdkWaylandTouchData *touch;
g_hash_table_iter_init (&iter, seat->touches);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
{
if (touch->surface == surface)
g_hash_table_iter_remove (&iter);
}
}
static void
mimic_pointer_emulating_touch_info (GdkDevice *device,
GdkWaylandTouchData *touch)

View File

@ -43,4 +43,7 @@ GType gdk_wayland_seat_get_type (void) G_GNUC_CONST;
void gdk_wayland_seat_update_cursor_scale (GdkWaylandSeat *seat);
void gdk_wayland_seat_clear_touchpoints (GdkWaylandSeat *seat,
GdkSurface *surface);
#endif /* __GDK_WAYLAND_SEAT_H__ */

View File

@ -2683,6 +2683,14 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
static void
gdk_wayland_surface_hide (GdkSurface *surface)
{
GdkSeat *seat;
seat = gdk_display_get_default_seat (surface->display);
if (surface->autohide)
gdk_seat_ungrab (seat);
gdk_wayland_seat_clear_touchpoints (GDK_WAYLAND_SEAT (seat), surface);
gdk_wayland_surface_hide_surface (surface);
_gdk_surface_clear_update_area (surface);
}

View File

@ -452,8 +452,6 @@ gtk_pad_controller_add_entry (GtkPadController *controller,
.action_name = g_strdup (entry->action_name)
};
g_array_set_size (controller->action_entries, controller->action_entries->len + 1);
for (i = 0; i < controller->action_entries->len; i++)
{
if (entry_compare_func (&new_entry,

View File

@ -540,7 +540,7 @@ create_popup_layout (GtkPopover *popover)
return layout;
}
static void
static gboolean
present_popup (GtkPopover *popover)
{
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
@ -553,7 +553,12 @@ present_popup (GtkPopover *popover)
MAX (req.width, 1),
MAX (req.height, 1),
layout))
update_popover_layout (popover, layout);
{
update_popover_layout (popover, layout);
return TRUE;
}
return FALSE;
}
static void
@ -913,7 +918,9 @@ gtk_popover_show (GtkWidget *widget)
_gtk_widget_set_visible_flag (widget, TRUE);
gtk_widget_realize (widget);
present_popup (popover);
if (!present_popup (popover))
return;
gtk_widget_map (widget);
if (priv->autohide)

View File

@ -459,10 +459,14 @@ gtk_text_handle_init (GtkTextHandle *widget)
GtkTextHandle *
gtk_text_handle_new (GtkWidget *parent)
{
return g_object_new (GTK_TYPE_TEXT_HANDLE,
"parent", parent,
"css-name", I_("cursor-handle"),
NULL);
GtkTextHandle *handle;
handle = g_object_new (GTK_TYPE_TEXT_HANDLE,
"css-name", I_("cursor-handle"),
NULL);
gtk_widget_set_parent (GTK_WIDGET (handle), parent);
return handle;
}
void

View File

@ -832,6 +832,7 @@ static void column_sizing_notify (GObject
GParamSpec *pspec,
gpointer data);
static void gtk_tree_view_stop_rubber_band (GtkTreeView *tree_view);
static void ensure_unprelighted (GtkTreeView *tree_view);
static void update_prelight (GtkTreeView *tree_view,
int x,
int y);
@ -2788,6 +2789,7 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
gtk_tree_view_stop_editing (tree_view, FALSE);
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
if (button > 3)
{
@ -2813,6 +2815,9 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
return;
}
if (sequence)
update_prelight (tree_view, x, y);
/* are we in an arrow? */
if (tree_view->prelight_node &&
tree_view->arrow_prelit &&
@ -2913,7 +2918,6 @@ gtk_tree_view_click_gesture_pressed (GtkGestureClick *gesture,
_gtk_tree_view_set_focus_column (tree_view, column);
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
modifiers = gdk_event_get_modifier_state (event);
@ -3270,10 +3274,12 @@ gtk_tree_view_click_gesture_released (GtkGestureClick *gesture,
gdouble y,
GtkTreeView *tree_view)
{
GdkEventSequence *sequence;
gboolean modify, extend;
guint button;
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
if (button != GDK_BUTTON_PRIMARY ||
tree_view->button_pressed_node == NULL ||
@ -3312,6 +3318,9 @@ gtk_tree_view_click_gesture_released (GtkGestureClick *gesture,
tree_view->button_pressed_tree = NULL;
tree_view->button_pressed_node = NULL;
if (sequence)
ensure_unprelighted (tree_view);
}
/* GtkWidget::motion_event function set.

View File

@ -7989,7 +7989,7 @@ gtk_window_maybe_revoke_implicit_grab (GtkWindow *window,
if (focus->toplevel != window)
continue;
if (device && focus->device == device &&
if ((!device || focus->device == device) &&
focus->target != grab_widget &&
!gtk_widget_is_ancestor (focus->target, grab_widget))
gtk_window_set_pointer_focus_grab (window,

View File

@ -202,7 +202,7 @@ gtk_window_group_list_windows (GtkWindowGroup *window_group)
{
GtkWindow *window = toplevel->data;
if (window_group == _gtk_window_get_window_group (window))
if (window_group == gtk_window_get_group (window))
group_windows = g_list_prepend (group_windows, window);
}