summaryrefslogtreecommitdiffstats
path: root/source/x11-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/x11-helper.c')
-rw-r--r--source/x11-helper.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/x11-helper.c b/source/x11-helper.c
index 346bb7ad..68bfe3a8 100644
--- a/source/x11-helper.c
+++ b/source/x11-helper.c
@@ -143,7 +143,26 @@ int window_get_cardinal_prop ( Display *display, Window w, Atom atom, unsigned l
Atom type; int items;
return window_get_prop ( display, w, atom, &type, &items, list, count * sizeof ( unsigned long ) ) && type == XA_CARDINAL ? items : 0;
}
+int monitor_get_smallest_size ( Display *display )
+{
+ int size = MIN ( WidthOfScreen ( DefaultScreenOfDisplay ( display ) ),
+ HeightOfScreen ( DefaultScreenOfDisplay ( display ) ) );
+ // locate the current monitor
+ if ( XineramaIsActive ( display ) ) {
+ int monitors;
+ XineramaScreenInfo *info = XineramaQueryScreens ( display, &monitors );
+ if ( info ) {
+ for ( int i = 0; i < monitors; i++ ) {
+ size = MIN ( info[i].width, size );
+ size = MIN ( info[i].height, size );
+ }
+ }
+ XFree ( info );
+ }
+
+ return size;
+}
int monitor_get_dimension ( Display *display, Screen *screen, int monitor, workarea *mon )
{
memset ( mon, 0, sizeof ( workarea ) );