config.h: document GAPSZ should be even; key.c: only use new center ratio; event.c: spawn new terminals with new ratio via kb

This commit is contained in:
Iris Lightshard 2021-02-25 00:37:57 -05:00
parent bc38a1ab32
commit 3a2f736ce5
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 28 additions and 27 deletions

View file

@ -5,6 +5,7 @@
#define GHOSTCOL 0x797979 #define GHOSTCOL 0x797979
#define BORDER 4 #define BORDER 4
/* Should be even */
#define GAPSZ 4 #define GAPSZ 4
#define MENUBORDER 0 #define MENUBORDER 0

View file

@ -292,7 +292,7 @@ newwindow(XCreateWindowEvent *e)
if (kbLaunch) if (kbLaunch)
{ {
usleep(100000); usleep(100000);
quickreshape(c, ra.width/5, ra.height/5, 3*ra.width/5, 3*ra.height/5); quickreshape(c, ra.width/6, GAPSZ, 2*ra.width/3, ra.height - 2*GAPSZ);
kbLaunch = 0; kbLaunch = 0;
} }
} }

52
key.c
View file

@ -130,45 +130,45 @@ keypress(XKeyEvent *e)
/* basic wm functionality */ /* basic wm functionality */
if(e->keycode == tabcode && (e->state&Mod1Mask) == (1<<3)) if(e->keycode == tabcode && (e->state&Mod1Mask) == (1<<3))
alttab(e->state&ShiftMask); alttab(e->state&ShiftMask);
if(e->keycode == dcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if(e->keycode == dcode && (e->state&SHORTCUTMOD) == (MODBITS))
delete(current, 0); delete(current, 0);
if (e->keycode == icode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == icode && (e->state&SHORTCUTMOD) == (MODBITS))
hide(current); hide(current);
if (e->keycode == ucode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == ucode && (e->state&SHORTCUTMOD) == (MODBITS))
unhide(0, 1); unhide(0, 1);
if (e->keycode == vcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == vcode && (e->state&SHORTCUTMOD) == (MODBITS))
move(current, Button3); move(current, Button3);
if (e->keycode == rcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == rcode && (e->state&SHORTCUTMOD) == (MODBITS))
reshape(current, Button3, sweep, 0); reshape(current, Button3, sweep, 0);
if (e->keycode == mcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == mcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, -BORDER, -BORDER, ra.width + 2*BORDER, ra.height + 2*BORDER); quickreshape(current, -BORDER, -BORDER, ra.width + 2*BORDER, ra.height + 2*BORDER);
if (e->keycode == scode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == scode && (e->state&SHORTCUTMOD) == (MODBITS))
stick(current); stick(current);
/* half snap */ /* half snap */
if (e->keycode == hcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == hcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height - 2*GAPSZ); quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height - 2*GAPSZ);
if (e->keycode == lcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == lcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height - 2*GAPSZ); quickreshape(current, ra.width/2 + 0.5*GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height - 2*GAPSZ);
if (e->keycode == jcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == jcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, ra.height/2 + GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 2*GAPSZ); quickreshape(current, GAPSZ, ra.height/2 + 0.5*GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 1.5*GAPSZ);
if (e->keycode == kcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == kcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 2*GAPSZ); quickreshape(current, GAPSZ, GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 1.5*GAPSZ);
/* quarter snap */ /* quarter snap */
if (e->keycode == qcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == qcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ); quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ);
if (e->keycode == wcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == wcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, ra.height/2 + GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ); quickreshape(current, GAPSZ, ra.height/2 + 0.5*GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ);
if (e->keycode == ocode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == ocode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + GAPSZ, ra.height/2 + GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ); quickreshape(current, ra.width/2 + 0.5*GAPSZ, ra.height/2 + 0.5*GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ);
if (e->keycode == pcode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == pcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ); quickreshape(current, ra.width/2 + 0.5*GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ);
/* center snap */ /* center snap */
if (e->keycode == ccode && (e->state&SHORTCUTMOD) == (MODBITS)) else if (e->keycode == ccode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/5, ra.height/5, 3*ra.width/5, 3*ra.height/5); quickreshape(current, ra.width/6, GAPSZ, 2*ra.width/3, ra.height - 2*GAPSZ);
#ifdef DEVEL #ifdef DEVEL
/* manage autostuck windows */ /* manage autostuck windows */
if (e->keycode == tcode && (e->state&SHORTCUTMOD) == (MODBITS)) if (e->keycode == tcode && (e->state&SHORTCUTMOD) == (MODBITS))