[gtk+] icontheme: Use GdkDisplay instead of GdkScreen
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] icontheme: Use GdkDisplay instead of GdkScreen
- Date: Tue, 31 Oct 2017 02:06:31 +0000 (UTC)
commit ecd5b399a44ebed419cee0d8089e3c2009e2f429
Author: Benjamin Otte <otte redhat com>
Date: Tue Oct 31 02:59:06 2017 +0100
icontheme: Use GdkDisplay instead of GdkScreen
demos/gtk-demo/clipboard.c | 2 +-
demos/gtk-demo/foreigndrawing.c | 2 +-
demos/gtk-demo/toolpalette.c | 4 +-
docs/reference/gtk/gtk4-sections.txt | 4 +-
gtk/gtkcssiconthemevalue.c | 2 +-
gtk/gtkdnd-quartz.c | 8 +-
gtk/gtkicontheme.c | 127 ++++++++++++++++------------------
gtk/gtkicontheme.h | 14 ++--
tests/testdnd2.c | 2 +-
tests/testnotebookdnd.c | 2 +-
10 files changed, 81 insertions(+), 86 deletions(-)
---
diff --git a/demos/gtk-demo/clipboard.c b/demos/gtk-demo/clipboard.c
index b024cc6..d618ede 100644
--- a/demos/gtk-demo/clipboard.c
+++ b/demos/gtk-demo/clipboard.c
@@ -78,7 +78,7 @@ get_image_surface (GtkImage *image)
return cairo_surface_reference (gtk_image_get_surface (image));
case GTK_IMAGE_ICON_NAME:
gtk_image_get_icon_name (image, &icon_name, &size);
- icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (image)));
+ icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
gtk_icon_size_lookup (size, &width, NULL);
return gtk_icon_theme_load_surface (icon_theme, icon_name, width, 1, NULL,
GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL);
default:
diff --git a/demos/gtk-demo/foreigndrawing.c b/demos/gtk-demo/foreigndrawing.c
index 716f61f..f2eb91a 100644
--- a/demos/gtk-demo/foreigndrawing.c
+++ b/demos/gtk-demo/foreigndrawing.c
@@ -850,7 +850,7 @@ draw_spinbutton (GtkWidget *widget,
draw_style_common (spin_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (entry_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
- icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
+ icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
gtk_style_context_get (up_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
diff --git a/demos/gtk-demo/toolpalette.c b/demos/gtk-demo/toolpalette.c
index f696528..dd7fe1a 100644
--- a/demos/gtk-demo/toolpalette.c
+++ b/demos/gtk-demo/toolpalette.c
@@ -42,7 +42,7 @@ canvas_item_new (GtkWidget *widget,
int width;
icon_name = gtk_tool_button_get_icon_name (button);
- icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
+ icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, NULL);
pixbuf = gtk_icon_theme_load_icon (icon_theme,
icon_name,
@@ -638,7 +638,7 @@ load_icon_items (GtkToolPalette *palette)
GList *l;
GtkIconTheme *icon_theme;
- icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (palette)));
+ icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (palette)));
contexts = gtk_icon_theme_list_contexts (icon_theme);
for (l = contexts; l; l = l->next)
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index dae5d44..4a852a9 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -5425,8 +5425,8 @@ GTK_ICON_THEME_ERROR
GtkIconThemeError
gtk_icon_theme_new
gtk_icon_theme_get_default
-gtk_icon_theme_get_for_screen
-gtk_icon_theme_set_screen
+gtk_icon_theme_get_for_display
+gtk_icon_theme_set_display
gtk_icon_theme_set_search_path
gtk_icon_theme_get_search_path
gtk_icon_theme_append_search_path
diff --git a/gtk/gtkcssiconthemevalue.c b/gtk/gtkcssiconthemevalue.c
index 6c4a303..c9c7f90 100644
--- a/gtk/gtkcssiconthemevalue.c
+++ b/gtk/gtkcssiconthemevalue.c
@@ -81,7 +81,7 @@ gtk_css_value_icon_theme_compute (GtkCssValue *icon_theme,
if (icon_theme->icontheme)
icontheme = icon_theme->icontheme;
else
- icontheme = gtk_icon_theme_get_for_screen (gdk_display_get_default_screen (_gtk_settings_get_display
(_gtk_style_provider_private_get_settings (provider))));
+ icontheme = gtk_icon_theme_get_for_display (_gtk_settings_get_display
(_gtk_style_provider_private_get_settings (provider)));
return gtk_css_icon_theme_value_new (icontheme);
}
diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c
index 240b107..e6162fb 100644
--- a/gtk/gtkdnd-quartz.c
+++ b/gtk/gtkdnd-quartz.c
@@ -1444,7 +1444,7 @@ gtk_drag_set_icon_name (GdkDragContext *context,
gint hot_x,
gint hot_y)
{
- GdkScreen *screen;
+ GdkDisplay *display;
GtkIconTheme *icon_theme;
GdkPixbuf *pixbuf;
gint width, height, icon_size;
@@ -1452,13 +1452,13 @@ gtk_drag_set_icon_name (GdkDragContext *context,
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (icon_name != NULL);
- screen = gdk_window_get_screen (gdk_drag_context_get_source_window (context));
- g_return_if_fail (screen != NULL);
+ display = gdk_window_get_display (gdk_drag_context_get_source_window (context));
+ g_return_if_fail (display != NULL);
gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &width, &height);
icon_size = MAX (width, height);
- icon_theme = gtk_icon_theme_get_for_screen (screen);
+ icon_theme = gtk_icon_theme_get_for_display (display);
pixbuf = gtk_icon_theme_load_icon (icon_theme, icon_name,
icon_size, 0, NULL);
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index fd7f949..9001728 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -139,11 +139,11 @@ struct _GtkIconThemePrivate
gint search_path_len;
GList *resource_paths;
- guint custom_theme : 1;
- guint is_screen_singleton : 1;
- guint pixbuf_supports_svg : 1;
- guint themes_valid : 1;
- guint loading_themes : 1;
+ guint custom_theme : 1;
+ guint is_display_singleton : 1;
+ guint pixbuf_supports_svg : 1;
+ guint themes_valid : 1;
+ guint loading_themes : 1;
/* A list of all the themes needed to look up icons.
* In search order, without duplicates
@@ -151,8 +151,8 @@ struct _GtkIconThemePrivate
GList *themes;
GHashTable *unthemed_icons;
- /* GdkScreen for the icon theme (may be NULL) */
- GdkScreen *screen;
+ /* GdkDisplay for the icon theme (may be NULL) */
+ GdkDisplay *display;
/* time when we last stat:ed for theme changes */
glong last_stat_time;
@@ -384,7 +384,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (GtkIconTheme, gtk_icon_theme, G_TYPE_OBJECT)
* Creates a new icon theme object. Icon theme objects are used
* to lookup up an icon by name in a particular icon theme.
* Usually, you’ll want to use gtk_icon_theme_get_default()
- * or gtk_icon_theme_get_for_screen() rather than creating
+ * or gtk_icon_theme_get_for_display() rather than creating
* a new icon theme object for scratch.
*
* Returns: the newly created #GtkIconTheme object.
@@ -400,12 +400,12 @@ gtk_icon_theme_new (void)
/**
* gtk_icon_theme_get_default:
*
- * Gets the icon theme for the default screen. See
- * gtk_icon_theme_get_for_screen().
+ * Gets the icon theme for the default display. See
+ * gtk_icon_theme_get_for_display().
*
* Returns: (transfer none): A unique #GtkIconTheme associated with
- * the default screen. This icon theme is associated with
- * the screen and can be used as long as the screen
+ * the default display. This icon theme is associated with
+ * the display and can be used as long as the display
* is open. Do not ref or unref it.
*
* Since: 2.4
@@ -413,48 +413,48 @@ gtk_icon_theme_new (void)
GtkIconTheme *
gtk_icon_theme_get_default (void)
{
- return gtk_icon_theme_get_for_screen (gdk_screen_get_default ());
+ return gtk_icon_theme_get_for_display (gdk_display_get_default ());
}
/**
- * gtk_icon_theme_get_for_screen:
- * @screen: a #GdkScreen
+ * gtk_icon_theme_get_for_display:
+ * @display: a #GdkDisplay
*
- * Gets the icon theme object associated with @screen; if this
+ * Gets the icon theme object associated with @display; if this
* function has not previously been called for the given
- * screen, a new icon theme object will be created and
- * associated with the screen. Icon theme objects are
+ * display, a new icon theme object will be created and
+ * associated with the display. Icon theme objects are
* fairly expensive to create, so using this function
* is usually a better choice than calling than gtk_icon_theme_new()
- * and setting the screen yourself; by using this function
+ * and setting the display yourself; by using this function
* a single icon theme object will be shared between users.
*
* Returns: (transfer none): A unique #GtkIconTheme associated with
- * the given screen. This icon theme is associated with
- * the screen and can be used as long as the screen
+ * the given display. This icon theme is associated with
+ * the display and can be used as long as the display
* is open. Do not ref or unref it.
*
- * Since: 2.4
+ * Since: 3.94
*/
GtkIconTheme *
-gtk_icon_theme_get_for_screen (GdkScreen *screen)
+gtk_icon_theme_get_for_display (GdkDisplay *display)
{
GtkIconTheme *icon_theme;
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
- icon_theme = g_object_get_data (G_OBJECT (screen), "gtk-icon-theme");
+ icon_theme = g_object_get_data (G_OBJECT (display), "gtk-icon-theme");
if (!icon_theme)
{
GtkIconThemePrivate *priv;
icon_theme = gtk_icon_theme_new ();
- gtk_icon_theme_set_screen (icon_theme, screen);
+ gtk_icon_theme_set_display (icon_theme, display);
priv = icon_theme->priv;
- priv->is_screen_singleton = TRUE;
+ priv->is_display_singleton = TRUE;
- g_object_set_data (G_OBJECT (screen), I_("gtk-icon-theme"), icon_theme);
+ g_object_set_data (G_OBJECT (display), I_("gtk-icon-theme"), icon_theme);
}
return icon_theme;
@@ -486,8 +486,8 @@ gtk_icon_theme_class_init (GtkIconThemeClass *klass)
/* Callback when the display that the icon theme is attached
- * to is closed; unset the screen, and if it’s the unique theme
- * for the screen, drop the reference
+ * to is closed; unset the display, and if it’s the unique theme
+ * for the display, drop the reference
*/
static void
display_closed (GdkDisplay *display,
@@ -495,18 +495,17 @@ display_closed (GdkDisplay *display,
GtkIconTheme *icon_theme)
{
GtkIconThemePrivate *priv = icon_theme->priv;
- GdkScreen *screen = priv->screen;
- gboolean was_screen_singleton = priv->is_screen_singleton;
+ gboolean was_display_singleton = priv->is_display_singleton;
- if (was_screen_singleton)
+ if (was_display_singleton)
{
- g_object_set_data (G_OBJECT (screen), I_("gtk-icon-theme"), NULL);
- priv->is_screen_singleton = FALSE;
+ g_object_set_data (G_OBJECT (display), I_("gtk-icon-theme"), NULL);
+ priv->is_display_singleton = FALSE;
}
- gtk_icon_theme_set_screen (icon_theme, NULL);
+ gtk_icon_theme_set_display (icon_theme, NULL);
- if (was_screen_singleton)
+ if (was_display_singleton)
{
g_object_unref (icon_theme);
}
@@ -525,9 +524,9 @@ update_current_theme (GtkIconTheme *icon_theme)
gchar *theme = NULL;
gboolean changed = FALSE;
- if (priv->screen)
+ if (priv->display)
{
- GtkSettings *settings = gtk_settings_get_for_screen (priv->screen);
+ GtkSettings *settings = gtk_settings_get_for_display (priv->display);
g_object_get (settings, "gtk-icon-theme-name", &theme, NULL);
}
@@ -557,60 +556,56 @@ theme_changed (GtkSettings *settings,
}
static void
-unset_screen (GtkIconTheme *icon_theme)
+unset_display (GtkIconTheme *icon_theme)
{
GtkIconThemePrivate *priv = icon_theme->priv;
GtkSettings *settings;
- GdkDisplay *display;
- if (priv->screen)
+ if (priv->display)
{
- settings = gtk_settings_get_for_screen (priv->screen);
- display = gdk_screen_get_display (priv->screen);
+ settings = gtk_settings_get_for_display (priv->display);
- g_signal_handlers_disconnect_by_func (display,
+ g_signal_handlers_disconnect_by_func (priv->display,
(gpointer) display_closed,
icon_theme);
g_signal_handlers_disconnect_by_func (settings,
(gpointer) theme_changed,
icon_theme);
- priv->screen = NULL;
+ priv->display = NULL;
}
}
/**
- * gtk_icon_theme_set_screen:
+ * gtk_icon_theme_set_display:
* @icon_theme: a #GtkIconTheme
- * @screen: a #GdkScreen
+ * @display: a #GdkDisplay
*
- * Sets the screen for an icon theme; the screen is used
+ * Sets the display for an icon theme; the display is used
* to track the user’s currently configured icon theme,
- * which might be different for different screens.
+ * which might be different for different displays.
*
- * Since: 2.4
+ * Since: 3.94
*/
void
-gtk_icon_theme_set_screen (GtkIconTheme *icon_theme,
- GdkScreen *screen)
+gtk_icon_theme_set_display (GtkIconTheme *icon_theme,
+ GdkDisplay *display)
{
GtkIconThemePrivate *priv;
GtkSettings *settings;
- GdkDisplay *display;
g_return_if_fail (GTK_ICON_THEME (icon_theme));
- g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
+ g_return_if_fail (display == NULL || GDK_IS_DISPLAY (display));
priv = icon_theme->priv;
- unset_screen (icon_theme);
+ unset_display (icon_theme);
- if (screen)
+ if (display)
{
- display = gdk_screen_get_display (screen);
- settings = gtk_settings_get_for_screen (screen);
+ settings = gtk_settings_get_for_display (display);
- priv->screen = screen;
+ priv->display = display;
g_signal_connect (display, "closed",
G_CALLBACK (display_closed), icon_theme);
@@ -737,8 +732,8 @@ theme_changed_idle (gpointer user_data)
g_signal_emit (icon_theme, signal_changed, 0);
- if (priv->screen && priv->is_screen_singleton)
- gtk_style_context_reset_widgets (gdk_screen_get_display (priv->screen));
+ if (priv->display && priv->is_display_singleton)
+ gtk_style_context_reset_widgets (priv->display);
priv->theme_changed_idle = 0;
@@ -810,7 +805,7 @@ gtk_icon_theme_finalize (GObject *object)
if (priv->theme_changed_idle)
g_source_remove (priv->theme_changed_idle);
- unset_screen (icon_theme);
+ unset_display (icon_theme);
g_free (priv->current_theme);
@@ -1014,7 +1009,7 @@ gtk_icon_theme_add_resource_path (GtkIconTheme *icon_theme,
* Sets the name of the icon theme that the #GtkIconTheme object uses
* overriding system configuration. This function cannot be called
* on the icon theme objects returned from gtk_icon_theme_get_default()
- * and gtk_icon_theme_get_for_screen().
+ * and gtk_icon_theme_get_for_display().
*
* Since: 2.4
*/
@@ -1028,7 +1023,7 @@ gtk_icon_theme_set_custom_theme (GtkIconTheme *icon_theme,
priv = icon_theme->priv;
- g_return_if_fail (!priv->is_screen_singleton);
+ g_return_if_fail (!priv->is_display_singleton);
if (theme_name != NULL)
{
@@ -3543,7 +3538,7 @@ gtk_icon_info_get_base_size (GtkIconInfo *icon_info)
*
* Gets the base scale for the icon. The base scale is a scale
* for the icon that was specified by the icon theme creator.
- * For instance an icon drawn for a high-dpi screen with window
+ * For instance an icon drawn for a high-dpi monitor with window
* scale 2 for a base size of 32 will be 64 pixels tall and have
* a base scale of 2.
*
diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h
index 4f69717..749d7c2 100644
--- a/gtk/gtkicontheme.h
+++ b/gtk/gtkicontheme.h
@@ -60,9 +60,9 @@ typedef struct _GtkIconThemePrivate GtkIconThemePrivate;
*
* Acts as a database of information about an icon theme.
* Normally, you retrieve the icon theme for a particular
- * screen using gtk_icon_theme_get_for_screen() and it
+ * display using gtk_icon_theme_get_for_display() and it
* will contain information about current icon theme for
- * that screen, but you can also create a new #GtkIconTheme
+ * that display, but you can also create a new #GtkIconTheme
* object and set the icon theme name explicitly using
* gtk_icon_theme_set_custom_theme().
*/
@@ -168,11 +168,11 @@ GDK_AVAILABLE_IN_ALL
GtkIconTheme *gtk_icon_theme_new (void);
GDK_AVAILABLE_IN_ALL
GtkIconTheme *gtk_icon_theme_get_default (void);
-GDK_AVAILABLE_IN_ALL
-GtkIconTheme *gtk_icon_theme_get_for_screen (GdkScreen *screen);
-GDK_AVAILABLE_IN_ALL
-void gtk_icon_theme_set_screen (GtkIconTheme *icon_theme,
- GdkScreen *screen);
+GDK_AVAILABLE_IN_3_94
+GtkIconTheme *gtk_icon_theme_get_for_display (GdkDisplay *display);
+GDK_AVAILABLE_IN_3_94
+void gtk_icon_theme_set_display (GtkIconTheme *icon_theme,
+ GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gtk_icon_theme_set_search_path (GtkIconTheme *icon_theme,
diff --git a/tests/testdnd2.c b/tests/testdnd2.c
index d77bdf4..fe0e2ec 100644
--- a/tests/testdnd2.c
+++ b/tests/testdnd2.c
@@ -18,7 +18,7 @@ get_image_surface (GtkImage *image,
return cairo_surface_reference (surface);
case GTK_IMAGE_ICON_NAME:
gtk_image_get_icon_name (image, &icon_name, &size);
- icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (image)));
+ icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
gtk_icon_size_lookup (size, &width, NULL);
*out_size = width;
return gtk_icon_theme_load_surface (icon_theme, icon_name, width, 1, NULL,
GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL);
diff --git a/tests/testnotebookdnd.c b/tests/testnotebookdnd.c
index a5b43bb..bf050e4 100644
--- a/tests/testnotebookdnd.c
+++ b/tests/testnotebookdnd.c
@@ -106,7 +106,7 @@ on_notebook_drag_begin (GtkWidget *widget,
GtkIconTheme *icon_theme;
int width;
- icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
+ icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &width, NULL);
surface = gtk_icon_theme_load_surface (icon_theme,
(page_num % 2) ? "help-browser" : "process-stop",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]