summaryrefslogtreecommitdiff
path: root/src/sxwm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sxwm.c')
-rw-r--r--src/sxwm.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/sxwm.c b/src/sxwm.c
index 01d0cb8..3990f3f 100644
--- a/src/sxwm.c
+++ b/src/sxwm.c
@@ -53,6 +53,7 @@ static void setup(void);
static void spawn(const char **cmd);
static void tile(void);
static void toggle_floating(void);
+static void toggle_floating_global(void);
static void update_borders(void);
static int xerr(Display *dpy, XErrorEvent *ee);
static void xev_case(XEvent *xev);
@@ -606,6 +607,43 @@ toggle_floating(void)
}
static void
+toggle_floating_global(void)
+{
+ Bool any_tiled = False;
+ for (Client *c = clients; c; c = c->next) {
+ if (!c->floating) {
+ any_tiled = True;
+ break;
+ }
+ }
+
+ for (Client *c = clients; c; c = c->next) {
+ c->floating = any_tiled;
+ if (c->floating) {
+ XWindowAttributes wa;
+ XGetWindowAttributes(dpy, c->win, &wa);
+ c->x = wa.x;
+ c->y = wa.y;
+ c->w = wa.width;
+ c->h = wa.height;
+
+ XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight,
+ &(XWindowChanges){
+ .x = c->x,
+ .y = c->y,
+ .width = c->w,
+ .height = c->h
+ }
+ );
+ XRaiseWindow(dpy, c->win);
+ }
+ }
+
+ tile();
+ update_borders();
+}
+
+static void
update_borders(void)
{
for (Client *c = clients; c; c = c->next) {
@@ -627,13 +665,13 @@ xerr(Display *dpy, XErrorEvent *ee)
XGetErrorText(dpy, ee->error_code, buf, sizeof(buf));
fprintf(stderr,
"sxwm: X error:\n"
- " request code: %d\n"
- " error code: %d (%s)\n"
- " resource id: 0x%lx\n",
+ "\trequest code: %d\n"
+ "\terror code: %d (%s)\n"
+ "\tresource id: 0x%lx\n",
ee->request_code,
ee->error_code, buf,
- ee->resourceid
- ); return 0;
+ ee->resourceid);
+ return 0;
if (dpy && ee) return 0;
}