From 4662cf109eab95c8418d9fbc11c495e0e67c1f03 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 27 Sep 2007 15:29:14 +0200 Subject: [PATCH] introduce get_screen_count(...) function --- screen.c | 17 +++++++++++++++++ screen.h | 1 + 2 files changed, 18 insertions(+) diff --git a/screen.c b/screen.c index 7f210fad..2a8dd999 100644 --- a/screen.c +++ b/screen.c @@ -121,6 +121,23 @@ get_screen_bycoord(Display *disp, int x, int y) return -1; } +/** Return the actual screen count + * \param disp Display ref + * \return the number of screen available + */ +int +get_screen_count(Display *disp) +{ + int screen_number; + + if(XineramaIsActive(disp)) + XineramaQueryScreens(disp, &screen_number); + else + return ScreenCount(disp); + + return screen_number; +} + void uicb_focusnextscreen(Display *disp, DC *drawcontext, diff --git a/screen.h b/screen.h index 994116e9..6b49a90b 100644 --- a/screen.h +++ b/screen.h @@ -31,6 +31,7 @@ typedef XineramaScreenInfo ScreenInfo; ScreenInfo * get_screen_info(Display *, int, Statusbar *, int *); ScreenInfo * get_display_info(Display *, int, Statusbar); int get_screen_bycoord(Display *, int, int); +int get_screen_count(Display *); UICB_PROTO(uicb_focusnextscreen); UICB_PROTO(uicb_focusprevscreen);