From 5e281dcd446c9ff982b6b569e5405fde79a955bf Mon Sep 17 00:00:00 2001 From: bakkeby Date: Wed, 20 May 2020 15:25:07 +0200 Subject: [PATCH] Adding (temporary?) EWMH_WINDOWS_FLOAT_PATCH --- dwm.c | 47 +++++++++++++++++++++++++++++++++++------------ patches.def.h | 7 +++++++ 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/dwm.c b/dwm.c index d483d9c..329b839 100644 --- a/dwm.c +++ b/dwm.c @@ -111,16 +111,20 @@ enum { #endif // VTCOLORS_PATCH }; /* color schemes */ -enum { NetSupported, NetWMName, NetWMState, NetWMCheck, - NetWMFullscreen, NetActiveWindow, NetWMWindowType, - #if SYSTRAY_PATCH - NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, - NetSystemTrayVisual, NetWMWindowTypeDock, NetSystemTrayOrientationHorz, - #endif // SYSTRAY_PATCH - #if EWMHTAGS_PATCH - NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, - #endif // EWMHTAGS_PATCH - NetWMWindowTypeDialog, NetClientList, NetLast +enum { + NetSupported, NetWMName, NetWMState, NetWMCheck, + NetWMFullscreen, NetActiveWindow, NetWMWindowType, + #if SYSTRAY_PATCH + NetSystemTray, NetSystemTrayOP, NetSystemTrayOrientation, + NetSystemTrayVisual, NetWMWindowTypeDock, NetSystemTrayOrientationHorz, + #endif // SYSTRAY_PATCH + #if EWMHTAGS_PATCH + NetDesktopNames, NetDesktopViewport, NetNumberOfDesktops, NetCurrentDesktop, + #endif // EWMHTAGS_PATCH + #if EWMH_WINDOWS_FLOAT_PATCH + NetWMModal, NetWMWindowTypeUtility, NetWMWindowTypeToolbar, NetWMWindowTypeSplash, + #endif // EWMH_WINDOWS_FLOAT_PATCH + NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */ #if WINDOWROLERULE_PATCH @@ -3044,8 +3048,16 @@ setup(void) netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False); netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False); netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + #if EWMH_WINDOWS_FLOAT_PATCH + netatom[NetWMModal] = XInternAtom(dpy, "_NET_WM_STATE_MODAL", False); + #endif // EWMH_WINDOWS_FLOAT_PATCH netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False); netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False); + #if EWMH_WINDOWS_FLOAT_PATCH + netatom[NetWMWindowTypeUtility] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_UTILITY", False); + netatom[NetWMWindowTypeToolbar] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_TOOLBAR", False); + netatom[NetWMWindowTypeSplash] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_SPLASH", False); + #endif // EWMH_WINDOWS_FLOAT_PATCH netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False); /* init cursors */ cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr); @@ -3947,9 +3959,20 @@ updatewindowtype(Client *c) if (state == netatom[NetWMFullscreen]) setfullscreen(c, 1); - if (wtype == netatom[NetWMWindowTypeDialog]) { + + #if EWMH_WINDOWS_FLOAT_PATCH + if (wtype == netatom[NetWMWindowTypeDialog] || + wtype == netatom[NetWMWindowTypeUtility] || + wtype == netatom[NetWMWindowTypeToolbar] || + wtype == netatom[NetWMWindowTypeSplash] || + state == netatom[NetWMModal]) + #else + if (wtype == netatom[NetWMWindowTypeDialog]) + #endif //EWMH_WINDOWS_FLOAT_PATCH + { #if CENTER_PATCH - c->iscentered = 1; + if (c->x == c->mon->mx && c->y == c->mon->my) + c->iscentered = 1; #endif // CENTER_PATCH c->isfloating = 1; } diff --git a/patches.def.h b/patches.def.h index 33ad14c..3480aff 100644 --- a/patches.def.h +++ b/patches.def.h @@ -169,6 +169,13 @@ */ #define EWMHTAGS_PATCH 0 +/* This patch makes dialog, utility, toolbar, splash and modal windows float by default. + * This may only be a temporary patch depending on whether this is integrated in the main + * dwm source, and if so how. + * https://lists.suckless.org/hackers/2005/17318.html + */ +#define EWMH_WINDOWS_FLOAT_PATCH 0 + /* This patch allows the user to change size and placement of floating windows using only the * keyboard. It also allows for temporary vertical and horizontal extension of windows similar * to other WMs fill command.