widget: Turn screen-changed signal into display-changed

This commit is contained in:
Benjamin Otte 2017-10-30 22:19:02 +01:00
parent 59cfd56365
commit 44614394e6
17 changed files with 146 additions and 162 deletions

View File

@ -116,8 +116,8 @@ static void gtk_button_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_button_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void gtk_button_display_changed (GtkWidget *widget,
GdkDisplay *previous_display);
static void gtk_button_unrealize (GtkWidget * widget);
static gint gtk_button_grab_broken (GtkWidget * widget,
GdkEventGrabBroken * event);
@ -200,7 +200,7 @@ gtk_button_class_init (GtkButtonClass *klass)
gobject_class->get_property = gtk_button_get_property;
widget_class->measure = gtk_button_measure_;
widget_class->screen_changed = gtk_button_screen_changed;
widget_class->display_changed = gtk_button_display_changed;
widget_class->unrealize = gtk_button_unrealize;
widget_class->grab_broken_event = gtk_button_grab_broken;
widget_class->key_release_event = gtk_button_key_release;
@ -1039,19 +1039,16 @@ gtk_button_update_state (GtkButton *button)
}
static void
gtk_button_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
gtk_button_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
GtkButton *button;
GtkButtonPrivate *priv;
if (!gtk_widget_has_screen (widget))
return;
button = GTK_BUTTON (widget);
priv = button->priv;
/* If the button is being pressed while the screen changes the
/* If the button is being pressed while the display changes the
release might never occur, so we reset the state. */
if (priv->button_down)
{

View File

@ -433,8 +433,8 @@ static void gtk_entry_direction_changed (GtkWidget *widget,
GtkTextDirection previous_dir);
static void gtk_entry_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static void gtk_entry_screen_changed (GtkWidget *widget,
GdkScreen *old_screen);
static void gtk_entry_display_changed (GtkWidget *widget,
GdkDisplay *old_display);
static gboolean gtk_entry_drag_drop (GtkWidget *widget,
GdkDragContext *context,
@ -730,7 +730,7 @@ gtk_entry_class_init (GtkEntryClass *class)
widget_class->drag_end = gtk_entry_drag_end;
widget_class->direction_changed = gtk_entry_direction_changed;
widget_class->state_flags_changed = gtk_entry_state_flags_changed;
widget_class->screen_changed = gtk_entry_screen_changed;
widget_class->display_changed = gtk_entry_display_changed;
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
widget_class->grab_notify = gtk_entry_grab_notify;
@ -4315,8 +4315,8 @@ gtk_entry_state_flags_changed (GtkWidget *widget,
}
static void
gtk_entry_screen_changed (GtkWidget *widget,
GdkScreen *old_screen)
gtk_entry_display_changed (GtkWidget *widget,
GdkDisplay *old_display)
{
gtk_entry_recompute (GTK_ENTRY (widget));
}

View File

@ -277,8 +277,8 @@ static void gtk_file_chooser_button_map (GtkWidget *wi
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_screen_changed (GtkWidget *widget,
GdkScreen *old_screen);
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);
@ -412,7 +412,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->screen_changed = gtk_file_chooser_button_screen_changed;
widget_class->display_changed = gtk_file_chooser_button_display_changed;
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;
@ -1553,12 +1553,11 @@ gtk_file_chooser_button_style_updated (GtkWidget *widget)
}
static void
gtk_file_chooser_button_screen_changed (GtkWidget *widget,
GdkScreen *old_screen)
gtk_file_chooser_button_display_changed (GtkWidget *widget,
GdkDisplay *old_display)
{
if (GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->screen_changed)
GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->screen_changed (widget,
old_screen);
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);
change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget));
}

View File

@ -462,9 +462,9 @@ static void gtk_file_chooser_widget_map (GtkWidget *w
static void gtk_file_chooser_widget_unmap (GtkWidget *widget);
static void gtk_file_chooser_widget_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel);
static void gtk_file_chooser_widget_style_updated (GtkWidget *widget);
static void gtk_file_chooser_widget_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
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_key_press_event (GtkWidget *widget,
GdkEventKey *event);
@ -3614,7 +3614,7 @@ cancel_all_operations (GtkFileChooserWidget *impl)
/* Removes the settings signal handler. It's safe to call multiple times */
static void
remove_settings_signal (GtkFileChooserWidget *impl,
GdkScreen *screen)
GdkDisplay *display)
{
GtkFileChooserWidgetPrivate *priv = impl->priv;
@ -3622,7 +3622,7 @@ remove_settings_signal (GtkFileChooserWidget *impl,
{
GtkSettings *settings;
settings = gtk_settings_get_for_screen (screen);
settings = gtk_settings_get_for_display (display);
g_signal_handler_disconnect (settings,
priv->settings_signal_id);
priv->settings_signal_id = 0;
@ -3652,7 +3652,7 @@ gtk_file_chooser_widget_dispose (GObject *object)
priv->extra_widget = NULL;
}
remove_settings_signal (impl, gtk_widget_get_screen (GTK_WIDGET (impl)));
remove_settings_signal (impl, gtk_widget_get_display (GTK_WIDGET (impl)));
if (priv->bookmarks_manager)
{
@ -3813,8 +3813,8 @@ gtk_file_chooser_widget_style_updated (GtkWidget *widget)
}
static void
gtk_file_chooser_widget_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
gtk_file_chooser_widget_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
GtkFileChooserWidget *impl;
@ -3822,10 +3822,10 @@ gtk_file_chooser_widget_screen_changed (GtkWidget *widget,
impl = GTK_FILE_CHOOSER_WIDGET (widget);
if (GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->screen_changed)
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->screen_changed (widget, previous_screen);
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_screen);
remove_settings_signal (impl, previous_display);
check_icon_theme (impl);
emit_default_size_changed (impl);
@ -8127,7 +8127,7 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
widget_class->unmap = gtk_file_chooser_widget_unmap;
widget_class->hierarchy_changed = gtk_file_chooser_widget_hierarchy_changed;
widget_class->style_updated = gtk_file_chooser_widget_style_updated;
widget_class->screen_changed = gtk_file_chooser_widget_screen_changed;
widget_class->display_changed = gtk_file_chooser_widget_display_changed;
widget_class->key_press_event = gtk_file_chooser_widget_key_press_event;
widget_class->measure = gtk_file_chooser_widget_measure;
widget_class->size_allocate = gtk_file_chooser_widget_size_allocate;

View File

@ -128,8 +128,8 @@ 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_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void gtk_font_chooser_widget_display_changed (GtkWidget *widget,
GdkDisplay *previous_display);
static void gtk_font_chooser_widget_style_updated (GtkWidget *widget);
@ -637,7 +637,7 @@ 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->screen_changed = gtk_font_chooser_widget_screen_changed;
widget_class->display_changed = gtk_font_chooser_widget_display_changed;
widget_class->style_updated = gtk_font_chooser_widget_style_updated;
widget_class->measure = gtk_font_chooser_widget_measure;
widget_class->size_allocate = gtk_font_chooser_widget_size_allocate;
@ -1111,28 +1111,28 @@ fontconfig_changed (GtkFontChooserWidget *fontchooser)
}
static void
gtk_font_chooser_widget_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
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)->screen_changed)
GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->screen_changed (widget, previous_screen);
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_screen)
if (previous_display)
{
settings = gtk_settings_get_for_screen (previous_screen);
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_screen == NULL)
previous_screen = gdk_screen_get_default ();
if (previous_display == NULL)
previous_display = gdk_display_get_default ();
if (previous_screen == gtk_widget_get_screen (widget))
if (previous_display == gtk_widget_get_display (widget))
return;
gtk_font_chooser_widget_load_fonts (fontchooser, FALSE);

View File

@ -198,7 +198,7 @@ gtk_invisible_set_screen (GtkInvisible *invisible,
priv->screen = screen;
if (screen != previous_screen)
_gtk_widget_propagate_screen_changed (widget, previous_screen);
_gtk_widget_propagate_display_changed (widget, gdk_screen_get_display (previous_screen));
g_object_notify (G_OBJECT (invisible), "screen");
if (was_realized)

View File

@ -446,8 +446,8 @@ static void gtk_label_set_markup_internal (GtkLabel *label,
static void gtk_label_recalculate (GtkLabel *label);
static void gtk_label_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static void gtk_label_screen_changed (GtkWidget *widget,
GdkScreen *old_screen);
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);
@ -600,7 +600,7 @@ gtk_label_class_init (GtkLabelClass *class)
widget_class->motion_notify_event = gtk_label_motion;
widget_class->leave_notify_event = gtk_label_leave_notify;
widget_class->hierarchy_changed = gtk_label_hierarchy_changed;
widget_class->screen_changed = gtk_label_screen_changed;
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;
@ -1916,18 +1916,15 @@ label_mnemonics_visible_changed (GtkWindow *window,
}
static void
gtk_label_screen_changed (GtkWidget *widget,
GdkScreen *old_screen)
gtk_label_display_changed (GtkWidget *widget,
GdkDisplay *old_display)
{
GtkSettings *settings;
gboolean shortcuts_connected;
/* The PangoContext is replaced when the screen changes, so clear the layouts */
/* The PangoContext is replaced when the display changes, so clear the layouts */
gtk_label_clear_layout (GTK_LABEL (widget));
if (!gtk_widget_has_screen (widget))
return;
settings = gtk_widget_get_settings (widget);
shortcuts_connected =

View File

@ -1293,20 +1293,17 @@ menu_change_screen (GtkMenu *menu,
{
GtkMenuPrivate *priv = menu->priv;
if (gtk_widget_has_screen (GTK_WIDGET (menu)))
{
if (new_screen == gtk_widget_get_screen (GTK_WIDGET (menu)))
return;
}
if (new_screen == gtk_widget_get_screen (GTK_WIDGET (menu)))
return;
gtk_window_set_screen (GTK_WINDOW (priv->toplevel), new_screen);
priv->monitor_num = -1;
}
static void
attach_widget_screen_changed (GtkWidget *attach_widget,
GdkScreen *previous_screen,
GtkMenu *menu)
attach_widget_display_changed (GtkWidget *attach_widget,
GdkDisplay *previous_display,
GtkMenu *menu)
{
if (gtk_widget_has_screen (attach_widget) &&
!g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen"))
@ -1366,9 +1363,9 @@ gtk_menu_attach_to_widget (GtkMenu *menu,
data = g_slice_new (GtkMenuAttachData);
data->attach_widget = attach_widget;
g_signal_connect (attach_widget, "screen-changed",
G_CALLBACK (attach_widget_screen_changed), menu);
attach_widget_screen_changed (attach_widget, NULL, menu);
g_signal_connect (attach_widget, "display-changed",
G_CALLBACK (attach_widget_display_changed), menu);
attach_widget_display_changed (attach_widget, NULL, menu);
data->detacher = detacher;
g_object_set_data (G_OBJECT (menu), I_(attach_data_key), data);
@ -1445,7 +1442,7 @@ gtk_menu_detach (GtkMenu *menu)
gtk_window_set_attached_to (toplevel, NULL);
g_signal_handlers_disconnect_by_func (data->attach_widget,
(gpointer) attach_widget_screen_changed,
(gpointer) attach_widget_display_changed,
menu);
if (data->detacher)
@ -4329,7 +4326,7 @@ gtk_menu_set_screen (GtkMenu *menu,
{
GtkWidget *attach_widget = gtk_menu_get_attach_widget (menu);
if (attach_widget)
attach_widget_screen_changed (attach_widget, NULL, menu);
attach_widget_display_changed (attach_widget, NULL, menu);
}
}

View File

@ -122,8 +122,8 @@ static gint gtk_menu_shell_button_release (GtkWidget *widget,
GdkEventButton *event);
static gint gtk_menu_shell_key_press (GtkWidget *widget,
GdkEventKey *event);
static void gtk_menu_shell_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void gtk_menu_shell_display_changed (GtkWidget *widget,
GdkDisplay *previous_display);
static gboolean gtk_menu_shell_grab_broken (GtkWidget *widget,
GdkEventGrabBroken *event);
static void gtk_menu_shell_add (GtkContainer *container,
@ -182,7 +182,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
widget_class->button_release_event = gtk_menu_shell_button_release;
widget_class->grab_broken_event = gtk_menu_shell_grab_broken;
widget_class->key_press_event = gtk_menu_shell_key_press;
widget_class->screen_changed = gtk_menu_shell_screen_changed;
widget_class->display_changed = gtk_menu_shell_display_changed;
container_class->add = gtk_menu_shell_add;
container_class->remove = gtk_menu_shell_remove;
@ -915,8 +915,8 @@ gtk_menu_shell_key_press (GtkWidget *widget,
}
static void
gtk_menu_shell_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
gtk_menu_shell_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
gtk_menu_shell_reset_key_hash (GTK_MENU_SHELL (widget));
}

View File

@ -179,8 +179,8 @@ static void gtk_path_bar_grab_notify (GtkWidget *widget,
static void gtk_path_bar_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static void gtk_path_bar_style_updated (GtkWidget *widget);
static void gtk_path_bar_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void gtk_path_bar_display_changed (GtkWidget *widget,
GdkDisplay *previous_display);
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,
@ -306,7 +306,7 @@ gtk_path_bar_class_init (GtkPathBarClass *path_bar_class)
widget_class->unmap = gtk_path_bar_unmap;
widget_class->size_allocate = gtk_path_bar_size_allocate;
widget_class->style_updated = gtk_path_bar_style_updated;
widget_class->screen_changed = gtk_path_bar_screen_changed;
widget_class->display_changed = gtk_path_bar_display_changed;
widget_class->grab_notify = gtk_path_bar_grab_notify;
widget_class->state_flags_changed = gtk_path_bar_state_flags_changed;
@ -375,13 +375,13 @@ gtk_path_bar_finalize (GObject *object)
/* Removes the settings signal handler. It's safe to call multiple times */
static void
remove_settings_signal (GtkPathBar *path_bar,
GdkScreen *screen)
GdkDisplay *display)
{
if (path_bar->priv->settings_signal_id)
{
GtkSettings *settings;
settings = gtk_settings_get_for_screen (screen);
settings = gtk_settings_get_for_display (display);
g_signal_handler_disconnect (settings,
path_bar->priv->settings_signal_id);
path_bar->priv->settings_signal_id = 0;
@ -393,7 +393,7 @@ gtk_path_bar_dispose (GObject *object)
{
GtkPathBar *path_bar = GTK_PATH_BAR (object);
remove_settings_signal (path_bar, gtk_widget_get_screen (GTK_WIDGET (object)));
remove_settings_signal (path_bar, gtk_widget_get_display (GTK_WIDGET (object)));
path_bar->priv->get_info_cancellable = NULL;
cancel_all_cancellables (path_bar);
@ -782,15 +782,15 @@ gtk_path_bar_style_updated (GtkWidget *widget)
}
static void
gtk_path_bar_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
gtk_path_bar_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
if (GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->screen_changed)
GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->screen_changed (widget, previous_screen);
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_screen)
remove_settings_signal (GTK_PATH_BAR (widget), previous_screen);
if (previous_display)
remove_settings_signal (GTK_PATH_BAR (widget), previous_display);
gtk_path_bar_check_icon_theme (GTK_PATH_BAR (widget));
}

View File

@ -206,8 +206,8 @@ static gboolean gtk_toolbar_focus (GtkWidget *widget,
GtkDirectionType dir);
static void gtk_toolbar_move_focus (GtkWidget *widget,
GtkDirectionType dir);
static void gtk_toolbar_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
static void gtk_toolbar_display_changed (GtkWidget *widget,
GdkDisplay *previous_display);
static void gtk_toolbar_set_child_property (GtkContainer *container,
GtkWidget *child,
guint property_id,
@ -392,7 +392,7 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
GTK_TYPE_TOOLBAR,
G_CALLBACK (gtk_toolbar_move_focus));
widget_class->screen_changed = gtk_toolbar_screen_changed;
widget_class->display_changed = gtk_toolbar_display_changed;
widget_class->popup_menu = gtk_toolbar_popup_menu;
widget_class->direction_changed = gtk_toolbar_direction_changed;
@ -1785,18 +1785,15 @@ settings_change_notify (GtkSettings *settings,
}
static void
gtk_toolbar_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
gtk_toolbar_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
GtkToolbar *toolbar = GTK_TOOLBAR (widget);
GtkToolbarPrivate *priv = toolbar->priv;
GtkSettings *old_settings = toolbar_get_settings (toolbar);
GtkSettings *settings;
if (gtk_widget_has_screen (GTK_WIDGET (toolbar)))
settings = gtk_widget_get_settings (GTK_WIDGET (toolbar));
else
settings = NULL;
settings = gtk_widget_get_settings (GTK_WIDGET (toolbar));
if (settings == old_settings)
return;

View File

@ -220,18 +220,15 @@ gtk_tool_item_group_settings_change_notify (GtkSettings *settings,
}
static void
gtk_tool_item_group_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
gtk_tool_item_group_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
GtkToolItemGroupPrivate* priv = group->priv;
GtkSettings *old_settings = priv->settings;
GtkSettings *settings;
if (gtk_widget_has_screen (GTK_WIDGET (group)))
settings = gtk_widget_get_settings (GTK_WIDGET (group));
else
settings = NULL;
settings = gtk_widget_get_settings (GTK_WIDGET (group));
if (settings == old_settings)
return;
@ -1544,7 +1541,7 @@ gtk_tool_item_group_class_init (GtkToolItemGroupClass *cls)
wclass->realize = gtk_tool_item_group_realize;
wclass->unrealize = gtk_tool_item_group_unrealize;
wclass->style_updated = gtk_tool_item_group_style_updated;
wclass->screen_changed = gtk_tool_item_group_screen_changed;
wclass->display_changed = gtk_tool_item_group_display_changed;
wclass->state_flags_changed = gtk_tool_item_group_state_flags_changed;
cclass->add = gtk_tool_item_group_add;

View File

@ -839,8 +839,8 @@ gtk_tool_palette_get_child_property (GtkContainer *container,
}
static void
gtk_tool_palette_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
gtk_tool_palette_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
@ -886,9 +886,9 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
cclass->set_child_property = gtk_tool_palette_set_child_property;
cclass->get_child_property = gtk_tool_palette_get_child_property;
/* Handle screen-changed so we can update our configuration.
/* Handle display-changed so we can update our configuration.
*/
wclass->screen_changed = gtk_tool_palette_screen_changed;
wclass->display_changed = gtk_tool_palette_display_changed;
g_object_class_override_property (oclass, PROP_ORIENTATION, "orientation");

View File

@ -541,7 +541,7 @@ enum {
DRAG_DATA_RECEIVED,
POPUP_MENU,
ACCEL_CLOSURES_CHANGED,
SCREEN_CHANGED,
DISPLAY_CHANGED,
CAN_ACTIVATE_ACCEL,
QUERY_TOOLTIP,
DRAG_FAILED,
@ -1066,7 +1066,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->drag_motion = NULL;
klass->drag_drop = NULL;
klass->drag_data_received = NULL;
klass->screen_changed = NULL;
klass->display_changed = NULL;
klass->can_activate_accel = gtk_widget_real_can_activate_accel;
klass->grab_broken_event = gtk_widget_real_grab_broken_event;
klass->query_tooltip = gtk_widget_real_query_tooltip;
@ -3092,23 +3092,23 @@ gtk_widget_class_init (GtkWidgetClass *klass)
G_TYPE_NONE, 0);
/**
* GtkWidget::screen-changed:
* GtkWidget::display-changed:
* @widget: the object on which the signal is emitted
* @previous_screen: (allow-none): the previous screen, or %NULL if the
* @previous_display: (allow-none): the previous screen, or %NULL if the
* widget was not associated with a screen before
*
* The ::screen-changed signal gets emitted when the
* screen of a widget has changed.
* The ::display-changed signal gets emitted when the
* display of a widget has changed.
*/
widget_signals[SCREEN_CHANGED] =
g_signal_new (I_("screen-changed"),
widget_signals[DISPLAY_CHANGED] =
g_signal_new (I_("display-changed"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkWidgetClass, screen_changed),
G_STRUCT_OFFSET (GtkWidgetClass, display_changed),
NULL, NULL,
NULL,
G_TYPE_NONE, 1,
GDK_TYPE_SCREEN);
GDK_TYPE_DISPLAY);
/**
* GtkWidget::can-activate-accel:
@ -8446,20 +8446,20 @@ gtk_widget_real_direction_changed (GtkWidget *widget,
typedef struct {
GtkWidget *previous_toplevel;
GdkScreen *previous_screen;
GdkScreen *new_screen;
GdkDisplay *previous_display;
GdkDisplay *new_display;
} HierarchyChangedInfo;
static void
do_screen_change (GtkWidget *widget,
GdkScreen *old_screen,
GdkScreen *new_screen)
do_display_change (GtkWidget *widget,
GdkDisplay *old_display,
GdkDisplay *new_display)
{
if (old_screen != new_screen)
if (old_display != new_display)
{
GtkWidgetPrivate *priv = widget->priv;
if (old_screen)
if (old_display)
{
PangoContext *context = g_object_get_qdata (G_OBJECT (widget), quark_pango_context);
if (context)
@ -8468,10 +8468,10 @@ do_screen_change (GtkWidget *widget,
_gtk_tooltip_hide (widget);
if (new_screen && priv->context)
gtk_style_context_set_screen (priv->context, new_screen);
if (new_display && priv->context)
gtk_style_context_set_screen (priv->context, gdk_display_get_default_screen (new_display));
g_signal_emit (widget, widget_signals[SCREEN_CHANGED], 0, old_screen);
g_signal_emit (widget, widget_signals[DISPLAY_CHANGED], 0, old_display);
}
}
@ -8502,7 +8502,7 @@ gtk_widget_propagate_hierarchy_changed_recurse (GtkWidget *widget,
}
g_signal_emit (widget, widget_signals[HIERARCHY_CHANGED], 0, info->previous_toplevel);
do_screen_change (widget, info->previous_screen, info->new_screen);
do_display_change (widget, info->previous_display, info->new_display);
gtk_widget_forall (widget, gtk_widget_propagate_hierarchy_changed_recurse, client_data);
@ -8527,16 +8527,16 @@ _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
HierarchyChangedInfo info;
info.previous_toplevel = previous_toplevel;
info.previous_screen = previous_toplevel ? gtk_widget_get_screen (previous_toplevel) : NULL;
info.previous_display = previous_toplevel ? gtk_widget_get_display (previous_toplevel) : NULL;
if (_gtk_widget_is_toplevel (widget) ||
(priv->parent && priv->parent->priv->anchored))
info.new_screen = gtk_widget_get_screen (widget);
info.new_display = gtk_widget_get_display (widget);
else
info.new_screen = NULL;
info.new_display = NULL;
if (info.previous_screen)
g_object_ref (info.previous_screen);
if (info.previous_display)
g_object_ref (info.previous_display);
if (previous_toplevel)
g_object_ref (previous_toplevel);
@ -8544,55 +8544,55 @@ _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
if (previous_toplevel)
g_object_unref (previous_toplevel);
if (info.previous_screen)
g_object_unref (info.previous_screen);
if (info.previous_display)
g_object_unref (info.previous_display);
}
static void
gtk_widget_propagate_screen_changed_recurse (GtkWidget *widget,
gpointer client_data)
gtk_widget_propagate_display_changed_recurse (GtkWidget *widget,
gpointer client_data)
{
HierarchyChangedInfo *info = client_data;
GtkWidget *child;
g_object_ref (widget);
do_screen_change (widget, info->previous_screen, info->new_screen);
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_screen_changed_recurse (child, client_data);
gtk_widget_propagate_display_changed_recurse (child, client_data);
}
g_object_unref (widget);
}
/**
* _gtk_widget_propagate_screen_changed:
* _gtk_widget_propagate_display_changed:
* @widget: a #GtkWidget
* @previous_screen: Previous screen
* @previous_display: Previous display
*
* Propagates changes in the screen for a widget to all
* children, emitting #GtkWidget::screen-changed.
* Propagates changes in the display for a widget to all
* children, emitting #GtkWidget::display-changed.
**/
void
_gtk_widget_propagate_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
_gtk_widget_propagate_display_changed (GtkWidget *widget,
GdkDisplay *previous_display)
{
HierarchyChangedInfo info;
info.previous_screen = previous_screen;
info.new_screen = gtk_widget_get_screen (widget);
info.previous_display = previous_display;
info.new_display = gtk_widget_get_display (widget);
if (previous_screen)
g_object_ref (previous_screen);
if (previous_display)
g_object_ref (previous_display);
gtk_widget_propagate_screen_changed_recurse (widget, &info);
gtk_widget_propagate_display_changed_recurse (widget, &info);
if (previous_screen)
g_object_unref (previous_screen);
if (previous_display)
g_object_unref (previous_display);
}
static void
@ -8823,7 +8823,7 @@ gtk_widget_peek_pango_context (GtkWidget *widget)
* the widget (it can be used until the screen for the widget changes
* or the widget is removed from its toplevel), and will be updated to
* match any changes to the widgets attributes. This can be tracked
* by using the #GtkWidget::screen-changed signal on the widget.
* by using the #GtkWidget::display-changed signal on the widget.
*
* Returns: (transfer none): the #PangoContext for the widget.
**/
@ -9067,7 +9067,7 @@ gtk_widget_create_pango_context (GtkWidget *widget)
*
* If you keep a #PangoLayout created in this way around, you need
* to re-create it when the widget #PangoContext is replaced.
* This can be tracked by using the #GtkWidget::screen-changed signal
* This can be tracked by using the #GtkWidget::display-changed signal
* on the widget.
*
* Returns: (transfer full): the new #PangoLayout

View File

@ -261,7 +261,7 @@ struct _GtkWidget
* context menu.
* @get_accessible: Returns the accessible object that describes the
* widget to an assistive technology.
* @screen_changed: Signal emitted when the screen of a widget has
* @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
@ -442,10 +442,10 @@ struct _GtkWidgetClass
/* accessibility support
*/
AtkObject * (* get_accessible) (GtkWidget *widget);
AtkObject * (* get_accessible) (GtkWidget *widget);
void (* screen_changed) (GtkWidget *widget,
GdkScreen *previous_screen);
void (* display_changed) (GtkWidget *widget,
GdkDisplay *previous_display);
gboolean (* can_activate_accel) (GtkWidget *widget,
guint signal_id);

View File

@ -214,10 +214,10 @@ void _gtk_widget_set_is_toplevel (GtkWidget *widget,
void _gtk_widget_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
void _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel);
void _gtk_widget_propagate_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen);
void _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel);
void _gtk_widget_propagate_display_changed (GtkWidget *widget,
GdkDisplay *previous_display);
void _gtk_widget_set_device_window (GtkWidget *widget,
GdkDevice *device,

View File

@ -9997,7 +9997,7 @@ gtk_window_set_screen (GtkWindow *window,
G_CALLBACK (gtk_window_on_theme_variant_changed), window);
#endif
_gtk_widget_propagate_screen_changed (widget, previous_screen);
_gtk_widget_propagate_display_changed (widget, gdk_screen_get_display (previous_screen));
}
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_SCREEN]);