forked from AuroraMiddleware/gtk
Add a flags argument to gtk_widget_pick
This will be used to let the inspector and other users pick insensitive widgets again. For now, update all callers to pass no flags, preserving the current behavior.
This commit is contained in:
parent
6bc32a3d5d
commit
b804235aea
@ -243,7 +243,7 @@ pressed_cb (GtkGesture *gesture,
|
||||
GtkWidget *child;
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
child = gtk_widget_pick (widget, x, y);
|
||||
child = gtk_widget_pick (widget, x, y, 0);
|
||||
|
||||
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_SECONDARY)
|
||||
{
|
||||
@ -320,7 +320,7 @@ released_cb (GtkGesture *gesture,
|
||||
GtkWidget *child;
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
child = gtk_widget_pick (widget, x, y);
|
||||
child = gtk_widget_pick (widget, x, y, 0);
|
||||
|
||||
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_PRIMARY)
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ puzzle_button_pressed (GtkGestureMultiPress *gesture,
|
||||
int l, t, i;
|
||||
int pos;
|
||||
|
||||
child = gtk_widget_pick (grid, x, y);
|
||||
child = gtk_widget_pick (grid, x, y, 0);
|
||||
|
||||
if (!child)
|
||||
{
|
||||
|
@ -1040,4 +1040,8 @@ typedef enum {
|
||||
GTK_PLACES_OPEN_NEW_WINDOW = 1 << 2
|
||||
} GtkPlacesOpenFlags;
|
||||
|
||||
typedef enum {
|
||||
GTK_PICK_ALL = 1 << 0
|
||||
} GtkPickFlags;
|
||||
|
||||
#endif /* __GTK_ENUMS_H__ */
|
||||
|
@ -3928,7 +3928,7 @@ gtk_flow_box_get_child_at_pos (GtkFlowBox *box,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GtkWidget *child = gtk_widget_pick (GTK_WIDGET (box), x, y);
|
||||
GtkWidget *child = gtk_widget_pick (GTK_WIDGET (box), x, y, 0);
|
||||
|
||||
if (!child)
|
||||
return NULL;
|
||||
|
@ -1703,7 +1703,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
target = gtk_window_lookup_pointer_focus_implicit_grab (toplevel, device, sequence);
|
||||
|
||||
if (!target)
|
||||
target = gtk_widget_pick (toplevel_widget, x, y);
|
||||
target = gtk_widget_pick (toplevel_widget, x, y, 0);
|
||||
|
||||
if (!target)
|
||||
target = toplevel_widget;
|
||||
@ -1742,7 +1742,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
if (event->any.type == GDK_BUTTON_RELEASE)
|
||||
{
|
||||
GtkWidget *new_target;
|
||||
new_target = gtk_widget_pick (GTK_WIDGET (toplevel), x, y);
|
||||
new_target = gtk_widget_pick (GTK_WIDGET (toplevel), x, y, 0);
|
||||
if (new_target == NULL)
|
||||
new_target = GTK_WIDGET (toplevel);
|
||||
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), target, new_target, event,
|
||||
|
@ -135,7 +135,7 @@ gtk_pointer_focus_repick_target (GtkPointerFocus *focus)
|
||||
{
|
||||
GtkWidget *target;
|
||||
|
||||
target = gtk_widget_pick (GTK_WIDGET (focus->toplevel), focus->x, focus->y);
|
||||
target = gtk_widget_pick (GTK_WIDGET (focus->toplevel), focus->x, focus->y, 0);
|
||||
if (target == NULL)
|
||||
target = GTK_WIDGET (focus->toplevel);
|
||||
gtk_pointer_focus_set_target (focus, target);
|
||||
|
@ -1865,7 +1865,7 @@ gtk_range_long_press_gesture_pressed (GtkGestureLongPress *gesture,
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
GtkWidget *mouse_location;
|
||||
|
||||
mouse_location = gtk_widget_pick (GTK_WIDGET (range), x, y);
|
||||
mouse_location = gtk_widget_pick (GTK_WIDGET (range), x, y, 0);
|
||||
|
||||
if (mouse_location == priv->slider_widget && !priv->zoom)
|
||||
{
|
||||
@ -1909,7 +1909,7 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
|
||||
"gtk-primary-button-warps-slider", &primary_warps,
|
||||
NULL);
|
||||
|
||||
mouse_location = gtk_widget_pick (widget, x, y);
|
||||
mouse_location = gtk_widget_pick (widget, x, y, 0);
|
||||
|
||||
/* For the purposes of this function, we ignore fill and highlight and
|
||||
* handle them like the trough */
|
||||
|
@ -434,7 +434,7 @@ _gtk_widget_find_at_coords (GdkSurface *surface,
|
||||
if (!event_widget)
|
||||
return NULL;
|
||||
|
||||
picked_widget = gtk_widget_pick (event_widget, surface_x, surface_y);
|
||||
picked_widget = gtk_widget_pick (event_widget, surface_x, surface_y, 0);
|
||||
|
||||
if (picked_widget != NULL)
|
||||
gtk_widget_translate_coordinates (event_widget, picked_widget, surface_x, surface_y, widget_x, widget_y);
|
||||
|
@ -11006,6 +11006,7 @@ gtk_widget_contains (GtkWidget *widget,
|
||||
* @widget: the widget to query
|
||||
* @x: X coordinate to test, relative to @widget's origin
|
||||
* @y: Y coordinate to test, relative to @widget's origin
|
||||
* @flags: Flags to influence what is picked
|
||||
*
|
||||
* Finds the descendant of @widget (including @widget itself) closest
|
||||
* to the screen at the point (@x, @y). The point must be given in
|
||||
@ -11024,20 +11025,26 @@ gtk_widget_contains (GtkWidget *widget,
|
||||
* coordinate or %NULL if none.
|
||||
**/
|
||||
GtkWidget *
|
||||
gtk_widget_pick (GtkWidget *widget,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
gtk_widget_pick (GtkWidget *widget,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GtkPickFlags flags)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
if (!gtk_widget_get_can_pick (widget) ||
|
||||
!_gtk_widget_is_sensitive (widget) ||
|
||||
!_gtk_widget_is_drawable (widget))
|
||||
if (!_gtk_widget_is_drawable (widget))
|
||||
return NULL;
|
||||
|
||||
if ((flags & GTK_PICK_ALL) == 0)
|
||||
{
|
||||
if (!gtk_widget_get_can_pick (widget) ||
|
||||
!_gtk_widget_is_sensitive (widget))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (priv->overflow)
|
||||
{
|
||||
default:
|
||||
@ -11061,7 +11068,7 @@ gtk_widget_pick (GtkWidget *widget,
|
||||
{
|
||||
GtkWidget *picked;
|
||||
|
||||
picked = gtk_window_pick_popover (GTK_WINDOW (widget), x, y);
|
||||
picked = gtk_window_pick_popover (GTK_WINDOW (widget), x, y, flags);
|
||||
if (picked)
|
||||
return picked;
|
||||
}
|
||||
@ -11097,7 +11104,7 @@ gtk_widget_pick (GtkWidget *widget,
|
||||
|
||||
graphene_point3d_interpolate (&p0, &p1, p0.z / (p0.z - p1.z), &res);
|
||||
|
||||
picked = gtk_widget_pick (child, res.x, res.y);
|
||||
picked = gtk_widget_pick (child, res.x, res.y, flags);
|
||||
if (picked)
|
||||
return picked;
|
||||
}
|
||||
|
@ -751,9 +751,10 @@ gboolean gtk_widget_contains (GtkWidget *widget,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_widget_pick (GtkWidget *widget,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
GtkWidget * gtk_widget_pick (GtkWidget *widget,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GtkPickFlags flags);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_add_controller (GtkWidget *widget,
|
||||
|
@ -736,9 +736,10 @@ static void popover_get_rect (GtkWindowPopover *popover,
|
||||
cairo_rectangle_int_t *rect);
|
||||
|
||||
GtkWidget *
|
||||
gtk_window_pick_popover (GtkWindow *window,
|
||||
double x,
|
||||
double y)
|
||||
gtk_window_pick_popover (GtkWindow *window,
|
||||
double x,
|
||||
double y,
|
||||
GtkPickFlags flags)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
GList *popovers;
|
||||
@ -753,7 +754,7 @@ gtk_window_pick_popover (GtkWindow *window,
|
||||
x, y,
|
||||
&dest_x, &dest_y);
|
||||
|
||||
picked = gtk_widget_pick (popover->widget, dest_x, dest_y);
|
||||
picked = gtk_widget_pick (popover->widget, dest_x, dest_y, flags);
|
||||
if (picked)
|
||||
return picked;
|
||||
}
|
||||
|
@ -162,9 +162,10 @@ void gtk_window_maybe_revoke_implicit_grab (GtkWindow *window,
|
||||
void gtk_window_maybe_update_cursor (GtkWindow *window,
|
||||
GtkWidget *widget,
|
||||
GdkDevice *device);
|
||||
GtkWidget * gtk_window_pick_popover (GtkWindow *window,
|
||||
double x,
|
||||
double y);
|
||||
GtkWidget * gtk_window_pick_popover (GtkWindow *window,
|
||||
double x,
|
||||
double y,
|
||||
GtkPickFlags flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -55,7 +55,7 @@ find_widget_at_pointer (GdkDevice *device)
|
||||
gdk_surface_get_device_position (gtk_widget_get_surface (widget),
|
||||
device, &x, &y, NULL);
|
||||
|
||||
widget = gtk_widget_pick (widget, x, y);
|
||||
widget = gtk_widget_pick (widget, x, y, 0);
|
||||
}
|
||||
|
||||
return widget;
|
||||
|
@ -187,7 +187,7 @@ gtk_transform_tester_snapshot (GtkWidget *widget,
|
||||
const float py = y;
|
||||
GtkWidget *picked;
|
||||
#if 1
|
||||
picked = gtk_widget_pick (widget, px, py);
|
||||
picked = gtk_widget_pick (widget, px, py, 0);
|
||||
#else
|
||||
{
|
||||
int dx, dy;
|
||||
|
Loading…
Reference in New Issue
Block a user