diff --git a/src/config.h.in b/src/config.h.in index beddd18..af98c95 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -35,12 +35,12 @@ #include "wmfs.h" -#define WMFS_VERSION "@WMFS_VERSION@" -#define WMFS_COMPILE_MACHINE "@WMFS_COMPILE_MACHINE@" -#define WMFS_COMPILE_BY "@WMFS_COMPILE_BY@" -#define WMFS_COMPILE_FLAGS "@WMFS_COMPILE_FLAGS@" -#define WMFS_LINKED_LIBS "@WMFS_LINKED_LIBS@" -#define XDG_CONFIG_DIR "@XDG_CONFIG_DIR@" +#define WMFS_VERSION "@WMFS_VERSION@" +#define WMFS_COMPILE_MACHINE "@WMFS_COMPILE_MACHINE@" +#define WMFS_COMPILE_BY "@WMFS_COMPILE_BY@" +#define WMFS_COMPILE_FLAGS "@WMFS_COMPILE_FLAGS@" +#define WMFS_LINKED_LIBS "@WMFS_LINKED_LIBS@" +#define XDG_CONFIG_DIR "@XDG_CONFIG_DIR@" @WMFS_HAVE_XINERAMA@ @WMFS_HAVE_XRANDR@ diff --git a/src/event.c b/src/event.c index 9513424..b9ab163 100644 --- a/src/event.c +++ b/src/event.c @@ -500,23 +500,6 @@ unmapnotify(XUnmapEvent *ev) return; } -/** Xrandr screen change notify handle event - *\ param ev XEvent pointer - */ -void -xrandrnotify(XEvent *ev) -{ - /* Update configuration */ - XRRUpdateConfiguration(ev); - - /* Reload WMFS to update the screen(s) geometry changement */ - quit(); - for(; argv_global[0] && argv_global[0] == ' '; ++argv_global); - execlp(argv_global, argv_global, NULL); - - return; -} - /** Send a client event *\param data Event data *\param atom_name Event atom name @@ -567,9 +550,20 @@ getevent(XEvent ev) case PropertyNotify: propertynotify(&ev.xproperty); break; case UnmapNotify: unmapnotify(&ev.xunmap); break; default: + +#ifdef HAVE_XRANDR /* Check Xrandr event */ if(ev.type == xrandr_event) - xrandrnotify(&ev); + { + /* Update xrandr configuration */ + XRRUpdateConfiguration(&ev); + + /* Reload WMFS to update the screen(s) geometry changement */ + quit(); + for(; argv_global[0] && argv_global[0] == ' '; ++argv_global); + execlp(argv_global, argv_global, NULL); + } +#endif break; } diff --git a/src/ewmh.c b/src/ewmh.c index 4bae38b..0354e2f 100644 --- a/src/ewmh.c +++ b/src/ewmh.c @@ -139,11 +139,13 @@ void ewmh_update_current_tag_prop(void) { int t; - char s[10] = { 0 }; + char *s = NULL; screen_get_sel(); t = seltag[selscreen] - 1; + s = emalloc(8, sizeof(char)); + /* Get current desktop (tag) */ XChangeProperty(dpy, ROOT, net_atom[net_current_desktop], XA_CARDINAL, 32, PropModeReplace, (uchar*)&t, 1); @@ -168,6 +170,8 @@ ewmh_update_current_tag_prop(void) PropModeReplace, (uchar*)tags[selscreen][seltag[selscreen]].layout.symbol, strlen(tags[selscreen][seltag[selscreen]].layout.symbol)); + free(s); + return; } diff --git a/src/launcher.c b/src/launcher.c index 0389da4..a34bfb2 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -80,7 +80,7 @@ launcher_execute(Launcher launcher) barwin_refresh(bw); - barwin_draw_text(bw, 1, FHINFOBAR, launcher.prompt); + barwin_draw_text(bw, 1, FHINFOBAR - 1, launcher.prompt); while(my_guitar_gently_wheeps) { @@ -192,8 +192,8 @@ launcher_execute(Launcher launcher) 1 + textw(launcher.prompt) + textw(" ") + textw(buf), 2, 1 + textw(launcher.prompt) + textw(" ") + textw(buf), INFOBARH - 4); - barwin_draw_text(bw, 1, FHINFOBAR, launcher.prompt); - barwin_draw_text(bw, 1 + textw(launcher.prompt) + textw(" "), FHINFOBAR, buf); + barwin_draw_text(bw, 1, FHINFOBAR - 1, launcher.prompt); + barwin_draw_text(bw, 1 + textw(launcher.prompt) + textw(" "), FHINFOBAR - 1, buf); barwin_refresh(bw); } else diff --git a/src/layout.c b/src/layout.c index d828e93..687c739 100644 --- a/src/layout.c +++ b/src/layout.c @@ -265,6 +265,7 @@ grid(int screen) /* Set all the other size with current client info */ cgeo.y = c->geo.y + c->geo.height + BORDH + TBARH; + if(cpcols + 1 > rows) { cpcols = 0; diff --git a/src/screen.c b/src/screen.c index 1e4e935..6846729 100644 --- a/src/screen.c +++ b/src/screen.c @@ -40,10 +40,12 @@ screen_count(void) { int n = 0; + n = ScreenCount(dpy); + +#ifdef HAVE_XINERAMA if(XineramaIsActive(dpy)) XineramaQueryScreens(dpy, &n); - else - n = ScreenCount(dpy); +#endif /* Set _WMFS_SCREEN_COUNT */ XChangeProperty(dpy, ROOT, net_atom[wmfs_screen_count], XA_CARDINAL, 32, @@ -59,13 +61,22 @@ screen_count(void) XRectangle screen_get_geo(int s) { - int n = 0; int barpos = tags[selscreen][seltag[selscreen]].barpos; XRectangle geo; + geo.x = BORDH; + if(barpos == IB_Hide || barpos == IB_Bottom) + geo.y = TBARH; + else + geo.y = INFOBARH + TBARH; + geo.height = MAXH - INFOBARH - TBARH; + geo.width = MAXW; + +#ifdef HAVE_XINERAMA if(XineramaIsActive(dpy)) { XineramaScreenInfo *xsi; + int n = 0; xsi = XineramaQueryScreens(dpy, &n); @@ -79,16 +90,7 @@ screen_get_geo(int s) XFree(xsi); } - else - { - geo.x = BORDH; - if(barpos == IB_Hide || barpos == IB_Bottom) - geo.y = TBARH; - else - geo.y = INFOBARH + TBARH; - geo.height = MAXH - INFOBARH - TBARH; - geo.width = MAXW; - } +#endif return geo; } @@ -135,20 +137,24 @@ screen_set_sel(int screen) int screen_get_sel(void) { + selscreen = 0; + +#ifdef HAVE_XINERAMA if(XineramaIsActive(dpy)) { /* Unused variables (except x/y) */ Window w; - int d, u, x, y; + int d, x, y; - XQueryPointer(dpy, ROOT, &w, &w, &x, &y, &d, &d, (uint *)&u); + XQueryPointer(dpy, ROOT, &w, &w, &x, &y, &d, &d, (uint *)&d); selscreen = screen_get_with_geo(x, y); - - /* Set _WMFS_CURRENT_SCREEN */ - XChangeProperty(dpy, ROOT, net_atom[wmfs_current_screen], XA_CARDINAL, 32, - PropModeReplace, (uchar*)&selscreen, 1); } +#endif + + /* Set _WMFS_CURRENT_SCREEN */ + XChangeProperty(dpy, ROOT, net_atom[wmfs_current_screen], XA_CARDINAL, 32, + PropModeReplace, (uchar*)&selscreen, 1); return selscreen; } @@ -158,8 +164,7 @@ screen_get_sel(void) void screen_init_geo(void) { - int i, n, d; - XineramaScreenInfo *xsi; + int i; sgeo = emalloc(screen_count(), sizeof(XRectangle)); spgeo = emalloc(screen_count(), sizeof(XRectangle)); @@ -167,6 +172,15 @@ screen_init_geo(void) for(i = 0; i < screen_count(); ++i) sgeo[i] = screen_get_geo(i); + spgeo[0].x = 0; + spgeo[0].y = 0; + spgeo[0].width = MAXW; + spgeo[0].height = MAXH; + +#ifdef HAVE_XINERAMA + XineramaScreenInfo *xsi; + int n; + if(XineramaIsActive(dpy)) { xsi = XineramaQueryScreens(dpy, &n); @@ -179,17 +193,15 @@ screen_init_geo(void) } XFree(xsi); } - else - { - spgeo[0].x = 0; - spgeo[0].y = 0; - spgeo[0].width = MAXW; - spgeo[0].height = MAXH; - } +#endif + +#ifdef HAVE_XRANDR + /* Init xrandr stuff */ + int d; - /* Init Xrandr stuff */ XRRSelectInput(dpy, ROOT, 1); XRRQueryExtension(dpy, &xrandr_event, &d); +#endif ewmh_set_desktop_geometry(); ewmh_set_workarea(); diff --git a/src/wmfs.h b/src/wmfs.h index 4ad81dd..ab6a533 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -50,13 +50,20 @@ #include #include #include -#include -#include /* Local headers */ #include "config.h" #include "structs.h" +#ifdef HAVE_XINERAMA +#include +#endif + +#ifdef HAVE_XRANDR +#include +#endif + + /* MACRO */ #define ButtonMask (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask) #define MouseMask (ButtonMask | PointerMotionMask) @@ -203,7 +210,6 @@ void mappingnotify(XMappingEvent *ev); void maprequest(XMapRequestEvent *ev); void propertynotify(XPropertyEvent *ev); void unmapnotify(XUnmapEvent *ev); -void xrandrnotify(XEvent *ev); void send_client_event(long data[5], char *atom_name); void getevent(XEvent ev);