diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-01-30 21:01:24 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-01-30 21:33:37 +0100 |
commit | a46f9af1c0f321cbaafc0383bf50e4f6a1d47c94 (patch) | |
tree | a9b1f430e9e7c5f5f6c41dc827b2bf14b48f3555 /gdk | |
parent | 99c89d61e18d63f1141b8dfb423c3971f4b66c9a (diff) | |
download | gtk+-a46f9af1c0f321cbaafc0383bf50e4f6a1d47c94.tar.gz |
Remove primary monitor api
We only have implementations of this on X11 and Win32,
so make it available as backend api there.
Update all callers to use either the backend api, or
just monitor 0.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/broadway/gdkdisplay-broadway.c | 9 | ||||
-rw-r--r-- | gdk/broadway/gdksurface-broadway.c | 2 | ||||
-rw-r--r-- | gdk/gdkdisplay.c | 34 | ||||
-rw-r--r-- | gdk/gdkdisplay.h | 2 | ||||
-rw-r--r-- | gdk/gdkmonitor.c | 17 | ||||
-rw-r--r-- | gdk/gdkmonitor.h | 2 | ||||
-rw-r--r-- | gdk/quartz/gdkdisplay-quartz.c | 9 | ||||
-rw-r--r-- | gdk/win32/gdkdisplay-win32.c | 3 | ||||
-rw-r--r-- | gdk/win32/gdksurface-win32.c | 2 | ||||
-rw-r--r-- | gdk/win32/gdkwin32display.h | 4 | ||||
-rw-r--r-- | gdk/x11/gdkcursor-x11.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 21 | ||||
-rw-r--r-- | gdk/x11/gdkmonitor-x11.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkx11display.h | 4 |
14 files changed, 31 insertions, 82 deletions
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index d02ea887b0..69a2d1085e 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -329,14 +329,6 @@ gdk_broadway_display_get_monitor (GdkDisplay *display, return NULL; } -static GdkMonitor * -gdk_broadway_display_get_primary_monitor (GdkDisplay *display) -{ - GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display); - - return broadway_display->monitor; -} - static gboolean gdk_broadway_display_get_setting (GdkDisplay *display, const char *name, @@ -443,7 +435,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class) display_class->get_n_monitors = gdk_broadway_display_get_n_monitors; display_class->get_monitor = gdk_broadway_display_get_monitor; - display_class->get_primary_monitor = gdk_broadway_display_get_primary_monitor; display_class->get_setting = gdk_broadway_display_get_setting; display_class->get_last_seen_time = gdk_broadway_display_get_last_seen_time; } diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c index 6229fa12a7..5d2426b687 100644 --- a/gdk/broadway/gdksurface-broadway.c +++ b/gdk/broadway/gdksurface-broadway.c @@ -770,7 +770,7 @@ gdk_broadway_surface_maximize (GdkSurface *surface) impl->pre_maximize_height = surface->height; display = gdk_surface_get_display (surface); - monitor = gdk_display_get_primary_monitor (display); + monitor = gdk_display_get_monitor (display, 0); gdk_monitor_get_geometry (monitor, &geom); gdk_broadway_surface_move_resize (surface, 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: * @@ -1589,32 +1581,6 @@ gdk_display_get_monitor (GdkDisplay *display, } /** - * 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 * @surface: a #GdkSurface 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/gdkmonitor.c b/gdk/gdkmonitor.c index 37e2c872eb..dbdcdddf04 100644 --- a/gdk/gdkmonitor.c +++ b/gdk/gdkmonitor.c @@ -492,23 +492,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/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c index 5b4b3c99ed..7ab78f09d6 100644 --- a/gdk/quartz/gdkdisplay-quartz.c +++ b/gdk/quartz/gdkdisplay-quartz.c @@ -159,14 +159,6 @@ gdk_quartz_display_get_monitor (GdkDisplay *display, return NULL; } -static GdkMonitor * -gdk_quartz_display_get_primary_monitor (GdkDisplay *display) -{ - GdkQuartzDisplay *quartz_display = GDK_QUARTZ_DISPLAY (display); - - return quartz_display->monitors->pdata[0]; -} - static gboolean gdk_quartz_display_get_setting (GdkDisplay *display, const gchar *name, @@ -242,7 +234,6 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class) display_class->utf8_to_string_target = _gdk_quartz_display_utf8_to_string_target; display_class->get_n_monitors = gdk_quartz_display_get_n_monitors; display_class->get_monitor = gdk_quartz_display_get_monitor; - display_class->get_primary_monitor = gdk_quartz_display_get_primary_monitor; display_class->get_setting = gdk_quartz_display_get_setting; ProcessSerialNumber psn = { 0, kCurrentProcess }; diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index 9cd080012c..8ccefcf539 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -980,7 +980,7 @@ gdk_win32_display_get_monitor (GdkDisplay *display, return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num); } -static GdkMonitor * +GdkMonitor * gdk_win32_display_get_primary_monitor (GdkDisplay *display) { GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display); @@ -1124,7 +1124,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass) display_class->get_n_monitors = gdk_win32_display_get_n_monitors; display_class->get_monitor = gdk_win32_display_get_monitor; - display_class->get_primary_monitor = gdk_win32_display_get_primary_monitor; #ifdef GDK_RENDERING_VULKAN display_class->vk_context_type = GDK_TYPE_WIN32_VULKAN_CONTEXT; diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c index 1fcc46ae47..eda9325bd5 100644 --- a/gdk/win32/gdksurface-win32.c +++ b/gdk/win32/gdksurface-win32.c @@ -2822,7 +2822,7 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window, unsnap (window, monitor); snap_right (window, monitor, - gdk_monitor_is_primary (monitor) ? monitor : gdk_display_get_monitor (display, n_monitors - 1)); + (gdk_win32_display_get_primary_monitor (monitor->display) == monitor) ? monitor : gdk_display_get_monitor (display, n_monitors - 1)); } else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT) { diff --git a/gdk/win32/gdkwin32display.h b/gdk/win32/gdkwin32display.h index 7671fd88a2..2f7af043be 100644 --- a/gdk/win32/gdkwin32display.h +++ b/gdk/win32/gdkwin32display.h @@ -101,6 +101,10 @@ void gdk_win32_display_remove_filter (GdkWin32Display GdkWin32MessageFilterFunc function, gpointer data); +GDK_AVAILABLE_IN_ALL +GdkMonitor * gdk_win32_display_get_primary_monitor (GdkDisplay *display); + + G_END_DECLS #endif /* __GDK_WIN32_DISPLAY_H__ */ diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c index 6f2682dc40..a050a70f7a 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_x11_display_get_primary_monitor (display)); 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..b758d197e5 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -2956,7 +2956,25 @@ gdk_x11_display_get_monitor (GdkDisplay *display, return NULL; } -static GdkMonitor * +/** + * gdk_x11_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_x11_display_get_primary_monitor (GdkDisplay *display) { GdkX11Display *x11_display = GDK_X11_DISPLAY (display); @@ -3062,7 +3080,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 2ed77b9b81..970095c11d 100644 --- a/gdk/x11/gdkmonitor-x11.c +++ b/gdk/x11/gdkmonitor-x11.c @@ -80,7 +80,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) && + if (monitor == gdk_x11_display_get_primary_monitor (monitor->display) && !gdk_monitor_has_fullscreen_window (monitor)) { gdk_x11_screen_get_work_area (screen, &workarea); diff --git a/gdk/x11/gdkx11display.h b/gdk/x11/gdkx11display.h index c4801b2e33..9a24a4a035 100644 --- a/gdk/x11/gdkx11display.h +++ b/gdk/x11/gdkx11display.h @@ -106,6 +106,9 @@ GDK_AVAILABLE_IN_ALL GdkX11Screen *gdk_x11_display_get_screen (GdkDisplay *display); GDK_AVAILABLE_IN_ALL +GdkMonitor * gdk_x11_display_get_primary_monitor (GdkDisplay *display); + +GDK_AVAILABLE_IN_ALL void gdk_x11_display_grab (GdkDisplay *display); GDK_AVAILABLE_IN_ALL void gdk_x11_display_ungrab (GdkDisplay *display); @@ -130,7 +133,6 @@ void gdk_x11_register_standard_event_type (GdkDisplay *display, GDK_AVAILABLE_IN_ALL void gdk_x11_set_sm_client_id (const gchar *sm_client_id); - G_END_DECLS #endif /* __GDK_X11_DISPLAY_H__ */ |