mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
Merge branch 'kill-display-changed' into 'master'
Kill display changed See merge request GNOME/gtk!807
This commit is contained in:
commit
574a25b09c
@ -129,8 +129,6 @@ static void gtk_button_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_button_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
static void gtk_button_unrealize (GtkWidget * widget);
|
||||
static void gtk_real_button_clicked (GtkButton * button);
|
||||
static void gtk_real_button_activate (GtkButton *button);
|
||||
@ -204,7 +202,6 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
gobject_class->set_property = gtk_button_set_property;
|
||||
gobject_class->get_property = gtk_button_get_property;
|
||||
|
||||
widget_class->display_changed = gtk_button_display_changed;
|
||||
widget_class->unrealize = gtk_button_unrealize;
|
||||
widget_class->state_flags_changed = gtk_button_state_flags_changed;
|
||||
widget_class->grab_notify = gtk_button_grab_notify;
|
||||
@ -923,18 +920,6 @@ gtk_button_get_use_underline (GtkButton *button)
|
||||
return priv->use_underline;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON (widget);
|
||||
GtkButtonPrivate *priv = gtk_button_get_instance_private (button);
|
||||
|
||||
/* If the button is being pressed while the display changes the
|
||||
release might never occur, so we reset the state. */
|
||||
priv->button_down = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state)
|
||||
|
@ -256,12 +256,11 @@ static void gtk_file_chooser_button_drag_data_received (GtkWidget *wi
|
||||
GtkSelectionData *data);
|
||||
static void gtk_file_chooser_button_show (GtkWidget *widget);
|
||||
static void gtk_file_chooser_button_hide (GtkWidget *widget);
|
||||
static void gtk_file_chooser_button_root (GtkWidget *widget);
|
||||
static void gtk_file_chooser_button_map (GtkWidget *widget);
|
||||
static gboolean gtk_file_chooser_button_mnemonic_activate (GtkWidget *widget,
|
||||
gboolean group_cycling);
|
||||
static void gtk_file_chooser_button_style_updated (GtkWidget *widget);
|
||||
static void gtk_file_chooser_button_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *old_display);
|
||||
static void gtk_file_chooser_button_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
|
||||
@ -395,7 +394,7 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
|
||||
widget_class->hide = gtk_file_chooser_button_hide;
|
||||
widget_class->map = gtk_file_chooser_button_map;
|
||||
widget_class->style_updated = gtk_file_chooser_button_style_updated;
|
||||
widget_class->display_changed = gtk_file_chooser_button_display_changed;
|
||||
widget_class->root = gtk_file_chooser_button_root;
|
||||
widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate;
|
||||
widget_class->state_flags_changed = gtk_file_chooser_button_state_flags_changed;
|
||||
widget_class->measure = gtk_file_chooser_button_measure;
|
||||
@ -1494,16 +1493,13 @@ gtk_file_chooser_button_style_updated (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_button_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *old_display)
|
||||
gtk_file_chooser_button_root (GtkWidget *widget)
|
||||
{
|
||||
if (GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->display_changed)
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->display_changed (widget, old_display);
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->root (widget);
|
||||
|
||||
change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget));
|
||||
}
|
||||
|
||||
|
||||
/* ******************* *
|
||||
* Utility Functions *
|
||||
* ******************* */
|
||||
|
@ -461,8 +461,6 @@ static void gtk_file_chooser_widget_unmap (GtkWidget *w
|
||||
static void gtk_file_chooser_widget_root (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_unroot (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_style_updated (GtkWidget *widget);
|
||||
static void gtk_file_chooser_widget_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
|
||||
static gboolean gtk_file_chooser_widget_set_current_folder (GtkFileChooser *chooser,
|
||||
GFile *folder,
|
||||
@ -536,6 +534,7 @@ static void search_shortcut_handler (GtkFileChooserWidget *impl);
|
||||
static void recent_shortcut_handler (GtkFileChooserWidget *impl);
|
||||
static void places_shortcut_handler (GtkFileChooserWidget *impl);
|
||||
static void update_appearance (GtkFileChooserWidget *impl);
|
||||
static void check_icon_theme (GtkFileChooserWidget *impl);
|
||||
|
||||
static void operation_mode_set (GtkFileChooserWidget *impl, OperationMode mode);
|
||||
static void location_mode_set (GtkFileChooserWidget *impl, LocationMode new_mode);
|
||||
@ -3538,6 +3537,10 @@ gtk_file_chooser_widget_unroot (GtkWidget *widget)
|
||||
priv->toplevel_current_focus_widget = NULL;
|
||||
}
|
||||
|
||||
remove_settings_signal (impl, gtk_widget_get_display (widget));
|
||||
check_icon_theme (impl);
|
||||
emit_default_size_changed (impl);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
@ -3622,27 +3625,6 @@ gtk_file_chooser_widget_style_updated (GtkWidget *widget)
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_widget_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display)
|
||||
{
|
||||
GtkFileChooserWidget *impl;
|
||||
|
||||
profile_start ("start", NULL);
|
||||
|
||||
impl = GTK_FILE_CHOOSER_WIDGET (widget);
|
||||
|
||||
if (GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->display_changed)
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->display_changed (widget, previous_display);
|
||||
|
||||
remove_settings_signal (impl, previous_display);
|
||||
check_icon_theme (impl);
|
||||
|
||||
emit_default_size_changed (impl);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
set_sort_column (GtkFileChooserWidget *impl)
|
||||
{
|
||||
@ -7919,7 +7901,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
widget_class->root = gtk_file_chooser_widget_root;
|
||||
widget_class->unroot = gtk_file_chooser_widget_unroot;
|
||||
widget_class->style_updated = gtk_file_chooser_widget_style_updated;
|
||||
widget_class->display_changed = gtk_file_chooser_widget_display_changed;
|
||||
|
||||
/*
|
||||
* Signals
|
||||
|
@ -169,9 +169,6 @@ static void gtk_font_chooser_widget_get_property (GObject *objec
|
||||
GParamSpec *pspec);
|
||||
static void gtk_font_chooser_widget_finalize (GObject *object);
|
||||
|
||||
static void gtk_font_chooser_widget_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
|
||||
static gboolean gtk_font_chooser_widget_find_font (GtkFontChooserWidget *fontchooser,
|
||||
const PangoFontDescription *font_desc,
|
||||
GtkTreeIter *iter);
|
||||
@ -670,21 +667,40 @@ gtk_font_chooser_widget_unmap (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
fontconfig_changed (GtkFontChooserWidget *fontchooser)
|
||||
{
|
||||
gtk_font_chooser_widget_load_fonts (fontchooser, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_font_chooser_widget_root (GtkWidget *widget)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->root (widget);
|
||||
|
||||
g_signal_connect_swapped (gtk_widget_get_root (widget), "notify::focus-widget",
|
||||
G_CALLBACK (update_key_capture), widget);
|
||||
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
g_signal_connect_object (settings, "notify::gtk-fontconfig-timestamp",
|
||||
G_CALLBACK (fontconfig_changed), widget, G_CONNECT_SWAPPED);
|
||||
|
||||
gtk_font_chooser_widget_load_fonts (GTK_FONT_CHOOSER_WIDGET (widget), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_font_chooser_widget_unroot (GtkWidget *widget)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (gtk_widget_get_root (widget),
|
||||
update_key_capture, widget);
|
||||
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
g_signal_handlers_disconnect_by_func (settings, fontconfig_changed, widget);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
@ -743,7 +759,6 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
|
||||
g_type_ensure (GTK_TYPE_DELAYED_FONT_DESCRIPTION);
|
||||
g_type_ensure (G_TYPE_THEMED_ICON);
|
||||
|
||||
widget_class->display_changed = gtk_font_chooser_widget_display_changed;
|
||||
widget_class->measure = gtk_font_chooser_widget_measure;
|
||||
widget_class->size_allocate = gtk_font_chooser_widget_size_allocate;
|
||||
widget_class->root = gtk_font_chooser_widget_root;
|
||||
@ -1308,40 +1323,6 @@ gtk_font_chooser_widget_find_font (GtkFontChooserWidget *fontchooser,
|
||||
return valid;
|
||||
}
|
||||
|
||||
static void
|
||||
fontconfig_changed (GtkFontChooserWidget *fontchooser)
|
||||
{
|
||||
gtk_font_chooser_widget_load_fonts (fontchooser, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_font_chooser_widget_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display)
|
||||
{
|
||||
GtkFontChooserWidget *fontchooser = GTK_FONT_CHOOSER_WIDGET (widget);
|
||||
GtkSettings *settings;
|
||||
|
||||
if (GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->display_changed)
|
||||
GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->display_changed (widget, previous_display);
|
||||
|
||||
if (previous_display)
|
||||
{
|
||||
settings = gtk_settings_get_for_display (previous_display);
|
||||
g_signal_handlers_disconnect_by_func (settings, fontconfig_changed, widget);
|
||||
}
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
g_signal_connect_object (settings, "notify::gtk-fontconfig-timestamp",
|
||||
G_CALLBACK (fontconfig_changed), widget, G_CONNECT_SWAPPED);
|
||||
|
||||
if (previous_display == NULL)
|
||||
previous_display = gdk_display_get_default ();
|
||||
|
||||
if (previous_display == gtk_widget_get_display (widget))
|
||||
return;
|
||||
|
||||
gtk_font_chooser_widget_load_fonts (fontchooser, FALSE);
|
||||
}
|
||||
|
||||
static PangoFontFamily *
|
||||
gtk_font_chooser_widget_get_family (GtkFontChooser *chooser)
|
||||
{
|
||||
|
@ -456,8 +456,6 @@ static void gtk_label_set_markup_internal (GtkLabel *label,
|
||||
static void gtk_label_recalculate (GtkLabel *label);
|
||||
static void gtk_label_root (GtkWidget *widget);
|
||||
static void gtk_label_unroot (GtkWidget *widget);
|
||||
static void gtk_label_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *old_display);
|
||||
static gboolean gtk_label_popup_menu (GtkWidget *widget);
|
||||
|
||||
static void gtk_label_set_selectable_hint (GtkLabel *label);
|
||||
@ -609,7 +607,6 @@ gtk_label_class_init (GtkLabelClass *class)
|
||||
widget_class->unmap = gtk_label_unmap;
|
||||
widget_class->root = gtk_label_root;
|
||||
widget_class->unroot = gtk_label_unroot;
|
||||
widget_class->display_changed = gtk_label_display_changed;
|
||||
widget_class->mnemonic_activate = gtk_label_mnemonic_activate;
|
||||
widget_class->drag_data_get = gtk_label_drag_data_get;
|
||||
widget_class->grab_focus = gtk_label_grab_focus;
|
||||
@ -1803,28 +1800,6 @@ gtk_label_setup_mnemonic (GtkLabel *label,
|
||||
g_object_set_qdata (G_OBJECT (label), quark_mnemonic_menu, mnemonic_menu);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_root (GtkWidget *widget)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_label_parent_class)->root (widget);
|
||||
|
||||
gtk_label_setup_mnemonic (label, gtk_widget_get_toplevel (widget), priv->mnemonic_keyval);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_unroot (GtkWidget *widget)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
|
||||
|
||||
gtk_label_setup_mnemonic (label, NULL, priv->mnemonic_keyval);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_label_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
label_shortcut_setting_apply (GtkLabel *label)
|
||||
{
|
||||
@ -1861,6 +1836,50 @@ label_shortcut_setting_changed (GtkSettings *settings)
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_root (GtkWidget *widget)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
|
||||
GtkSettings *settings;
|
||||
gboolean shortcuts_connected;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_label_parent_class)->root (widget);
|
||||
|
||||
gtk_label_setup_mnemonic (label, gtk_widget_get_toplevel (widget), priv->mnemonic_keyval);
|
||||
|
||||
/* The PangoContext is replaced when the display changes, so clear the layouts */
|
||||
gtk_label_clear_layout (GTK_LABEL (widget));
|
||||
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
|
||||
shortcuts_connected =
|
||||
GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (settings), quark_shortcuts_connected));
|
||||
|
||||
if (! shortcuts_connected)
|
||||
{
|
||||
g_signal_connect (settings, "notify::gtk-enable-accels",
|
||||
G_CALLBACK (label_shortcut_setting_changed),
|
||||
NULL);
|
||||
|
||||
g_object_set_qdata (G_OBJECT (settings), quark_shortcuts_connected,
|
||||
GINT_TO_POINTER (TRUE));
|
||||
}
|
||||
|
||||
label_shortcut_setting_apply (GTK_LABEL (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_unroot (GtkWidget *widget)
|
||||
{
|
||||
GtkLabel *label = GTK_LABEL (widget);
|
||||
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
|
||||
|
||||
gtk_label_setup_mnemonic (label, NULL, priv->mnemonic_keyval);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_label_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
mnemonics_visible_apply (GtkWidget *widget,
|
||||
gboolean mnemonics_visible)
|
||||
@ -1913,35 +1932,6 @@ label_mnemonics_visible_changed (GtkWindow *window,
|
||||
GINT_TO_POINTER (mnemonics_visible));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *old_display)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
gboolean shortcuts_connected;
|
||||
|
||||
/* The PangoContext is replaced when the display changes, so clear the layouts */
|
||||
gtk_label_clear_layout (GTK_LABEL (widget));
|
||||
|
||||
settings = gtk_widget_get_settings (widget);
|
||||
|
||||
shortcuts_connected =
|
||||
GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (settings), quark_shortcuts_connected));
|
||||
|
||||
if (! shortcuts_connected)
|
||||
{
|
||||
g_signal_connect (settings, "notify::gtk-enable-accels",
|
||||
G_CALLBACK (label_shortcut_setting_changed),
|
||||
NULL);
|
||||
|
||||
g_object_set_qdata (G_OBJECT (settings), quark_shortcuts_connected,
|
||||
GINT_TO_POINTER (TRUE));
|
||||
}
|
||||
|
||||
label_shortcut_setting_apply (GTK_LABEL (widget));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
label_mnemonic_widget_weak_notify (gpointer data,
|
||||
GObject *where_the_object_was)
|
||||
|
@ -1045,14 +1045,6 @@ menu_change_display (GtkMenu *menu,
|
||||
priv->monitor_num = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
attach_widget_display_changed (GtkWidget *attach_widget,
|
||||
GdkDisplay *previous_display,
|
||||
GtkMenu *menu)
|
||||
{
|
||||
menu_change_display (menu, gtk_widget_get_display (attach_widget));
|
||||
}
|
||||
|
||||
static void
|
||||
attach_widget_root_changed (GObject *attach_widget,
|
||||
GParamSpec *pspec,
|
||||
@ -1115,11 +1107,9 @@ gtk_menu_attach_to_widget (GtkMenu *menu,
|
||||
data = g_slice_new (GtkMenuAttachData);
|
||||
data->attach_widget = attach_widget;
|
||||
|
||||
g_signal_connect (attach_widget, "display-changed",
|
||||
G_CALLBACK (attach_widget_display_changed), menu);
|
||||
g_signal_connect (attach_widget, "notify::root",
|
||||
G_CALLBACK (attach_widget_root_changed), menu);
|
||||
attach_widget_display_changed (attach_widget, NULL, menu);
|
||||
attach_widget_root_changed (G_OBJECT (attach_widget), NULL, menu);
|
||||
|
||||
data->detacher = detacher;
|
||||
g_object_set_data (G_OBJECT (menu), I_(attach_data_key), data);
|
||||
@ -1198,9 +1188,6 @@ gtk_menu_detach (GtkMenu *menu)
|
||||
gtk_window_set_attached_to (toplevel, NULL);
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_by_func (data->attach_widget,
|
||||
(gpointer) attach_widget_display_changed,
|
||||
menu);
|
||||
g_signal_handlers_disconnect_by_func (data->attach_widget,
|
||||
(gpointer) attach_widget_root_changed,
|
||||
menu);
|
||||
|
@ -118,8 +118,7 @@ static gboolean gtk_menu_shell_key_press (GtkEventControllerKey *key,
|
||||
guint keycode,
|
||||
GdkModifierType modifiers,
|
||||
GtkWidget *widget);
|
||||
static void gtk_menu_shell_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
static void gtk_menu_shell_root (GtkWidget *widget);
|
||||
static void multi_press_pressed (GtkGestureMultiPress *gesture,
|
||||
gint n_press,
|
||||
gdouble x,
|
||||
@ -188,7 +187,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
|
||||
object_class->finalize = gtk_menu_shell_finalize;
|
||||
object_class->dispose = gtk_menu_shell_dispose;
|
||||
|
||||
widget_class->display_changed = gtk_menu_shell_display_changed;
|
||||
widget_class->root = gtk_menu_shell_root;
|
||||
|
||||
container_class->add = gtk_menu_shell_add;
|
||||
container_class->remove = gtk_menu_shell_remove;
|
||||
@ -945,9 +944,10 @@ gtk_menu_shell_key_press (GtkEventControllerKey *key,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_shell_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display)
|
||||
gtk_menu_shell_root (GtkWidget *widget)
|
||||
{
|
||||
GTK_WIDGET_CLASS (gtk_menu_shell_parent_class)->root (widget);
|
||||
|
||||
gtk_menu_shell_reset_key_hash (GTK_MENU_SHELL (widget));
|
||||
}
|
||||
|
||||
|
@ -151,8 +151,8 @@ static gboolean gtk_path_bar_slider_down_defocus (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GtkPathBar *path_bar);
|
||||
static void gtk_path_bar_style_updated (GtkWidget *widget);
|
||||
static void gtk_path_bar_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
static void gtk_path_bar_root (GtkWidget *widget);
|
||||
static void gtk_path_bar_unroot (GtkWidget *widget);
|
||||
static void gtk_path_bar_check_icon_theme (GtkPathBar *path_bar);
|
||||
static void gtk_path_bar_update_button_appearance (GtkPathBar *path_bar,
|
||||
ButtonData *button_data,
|
||||
@ -273,7 +273,8 @@ gtk_path_bar_class_init (GtkPathBarClass *path_bar_class)
|
||||
widget_class->measure = gtk_path_bar_measure;
|
||||
widget_class->size_allocate = gtk_path_bar_size_allocate;
|
||||
widget_class->style_updated = gtk_path_bar_style_updated;
|
||||
widget_class->display_changed = gtk_path_bar_display_changed;
|
||||
widget_class->root = gtk_path_bar_root;
|
||||
widget_class->unroot = gtk_path_bar_unroot;
|
||||
|
||||
container_class->add = gtk_path_bar_add;
|
||||
container_class->forall = gtk_path_bar_forall;
|
||||
@ -729,19 +730,21 @@ gtk_path_bar_style_updated (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_bar_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display)
|
||||
gtk_path_bar_root (GtkWidget *widget)
|
||||
{
|
||||
if (GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->display_changed)
|
||||
GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->display_changed (widget, previous_display);
|
||||
|
||||
/* We might nave a new settings, so we remove the old one */
|
||||
if (previous_display)
|
||||
remove_settings_signal (GTK_PATH_BAR (widget), previous_display);
|
||||
GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->root (widget);
|
||||
|
||||
gtk_path_bar_check_icon_theme (GTK_PATH_BAR (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_path_bar_unroot (GtkWidget *widget)
|
||||
{
|
||||
remove_settings_signal (GTK_PATH_BAR (widget), gtk_widget_get_display (widget));
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_path_bar_scroll_controller_scroll (GtkEventControllerScroll *scroll,
|
||||
gdouble dx,
|
||||
|
@ -324,8 +324,7 @@ static void gtk_text_direction_changed (GtkWidget *widget,
|
||||
GtkTextDirection previous_dir);
|
||||
static void gtk_text_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
static void gtk_text_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *old_display);
|
||||
static void gtk_text_root (GtkWidget *widget);
|
||||
|
||||
static gboolean gtk_text_drag_drop (GtkWidget *widget,
|
||||
GdkDrop *drop,
|
||||
@ -679,7 +678,7 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
widget_class->drag_end = gtk_text_drag_end;
|
||||
widget_class->direction_changed = gtk_text_direction_changed;
|
||||
widget_class->state_flags_changed = gtk_text_state_flags_changed;
|
||||
widget_class->display_changed = gtk_text_display_changed;
|
||||
widget_class->root = gtk_text_root;
|
||||
widget_class->mnemonic_activate = gtk_text_mnemonic_activate;
|
||||
widget_class->popup_menu = gtk_text_popup_menu;
|
||||
widget_class->drag_drop = gtk_text_drag_drop;
|
||||
@ -3029,9 +3028,10 @@ gtk_text_state_flags_changed (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *old_display)
|
||||
gtk_text_root (GtkWidget *widget)
|
||||
{
|
||||
GTK_WIDGET_CLASS (gtk_text_parent_class)->root (widget);
|
||||
|
||||
gtk_text_recompute (GTK_TEXT (widget));
|
||||
}
|
||||
|
||||
|
@ -186,8 +186,8 @@ static gboolean gtk_toolbar_focus (GtkWidget *widget,
|
||||
GtkDirectionType dir);
|
||||
static void gtk_toolbar_move_focus (GtkWidget *widget,
|
||||
GtkDirectionType dir);
|
||||
static void gtk_toolbar_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
static void gtk_toolbar_root (GtkWidget *widget);
|
||||
static void gtk_toolbar_unroot (GtkWidget *widget);
|
||||
static void gtk_toolbar_finalize (GObject *object);
|
||||
static void gtk_toolbar_dispose (GObject *object);
|
||||
static void gtk_toolbar_add (GtkContainer *container,
|
||||
@ -362,7 +362,8 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
|
||||
GTK_TYPE_TOOLBAR,
|
||||
G_CALLBACK (gtk_toolbar_move_focus));
|
||||
|
||||
widget_class->display_changed = gtk_toolbar_display_changed;
|
||||
widget_class->root = gtk_toolbar_root;
|
||||
widget_class->unroot = gtk_toolbar_unroot;
|
||||
widget_class->popup_menu = gtk_toolbar_popup_menu;
|
||||
|
||||
container_class->add = gtk_toolbar_add;
|
||||
@ -1645,41 +1646,40 @@ settings_change_notify (GtkSettings *settings,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_toolbar_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display)
|
||||
gtk_toolbar_root (GtkWidget *widget)
|
||||
{
|
||||
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
|
||||
GtkToolbarPrivate *priv = toolbar->priv;
|
||||
GtkSettings *old_settings = toolbar_get_settings (toolbar);
|
||||
GtkSettings *settings;
|
||||
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_toolbar_parent_class)->root (widget);
|
||||
|
||||
settings = gtk_widget_get_settings (GTK_WIDGET (toolbar));
|
||||
|
||||
if (settings == old_settings)
|
||||
return;
|
||||
|
||||
if (old_settings)
|
||||
{
|
||||
g_signal_handler_disconnect (old_settings, priv->settings_connection);
|
||||
priv->settings_connection = 0;
|
||||
g_object_unref (old_settings);
|
||||
}
|
||||
|
||||
if (settings)
|
||||
{
|
||||
priv->settings_connection =
|
||||
g_signal_connect (settings, "notify",
|
||||
G_CALLBACK (settings_change_notify),
|
||||
toolbar);
|
||||
priv->settings_connection =
|
||||
g_signal_connect (settings, "notify",
|
||||
G_CALLBACK (settings_change_notify),
|
||||
toolbar);
|
||||
|
||||
priv->settings = g_object_ref (settings);
|
||||
}
|
||||
else
|
||||
priv->settings = NULL;
|
||||
priv->settings = g_object_ref (settings);
|
||||
|
||||
animation_change_notify (toolbar);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_toolbar_unroot (GtkWidget *widget)
|
||||
{
|
||||
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
|
||||
GtkToolbarPrivate *priv = toolbar->priv;
|
||||
|
||||
if (priv->settings_connection)
|
||||
g_signal_handler_disconnect (priv->settings, priv->settings_connection);
|
||||
priv->settings_connection = 0;
|
||||
g_clear_object (&priv->settings);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_toolbar_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
static int
|
||||
find_drop_index (GtkToolbar *toolbar,
|
||||
gint x,
|
||||
|
139
gtk/gtkwidget.c
139
gtk/gtkwidget.c
@ -632,8 +632,6 @@ static void gtk_widget_real_move_focus (GtkWidget
|
||||
GtkDirectionType direction);
|
||||
static gboolean gtk_widget_real_keynav_failed (GtkWidget *widget,
|
||||
GtkDirectionType direction);
|
||||
static void gtk_widget_root (GtkWidget *widget);
|
||||
static void gtk_widget_unroot (GtkWidget *widget);
|
||||
#ifdef G_ENABLE_CONSISTENCY_CHECKS
|
||||
static void gtk_widget_verify_invariants (GtkWidget *widget);
|
||||
static void gtk_widget_push_verify_invariants (GtkWidget *widget);
|
||||
@ -918,7 +916,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
klass->drag_motion = NULL;
|
||||
klass->drag_drop = NULL;
|
||||
klass->drag_data_received = NULL;
|
||||
klass->display_changed = NULL;
|
||||
klass->can_activate_accel = gtk_widget_real_can_activate_accel;
|
||||
klass->query_tooltip = gtk_widget_real_query_tooltip;
|
||||
klass->style_updated = gtk_widget_real_style_updated;
|
||||
@ -2077,25 +2074,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkWidget::display-changed:
|
||||
* @widget: the object on which the signal is emitted
|
||||
* @previous_display: (allow-none): the previous screen, or %NULL if the
|
||||
* widget was not associated with a screen before
|
||||
*
|
||||
* The ::display-changed signal gets emitted when the
|
||||
* display of a widget has changed.
|
||||
*/
|
||||
widget_signals[DISPLAY_CHANGED] =
|
||||
g_signal_new (I_("display-changed"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkWidgetClass, display_changed),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
GDK_TYPE_DISPLAY);
|
||||
|
||||
/**
|
||||
* GtkWidget::can-activate-accel:
|
||||
* @widget: the object which received the signal
|
||||
@ -2865,21 +2843,22 @@ gtk_widget_new (GType type,
|
||||
return widget;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
gtk_widget_root (GtkWidget *widget)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
|
||||
/* roots are rooted by default */
|
||||
if (GTK_IS_ROOT (widget))
|
||||
return;
|
||||
|
||||
g_assert (priv->root == NULL);
|
||||
g_assert (!priv->realized);
|
||||
g_assert (priv->parent);
|
||||
g_assert (priv->parent->priv->root);
|
||||
|
||||
priv->root = priv->parent->priv->root;
|
||||
if (GTK_IS_ROOT (widget))
|
||||
{
|
||||
g_assert (priv->root == GTK_ROOT (widget));
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert (priv->root == NULL);
|
||||
priv->root = priv->parent->priv->root;
|
||||
}
|
||||
|
||||
if (priv->context)
|
||||
gtk_style_context_set_display (priv->context, gtk_root_get_display (priv->root));
|
||||
@ -2889,19 +2868,16 @@ gtk_widget_root (GtkWidget *widget)
|
||||
|
||||
GTK_WIDGET_GET_CLASS (widget)->root (widget);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_ROOT]);
|
||||
if (!GTK_IS_ROOT (widget))
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_ROOT]);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
gtk_widget_unroot (GtkWidget *widget)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GtkWidgetSurfaceTransformData *surface_transform_data;
|
||||
|
||||
/* roots are rooted by default and cannot be unrooted */
|
||||
if (GTK_IS_ROOT (widget))
|
||||
return;
|
||||
|
||||
g_assert (priv->root);
|
||||
g_assert (!priv->realized);
|
||||
|
||||
@ -2915,9 +2891,16 @@ gtk_widget_unroot (GtkWidget *widget)
|
||||
if (priv->context)
|
||||
gtk_style_context_set_display (priv->context, gdk_display_get_default ());
|
||||
|
||||
priv->root = NULL;
|
||||
if (g_object_get_qdata (G_OBJECT (widget), quark_pango_context))
|
||||
g_object_set_qdata (G_OBJECT (widget), quark_pango_context, NULL);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_ROOT]);
|
||||
_gtk_tooltip_hide (widget);
|
||||
|
||||
if (!GTK_IS_ROOT (widget))
|
||||
{
|
||||
priv->root = NULL;
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_ROOT]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6691,84 +6674,6 @@ gtk_widget_real_direction_changed (GtkWidget *widget,
|
||||
gtk_widget_queue_resize (widget);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GtkWidget *previous_toplevel;
|
||||
GdkDisplay *previous_display;
|
||||
GdkDisplay *new_display;
|
||||
} HierarchyChangedInfo;
|
||||
|
||||
static void
|
||||
do_display_change (GtkWidget *widget,
|
||||
GdkDisplay *old_display,
|
||||
GdkDisplay *new_display)
|
||||
{
|
||||
if (old_display != new_display)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
|
||||
if (old_display)
|
||||
{
|
||||
PangoContext *context = g_object_get_qdata (G_OBJECT (widget), quark_pango_context);
|
||||
if (context)
|
||||
g_object_set_qdata (G_OBJECT (widget), quark_pango_context, NULL);
|
||||
}
|
||||
|
||||
_gtk_tooltip_hide (widget);
|
||||
|
||||
if (new_display && priv->context)
|
||||
gtk_style_context_set_display (priv->context, new_display);
|
||||
|
||||
g_signal_emit (widget, widget_signals[DISPLAY_CHANGED], 0, old_display);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_propagate_display_changed_recurse (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
HierarchyChangedInfo *info = client_data;
|
||||
GtkWidget *child;
|
||||
|
||||
g_object_ref (widget);
|
||||
|
||||
do_display_change (widget, info->previous_display, info->new_display);
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
gtk_widget_propagate_display_changed_recurse (child, client_data);
|
||||
}
|
||||
|
||||
g_object_unref (widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_widget_propagate_display_changed:
|
||||
* @widget: a #GtkWidget
|
||||
* @previous_display: Previous display
|
||||
*
|
||||
* Propagates changes in the display for a widget to all
|
||||
* children, emitting #GtkWidget::display-changed.
|
||||
**/
|
||||
void
|
||||
_gtk_widget_propagate_display_changed (GtkWidget *widget,
|
||||
GdkDisplay *previous_display)
|
||||
{
|
||||
HierarchyChangedInfo info;
|
||||
|
||||
info.previous_display = previous_display;
|
||||
info.new_display = gtk_widget_get_display (widget);
|
||||
|
||||
if (previous_display)
|
||||
g_object_ref (previous_display);
|
||||
|
||||
gtk_widget_propagate_display_changed_recurse (widget, &info);
|
||||
|
||||
if (previous_display)
|
||||
g_object_unref (previous_display);
|
||||
}
|
||||
|
||||
static void
|
||||
reset_style_recurse (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
|
@ -209,8 +209,6 @@ struct _GtkWidget
|
||||
* context menu.
|
||||
* @get_accessible: Returns the accessible object that describes the
|
||||
* widget to an assistive technology.
|
||||
* @display_changed: Signal emitted when the #GdkDisplay of a widget has
|
||||
* changed.
|
||||
* @can_activate_accel: Signal allows applications and derived widgets
|
||||
* to override the default GtkWidget handling for determining whether
|
||||
* an accelerator can be activated.
|
||||
@ -314,8 +312,6 @@ struct _GtkWidgetClass
|
||||
*/
|
||||
AtkObject * (* get_accessible) (GtkWidget *widget);
|
||||
|
||||
void (* display_changed) (GtkWidget *widget,
|
||||
GdkDisplay *previous_display);
|
||||
gboolean (* can_activate_accel) (GtkWidget *widget,
|
||||
guint signal_id);
|
||||
|
||||
|
@ -209,6 +209,8 @@ struct _GtkWidgetPrivate
|
||||
GdkCursor *cursor;
|
||||
};
|
||||
|
||||
void gtk_widget_root (GtkWidget *widget);
|
||||
void gtk_widget_unroot (GtkWidget *widget);
|
||||
GtkCssNode * gtk_widget_get_css_node (GtkWidget *widget);
|
||||
void _gtk_widget_set_visible_flag (GtkWidget *widget,
|
||||
gboolean visible);
|
||||
|
@ -8510,7 +8510,9 @@ gtk_window_set_display (GtkWindow *window,
|
||||
G_CALLBACK (gtk_window_on_theme_variant_changed), window);
|
||||
#endif
|
||||
|
||||
_gtk_widget_propagate_display_changed (widget, previous_display);
|
||||
gtk_widget_unroot (widget);
|
||||
gtk_widget_root (widget);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_DISPLAY]);
|
||||
|
||||
if (was_mapped)
|
||||
|
Loading…
Reference in New Issue
Block a user