Compare commits
1 Commits
reverse-li
...
kill-prima
Author | SHA1 | Date | |
---|---|---|---|
|
5d9efb5675 |
@@ -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);
|
||||
|
||||
|
@@ -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,
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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
|
||||
|
@@ -980,18 +980,6 @@ gdk_win32_display_get_monitor (GdkDisplay *display,
|
||||
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num);
|
||||
}
|
||||
|
||||
static GdkMonitor *
|
||||
gdk_win32_display_get_primary_monitor (GdkDisplay *display)
|
||||
{
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
|
||||
/* We arrange for the first monitor in the array to also be the primiary monitor */
|
||||
if (win32_display->monitors->len > 0)
|
||||
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, 0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
guint
|
||||
_gdk_win32_display_get_monitor_scale_factor (GdkWin32Display *win32_display,
|
||||
HMONITOR hmonitor,
|
||||
@@ -1124,7 +1112,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;
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -115,7 +115,6 @@ struct _GdkX11Display
|
||||
GHashTable *cursors;
|
||||
|
||||
GPtrArray *monitors;
|
||||
int primary_monitor;
|
||||
|
||||
/* Startup notification */
|
||||
gchar *startup_notification_id;
|
||||
|
@@ -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))
|
||||
|
@@ -317,12 +317,9 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
GdkDisplay *display = GDK_SCREEN_DISPLAY (x11_screen);
|
||||
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
|
||||
XRRScreenResources *resources;
|
||||
RROutput primary_output = None;
|
||||
RROutput first_output = None;
|
||||
int i;
|
||||
XRRMonitorInfo *rr_monitors;
|
||||
int num_rr_monitors;
|
||||
int old_primary;
|
||||
|
||||
if (!x11_display->have_randr15)
|
||||
return FALSE;
|
||||
@@ -371,9 +368,6 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (first_output == None)
|
||||
first_output = output;
|
||||
|
||||
if (output_info->crtc)
|
||||
{
|
||||
XRRCrtcInfo *crtc = XRRGetCrtcInfo (x11_screen->xdisplay, resources, output_info->crtc);
|
||||
@@ -482,9 +476,6 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
g_free (manufacturer);
|
||||
g_free (name);
|
||||
|
||||
if (rr_monitors[i].primary)
|
||||
primary_output = monitor->output;
|
||||
|
||||
XRRFreeOutputInfo (output_info);
|
||||
}
|
||||
|
||||
@@ -509,33 +500,6 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
}
|
||||
}
|
||||
|
||||
old_primary = x11_display->primary_monitor;
|
||||
x11_display->primary_monitor = 0;
|
||||
for (i = 0; i < x11_display->monitors->len; ++i)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
if (monitor->output == primary_output)
|
||||
{
|
||||
x11_display->primary_monitor = i;
|
||||
break;
|
||||
}
|
||||
|
||||
/* No RandR1.3+ available or no primary set, fall back to prefer LVDS as primary if present */
|
||||
if (primary_output == None &&
|
||||
g_ascii_strncasecmp (gdk_monitor_get_model (GDK_MONITOR (monitor)), "LVDS", 4) == 0)
|
||||
{
|
||||
x11_display->primary_monitor = i;
|
||||
break;
|
||||
}
|
||||
|
||||
/* No primary specified and no LVDS found */
|
||||
if (monitor->output == first_output)
|
||||
x11_display->primary_monitor = i;
|
||||
}
|
||||
|
||||
if (x11_display->primary_monitor != old_primary)
|
||||
*changed = TRUE;
|
||||
|
||||
return x11_display->monitors->len > 0;
|
||||
#endif
|
||||
|
||||
@@ -549,10 +513,7 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
GdkDisplay *display = GDK_SCREEN_DISPLAY (x11_screen);
|
||||
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
|
||||
XRRScreenResources *resources;
|
||||
RROutput primary_output = None;
|
||||
RROutput first_output = None;
|
||||
int i;
|
||||
int old_primary;
|
||||
|
||||
if (!x11_display->have_randr13)
|
||||
return FALSE;
|
||||
@@ -651,9 +612,6 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
XRRFreeOutputInfo (output_info);
|
||||
}
|
||||
|
||||
if (resources->noutput > 0)
|
||||
first_output = resources->outputs[0];
|
||||
|
||||
XRRFreeScreenResources (resources);
|
||||
|
||||
/* Which usable multihead data is not returned in non RandR 1.2+ X driver? */
|
||||
@@ -676,36 +634,6 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
}
|
||||
}
|
||||
|
||||
old_primary = x11_display->primary_monitor;
|
||||
x11_display->primary_monitor = 0;
|
||||
primary_output = XRRGetOutputPrimary (x11_screen->xdisplay,
|
||||
x11_screen->xroot_window);
|
||||
|
||||
for (i = 0; i < x11_display->monitors->len; ++i)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
if (monitor->output == primary_output)
|
||||
{
|
||||
x11_display->primary_monitor = i;
|
||||
break;
|
||||
}
|
||||
|
||||
/* No RandR1.3+ available or no primary set, fall back to prefer LVDS as primary if present */
|
||||
if (primary_output == None &&
|
||||
g_ascii_strncasecmp (gdk_monitor_get_model (GDK_MONITOR (monitor)), "LVDS", 4) == 0)
|
||||
{
|
||||
x11_display->primary_monitor = i;
|
||||
break;
|
||||
}
|
||||
|
||||
/* No primary specified and no LVDS found */
|
||||
if (monitor->output == first_output)
|
||||
x11_display->primary_monitor = i;
|
||||
}
|
||||
|
||||
if (x11_display->primary_monitor != old_primary)
|
||||
*changed = TRUE;
|
||||
|
||||
return x11_display->monitors->len > 0;
|
||||
#endif
|
||||
|
||||
@@ -762,10 +690,6 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
gdk_monitor_set_physical_size (GDK_MONITOR (monitor), width_mm, height_mm);
|
||||
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->surface_scale);
|
||||
|
||||
if (x11_display->primary_monitor != 0)
|
||||
*changed = TRUE;
|
||||
x11_display->primary_monitor = 0;
|
||||
|
||||
for (i = x11_display->monitors->len - 1; i >= 0; i--)
|
||||
{
|
||||
monitor = x11_display->monitors->pdata[i];
|
||||
|
@@ -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_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);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user