From 3c9eba037e0c2fa552063548582468c86c0d3182 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 8 Oct 2019 23:15:11 +0200 Subject: [PATCH] Adding fakefullscreen patch --- README.md | 6 +++++- dwm.c | 26 ++++++++++++++++++++++++-- patches.h | 7 +++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 82b0518..26cdee4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2019-10-08 - Added columns layout +2019-10-08 - Added columns layout and fakefullscreen patch 2019-10-07 - Added sortscreens and dwmc patches, fixed minor cross-compatibility issues for combo, holdbar, leftlayout, hidevacanttags, taggrid and activetagindicatorbar @@ -113,6 +113,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [ewmhtags](https://dwm.suckless.org/patches/ewmhtags/) - adds EWMH support for \_NET_NUMBER_OF_DESKTOPS, \_NET_CURRENT_DESKTOP, \_NET_DESKTOP_NAMES and \_NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs that request workspace information, e.g. polybar's xworkspaces module + - [fakefullscreen](https://dwm.suckless.org/patches/fakefullscreen/) + - only allow clients to "fullscreen" into the space currently given to them + - as an example, this will allow you to view a fullscreen video in your browser on one half of the screen, while having the other half available for other tasks + - [fancybar](https://dwm.suckless.org/patches/fancybar/) - shows the titles of all visible windows in the status bar diff --git a/dwm.c b/dwm.c index 0b2c771..95129b5 100644 --- a/dwm.c +++ b/dwm.c @@ -919,7 +919,11 @@ clientmessage(XEvent *e) if (cme->data.l[1] == netatom[NetWMFullscreen] || cme->data.l[2] == netatom[NetWMFullscreen]) setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ - || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); + || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ + #if !FAKEFULLSCREEN_PATCH + && !c->isfullscreen + #endif // !FAKEFULLSCREEN_PATCH + ))); } else if (cme->message_type == netatom[NetActiveWindow]) { #if FOCUSONNETACTIVE_PATCH for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++); @@ -960,7 +964,9 @@ void configurenotify(XEvent *e) { Monitor *m; + #if !FAKEFULLSCREEN_PATCH Client *c; + #endif // !FAKEFULLSCREEN_PATCH XConfigureEvent *ev = &e->xconfigure; int dirty; @@ -973,9 +979,11 @@ configurenotify(XEvent *e) drw_resize(drw, sw, bh); updatebars(); for (m = mons; m; m = m->next) { + #if !FAKEFULLSCREEN_PATCH for (c = m->clients; c; c = c->next) if (c->isfullscreen) resizeclient(c, m->mx, m->my, m->mw, m->mh); + #endif // !FAKEFULLSCREEN_PATCH XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); } focus(NULL); @@ -2006,8 +2014,10 @@ movemouse(const Arg *arg) if (!(c = selmon->sel)) return; + #if !FAKEFULLSCREEN_PATCH if (c->isfullscreen) /* no support moving fullscreen windows by mouse */ return; + #endif // FAKEFULLSCREEN_PATCH restack(selmon); ocx = c->x; ocy = c->y; @@ -2235,8 +2245,10 @@ resizemouse(const Arg *arg) if (!(c = selmon->sel)) return; + #if !FAKEFULLSCREEN_PATCH if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */ return; + #endif // !FAKEFULLSCREEN_PATCH restack(selmon); ocx = c->x; ocy = c->y; @@ -2508,16 +2520,19 @@ setfullscreen(Client *c, int fullscreen) XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); c->isfullscreen = 1; + #if !FAKEFULLSCREEN_PATCH c->oldstate = c->isfloating; c->oldbw = c->bw; c->bw = 0; c->isfloating = 1; resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); XRaiseWindow(dpy, c->win); + #endif // !FAKEFULLSCREEN_PATCH } else if (!fullscreen && c->isfullscreen){ XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32, PropModeReplace, (unsigned char*)0, 0); c->isfullscreen = 0; + #if !FAKEFULLSCREEN_PATCH c->isfloating = c->oldstate; c->bw = c->oldbw; c->x = c->oldx; @@ -2526,6 +2541,7 @@ setfullscreen(Client *c, int fullscreen) c->h = c->oldh; resizeclient(c, c->x, c->y, c->w, c->h); arrange(c->mon); + #endif // !FAKEFULLSCREEN_PATCH } } @@ -2756,7 +2772,11 @@ showhide(Client *c) #else XMoveWindow(dpy, c->win, c->x, c->y); #endif // AUTORESIZE_PATCH - if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen) + if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) + #if !FAKEFULLSCREEN_PATCH + && !c->isfullscreen + #endif // !FAKEFULLSCREEN_PATCH + ) resize(c, c->x, c->y, c->w, c->h, 0); showhide(c->snext); } else { @@ -2853,8 +2873,10 @@ togglefloating(const Arg *arg) { if (!selmon->sel) return; + #if !FAKEFULLSCREEN_PATCH if (selmon->sel->isfullscreen) /* no support for fullscreen windows */ return; + #endif // !FAKEFULLSCREEN_PATCH selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; #if FLOAT_BORDER_COLOR_PATCH if (selmon->sel->isfloating) diff --git a/patches.h b/patches.h index d890245..5d86161 100644 --- a/patches.h +++ b/patches.h @@ -136,6 +136,13 @@ */ #define EWMHTAGS_PATCH 0 +/* Only allow clients to "fullscreen" into the space currently given to them. + * As an example, this will allow you to view a fullscreen video in your browser on + * one half of the screen, while having the other half available for other tasks. + * https://dwm.suckless.org/patches/fakefullscreen/ + */ +#define FAKEFULLSCREEN_PATCH 0 + /* This patch shows the titles of all visible windows in the status bar * (as opposed to showing only the selected one). * Awesomebar takes precedence over fancybar. Fancybar takes precedence over