How to replace gdk_screen_get_monitor_at_window?
- From: zahlenmeer gmx de
- To: gtk-app-devel-list gnome org
- Subject: How to replace gdk_screen_get_monitor_at_window?
- Date: Mon, 23 Jan 2017 18:17:04 +0100
I am specifically interested in the number of the monitor, which is
returned by gdk_screen_get_monitor_at_window. However, its advertised
replacement gdk_display_get_monitor_at_window only returns the pointer
to the monitor.
My try would be:
gint display_helper_get_monitor_num_at_window (GdkDisplay *display,
GdkWindow *window)
{
gint i;
GdkMonitor *mon;
for (i = 0; i < gdk_display_get_n_monitors (display); ++i)
{
mon = gdk_display_get_monitor_at_window (display, window);
if (gdk_display_get_monitor (i) == mon)
return i;
}
// no monitor found, can this even happen?
return -1;
}
Maybe a little context:
I am using the number to identify monitors in a settings backend. The
idea behing this choice was that not all monitors have a model name, but
a number. So the number was the preferred way of identifying monitors
(although I am aware that even the numbers could change).
Is there a recommended way in GTK to identify monitors?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]