add SHOWMAX option and maximize menu item, fix (I think) shuffle on delete to only shuffle if there is no current after deletion

This commit is contained in:
Iris Lightshard 2021-03-08 15:51:53 -05:00
parent 404424f518
commit 5f0c7eaf25
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 50 additions and 11 deletions

View file

@ -94,6 +94,9 @@
*/ */
#define CENTERVMAX #define CENTERVMAX
/* Show 'Maximize' menuitem? */
//#define SHOWMAX
/* Show 'Stick' menuitem? */ /* Show 'Stick' menuitem? */
//#define SHOWSTICK //#define SHOWSTICK

4
dat.h
View file

@ -6,7 +6,9 @@
#define CORNER _corner #define CORNER _corner
#define INSET _inset #define INSET _inset
#define MAXHIDDEN 128 #define MAXHIDDEN 128
#ifdef SHOWSTICK #if defined (SHOWMAX) && defined (SHOWSTICK)
#define B3FIXED 7
#elif defined (SHOWMAX) || defined (SHOWSTICK)
#define B3FIXED 6 #define B3FIXED 6
#else #else
#define B3FIXED 5 #define B3FIXED 5

54
menu.c
View file

@ -35,24 +35,38 @@ char* b3items[B3FIXED + MAXHIDDEN + 1] = {
"New", "New",
"Reshape", "Reshape",
"Move", "Move",
"Delete", #if defined(SHOWMAX) && defined(SHOWSTICK)
"Hide", "Maximize",
"Stick",
#else
#ifdef SHOWMAX
"Maximize",
#endif
#ifdef SHOWSTICK #ifdef SHOWSTICK
"Stick", "Stick",
#endif #endif
#endif
"Delete",
"Hide",
0}; 0};
enum { enum {
New, New,
Reshape, Reshape,
Move, Move,
Delete, #if defined(SHOWMAX) && defined(SHOWSTICK)
#ifdef SHOWSTICK Maximize,
Hide, Stick,
Stick
#else #else
Hide #ifdef SHOWMAX
Maximize,
#endif #endif
#ifdef SHOWSTICK
Stick,
#endif
#endif
Delete,
Hide
}; };
Menu b3menu = {b3items}; Menu b3menu = {b3items};
@ -65,6 +79,9 @@ void button(XButtonEvent* e) {
Window dw; Window dw;
ScreenInfo* s; ScreenInfo* s;
static XWindowAttributes ra;
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &ra);
curtime = e->time; curtime = e->time;
s = getscreen(e->root); s = getscreen(e->root);
if (s == 0) if (s == 0)
@ -170,6 +187,23 @@ void button(XButtonEvent* e) {
case Hide: case Hide:
hide(selectwin(1, 0, s)); hide(selectwin(1, 0, s));
break; break;
#ifdef SHOWMAX
case Maximize:
c = selectwin(1, 0, s);
#ifdef AUTOSTICK
if (isautostick(c))
break;
#endif
quickreshape(
c,
-BORDER,
-BORDER,
ra.width + 2 * BORDER,
ra.height + 2 * BORDER);
active(c);
top(c);
break;
#endif
#ifdef SHOWSTICK #ifdef SHOWSTICK
case Stick: case Stick:
stick(selectwin(1, 0, s)); stick(selectwin(1, 0, s));
@ -260,13 +294,13 @@ void move(Client* c, int but) {
} }
void delete (Client* c, int shift) { void delete (Client* c, int shift) {
int v; //int v;
if (c == 0) if (c == 0)
return; return;
v = c->virt; //v = c->virt;
if ((c->proto & Pdelete) && !shift) { if ((c->proto & Pdelete) && !shift) {
sendcmessage(c->window, wm_protocols, wm_delete, 0, 0); sendcmessage(c->window, wm_protocols, wm_delete, 0, 0);
if (v == virt) { if (!current) {
shuffle(0); shuffle(0);
} }
} }