API: gdk: Remove monitor APIs on GdkScreen

This commit is contained in:
Benjamin Otte 2016-09-04 21:53:20 +02:00
parent d2a8667f83
commit 1a0a423250
2 changed files with 0 additions and 362 deletions

View File

@ -194,79 +194,6 @@ _gdk_screen_close (GdkScreen *screen)
}
}
static int
get_monitor_num (GdkMonitor *monitor)
{
GdkDisplay *display;
int n_monitors, i;
display = gdk_monitor_get_display (monitor);
n_monitors = gdk_display_get_n_monitors (display);
for (i = 0; i < n_monitors; i++)
{
if (gdk_display_get_monitor (display, i) == monitor)
return i;
}
return -1;
}
/**
* gdk_screen_get_monitor_at_point:
* @screen: a #GdkScreen.
* @x: the x coordinate in the virtual screen.
* @y: the y coordinate in the virtual screen.
*
* Returns the monitor number in which the point (@x,@y) is located.
*
* Returns: the monitor number in which the point (@x,@y) lies, or
* a monitor close to (@x,@y) if the point is not in any monitor.
*
* Since: 2.2
**/
gint
gdk_screen_get_monitor_at_point (GdkScreen *screen,
gint x,
gint y)
{
GdkDisplay *display;
GdkMonitor *monitor;
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
display = gdk_screen_get_display (screen);
monitor = gdk_display_get_monitor_at_point (display, x, y);
return get_monitor_num (monitor);
}
/**
* gdk_screen_get_monitor_at_window:
* @screen: a #GdkScreen.
* @window: a #GdkWindow
*
* Returns the number of the monitor in which the largest area of the
* bounding rectangle of @window resides.
*
* Returns: the monitor number in which most of @window is located,
* or if @window does not intersect any monitors, a monitor,
* close to @window.
*
* Since: 2.2
**/
gint
gdk_screen_get_monitor_at_window (GdkScreen *screen,
GdkWindow *window)
{
GdkDisplay *display;
GdkMonitor *monitor;
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
g_return_val_if_fail (GDK_IS_WINDOW (window), -1);
display = gdk_screen_get_display (screen);
monitor = gdk_display_get_monitor_at_window (display, window);
return get_monitor_num (monitor);
}
/**
* gdk_screen_width:
*
@ -639,229 +566,6 @@ gdk_screen_get_root_window (GdkScreen *screen)
return GDK_SCREEN_GET_CLASS (screen)->get_root_window (screen);
}
static GdkMonitor *
get_monitor (GdkScreen *screen,
gint n)
{
GdkDisplay *display;
display = gdk_screen_get_display (screen);
return gdk_display_get_monitor (display, n);
}
/**
* gdk_screen_get_n_monitors:
* @screen: a #GdkScreen
*
* Returns the number of monitors which @screen consists of.
*
* Returns: number of monitors which @screen consists of
*
* Since: 2.2
*/
gint
gdk_screen_get_n_monitors (GdkScreen *screen)
{
GdkDisplay *display;
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
display = gdk_screen_get_display (screen);
return gdk_display_get_n_monitors (display);
}
/**
* gdk_screen_get_primary_monitor:
* @screen: a #GdkScreen.
*
* Gets the primary monitor for @screen. The primary monitor
* is considered the monitor where the main desktop lives.
* While normal application windows typically allow the window
* manager to place the windows, specialized desktop applications
* such as panels should place themselves on the primary monitor.
*
* If no primary monitor is configured by the user, the return value
* will be 0, defaulting to the first monitor.
*
* Returns: An integer index for the primary monitor, or 0 if none is configured.
*
* Since: 2.20
*/
gint
gdk_screen_get_primary_monitor (GdkScreen *screen)
{
GdkDisplay *display;
GdkMonitor *primary;
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
display = gdk_screen_get_display (screen);
primary = gdk_display_get_primary_monitor (display);
if (primary)
return get_monitor_num (primary);
return 0;
}
/**
* gdk_screen_get_monitor_width_mm:
* @screen: a #GdkScreen
* @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
*
* Gets the width in millimeters of the specified monitor, if available.
*
* Returns: the width of the monitor, or -1 if not available
*
* Since: 2.14
*/
gint
gdk_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num)
{
GdkMonitor *monitor;
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
monitor = get_monitor (screen, monitor_num);
g_return_val_if_fail (monitor != NULL, -1);
return gdk_monitor_get_width_mm (monitor);
}
/**
* gdk_screen_get_monitor_height_mm:
* @screen: a #GdkScreen
* @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
*
* Gets the height in millimeters of the specified monitor.
*
* Returns: the height of the monitor, or -1 if not available
*
* Since: 2.14
*/
gint
gdk_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num)
{
GdkMonitor *monitor;
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
monitor = get_monitor (screen, monitor_num);
g_return_val_if_fail (monitor != NULL, -1);
return gdk_monitor_get_height_mm (monitor);
}
/**
* gdk_screen_get_monitor_plug_name:
* @screen: a #GdkScreen
* @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
*
* Returns the output name of the specified monitor.
* Usually something like VGA, DVI, or TV, not the actual
* product name of the display device.
*
* Returns: (nullable): a newly-allocated string containing the name
* of the monitor, or %NULL if the name cannot be determined
*
* Since: 2.14
*/
gchar *
gdk_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num)
{
GdkMonitor *monitor;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
monitor = get_monitor (screen, monitor_num);
g_return_val_if_fail (monitor != NULL, NULL);
return g_strdup (gdk_monitor_get_model (monitor));
}
/**
* gdk_screen_get_monitor_geometry:
* @screen: a #GdkScreen
* @monitor_num: the monitor number
* @dest: (out) (allow-none): a #GdkRectangle to be filled with
* the monitor geometry
*
* Retrieves the #GdkRectangle representing the size and position of
* the individual monitor within the entire screen area. The returned
* geometry is in application pixels, not in device pixels (see
* gdk_screen_get_monitor_scale_factor()).
*
* Monitor numbers start at 0. To obtain the number of monitors of
* @screen, use gdk_screen_get_n_monitors().
*
* Note that the size of the entire screen area can be retrieved via
* gdk_screen_get_width() and gdk_screen_get_height().
*
* Since: 2.2
*/
void
gdk_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
GdkMonitor *monitor;
g_return_if_fail (GDK_IS_SCREEN (screen));
monitor = get_monitor (screen, monitor_num);
g_return_if_fail (monitor != NULL);
gdk_monitor_get_geometry (monitor, dest);
}
/**
* gdk_screen_get_monitor_workarea:
* @screen: a #GdkScreen
* @monitor_num: the monitor number
* @dest: (out) (allow-none): a #GdkRectangle to be filled with
* the monitor workarea
*
* Retrieves the #GdkRectangle representing the size and position of
* the work area on a monitor within the entire screen area. The returned
* geometry is in application pixels, not in device pixels (see
* gdk_screen_get_monitor_scale_factor()).
*
* The work area should be considered when positioning menus and
* similar popups, to avoid placing them below panels, docks or other
* desktop components.
*
* Note that not all backends may have a concept of workarea. This
* function will return the monitor geometry if a workarea is not
* available, or does not apply.
*
* Monitor numbers start at 0. To obtain the number of monitors of
* @screen, use gdk_screen_get_n_monitors().
*
* Since: 3.4
*/
void
gdk_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
GdkMonitor *monitor;
g_return_if_fail (GDK_IS_SCREEN (screen));
monitor = get_monitor (screen, monitor_num);
g_return_if_fail (monitor != NULL);
/* FIXME */
gdk_monitor_get_geometry (monitor, dest);
}
/**
* gdk_screen_list_visuals:
* @screen: the relevant #GdkScreen.
@ -1074,36 +778,3 @@ gdk_screen_get_setting (GdkScreen *screen,
return GDK_SCREEN_GET_CLASS (screen)->get_setting (screen, name, value);
}
/**
* gdk_screen_get_monitor_scale_factor:
* @screen: screen to get scale factor for
* @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
*
* Returns the internal scale factor that maps from monitor coordinates
* to the actual device pixels. On traditional systems this is 1, but
* on very high density outputs this can be a higher value (often 2).
*
* This can be used if you want to create pixel based data for a
* particular monitor, but most of the time youre drawing to a window
* where it is better to use gdk_window_get_scale_factor() instead.
*
* Since: 3.10
* Returns: the scale factor
*/
gint
gdk_screen_get_monitor_scale_factor (GdkScreen *screen,
gint monitor_num)
{
GdkMonitor *monitor;
g_return_val_if_fail (GDK_IS_SCREEN (screen), 1);
g_return_val_if_fail (monitor_num >= 0, 1);
g_return_val_if_fail (monitor_num < gdk_screen_get_n_monitors (screen), 1);
monitor = get_monitor (screen, monitor_num);
g_return_val_if_fail (monitor != NULL, 1);
return gdk_monitor_get_scale_factor (monitor);
}

View File

@ -70,39 +70,6 @@ GList * gdk_screen_get_toplevel_windows (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
gchar * gdk_screen_make_display_name (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
gint gdk_screen_get_n_monitors (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
gint gdk_screen_get_primary_monitor (GdkScreen *screen);
GDK_AVAILABLE_IN_ALL
void gdk_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
GDK_AVAILABLE_IN_3_4
void gdk_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
GDK_AVAILABLE_IN_ALL
gint gdk_screen_get_monitor_at_point (GdkScreen *screen,
gint x,
gint y);
GDK_AVAILABLE_IN_ALL
gint gdk_screen_get_monitor_at_window (GdkScreen *screen,
GdkWindow *window);
GDK_AVAILABLE_IN_ALL
gint gdk_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num);
GDK_AVAILABLE_IN_ALL
gint gdk_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num);
GDK_AVAILABLE_IN_ALL
gchar * gdk_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num);
GDK_AVAILABLE_IN_3_10
gint gdk_screen_get_monitor_scale_factor (GdkScreen *screen,
gint monitor_num);
GDK_AVAILABLE_IN_ALL
GdkScreen *gdk_screen_get_default (void);