[gtk/kill-primary-monitor] Remove primary monitors



commit 886eeafee7feb4c0c7a01276000c1f379012f022
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 3 18:35:30 2020 -0500

    Remove primary monitors
    
    This is not a very successful concept, and Wayland
    does not have it at all, so lets just remove it.
    
    https://gitlab.gnome.org/GNOME/gtk/issues/982

 gdk/gdkdisplay.c          | 34 ----------------------------------
 gdk/gdkdisplay.h          |  2 --
 gdk/gdkdisplayprivate.h   |  1 -
 gdk/gdkmonitor.c          | 20 +-------------------
 gdk/gdkmonitor.h          |  2 --
 gdk/x11/gdkcursor-x11.c   |  2 +-
 gdk/x11/gdkdisplay-x11.c  | 12 ------------
 gdk/x11/gdkmonitor-x11.c  |  3 +--
 gtk/inspector/general.c   |  2 --
 gtk/inspector/visual.c    |  2 +-
 tests/animated-resizing.c |  2 +-
 11 files changed, 5 insertions(+), 77 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index c2a9e26bf7..5eb928bd0c 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -155,12 +155,6 @@ gdk_display_real_get_default_seat (GdkDisplay *display)
   return display->seats->data;
 }
 
-static GdkMonitor *
-gdk_display_real_get_primary_monitor (GdkDisplay *display)
-{
-  return gdk_display_get_monitor (display, 0);
-}
-
 static void
 gdk_display_class_init (GdkDisplayClass *class)
 {
@@ -177,8 +171,6 @@ gdk_display_class_init (GdkDisplayClass *class)
   class->event_data_free = gdk_display_real_event_data_free;
   class->get_default_seat = gdk_display_real_get_default_seat;
 
-  class->get_primary_monitor = gdk_display_real_get_primary_monitor;
-
   /**
    * GdkDisplay:composited:
    *
@@ -1588,32 +1580,6 @@ gdk_display_get_monitor (GdkDisplay *display,
   return GDK_DISPLAY_GET_CLASS (display)->get_monitor (display, monitor_num);
 }
 
-/**
- * gdk_display_get_primary_monitor:
- * @display: a #GdkDisplay
- *
- * Gets the primary monitor for the display.
- *
- * The primary monitor is considered the monitor where the “main desktop”
- * lives. While normal application surfaces typically allow the window
- * manager to place the surfaces, specialized desktop applications
- * such as panels should place themselves on the primary monitor.
- *
- * If no monitor is the designated primary monitor, any monitor
- * (usually the first) may be returned. To make sure there is a dedicated
- * primary monitor, use gdk_monitor_is_primary() on the returned monitor.
- *
- * Returns: (transfer none): the primary monitor, or any monitor if no
- *     primary monitor is configured by the user
- */
-GdkMonitor *
-gdk_display_get_primary_monitor (GdkDisplay *display)
-{
-  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-
-  return GDK_DISPLAY_GET_CLASS (display)->get_primary_monitor (display);
-}
-
 /**
  * gdk_display_get_monitor_at_surface:
  * @display: a #GdkDisplay
diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h
index fed7d86da2..34610aa51b 100644
--- a/gdk/gdkdisplay.h
+++ b/gdk/gdkdisplay.h
@@ -112,8 +112,6 @@ GDK_AVAILABLE_IN_ALL
 GdkMonitor * gdk_display_get_monitor           (GdkDisplay *display,
                                                 int         monitor_num);
 GDK_AVAILABLE_IN_ALL
-GdkMonitor * gdk_display_get_primary_monitor   (GdkDisplay *display);
-GDK_AVAILABLE_IN_ALL
 GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display,
                                                 GdkSurface  *surface);
 
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 8c8b76a8bc..dca4d0fc2d 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -167,7 +167,6 @@ struct _GdkDisplayClass
   int                    (*get_n_monitors)             (GdkDisplay     *display);
   GdkMonitor *           (*get_monitor)                (GdkDisplay     *display,
                                                         int             index);
-  GdkMonitor *           (*get_primary_monitor)        (GdkDisplay     *display);
   GdkMonitor *           (*get_monitor_at_surface)      (GdkDisplay     *display,
                                                         GdkSurface      *surface);
   gboolean               (*get_setting)                (GdkDisplay     *display,
diff --git a/gdk/gdkmonitor.c b/gdk/gdkmonitor.c
index 37e2c872eb..7df2ac3266 100644
--- a/gdk/gdkmonitor.c
+++ b/gdk/gdkmonitor.c
@@ -33,8 +33,7 @@
  * GdkMonitor objects represent the individual outputs that are
  * associated with a #GdkDisplay. GdkDisplay has APIs to enumerate
  * monitors with gdk_display_get_n_monitors() and gdk_display_get_monitor(), and
- * to find particular monitors with gdk_display_get_primary_monitor() or
- * gdk_display_get_monitor_at_surface().
+ * to find particular monitors with gdk_display_get_monitor_at_surface().
  */
 
 /**
@@ -492,23 +491,6 @@ gdk_monitor_get_subpixel_layout (GdkMonitor *monitor)
   return monitor->subpixel_layout;
 }
 
-/**
- * gdk_monitor_is_primary:
- * @monitor: a #GdkMonitor
- *
- * Gets whether this monitor should be considered primary
- * (see gdk_display_get_primary_monitor()).
- *
- * Returns: %TRUE if @monitor is primary
- */
-gboolean
-gdk_monitor_is_primary (GdkMonitor *monitor)
-{
-  g_return_val_if_fail (GDK_IS_MONITOR (monitor), FALSE);
-
-  return monitor == gdk_display_get_primary_monitor (monitor->display);
-}
-
 GdkMonitor *
 gdk_monitor_new (GdkDisplay *display)
 {
diff --git a/gdk/gdkmonitor.h b/gdk/gdkmonitor.h
index 832f7010e9..58592a5c32 100644
--- a/gdk/gdkmonitor.h
+++ b/gdk/gdkmonitor.h
@@ -88,8 +88,6 @@ int               gdk_monitor_get_refresh_rate    (GdkMonitor   *monitor);
 GDK_AVAILABLE_IN_ALL
 GdkSubpixelLayout gdk_monitor_get_subpixel_layout (GdkMonitor   *monitor);
 GDK_AVAILABLE_IN_ALL
-gboolean          gdk_monitor_is_primary          (GdkMonitor   *monitor);
-GDK_AVAILABLE_IN_ALL
 gboolean          gdk_monitor_is_valid            (GdkMonitor   *monitor);
 
 G_END_DECLS
diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c
index 6f2682dc40..1f0f37e346 100644
--- a/gdk/x11/gdkcursor-x11.c
+++ b/gdk/x11/gdkcursor-x11.c
@@ -176,7 +176,7 @@ gdk_x11_cursor_create_for_texture (GdkDisplay *display,
   int target_scale;
 
   target_scale =
-    gdk_monitor_get_scale_factor (gdk_display_get_primary_monitor (display));
+    gdk_monitor_get_scale_factor (gdk_display_get_monitor (display, 0));
   xcimage = create_cursor_image (texture, x, y, target_scale);
   xcursor = XcursorImageLoadCursor (GDK_DISPLAY_XDISPLAY (display), xcimage);
   XcursorImageDestroy (xcimage);
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index fdfbecbf7c..9ab67045fb 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -2956,17 +2956,6 @@ gdk_x11_display_get_monitor (GdkDisplay *display,
   return NULL;
 }
 
-static GdkMonitor *
-gdk_x11_display_get_primary_monitor (GdkDisplay *display)
-{
-  GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
-
-  if (0 <= x11_display->primary_monitor && x11_display->primary_monitor < x11_display->monitors->len)
-    return x11_display->monitors->pdata[x11_display->primary_monitor];
-
-  return NULL;
-}
-
 int
 gdk_x11_display_get_window_depth (GdkX11Display *display)
 {
@@ -3062,7 +3051,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
 
   display_class->get_n_monitors = gdk_x11_display_get_n_monitors;
   display_class->get_monitor = gdk_x11_display_get_monitor;
-  display_class->get_primary_monitor = gdk_x11_display_get_primary_monitor;
   display_class->get_setting = gdk_x11_display_get_setting;
   display_class->get_last_seen_time = gdk_x11_display_get_last_seen_time;
   display_class->set_cursor_theme = gdk_x11_display_set_cursor_theme;
diff --git a/gdk/x11/gdkmonitor-x11.c b/gdk/x11/gdkmonitor-x11.c
index 34d88e98f8..9b75297132 100644
--- a/gdk/x11/gdkmonitor-x11.c
+++ b/gdk/x11/gdkmonitor-x11.c
@@ -73,8 +73,7 @@ gdk_x11_monitor_get_workarea (GdkMonitor   *monitor,
    * but the primary monitor. Since that is where the 'desktop
    * chrome' usually lives, this works ok in practice.
    */
-  if (gdk_monitor_is_primary (monitor) &&
-      !gdk_monitor_has_fullscreen_window (monitor))
+  if (!gdk_monitor_has_fullscreen_window (monitor))
     {
       gdk_x11_screen_get_work_area (screen, &workarea);
       if (gdk_rectangle_intersect (dest, &workarea, &workarea))
diff --git a/gtk/inspector/general.c b/gtk/inspector/general.c
index 4f575de4a9..0bf95670b9 100644
--- a/gtk/inspector/general.c
+++ b/gtk/inspector/general.c
@@ -577,8 +577,6 @@ populate_display (GdkDisplay *display, GtkInspectorGeneral *gen)
       add_label_row (gen, list, "Size", value, 10);
       g_free (value);
 
-      add_check_row (gen, list, "Primary", gdk_monitor_is_primary (monitor), 10);
-
       if (gdk_monitor_get_refresh_rate (monitor) != 0)
         value = g_strdup_printf ("%.2f Hz",
                                  0.001 * gdk_monitor_get_refresh_rate (monitor));
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 5787f12756..5c708821a5 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -771,7 +771,7 @@ init_scale (GtkInspectorVisual *vis)
     {
       gdouble scale;
 
-      scale = gdk_monitor_get_scale_factor (gdk_display_get_primary_monitor (vis->priv->display));
+      scale = gdk_monitor_get_scale_factor (gdk_display_get_monitor (vis->priv->display, 0));
       gtk_adjustment_set_value (vis->priv->scale_adjustment, scale);
       g_signal_connect (vis->priv->scale_adjustment, "value-changed",
                         G_CALLBACK (scale_changed), vis);
diff --git a/tests/animated-resizing.c b/tests/animated-resizing.c
index 1984aace2d..0301820d92 100644
--- a/tests/animated-resizing.c
+++ b/tests/animated-resizing.c
@@ -201,7 +201,7 @@ main(int argc, char **argv)
   on_frame (0.);
 
   display = gtk_widget_get_display (window);
-  monitor = gdk_display_get_primary_monitor (display);
+  monitor = gdk_display_get_monitor (display, 0);
   gdk_monitor_get_geometry (monitor, &monitor_bounds);
 
   gtk_widget_show (window);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]