Addressed some conflicts between CMDCUSTOMIZE and NODMENU patches as well as between EXRESIZE and MAXIMIZE patches

This commit is contained in:
bakkeby 2019-11-04 08:17:00 +01:00
parent 2112ea927f
commit 42b66d4b29
8 changed files with 52 additions and 28 deletions

View File

@ -605,7 +605,7 @@ static Key keys[] = {
{ MODKEY|ControlMask|ShiftMask, XK_l, togglehorizontalmax, {0} }, { MODKEY|ControlMask|ShiftMask, XK_l, togglehorizontalmax, {0} },
{ MODKEY|ControlMask|ShiftMask, XK_j, toggleverticalmax, {0} }, { MODKEY|ControlMask|ShiftMask, XK_j, toggleverticalmax, {0} },
{ MODKEY|ControlMask|ShiftMask, XK_k, toggleverticalmax, {0} }, { MODKEY|ControlMask|ShiftMask, XK_k, toggleverticalmax, {0} },
{ MODKEY|ControlMask, XK_m, togglemaximize, {0} }, { MODKEY|ControlMask, XK_m, togglemax, {0} },
#endif // MAXIMIZE_PATCH #endif // MAXIMIZE_PATCH
#if UNFLOATVISIBLE_PATCH #if UNFLOATVISIBLE_PATCH
{ MODKEY|Mod4Mask, XK_space, unfloatvisible, {0} }, { MODKEY|Mod4Mask, XK_space, unfloatvisible, {0} },

18
dwm.c
View File

@ -3800,7 +3800,7 @@ zoom(const Arg *arg)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
#if CMDCUSTOMIZE #if CMDCUSTOMIZE_PATCH
for (int i=1;i<argc;i+=1) for (int i=1;i<argc;i+=1)
if (!strcmp("-v", argv[i])) if (!strcmp("-v", argv[i]))
die("dwm-"VERSION); die("dwm-"VERSION);
@ -3816,6 +3816,19 @@ main(int argc, char *argv[])
colors[SchemeSel][1] = argv[++i]; colors[SchemeSel][1] = argv[++i];
else if (!strcmp("-sf", argv[i])) /* selected foreground color */ else if (!strcmp("-sf", argv[i])) /* selected foreground color */
colors[SchemeSel][0] = argv[++i]; colors[SchemeSel][0] = argv[++i];
#if NODMENU_PATCH
else if (!strcmp("-df", argv[i])) /* dmenu font */
dmenucmd[2] = argv[++i];
else if (!strcmp("-dnb", argv[i])) /* dmenu normal background color */
dmenucmd[4] = argv[++i];
else if (!strcmp("-dnf", argv[i])) /* dmenu normal foreground color */
dmenucmd[6] = argv[++i];
else if (!strcmp("-dsb", argv[i])) /* dmenu selected background color */
dmenucmd[8] = argv[++i];
else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */
dmenucmd[10] = argv[++i];
else die(help());
#else
else if (!strcmp("-df", argv[i])) /* dmenu font */ else if (!strcmp("-df", argv[i])) /* dmenu font */
dmenucmd[4] = argv[++i]; dmenucmd[4] = argv[++i];
else if (!strcmp("-dnb", argv[i])) /* dmenu normal background color */ else if (!strcmp("-dnb", argv[i])) /* dmenu normal background color */
@ -3827,12 +3840,13 @@ main(int argc, char *argv[])
else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */ else if (!strcmp("-dsf", argv[i])) /* dmenu selected foreground color */
dmenucmd[12] = argv[++i]; dmenucmd[12] = argv[++i];
else die(help()); else die(help());
#endif // NODMENU_PATCH
#else #else
if (argc == 2 && !strcmp("-v", argv[1])) if (argc == 2 && !strcmp("-v", argv[1]))
die("dwm-"VERSION); die("dwm-"VERSION);
else if (argc != 1) else if (argc != 1)
die("usage: dwm [-v]"); die("usage: dwm [-v]");
#endif // CMDCUSTOMIZE #endif // CMDCUSTOMIZE_PATCH
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr); fputs("warning: no locale support\n", stderr);
if (!(dpy = XOpenDisplay(NULL))) if (!(dpy = XOpenDisplay(NULL)))

View File

@ -11,7 +11,8 @@
#define FORCE_EXPANDALL ~0 // Force expand in all directions #define FORCE_EXPANDALL ~0 // Force expand in all directions
void void
exresize(const Arg *arg) { exresize(const Arg *arg)
{
Client *c; Client *c;
int x, y, nx, ny, nw, nh; int x, y, nx, ny, nw, nh;
c = selmon->sel; c = selmon->sel;
@ -59,7 +60,8 @@ exresize(const Arg *arg) {
} }
void void
explace(const Arg *arg) { explace(const Arg *arg)
{
Client *c; Client *c;
int nx, ny; int nx, ny;
@ -87,13 +89,13 @@ int
calculate_expand(unsigned char mask, unsigned char curmask, calculate_expand(unsigned char mask, unsigned char curmask,
unsigned char *newmask, unsigned char key, unsigned char *newmask, unsigned char key,
int *reset_value, int new_reset_value, int *reset_value, int new_reset_value,
int max_value, int old_value) { int max_value, int old_value)
{
if (IS_SET(key, mask) || if (IS_SET(key, mask) ||
(IS_SET(key, curmask) && (!IS_SET(key, mask) && IS_FORCED(key, mask))) || (IS_SET(key, curmask) && (!IS_SET(key, mask) && IS_FORCED(key, mask))) ||
(!IS_SET(key, curmask) && (IS_SET(key, mask) && IS_FORCED(key, mask)))) { (!IS_SET(key, curmask) && (IS_SET(key, mask) && IS_FORCED(key, mask)))) {
if (IS_SET(key, mask) && (!IS_SET(key,curmask) || IS_FORCED(key,mask))) if (IS_SET(key, mask) && (!IS_SET(key,curmask) || IS_FORCED(key,mask))) {
{
if (!IS_SET(key, curmask)) if (!IS_SET(key, curmask))
*reset_value = new_reset_value; *reset_value = new_reset_value;
*newmask |= key; *newmask |= key;
@ -111,13 +113,14 @@ calculate_expand(unsigned char mask, unsigned char curmask,
} }
void void
expand(unsigned char mask) { expand(unsigned char mask)
{
XEvent ev; XEvent ev;
int nx1, ny1, nx2, ny2; int nx1, ny1, nx2, ny2;
unsigned char curmask; unsigned char curmask;
unsigned char newmask; unsigned char newmask;
if(!selmon->sel || selmon->sel->isfixed) if (!selmon->sel || selmon->sel->isfixed)
return; return;
XRaiseWindow(dpy, selmon->sel->win); XRaiseWindow(dpy, selmon->sel->win);
newmask = curmask = selmon->sel->expandmask; newmask = curmask = selmon->sel->expandmask;
@ -163,21 +166,24 @@ expand(unsigned char mask) {
} }
void void
togglemaximize(const Arg *arg) { togglemaximize(const Arg *arg)
{
if (arg->i > 0) expand(FORCE_EXPANDALL); if (arg->i > 0) expand(FORCE_EXPANDALL);
else if (arg->i < 0) expand(UNEXPAND); else if (arg->i < 0) expand(UNEXPAND);
else expand(EXPANDALL); else expand(EXPANDALL);
} }
void void
toggleverticalexpand(const Arg *arg) { toggleverticalexpand(const Arg *arg)
{
if (arg->i < 0) expand(EXPAND_DOWN); if (arg->i < 0) expand(EXPAND_DOWN);
else if (arg->i > 0) expand(EXPAND_UP); else if (arg->i > 0) expand(EXPAND_UP);
else expand(EXPAND_DOWN | EXPAND_UP); else expand(EXPAND_DOWN | EXPAND_UP);
} }
void void
togglehorizontalexpand(const Arg *arg) { togglehorizontalexpand(const Arg *arg)
{
if (arg->i < 0) expand(EXPAND_LEFT); if (arg->i < 0) expand(EXPAND_LEFT);
else if (arg->i > 0) expand(EXPAND_RIGHT); else if (arg->i > 0) expand(EXPAND_RIGHT);
else expand(EXPAND_LEFT | EXPAND_RIGHT); else expand(EXPAND_LEFT | EXPAND_RIGHT);

View File

@ -17,7 +17,7 @@
#if CFACTS_PATCH #if CFACTS_PATCH
#include "cfacts.c" #include "cfacts.c"
#endif #endif
#if CMDCUSTOMIZE #if CMDCUSTOMIZE_PATCH
#include "cmdcustomize.c" #include "cmdcustomize.c"
#endif #endif
#if COMBO_PATCH #if COMBO_PATCH
@ -174,4 +174,4 @@
#endif #endif
#if TILE_LAYOUT #if TILE_LAYOUT
#include "tile.c" #include "tile.c"
#endif #endif

View File

@ -17,7 +17,7 @@
#if CFACTS_PATCH #if CFACTS_PATCH
#include "cfacts.h" #include "cfacts.h"
#endif #endif
#if CMDCUSTOMIZE #if CMDCUSTOMIZE_PATCH
#include "cmdcustomize.h" #include "cmdcustomize.h"
#endif #endif
#if COMBO_PATCH #if COMBO_PATCH
@ -174,4 +174,4 @@
#endif #endif
#if TILE_LAYOUT #if TILE_LAYOUT
#include "tile.h" #include "tile.h"
#endif #endif

View File

@ -1,12 +1,13 @@
void void
maximize(int x, int y, int w, int h) { maximize(int x, int y, int w, int h)
{
XEvent ev; XEvent ev;
if(!selmon->sel || selmon->sel->isfixed) if (!selmon->sel || selmon->sel->isfixed)
return; return;
XRaiseWindow(dpy, selmon->sel->win); XRaiseWindow(dpy, selmon->sel->win);
if(!selmon->sel->ismax) { if (!selmon->sel->ismax) {
if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating) if (!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating)
selmon->sel->wasfloating = True; selmon->sel->wasfloating = True;
else { else {
togglefloating(NULL); togglefloating(NULL);
@ -21,25 +22,28 @@ maximize(int x, int y, int w, int h) {
} }
else { else {
resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True); resize(selmon->sel, selmon->sel->oldx, selmon->sel->oldy, selmon->sel->oldw, selmon->sel->oldh, True);
if(!selmon->sel->wasfloating) if (!selmon->sel->wasfloating)
togglefloating(NULL); togglefloating(NULL);
selmon->sel->ismax = False; selmon->sel->ismax = False;
} }
drawbar(selmon); drawbar(selmon);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
} }
void void
togglemaximize(const Arg *arg) { togglemax(const Arg *arg)
{
maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, selmon->wh - 2 * borderpx); maximize(selmon->wx, selmon->wy, selmon->ww - 2 * borderpx, selmon->wh - 2 * borderpx);
} }
void void
toggleverticalmax(const Arg *arg) { toggleverticalmax(const Arg *arg)
{
maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * borderpx); maximize(selmon->sel->x, selmon->wy, selmon->sel->w, selmon->wh - 2 * borderpx);
} }
void void
togglehorizontalmax(const Arg *arg) { togglehorizontalmax(const Arg *arg)
{
maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx, selmon->sel->h); maximize(selmon->wx, selmon->sel->y, selmon->ww - 2 * borderpx, selmon->sel->h);
} }

View File

@ -1,4 +1,4 @@
static void maximize(int x, int y, int w, int h); static void maximize(int x, int y, int w, int h);
static void togglemaximize(const Arg *arg); static void togglemax(const Arg *arg);
static void toggleverticalmax(const Arg *arg); static void toggleverticalmax(const Arg *arg);
static void togglehorizontalmax(const Arg *arg); static void togglehorizontalmax(const Arg *arg);

View File

@ -101,7 +101,7 @@
/* This patch allows color attributes to be set through the command line. /* This patch allows color attributes to be set through the command line.
* https://dwm.suckless.org/patches/cmdcustomize/ * https://dwm.suckless.org/patches/cmdcustomize/
*/ */
#define CMDCUSTOMIZE 0 #define CMDCUSTOMIZE_PATCH 0
/* This patch tweaks the tagging interface so that you can select multiple tags for tag /* This patch tweaks the tagging interface so that you can select multiple tags for tag
* or view by pressing all the right keys as a combo. For example to view tags 1 and 3, * or view by pressing all the right keys as a combo. For example to view tags 1 and 3,