[gtk+/gtk-3-22] Deprecate to-be-removed screen API
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] Deprecate to-be-removed screen API
- Date: Thu, 20 Oct 2016 16:06:51 +0000 (UTC)
commit 61fc7ddd87421348b419f6246b786761fbb136e5
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 20 11:59:21 2016 -0400
Deprecate to-be-removed screen API
GTK+ 4 is removing the monitor-related screen APIs. We should
deprecate them in 3.22 so people know to port away from them.
gdk/gdkscreen.c | 25 ++++++++++++++++++++++++-
gdk/gdkscreen.h | 20 ++++++++++----------
gdk/wayland/gdkwindow-wayland.c | 6 ++++++
gdk/x11/gdkcursor-x11.c | 5 +++++
gtk/inspector/visual.c | 2 ++
5 files changed, 47 insertions(+), 11 deletions(-)
---
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c
index 2249e7e..80de17c 100644
--- a/gdk/gdkscreen.c
+++ b/gdk/gdkscreen.c
@@ -222,6 +222,8 @@ get_monitor_num (GdkMonitor *monitor)
* a monitor close to (@x,@y) if the point is not in any monitor.
*
* Since: 2.2
+ *
+ * Deprecated: 3.22: Use gdk_display_get_monitor_at_point() instead
**/
gint
gdk_screen_get_monitor_at_point (GdkScreen *screen,
@@ -251,6 +253,8 @@ gdk_screen_get_monitor_at_point (GdkScreen *screen,
* close to @window.
*
* Since: 2.2
+ *
+ * Deprecated: 3.22: Use gdk_display_get_monitor_at_window() instead
**/
gint
gdk_screen_get_monitor_at_window (GdkScreen *screen,
@@ -658,6 +662,8 @@ get_monitor (GdkScreen *screen,
* Returns: number of monitors which @screen consists of
*
* Since: 2.2
+ *
+ * Deprecated: 3.22: Use gdk_display_get_n_monitors() instead
*/
gint
gdk_screen_get_n_monitors (GdkScreen *screen)
@@ -686,6 +692,8 @@ gdk_screen_get_n_monitors (GdkScreen *screen)
* Returns: An integer index for the primary monitor, or 0 if none is configured.
*
* Since: 2.20
+ *
+ * Deprecated: 3.22: Use gdk_display_get_primary_monitor() instead
*/
gint
gdk_screen_get_primary_monitor (GdkScreen *screen)
@@ -713,6 +721,8 @@ gdk_screen_get_primary_monitor (GdkScreen *screen)
* Returns: the width of the monitor, or -1 if not available
*
* Since: 2.14
+ *
+ * Deprecated: 3.22: Use gdk_monitor_get_width_mm() instead
*/
gint
gdk_screen_get_monitor_width_mm (GdkScreen *screen,
@@ -739,6 +749,8 @@ gdk_screen_get_monitor_width_mm (GdkScreen *screen,
* Returns: the height of the monitor, or -1 if not available
*
* Since: 2.14
+ *
+ * Deprecated: 3.22: Use gdk_monitor_get_height_mm() instead
*/
gint
gdk_screen_get_monitor_height_mm (GdkScreen *screen,
@@ -768,6 +780,8 @@ gdk_screen_get_monitor_height_mm (GdkScreen *screen,
* of the monitor, or %NULL if the name cannot be determined
*
* Since: 2.14
+ *
+ * Deprecated: 3.22: Use gdk_monitor_get_model() instead
*/
gchar *
gdk_screen_get_monitor_plug_name (GdkScreen *screen,
@@ -803,6 +817,8 @@ gdk_screen_get_monitor_plug_name (GdkScreen *screen,
* gdk_screen_get_width() and gdk_screen_get_height().
*
* Since: 2.2
+ *
+ * Deprecated: 3.22: Use gdk_monitor_get_geometry() instead
*/
void
gdk_screen_get_monitor_geometry (GdkScreen *screen,
@@ -844,6 +860,8 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
* @screen, use gdk_screen_get_n_monitors().
*
* Since: 3.4
+ *
+ * Deprecated: 3.22: Use gdk_monitor_get_workarea() instead
*/
void
gdk_screen_get_monitor_workarea (GdkScreen *screen,
@@ -1088,8 +1106,11 @@ gdk_screen_get_setting (GdkScreen *screen,
* particular monitor, but most of the time you’re drawing to a window
* where it is better to use gdk_window_get_scale_factor() instead.
*
- * Since: 3.10
* Returns: the scale factor
+ *
+ * Since: 3.10
+ *
+ * Deprecated: 3.22: Use gdk_monitor_get_scale_factor() instead
*/
gint
gdk_screen_get_monitor_scale_factor (GdkScreen *screen,
@@ -1099,7 +1120,9 @@ gdk_screen_get_monitor_scale_factor (GdkScreen *screen,
g_return_val_if_fail (GDK_IS_SCREEN (screen), 1);
g_return_val_if_fail (monitor_num >= 0, 1);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_return_val_if_fail (monitor_num < gdk_screen_get_n_monitors (screen), 1);
+G_GNUC_END_IGNORE_DEPRECATIONS
monitor = get_monitor (screen, monitor_num);
diff --git a/gdk/gdkscreen.h b/gdk/gdkscreen.h
index dde5524..28f6ab6 100644
--- a/gdk/gdkscreen.h
+++ b/gdk/gdkscreen.h
@@ -70,36 +70,36 @@ GList * gdk_screen_get_toplevel_windows (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
gchar * gdk_screen_make_display_name (GdkScreen *screen);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_22_FOR(gdk_display_get_n_monitors)
gint gdk_screen_get_n_monitors (GdkScreen *screen);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_22_FOR(gdk_display_get_primary_monitor)
gint gdk_screen_get_primary_monitor (GdkScreen *screen);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_geometry)
void gdk_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
-GDK_AVAILABLE_IN_3_4
+GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_workarea)
void gdk_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_22_FOR(gdk_display_get_monitor_at_point)
gint gdk_screen_get_monitor_at_point (GdkScreen *screen,
gint x,
gint y);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_22_FOR(gdk_display_get_monitor_at_window)
gint gdk_screen_get_monitor_at_window (GdkScreen *screen,
GdkWindow *window);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_width_mm)
gint gdk_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_height_mm)
gint gdk_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num);
-GDK_AVAILABLE_IN_ALL
+GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_model)
gchar * gdk_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num);
-GDK_AVAILABLE_IN_3_10
+GDK_DEPRECATED_IN_3_22_FOR(gdk_monitor_get_scale_factor)
gint gdk_screen_get_monitor_scale_factor (GdkScreen *screen,
gint monitor_num);
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 6270542..a8e6785 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -366,9 +366,11 @@ _gdk_wayland_screen_create_root_window (GdkScreen *screen,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
impl->wrapper = GDK_WINDOW (window);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
gdk_screen_get_n_monitors (screen) > 0)
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
+G_GNUC_END_IGNORE_DEPRECATIONS
/* logical 1x1 fake buffer */
impl->staging_cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
@@ -687,9 +689,11 @@ _gdk_wayland_display_create_window_impl (GdkDisplay *display,
g_object_ref (window);
/* More likely to be right than just assuming 1 */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
gdk_screen_get_n_monitors (screen) > 0)
impl->scale = gdk_screen_get_monitor_scale_factor (screen, 0);
+G_GNUC_END_IGNORE_DEPRECATIONS
impl->title = NULL;
@@ -1450,9 +1454,11 @@ gdk_wayland_window_create_xdg_toplevel (GdkWindow *window)
const gchar *app_id;
GdkScreen *screen = gdk_window_get_screen (window);
struct wl_output *fullscreen_output = NULL;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (impl->initial_fullscreen_monitor >= 0 &&
impl->initial_fullscreen_monitor < gdk_screen_get_n_monitors (screen))
fullscreen_output = _gdk_wayland_screen_get_wl_output (screen, impl->initial_fullscreen_monitor);
+G_GNUC_END_IGNORE_DEPRECATIONS
impl->display_server.xdg_surface =
zxdg_shell_v6_get_xdg_surface (display_wayland->xdg_shell,
diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c
index 3cce62f..e7ca3f1 100644
--- a/gdk/x11/gdkcursor-x11.c
+++ b/gdk/x11/gdkcursor-x11.c
@@ -357,8 +357,10 @@ gdk_x11_cursor_get_surface (GdkCursor *cursor,
/* Assume the currently set cursor was defined for the screen
scale */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
scale =
gdk_screen_get_monitor_scale_factor (gdk_display_get_default_screen (display), 0);
+G_GNUC_END_IGNORE_DEPRECATIONS
surface = gdk_window_create_similar_image_surface (NULL,
CAIRO_FORMAT_ARGB32,
@@ -589,8 +591,11 @@ _gdk_x11_display_get_cursor_for_surface (GdkDisplay *display,
}
else
{
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
target_scale =
gdk_screen_get_monitor_scale_factor (gdk_display_get_default_screen (display), 0);
+G_GNUC_END_IGNORE_DEPRECATIONS
+
xcimage = create_cursor_image (surface, x, y, target_scale);
xcursor = XcursorImageLoadCursor (GDK_DISPLAY_XDISPLAY (display), xcimage);
XcursorImageDestroy (xcimage);
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index b3da229..42b8922 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -578,7 +578,9 @@ init_scale (GtkInspectorVisual *vis)
{
gdouble scale;
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
scale = gdk_screen_get_monitor_scale_factor (screen, 0);
+G_GNUC_END_IGNORE_DEPRECATIONS
gtk_adjustment_set_value (vis->priv->scale_adjustment, scale);
g_signal_connect (vis->priv->scale_adjustment, "value-changed",
G_CALLBACK (scale_changed), vis);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]