[gtk+] invisible: Make it use display, not screen
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] invisible: Make it use display, not screen
- Date: Tue, 31 Oct 2017 07:26:11 +0000 (UTC)
commit 4a43229d0bb9a422cb7420158510302cf25a9c9e
Author: Benjamin Otte <otte redhat com>
Date: Tue Oct 31 08:07:32 2017 +0100
invisible: Make it use display, not screen
gtk/gtkclipboard.c | 2 +-
gtk/gtkfilechoosernativeportal.c | 4 +-
gtk/gtkinvisible.c | 84 +++++++++++++++++++-------------------
gtk/gtkinvisible.h | 14 +++---
gtk/gtkwidget.c | 2 +-
gtk/inspector/inspect-button.c | 2 +-
6 files changed, 54 insertions(+), 54 deletions(-)
---
diff --git a/gtk/gtkclipboard.c b/gtk/gtkclipboard.c
index 72bc0de..b066546 100644
--- a/gtk/gtkclipboard.c
+++ b/gtk/gtkclipboard.c
@@ -436,7 +436,7 @@ static GtkWidget *
make_clipboard_widget (GdkDisplay *display,
gboolean provider)
{
- GtkWidget *widget = gtk_invisible_new_for_screen (gdk_display_get_default_screen (display));
+ GtkWidget *widget = gtk_invisible_new_for_display (display);
g_signal_connect (widget, "selection-received",
G_CALLBACK (selection_received), NULL);
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index b6fa011..f6d7c42 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -398,9 +398,9 @@ window_handle_exported (GtkWindow *window,
if (data->modal)
{
- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window));
+ GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (window));
- data->grab_widget = gtk_invisible_new_for_screen (screen);
+ data->grab_widget = gtk_invisible_new_for_display (display);
gtk_grab_add (GTK_WIDGET (data->grab_widget));
}
diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c
index 246d883..512fcda 100644
--- a/gtk/gtkinvisible.c
+++ b/gtk/gtkinvisible.c
@@ -45,13 +45,13 @@
struct _GtkInvisiblePrivate
{
- GdkScreen *screen;
+ GdkDisplay *display;
gboolean has_user_ref_count;
};
enum {
PROP_0,
- PROP_SCREEN,
+ PROP_DISPLAY,
LAST_ARG
};
@@ -90,11 +90,11 @@ gtk_invisible_class_init (GtkInvisibleClass *class)
gobject_class->constructed = gtk_invisible_constructed;
g_object_class_install_property (gobject_class,
- PROP_SCREEN,
- g_param_spec_object ("screen",
- P_("Screen"),
- P_("The screen where this window will be displayed"),
- GDK_TYPE_SCREEN,
+ PROP_DISPLAY,
+ g_param_spec_object ("display",
+ P_("Display"),
+ P_("The display where this window will be displayed"),
+ GDK_TYPE_DISPLAY,
GTK_PARAM_READWRITE));
}
@@ -112,7 +112,7 @@ gtk_invisible_init (GtkInvisible *invisible)
g_object_ref_sink (invisible);
priv->has_user_ref_count = TRUE;
- priv->screen = gdk_screen_get_default ();
+ priv->display = gdk_display_get_default ();
}
static void
@@ -131,22 +131,22 @@ gtk_invisible_destroy (GtkWidget *widget)
}
/**
- * gtk_invisible_new_for_screen:
- * @screen: a #GdkScreen which identifies on which
- * the new #GtkInvisible will be created.
+ * gtk_invisible_new_for_display:
+ * @display: a #GdkDisplay which identifies on which
+ * the new #GtkInvisible will be created.
*
- * Creates a new #GtkInvisible object for a specified screen
+ * Creates a new #GtkInvisible object for a specified display.
*
* Returns: a newly created #GtkInvisible object
*
- * Since: 2.2
+ * Since: 3.94
**/
GtkWidget*
-gtk_invisible_new_for_screen (GdkScreen *screen)
+gtk_invisible_new_for_display (GdkDisplay *display)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
- return g_object_new (GTK_TYPE_INVISIBLE, "screen", screen, NULL);
+ return g_object_new (GTK_TYPE_INVISIBLE, "display", display, NULL);
}
/**
@@ -163,64 +163,64 @@ gtk_invisible_new (void)
}
/**
- * gtk_invisible_set_screen:
+ * gtk_invisible_set_display:
* @invisible: a #GtkInvisible.
- * @screen: a #GdkScreen.
+ * @display: a #GdkDisplay.
*
- * Sets the #GdkScreen where the #GtkInvisible object will be displayed.
+ * Sets the #GdkDisplay where the #GtkInvisible object will be displayed.
*
- * Since: 2.2
+ * Since: 3.94
**/
void
-gtk_invisible_set_screen (GtkInvisible *invisible,
- GdkScreen *screen)
+gtk_invisible_set_display (GtkInvisible *invisible,
+ GdkDisplay *display)
{
GtkInvisiblePrivate *priv;
GtkWidget *widget;
- GdkScreen *previous_screen;
+ GdkDisplay *previous_display;
gboolean was_realized;
g_return_if_fail (GTK_IS_INVISIBLE (invisible));
- g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (GDK_IS_DISPLAY (display));
priv = invisible->priv;
- if (screen == priv->screen)
+ if (display == priv->display)
return;
widget = GTK_WIDGET (invisible);
- previous_screen = priv->screen;
+ previous_display = priv->display;
was_realized = gtk_widget_get_realized (widget);
if (was_realized)
gtk_widget_unrealize (widget);
- priv->screen = screen;
- if (screen != previous_screen)
- _gtk_widget_propagate_display_changed (widget, gdk_screen_get_display (previous_screen));
- g_object_notify (G_OBJECT (invisible), "screen");
+ priv->display = display;
+ if (display != previous_display)
+ _gtk_widget_propagate_display_changed (widget, previous_display);
+ g_object_notify (G_OBJECT (invisible), "display");
if (was_realized)
gtk_widget_realize (widget);
}
/**
- * gtk_invisible_get_screen:
+ * gtk_invisible_get_display:
* @invisible: a #GtkInvisible.
*
- * Returns the #GdkScreen object associated with @invisible
+ * Returns the #GdkDisplay object associated with @invisible
*
- * Returns: (transfer none): the associated #GdkScreen.
+ * Returns: (transfer none): the associated #GdkDisplay.
*
- * Since: 2.2
+ * Since: 3.94
**/
-GdkScreen *
-gtk_invisible_get_screen (GtkInvisible *invisible)
+GdkDisplay *
+gtk_invisible_get_display (GtkInvisible *invisible)
{
g_return_val_if_fail (GTK_IS_INVISIBLE (invisible), NULL);
- return invisible->priv->screen;
+ return invisible->priv->display;
}
static void
@@ -258,8 +258,8 @@ gtk_invisible_set_property (GObject *object,
switch (prop_id)
{
- case PROP_SCREEN:
- gtk_invisible_set_screen (invisible, g_value_get_object (value));
+ case PROP_DISPLAY:
+ gtk_invisible_set_display (invisible, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -278,8 +278,8 @@ gtk_invisible_get_property (GObject *object,
switch (prop_id)
{
- case PROP_SCREEN:
- g_value_set_object (value, priv->screen);
+ case PROP_DISPLAY:
+ g_value_set_object (value, priv->display);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -288,7 +288,7 @@ gtk_invisible_get_property (GObject *object,
}
/* We use a constructor here so that we can realize the invisible on
- * the correct screen after the “screen” property has been set
+ * the correct display after the “display” property has been set
*/
static void
gtk_invisible_constructed (GObject *object)
diff --git a/gtk/gtkinvisible.h b/gtk/gtkinvisible.h
index 8aa0520..a635127 100644
--- a/gtk/gtkinvisible.h
+++ b/gtk/gtkinvisible.h
@@ -69,13 +69,13 @@ GType gtk_invisible_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_invisible_new (void);
-GDK_AVAILABLE_IN_ALL
-GtkWidget* gtk_invisible_new_for_screen (GdkScreen *screen);
-GDK_AVAILABLE_IN_ALL
-void gtk_invisible_set_screen (GtkInvisible *invisible,
- GdkScreen *screen);
-GDK_AVAILABLE_IN_ALL
-GdkScreen* gtk_invisible_get_screen (GtkInvisible *invisible);
+GDK_AVAILABLE_IN_3_94
+GtkWidget* gtk_invisible_new_for_display(GdkDisplay *display);
+GDK_AVAILABLE_IN_3_94
+void gtk_invisible_set_display (GtkInvisible *invisible,
+ GdkDisplay *display);
+GDK_AVAILABLE_IN_3_94
+GdkDisplay*gtk_invisible_get_display (GtkInvisible *invisible);
G_END_DECLS
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index e38c8ab..161f869 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -9268,7 +9268,7 @@ gtk_widget_get_screen (GtkWidget *widget)
if (GTK_IS_WINDOW (toplevel))
return gdk_display_get_default_screen (gtk_window_get_display (GTK_WINDOW (toplevel)));
else if (GTK_IS_INVISIBLE (toplevel))
- return gtk_invisible_get_screen (GTK_INVISIBLE (widget));
+ return gdk_display_get_default_screen (gtk_invisible_get_display (GTK_INVISIBLE (widget)));
}
return gdk_screen_get_default ();
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index 59a8e0c..8e8a1ec 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -277,7 +277,7 @@ gtk_inspector_on_inspect (GtkWidget *button,
if (!iw->invisible)
{
- iw->invisible = gtk_invisible_new_for_screen (gdk_screen_get_default ());
+ iw->invisible = gtk_invisible_new_for_display (gdk_display_get_default ());
gtk_widget_realize (iw->invisible);
gtk_widget_show (iw->invisible);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]