mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
Merge branch 'wip/carlosg/for-master' into 'master'
Wip/carlosg/for master Closes #3461, #593, #3083, #3009, #3463, and #3426 See merge request GNOME/gtk!2945
This commit is contained in:
commit
c2727e6e04
@ -1555,6 +1555,20 @@ gdk_surface_freeze_updates (GdkSurface *surface)
|
||||
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
request_motion_cb (void *data)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
|
||||
|
||||
if (clock)
|
||||
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
|
||||
surface->request_motion_id = 0;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gdk_surface_thaw_updates:
|
||||
* @surface: a #GdkSurface
|
||||
@ -1578,6 +1592,13 @@ gdk_surface_thaw_updates (GdkSurface *surface)
|
||||
|
||||
if (surface->pending_phases)
|
||||
gdk_frame_clock_request_phase (frame_clock, surface->pending_phases);
|
||||
|
||||
if (surface->request_motion && surface->request_motion_id == 0)
|
||||
{
|
||||
surface->request_motion_id =
|
||||
g_idle_add_full (GDK_PRIORITY_REDRAW + 20,
|
||||
request_motion_cb, surface, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2410,19 +2431,6 @@ gdk_surface_flush_events (GdkFrameClock *clock,
|
||||
surface->frame_clock_events_paused = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
request_motion_cb (void *data)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (data);
|
||||
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
|
||||
|
||||
if (clock)
|
||||
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
|
||||
surface->request_motion_id = 0;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_resume_events (GdkFrameClock *clock,
|
||||
void *data)
|
||||
@ -2434,13 +2442,6 @@ gdk_surface_resume_events (GdkFrameClock *clock,
|
||||
_gdk_display_unpause_events (surface->display);
|
||||
surface->frame_clock_events_paused = FALSE;
|
||||
}
|
||||
|
||||
if (surface->request_motion)
|
||||
{
|
||||
surface->request_motion_id =
|
||||
g_idle_add_full (GDK_PRIORITY_REDRAW + 1,
|
||||
request_motion_cb, surface, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1099,7 +1099,6 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
|
||||
GdkSurface *surface;
|
||||
GtkRequisition entry_req;
|
||||
GtkRequisition tree_req;
|
||||
GtkTreePath *path;
|
||||
int width;
|
||||
|
||||
surface = gtk_native_get_surface (gtk_widget_get_native (completion->entry));
|
||||
@ -1143,14 +1142,6 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
|
||||
gtk_widget_set_size_request (completion->popup_window, width, -1);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (completion->scrolled_window), items * height);
|
||||
|
||||
if (matches > 0)
|
||||
{
|
||||
path = gtk_tree_path_new_from_indices (0, -1);
|
||||
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (completion->tree_view), path,
|
||||
NULL, FALSE, 0.0, 0.0);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
gtk_popover_present (GTK_POPOVER (completion->popup_window));
|
||||
}
|
||||
|
||||
@ -1175,6 +1166,16 @@ gtk_entry_completion_popup (GtkEntryCompletion *completion)
|
||||
|
||||
_gtk_entry_completion_resize_popup (completion);
|
||||
|
||||
if (completion->filter_model)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
||||
path = gtk_tree_path_new_from_indices (0, -1);
|
||||
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (completion->tree_view), path,
|
||||
NULL, FALSE, 0.0, 0.0);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
gtk_popover_popup (GTK_POPOVER (completion->popup_window));
|
||||
}
|
||||
|
||||
|
@ -325,6 +325,9 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
|
||||
if (dx != 0 || dy != 0)
|
||||
g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
|
||||
else if (direction == GDK_SCROLL_SMOOTH &&
|
||||
(scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_DISCRETE) != 0)
|
||||
handled = scroll->active;
|
||||
|
||||
if (direction == GDK_SCROLL_SMOOTH &&
|
||||
scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
|
||||
@ -334,6 +337,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
{
|
||||
g_signal_emit (controller, signals[SCROLL_END], 0);
|
||||
scroll->active = FALSE;
|
||||
handled = FALSE;
|
||||
|
||||
if (scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
|
||||
{
|
||||
|
@ -1493,6 +1493,7 @@ gtk_model_button_init (GtkModelButton *self)
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_PRIMARY);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (gesture_pressed), self);
|
||||
g_signal_connect_swapped (gesture, "released", G_CALLBACK (emit_clicked), self);
|
||||
g_signal_connect_swapped (gesture, "unpaired-release", G_CALLBACK (emit_clicked), self);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture), GTK_PHASE_CAPTURE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
@ -168,11 +168,6 @@ static void gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
double x,
|
||||
double y,
|
||||
GtkRange *range);
|
||||
static void gtk_range_click_gesture_released (GtkGestureClick *gesture,
|
||||
guint n_press,
|
||||
double x,
|
||||
double y,
|
||||
GtkRange *range);
|
||||
static void gtk_range_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
@ -181,6 +176,10 @@ static void gtk_range_drag_gesture_update (GtkGestureDrag *gesture
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
GtkRange *range);
|
||||
static void gtk_range_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
GtkRange *range);
|
||||
static void gtk_range_long_press_gesture_pressed (GtkGestureLongPress *gesture,
|
||||
double x,
|
||||
double y,
|
||||
@ -554,14 +553,14 @@ gtk_range_init (GtkRange *range)
|
||||
G_CALLBACK (gtk_range_drag_gesture_begin), range);
|
||||
g_signal_connect (priv->drag_gesture, "drag-update",
|
||||
G_CALLBACK (gtk_range_drag_gesture_update), range);
|
||||
g_signal_connect (priv->drag_gesture, "drag-end",
|
||||
G_CALLBACK (gtk_range_drag_gesture_end), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
gesture = gtk_gesture_click_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (gtk_range_click_gesture_pressed), range);
|
||||
g_signal_connect (gesture, "released",
|
||||
G_CALLBACK (gtk_range_click_gesture_released), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), GTK_EVENT_CONTROLLER (gesture));
|
||||
gtk_gesture_group (gesture, priv->drag_gesture);
|
||||
|
||||
@ -1976,19 +1975,6 @@ gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_click_gesture_released (GtkGestureClick *gesture,
|
||||
guint n_press,
|
||||
double x,
|
||||
double y,
|
||||
GtkRange *range)
|
||||
{
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
|
||||
priv->in_drag = FALSE;
|
||||
stop_scrolling (range);
|
||||
}
|
||||
|
||||
/* During a slide, move the slider as required given new mouse position */
|
||||
static void
|
||||
update_slider_position (GtkRange *range,
|
||||
@ -2301,6 +2287,18 @@ gtk_range_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
gtk_gesture_set_state (priv->drag_gesture, GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
GtkRange *range)
|
||||
{
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
|
||||
priv->in_drag = FALSE;
|
||||
stop_scrolling (range);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_adjustment_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
|
@ -408,6 +408,11 @@ static void indicator_set_over (Indicator *indicator,
|
||||
static void install_scroll_cursor (GtkScrolledWindow *scrolled_window);
|
||||
static void uninstall_scroll_cursor (GtkScrolledWindow *scrolled_window);
|
||||
|
||||
static void scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
|
||||
double delta_x,
|
||||
double delta_y,
|
||||
GtkEventControllerScroll *scroll);
|
||||
|
||||
static guint signals[LAST_SIGNAL] = {0};
|
||||
static GParamSpec *properties[NUM_PROPERTIES];
|
||||
|
||||
@ -1220,8 +1225,17 @@ captured_scroll_cb (GtkEventControllerScroll *scroll,
|
||||
double delta_y,
|
||||
GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv =
|
||||
gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||
|
||||
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
||||
|
||||
if (priv->smooth_scroll)
|
||||
{
|
||||
scrolled_window_scroll (scrolled_window, delta_x, delta_y, scroll);
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
@ -1305,13 +1319,14 @@ scroll_controller_scroll_begin (GtkEventControllerScroll *scroll,
|
||||
priv->smooth_scroll = TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
scroll_controller_scroll (GtkEventControllerScroll *scroll,
|
||||
static void
|
||||
scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
|
||||
double delta_x,
|
||||
double delta_y,
|
||||
GtkScrolledWindow *scrolled_window)
|
||||
GtkEventControllerScroll *scroll)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||
GtkScrolledWindowPrivate *priv =
|
||||
gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||
gboolean shifted;
|
||||
GdkModifierType state;
|
||||
|
||||
@ -1373,6 +1388,19 @@ scroll_controller_scroll (GtkEventControllerScroll *scroll,
|
||||
g_source_set_name_by_id (priv->scroll_events_overshoot_id,
|
||||
"[gtk] start_scroll_deceleration_cb");
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
scroll_controller_scroll (GtkEventControllerScroll *scroll,
|
||||
double delta_x,
|
||||
double delta_y,
|
||||
GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv =
|
||||
gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||
|
||||
if (!priv->smooth_scroll)
|
||||
scrolled_window_scroll (scrolled_window, delta_x, delta_y, scroll);
|
||||
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
@ -2056,8 +2084,6 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
G_CALLBACK (scroll_controller_scroll), scrolled_window);
|
||||
g_signal_connect (controller, "scroll-end",
|
||||
G_CALLBACK (scroll_controller_scroll_end), scrolled_window);
|
||||
g_signal_connect (controller, "decelerate",
|
||||
G_CALLBACK (scroll_controller_decelerate), scrolled_window);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_BOTH_AXES |
|
||||
@ -2065,6 +2091,8 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (controller, "scroll",
|
||||
G_CALLBACK (captured_scroll_cb), scrolled_window);
|
||||
g_signal_connect (controller, "decelerate",
|
||||
G_CALLBACK (scroll_controller_decelerate), scrolled_window);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
|
@ -2627,7 +2627,7 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
|
||||
* preferring the top left corner (for RTL)
|
||||
* or top right corner (for LTR)
|
||||
*/
|
||||
min_x = gtk_adjustment_get_value (priv->hadjustment);
|
||||
min_x = 0;
|
||||
max_x = min_x + width - child_rect.width;
|
||||
min_y = 0;
|
||||
max_y = min_y + height - gtk_tree_view_get_effective_header_height (tree_view) - child_rect.height;
|
||||
|
@ -1309,10 +1309,10 @@ get_edge_for_coordinates (GtkWindow *window,
|
||||
|
||||
if (x < left && x >= left - handle_size.left)
|
||||
{
|
||||
if (y < top && y >= top - handle_size.top)
|
||||
if (y < top + handle_size.top && y >= top - handle_size.top)
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
|
||||
|
||||
if (y > top + border_rect->size.height &&
|
||||
if (y > top + border_rect->size.height - handle_size.bottom &&
|
||||
y <= top + border_rect->size.height + handle_size.bottom)
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
|
||||
|
||||
@ -1321,24 +1321,36 @@ get_edge_for_coordinates (GtkWindow *window,
|
||||
else if (x > left + border_rect->size.width &&
|
||||
x <= left + border_rect->size.width + handle_size.right)
|
||||
{
|
||||
if (y < top && y >= top - handle_size.top)
|
||||
if (y < top + handle_size.top && y >= top - handle_size.top)
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
|
||||
|
||||
if (y > top + border_rect->size.height &&
|
||||
if (y > top + border_rect->size.height - handle_size.bottom &&
|
||||
y <= top + border_rect->size.height + handle_size.bottom)
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);
|
||||
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_EAST);
|
||||
}
|
||||
|
||||
if (y < top && y >= top - handle_size.top)
|
||||
else if (y < top && y >= top - handle_size.top)
|
||||
{
|
||||
/* NORTH_EAST is handled elsewhere */
|
||||
if (x < left + handle_size.left && x >= left - handle_size.left)
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_WEST);
|
||||
|
||||
if (x > left + border_rect->size.width - handle_size.right &&
|
||||
x <= left + border_rect->size.width + handle_size.right)
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH_EAST);
|
||||
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_NORTH);
|
||||
}
|
||||
else if (y > top + border_rect->size.height &&
|
||||
y <= top + border_rect->size.height + handle_size.bottom)
|
||||
{
|
||||
if (x < left + handle_size.left && x >= left - handle_size.left)
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_WEST);
|
||||
|
||||
if (x > left + border_rect->size.width - handle_size.right &&
|
||||
x <= left + border_rect->size.width + handle_size.right)
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH_EAST);
|
||||
|
||||
return edge_or_minus_one (GDK_SURFACE_EDGE_SOUTH);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user