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);