summaryrefslogtreecommitdiffstats
path: root/source/x11-helper.c
diff options
context:
space:
mode:
authorQC <qball@gmpclient.org>2015-10-18 13:40:39 +0200
committerQC <qball@gmpclient.org>2015-10-18 13:40:39 +0200
commit93b6b83fb9fc1add7ebc781c7df20e005352acfb (patch)
tree45cf356b59653c2894e86974246a93df50f2ca79 /source/x11-helper.c
parentb1883ccaea53c79c6bbcf636b0e50a3b266b03bb (diff)
Try todo some validation of monitor size/padding in config sanity check.
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 ) );