mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-29 06:51:10 +00:00
widget: Remove gtk_widget_has_screen()
All widgets always have a screen (or display).
This commit is contained in:
parent
43b0fcb727
commit
1c36c6ed4d
@ -4556,7 +4556,6 @@ gtk_widget_get_settings
|
||||
gtk_widget_get_clipboard
|
||||
gtk_widget_get_display
|
||||
gtk_widget_get_screen
|
||||
gtk_widget_has_screen
|
||||
gtk_widget_get_size_request
|
||||
gtk_widget_set_child_visible
|
||||
gtk_widget_set_size_request
|
||||
|
@ -1263,9 +1263,6 @@ gtk_entry_accessible_copy_text (AtkEditableText *text,
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
if (!gtk_widget_has_screen (widget))
|
||||
return;
|
||||
|
||||
editable = GTK_EDITABLE (widget);
|
||||
str = gtk_editable_get_chars (editable, start_pos, end_pos);
|
||||
clipboard = gtk_widget_get_clipboard (widget, GDK_SELECTION_CLIPBOARD);
|
||||
@ -1287,9 +1284,6 @@ gtk_entry_accessible_cut_text (AtkEditableText *text,
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
if (!gtk_widget_has_screen (widget))
|
||||
return;
|
||||
|
||||
editable = GTK_EDITABLE (widget);
|
||||
if (!gtk_editable_get_editable (editable))
|
||||
return;
|
||||
@ -1353,9 +1347,6 @@ gtk_entry_accessible_paste_text (AtkEditableText *text,
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
if (!gtk_widget_has_screen (widget))
|
||||
return;
|
||||
|
||||
editable = GTK_EDITABLE (widget);
|
||||
if (!gtk_editable_get_editable (editable))
|
||||
return;
|
||||
|
@ -1539,17 +1539,15 @@ change_icon_theme (GtkFileChooserButton *button)
|
||||
static void
|
||||
gtk_file_chooser_button_style_updated (GtkWidget *widget)
|
||||
{
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
GtkCssStyleChange *change = gtk_style_context_get_change (context);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->style_updated (widget);
|
||||
|
||||
if (gtk_widget_has_screen (widget))
|
||||
{
|
||||
/* We need to update the icon surface, but only in case
|
||||
* the icon theme really changed. */
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
GtkCssStyleChange *change = gtk_style_context_get_change (context);
|
||||
if (!change || gtk_css_style_change_changes_property (change, GTK_CSS_PROPERTY_ICON_THEME))
|
||||
change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget));
|
||||
}
|
||||
/* We need to update the icon surface, but only in case
|
||||
* the icon theme really changed. */
|
||||
if (!change || gtk_css_style_change_changes_property (change, GTK_CSS_PROPERTY_ICON_THEME))
|
||||
change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3779,14 +3779,11 @@ check_icon_theme (GtkFileChooserWidget *impl)
|
||||
return;
|
||||
}
|
||||
|
||||
if (gtk_widget_has_screen (GTK_WIDGET (impl)))
|
||||
{
|
||||
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
|
||||
priv->settings_signal_id = g_signal_connect (settings, "notify",
|
||||
G_CALLBACK (settings_notify_cb), impl);
|
||||
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
|
||||
priv->settings_signal_id = g_signal_connect (settings, "notify",
|
||||
G_CALLBACK (settings_notify_cb), impl);
|
||||
|
||||
change_icon_theme (impl);
|
||||
}
|
||||
change_icon_theme (impl);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
@ -3804,8 +3801,7 @@ gtk_file_chooser_widget_style_updated (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->style_updated (widget);
|
||||
profile_msg (" parent class style_updated end", NULL);
|
||||
|
||||
if (gtk_widget_has_screen (GTK_WIDGET (impl)))
|
||||
change_icon_theme (impl);
|
||||
change_icon_theme (impl);
|
||||
|
||||
emit_default_size_changed (impl);
|
||||
|
||||
|
@ -5234,11 +5234,8 @@ gtk_label_select_region_index (GtkLabel *label,
|
||||
priv->select_info->selection_anchor = anchor_index;
|
||||
priv->select_info->selection_end = end_index;
|
||||
|
||||
if (gtk_widget_has_screen (GTK_WIDGET (label)))
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (label),
|
||||
GDK_SELECTION_PRIMARY);
|
||||
else
|
||||
clipboard = NULL;
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (label),
|
||||
GDK_SELECTION_PRIMARY);
|
||||
|
||||
if (anchor_index != end_index)
|
||||
{
|
||||
|
@ -1305,8 +1305,7 @@ 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"))
|
||||
if (!g_object_get_data (G_OBJECT (menu), "gtk-menu-explicit-screen"))
|
||||
menu_change_screen (menu, gtk_widget_get_screen (attach_widget));
|
||||
}
|
||||
|
||||
|
@ -1525,11 +1525,10 @@ gtk_menu_shell_get_key_hash (GtkMenuShell *menu_shell,
|
||||
GtkMenuShellPrivate *priv = menu_shell->priv;
|
||||
GtkWidget *widget = GTK_WIDGET (menu_shell);
|
||||
|
||||
if (!priv->key_hash && create && gtk_widget_has_screen (widget))
|
||||
if (!priv->key_hash && create)
|
||||
{
|
||||
GtkMnemonicHash *mnemonic_hash = gtk_menu_shell_get_mnemonic_hash (menu_shell, FALSE);
|
||||
GdkScreen *screen = gtk_widget_get_screen (widget);
|
||||
GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_screen_get_display (screen));
|
||||
GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (widget));
|
||||
|
||||
if (!mnemonic_hash)
|
||||
return NULL;
|
||||
|
@ -2315,21 +2315,18 @@ draw_collate (GtkDrawingArea *da,
|
||||
static void
|
||||
gtk_print_unix_dialog_style_updated (GtkWidget *widget)
|
||||
{
|
||||
GtkPrintUnixDialog *dialog = (GtkPrintUnixDialog *)widget;
|
||||
GtkPrintUnixDialogPrivate *priv = dialog->priv;
|
||||
gint size;
|
||||
gfloat scale;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_print_unix_dialog_parent_class)->style_updated (widget);
|
||||
|
||||
if (gtk_widget_has_screen (widget))
|
||||
{
|
||||
GtkPrintUnixDialog *dialog = (GtkPrintUnixDialog *)widget;
|
||||
GtkPrintUnixDialogPrivate *priv = dialog->priv;
|
||||
gint size;
|
||||
gfloat scale;
|
||||
gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &size, NULL);
|
||||
scale = size / 48.0;
|
||||
|
||||
gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &size, NULL);
|
||||
scale = size / 48.0;
|
||||
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (priv->collate_image), (50 + 20) * scale);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (priv->collate_image), (15 + 26) * scale);
|
||||
}
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (priv->collate_image), (50 + 20) * scale);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (priv->collate_image), (15 + 26) * scale);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -697,7 +697,6 @@ static void gtk_widget_real_state_flags_changed (GtkWidget
|
||||
static AtkObject* gtk_widget_real_get_accessible (GtkWidget *widget);
|
||||
static void gtk_widget_accessible_interface_init (AtkImplementorIface *iface);
|
||||
static AtkObject* gtk_widget_ref_accessible (AtkImplementor *implementor);
|
||||
static GdkScreen * gtk_widget_get_screen_unchecked (GtkWidget *widget);
|
||||
static gboolean gtk_widget_real_can_activate_accel (GtkWidget *widget,
|
||||
guint signal_id);
|
||||
|
||||
@ -9238,24 +9237,6 @@ gtk_widget_get_child_visible (GtkWidget *widget)
|
||||
return widget->priv->child_visible;
|
||||
}
|
||||
|
||||
static GdkScreen *
|
||||
gtk_widget_get_screen_unchecked (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = _gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (_gtk_widget_is_toplevel (toplevel))
|
||||
{
|
||||
if (GTK_IS_WINDOW (toplevel))
|
||||
return _gtk_window_get_screen (GTK_WINDOW (toplevel));
|
||||
else if (GTK_IS_INVISIBLE (toplevel))
|
||||
return gtk_invisible_get_screen (GTK_INVISIBLE (widget));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_get_screen:
|
||||
* @widget: a #GtkWidget
|
||||
@ -9276,38 +9257,21 @@ gtk_widget_get_screen_unchecked (GtkWidget *widget)
|
||||
GdkScreen*
|
||||
gtk_widget_get_screen (GtkWidget *widget)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
GtkWidget *toplevel;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
screen = gtk_widget_get_screen_unchecked (widget);
|
||||
toplevel = _gtk_widget_get_toplevel (widget);
|
||||
|
||||
if (screen)
|
||||
return screen;
|
||||
else
|
||||
return gdk_screen_get_default ();
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_has_screen:
|
||||
* @widget: a #GtkWidget
|
||||
*
|
||||
* Checks whether there is a #GdkScreen is associated with
|
||||
* this widget. All toplevel widgets have an associated
|
||||
* screen, and all widgets added into a hierarchy with a toplevel
|
||||
* window at the top.
|
||||
*
|
||||
* Returns: %TRUE if there is a #GdkScreen associated
|
||||
* with the widget.
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
gboolean
|
||||
gtk_widget_has_screen (GtkWidget *widget)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
|
||||
|
||||
return (gtk_widget_get_screen_unchecked (widget) != NULL);
|
||||
if (_gtk_widget_is_toplevel (toplevel))
|
||||
{
|
||||
if (GTK_IS_WINDOW (toplevel))
|
||||
return _gtk_window_get_screen (GTK_WINDOW (toplevel));
|
||||
else if (GTK_IS_INVISIBLE (toplevel))
|
||||
return gtk_invisible_get_screen (GTK_INVISIBLE (widget));
|
||||
}
|
||||
|
||||
return gdk_screen_get_default ();
|
||||
}
|
||||
|
||||
void
|
||||
@ -12618,7 +12582,6 @@ GtkClipboard *
|
||||
gtk_widget_get_clipboard (GtkWidget *widget, GdkAtom selection)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
g_return_val_if_fail (gtk_widget_has_screen (widget), NULL);
|
||||
|
||||
return gtk_clipboard_get_for_display (gtk_widget_get_display (widget),
|
||||
selection);
|
||||
|
@ -784,8 +784,6 @@ GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkScreen * gtk_widget_get_screen (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_widget_has_screen (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
gint gtk_widget_get_scale_factor (GtkWidget *widget);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
Loading…
Reference in New Issue
Block a user