14
13
* Library General Public License for more details.
16
15
* You should have received a copy of the GNU Library General Public
17
* License along with this library; if not, write to the
18
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
21
#ifdef HAVE_CONFIG_H
51
50
xfce_gdk_screen_get_active (gint *monitor_return)
53
#ifdef GDK_WINDOWING_X11
64
/* determine the list of active displays */
65
displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
66
for (lp = displays; lp != NULL; lp = lp->next)
68
/* check all screens on this display */
69
for (n = 0; n < gdk_display_get_n_screens (lp->data); ++n)
71
/* check if this screen contains the pointer */
72
screen = gdk_display_get_screen (lp->data, n);
73
if (XQueryPointer (GDK_SCREEN_XDISPLAY (screen),
74
GDK_DRAWABLE_XID (gdk_screen_get_root_window (screen)),
75
&root, &child, &rootx, &rooty, &winx, &winy, &xmask))
77
/* return the monitor number */
78
if (monitor_return != NULL)
79
*monitor_return = gdk_screen_get_monitor_at_point (screen, rootx, rooty);
81
/* yap, this screen contains the pointer, hence it's the active screen */
87
/* nothing found, fallback to default screen */
88
screen = gdk_screen_get_default ();
89
if (monitor_return != NULL)
93
g_slist_free (displays);
56
display = gdk_display_get_default ();
57
gdk_display_get_pointer (display, &screen, &rootx, &rooty, NULL);
59
if (G_UNLIKELY (screen == NULL))
61
screen = gdk_screen_get_default ();
62
if (monitor_return != NULL)
67
/* return the monitor number */
68
if (monitor_return != NULL)
69
*monitor_return = gdk_screen_get_monitor_at_point (screen, rootx, rooty);
97
/* dunno what to do on non-X11 window systems */
98
return gdk_screen_get_default ();