forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
99c89d61e1
commit
a46f9af1c0
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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 };
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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__ */
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -105,6 +105,9 @@ GdkDisplay *gdk_x11_lookup_xdisplay (Display *xdisplay);
|
||||
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
|
||||
@ -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__ */
|
||||
|
@ -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));
|
||||
|
@ -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_x11_display_get_primary_monitor (vis->priv->display));
|
||||
gtk_adjustment_set_value (vis->priv->scale_adjustment, scale);
|
||||
g_signal_connect (vis->priv->scale_adjustment, "value-changed",
|
||||
G_CALLBACK (scale_changed), vis);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user