mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master Closes #3364 See merge request GNOME/gtk!2898
This commit is contained in:
commit
61e7326f22
@ -43,12 +43,17 @@ private_headers = [
|
||||
'x11/gdkeventsource.h',
|
||||
'gtk-primary-selection-client-protocol.h',
|
||||
'gtk-shell-client-protocol.h',
|
||||
'idle-inhibit-unstable-v1-client-protocol.h',
|
||||
'keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h',
|
||||
'pointer-gestures-unstable-v1-client-protocol.h',
|
||||
'primary-selection-unstable-v1-client-protocol.h',
|
||||
'server-decoration-client-protocol.h',
|
||||
'tablet-unstable-v2-client-protocol.h',
|
||||
'xdg-foreign-unstable-v1-client-protocol.h',
|
||||
'xdg-shell-unstable-v6-client-protocol.h',
|
||||
'xdg-output-unstable-v1-client-protocol.h',
|
||||
'xdg-shell-client-protocol.h',
|
||||
'xdg-shell-unstable-v6-client-protocol.h',
|
||||
'win32',
|
||||
'quartz',
|
||||
'broadway',
|
||||
|
@ -306,10 +306,10 @@ color_matrix_modifies_alpha (GskRenderNode *node)
|
||||
static inline void
|
||||
gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self)
|
||||
{
|
||||
self->bounds.size.width = ceilf (MAX (MAX (self->corner[0].width, self->corner[1].width),
|
||||
MAX (self->corner[2].width, self->corner[3].width)) * 2);
|
||||
self->bounds.size.height = ceilf (MAX (MAX (self->corner[0].height, self->corner[1].height),
|
||||
MAX (self->corner[2].height, self->corner[3].height)) * 2);
|
||||
self->bounds.size.width = MAX (self->corner[0].width + self->corner[1].width,
|
||||
self->corner[3].width + self->corner[2].width);
|
||||
self->bounds.size.height = MAX (self->corner[0].height + self->corner[3].height,
|
||||
self->corner[1].height + self->corner[2].height);
|
||||
}
|
||||
|
||||
static inline gboolean G_GNUC_PURE
|
||||
|
@ -1149,7 +1149,7 @@ gsk_shader_args_builder_to_args (GskShaderArgsBuilder *builder)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_shader_args_builder_free_to_args: (skip)
|
||||
* gsk_shader_args_builder_free_to_args: (skip)
|
||||
* @builder: a #GskShaderArgsBuilder
|
||||
*
|
||||
* Creates a new #GBytes args from the current state of the
|
||||
|
@ -133,12 +133,12 @@ update_pointer_focus (GtkEventController *controller,
|
||||
if (motion->is_pointer != is_pointer)
|
||||
{
|
||||
motion->is_pointer = is_pointer;
|
||||
g_object_notify (G_OBJECT (motion), "is-pointer");
|
||||
g_object_notify_by_pspec (G_OBJECT (motion), props[PROP_IS_POINTER]);
|
||||
}
|
||||
if (motion->contains_pointer != contains_pointer)
|
||||
{
|
||||
motion->contains_pointer = contains_pointer;
|
||||
g_object_notify (G_OBJECT (motion), "contains-pointer");
|
||||
g_object_notify_by_pspec (G_OBJECT (motion), props[PROP_CONTAINS_POINTER]);
|
||||
}
|
||||
g_object_thaw_notify (G_OBJECT (motion));
|
||||
|
||||
|
@ -1387,18 +1387,16 @@ pointer_cb (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *target = GTK_WIDGET (data);
|
||||
GtkWidget *popover;
|
||||
gboolean contains;
|
||||
|
||||
contains = gtk_event_controller_motion_contains_pointer (GTK_EVENT_CONTROLLER_MOTION (object));
|
||||
|
||||
popover = gtk_widget_get_ancestor (target, GTK_TYPE_POPOVER_MENU);
|
||||
|
||||
if (contains)
|
||||
{
|
||||
GtkWidget *target;
|
||||
GtkWidget *popover;
|
||||
|
||||
target = GTK_WIDGET (data);
|
||||
popover = gtk_widget_get_ancestor (target, GTK_TYPE_POPOVER_MENU);
|
||||
|
||||
if (popover)
|
||||
{
|
||||
if (gtk_popover_menu_get_open_submenu (GTK_POPOVER_MENU (popover)) != NULL)
|
||||
@ -1412,6 +1410,7 @@ pointer_cb (GObject *object,
|
||||
GtkModelButton *button = data;
|
||||
|
||||
stop_open (button);
|
||||
gtk_popover_menu_set_active_item (GTK_POPOVER_MENU (popover), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,15 +275,15 @@ focus_out (GtkEventController *controller,
|
||||
}
|
||||
|
||||
static void
|
||||
leave_cb (GtkEventController *controller,
|
||||
gpointer data)
|
||||
leave_cb (GtkEventController *controller,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *target;
|
||||
|
||||
target = gtk_event_controller_get_widget (controller);
|
||||
|
||||
if (!gtk_event_controller_motion_contains_pointer (GTK_EVENT_CONTROLLER_MOTION (controller)))
|
||||
gtk_popover_menu_set_active_item (GTK_POPOVER_MENU (target), NULL);
|
||||
{
|
||||
GtkWidget *target = gtk_event_controller_get_widget (controller);
|
||||
|
||||
gtk_popover_menu_set_active_item (GTK_POPOVER_MENU (target), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -309,7 +309,7 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
|
||||
gtk_widget_add_controller (GTK_WIDGET (popover), controller);
|
||||
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (leave_cb), popover);
|
||||
g_signal_connect (controller, "notify::contains-pointer", G_CALLBACK (leave_cb), popover);
|
||||
gtk_widget_add_controller (GTK_WIDGET (popover), controller);
|
||||
|
||||
controllers = gtk_widget_list_controllers (GTK_WIDGET (popover), GTK_PHASE_CAPTURE, &n_controllers);
|
||||
|
@ -91,6 +91,7 @@ struct _GtkShortcutController
|
||||
GtkShortcutScope scope;
|
||||
GdkModifierType mnemonics_modifiers;
|
||||
|
||||
gulong shortcuts_changed_id;
|
||||
guint custom_shortcuts : 1;
|
||||
|
||||
guint last_activated;
|
||||
@ -213,7 +214,11 @@ gtk_shortcut_controller_set_property (GObject *object,
|
||||
self->shortcuts = g_object_ref (model);
|
||||
self->custom_shortcuts = FALSE;
|
||||
}
|
||||
g_signal_connect_swapped (self->shortcuts, "items-changed", G_CALLBACK (g_list_model_items_changed), self);
|
||||
|
||||
self->shortcuts_changed_id = g_signal_connect_swapped (self->shortcuts,
|
||||
"items-changed",
|
||||
G_CALLBACK (g_list_model_items_changed),
|
||||
self);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -265,7 +270,7 @@ gtk_shortcut_controller_finalize (GObject *object)
|
||||
{
|
||||
GtkShortcutController *self = GTK_SHORTCUT_CONTROLLER (object);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (self->shortcuts, g_list_model_items_changed, self);
|
||||
g_clear_signal_handler (&self->shortcuts_changed_id, self->shortcuts);
|
||||
g_clear_object (&self->shortcuts);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shortcut_controller_parent_class)->finalize (object);
|
||||
@ -442,27 +447,26 @@ gtk_shortcut_controller_handle_event (GtkEventController *controller,
|
||||
}
|
||||
|
||||
static void
|
||||
update_accel (GtkShortcut *shortcut,
|
||||
GtkWidget *widget,
|
||||
gboolean set)
|
||||
update_accel (GtkShortcut *shortcut,
|
||||
GtkActionMuxer *muxer,
|
||||
gboolean set)
|
||||
{
|
||||
GtkShortcutTrigger *trigger;
|
||||
GtkShortcutAction *action;
|
||||
GtkActionMuxer *muxer;
|
||||
GVariant *target;
|
||||
const char *action_name;
|
||||
char *action_and_target;
|
||||
char *accel = NULL;
|
||||
|
||||
trigger = gtk_shortcut_get_trigger (shortcut);
|
||||
action = gtk_shortcut_get_action (shortcut);
|
||||
|
||||
if (!GTK_IS_NAMED_ACTION (action) ||
|
||||
!GTK_IS_KEYVAL_TRIGGER (trigger))
|
||||
if (!muxer)
|
||||
return;
|
||||
|
||||
muxer = _gtk_widget_get_action_muxer (widget, set);
|
||||
if (!muxer)
|
||||
action = gtk_shortcut_get_action (shortcut);
|
||||
if (!GTK_IS_NAMED_ACTION (action))
|
||||
return;
|
||||
|
||||
trigger = gtk_shortcut_get_trigger (shortcut);
|
||||
if (!GTK_IS_KEYVAL_TRIGGER (trigger))
|
||||
return;
|
||||
|
||||
target = gtk_shortcut_get_arguments (shortcut);
|
||||
@ -481,15 +485,18 @@ gtk_shortcut_controller_set_widget (GtkEventController *controller,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkShortcutController *self = GTK_SHORTCUT_CONTROLLER (controller);
|
||||
GListModel *shortcuts = self->shortcuts;
|
||||
GtkActionMuxer *muxer;
|
||||
guint i, p;
|
||||
|
||||
GTK_EVENT_CONTROLLER_CLASS (gtk_shortcut_controller_parent_class)->set_widget (controller, widget);
|
||||
|
||||
for (i = 0, p = g_list_model_get_n_items (G_LIST_MODEL (controller)); i < p; i++)
|
||||
muxer = _gtk_widget_get_action_muxer (widget, TRUE);
|
||||
for (i = 0, p = g_list_model_get_n_items (shortcuts); i < p; i++)
|
||||
{
|
||||
GtkShortcut *shortcut = g_list_model_get_item (G_LIST_MODEL (controller), i);
|
||||
GtkShortcut *shortcut = g_list_model_get_item (shortcuts, i);
|
||||
if (GTK_IS_SHORTCUT (shortcut))
|
||||
update_accel (shortcut, widget, TRUE);
|
||||
update_accel (shortcut, muxer, TRUE);
|
||||
g_object_unref (shortcut);
|
||||
}
|
||||
|
||||
@ -736,7 +743,11 @@ gtk_shortcut_controller_add_shortcut (GtkShortcutController *self,
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (self));
|
||||
if (widget)
|
||||
update_accel (shortcut, widget, TRUE);
|
||||
{
|
||||
GtkActionMuxer *muxer = _gtk_widget_get_action_muxer (widget, TRUE);
|
||||
|
||||
update_accel (shortcut, muxer, TRUE);
|
||||
}
|
||||
|
||||
g_list_store_append (G_LIST_STORE (self->shortcuts), shortcut);
|
||||
g_object_unref (shortcut);
|
||||
@ -767,7 +778,11 @@ gtk_shortcut_controller_remove_shortcut (GtkShortcutController *self,
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (self));
|
||||
if (widget)
|
||||
update_accel (shortcut, widget, FALSE);
|
||||
{
|
||||
GtkActionMuxer *muxer = _gtk_widget_get_action_muxer (widget, FALSE);
|
||||
|
||||
update_accel (shortcut, muxer, FALSE);
|
||||
}
|
||||
|
||||
for (i = 0; i < g_list_model_get_n_items (self->shortcuts); i++)
|
||||
{
|
||||
|
@ -5776,6 +5776,9 @@ gtk_widget_reposition_after (GtkWidget *widget,
|
||||
|
||||
_gtk_widget_update_parent_muxer (widget);
|
||||
|
||||
if (parent->priv->root && priv->root == NULL)
|
||||
gtk_widget_root (widget);
|
||||
|
||||
if (parent->priv->children_observer)
|
||||
{
|
||||
if (prev_previous)
|
||||
@ -5784,9 +5787,6 @@ gtk_widget_reposition_after (GtkWidget *widget,
|
||||
gtk_list_list_model_item_added (parent->priv->children_observer, widget);
|
||||
}
|
||||
|
||||
if (parent->priv->root && priv->root == NULL)
|
||||
gtk_widget_root (widget);
|
||||
|
||||
if (prev_parent == NULL)
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_PARENT]);
|
||||
|
||||
|
@ -479,12 +479,6 @@ _gtk_widget_is_sensitive (GtkWidget *widget)
|
||||
return !(widget->priv->state_flags & GTK_STATE_FLAG_INSENSITIVE);
|
||||
}
|
||||
|
||||
static inline GskTransform *
|
||||
gtk_widget_get_transform (GtkWidget *widget)
|
||||
{
|
||||
return widget->priv->transform;
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_WIDGET_PRIVATE_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user