macos: external access to display name helpers
authorChristian Hergert <christian@hergert.me>
Mon, 28 Feb 2022 19:29:24 +0000 (11:29 -0800)
committerChristian Hergert <christian@hergert.me>
Mon, 28 Feb 2022 19:36:27 +0000 (11:36 -0800)
These can be handy to print debug information when we don't have a
GdkMacosMonitor to work with.

gdk/macos/gdkmacosmonitor-private.h
gdk/macos/gdkmacosmonitor.c

index fee511d057bc15538015d629e1fb65e5dc93a0d9..88f586813e79cabdb37c360dcca61009fd0aca9a 100644 (file)
@@ -29,6 +29,8 @@
 
 G_BEGIN_DECLS
 
+char              *_gdk_macos_monitor_get_localized_name    (NSScreen          *screen);
+char              *_gdk_macos_monitor_get_connector_name    (CGDirectDisplayID  screen_id);
 GdkMacosMonitor   *_gdk_macos_monitor_new                   (GdkMacosDisplay   *display,
                                                              CGDirectDisplayID  screen_id);
 CGDirectDisplayID  _gdk_macos_monitor_get_screen_id         (GdkMacosMonitor   *self);
index 3773ec535520730ec6023dfe5a2b838e3b8f59d9..bfec76b7ef95e79a4d681005fcbba4cc351021a5 100644 (file)
@@ -160,8 +160,8 @@ GetSubpixelLayout (CGDirectDisplayID screen_id)
   return GDK_SUBPIXEL_LAYOUT_UNKNOWN;
 }
 
-static char *
-GetLocalizedName (NSScreen *screen)
+char *
+_gdk_macos_monitor_get_localized_name (NSScreen *screen)
 {
 #ifdef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
   GDK_BEGIN_MACOS_ALLOC_POOL;
@@ -182,8 +182,8 @@ GetLocalizedName (NSScreen *screen)
 #endif
 }
 
-static char *
-GetConnectorName (CGDirectDisplayID screen_id)
+char *
+_gdk_macos_monitor_get_connector_name (CGDirectDisplayID screen_id)
 {
   guint unit = CGDisplayUnitNumber (screen_id);
   return g_strdup_printf ("unit-%u", unit);
@@ -306,8 +306,8 @@ _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self)
   pixel_width = CGDisplayModeGetPixelWidth (mode);
   has_opengl = CGDisplayUsesOpenGLAcceleration (self->screen_id);
   subpixel_layout = GetSubpixelLayout (self->screen_id);
-  name = GetLocalizedName (screen);
-  connector = GetConnectorName (self->screen_id);
+  name = _gdk_macos_monitor_get_localized_name (screen);
+  connector = _gdk_macos_monitor_get_connector_name (self->screen_id);
 
   if (width != 0 && pixel_width != 0)
     scale_factor = MAX (1, pixel_width / width);