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
/* Show 'Maximize' menuitem? */
//#define SHOWMAX
/* Show 'Stick' menuitem? */
//#define SHOWSTICK

4
dat.h
View file

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

54
menu.c
View file

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