From 3a2f736ce58210e52bb223b4e5474c48c1e322e3 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Thu, 25 Feb 2021 00:37:57 -0500 Subject: [PATCH] config.h: document GAPSZ should be even; key.c: only use new center ratio; event.c: spawn new terminals with new ratio via kb --- config.h | 1 + event.c | 2 +- key.c | 52 ++++++++++++++++++++++++++-------------------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/config.h b/config.h index 681e8b5..76ee110 100755 --- a/config.h +++ b/config.h @@ -5,6 +5,7 @@ #define GHOSTCOL 0x797979 #define BORDER 4 +/* Should be even */ #define GAPSZ 4 #define MENUBORDER 0 diff --git a/event.c b/event.c index 1a0b85c..7533b63 100755 --- a/event.c +++ b/event.c @@ -292,7 +292,7 @@ newwindow(XCreateWindowEvent *e) if (kbLaunch) { 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; } } diff --git a/key.c b/key.c index ba7805a..9d7ab08 100755 --- a/key.c +++ b/key.c @@ -130,45 +130,45 @@ keypress(XKeyEvent *e) /* basic wm functionality */ if(e->keycode == tabcode && (e->state&Mod1Mask) == (1<<3)) alttab(e->state&ShiftMask); - if(e->keycode == dcode && (e->state&SHORTCUTMOD) == (MODBITS)) + else if(e->keycode == dcode && (e->state&SHORTCUTMOD) == (MODBITS)) delete(current, 0); - if (e->keycode == icode && (e->state&SHORTCUTMOD) == (MODBITS)) + else if (e->keycode == icode && (e->state&SHORTCUTMOD) == (MODBITS)) hide(current); - if (e->keycode == ucode && (e->state&SHORTCUTMOD) == (MODBITS)) + else if (e->keycode == ucode && (e->state&SHORTCUTMOD) == (MODBITS)) unhide(0, 1); - if (e->keycode == vcode && (e->state&SHORTCUTMOD) == (MODBITS)) + else if (e->keycode == vcode && (e->state&SHORTCUTMOD) == (MODBITS)) 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); - 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); - if (e->keycode == scode && (e->state&SHORTCUTMOD) == (MODBITS)) + else if (e->keycode == scode && (e->state&SHORTCUTMOD) == (MODBITS)) stick(current); /* half snap */ - if (e->keycode == hcode && (e->state&SHORTCUTMOD) == (MODBITS)) - quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height - 2*GAPSZ); - if (e->keycode == lcode && (e->state&SHORTCUTMOD) == (MODBITS)) - quickreshape(current, ra.width/2 + GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height - 2*GAPSZ); - if (e->keycode == jcode && (e->state&SHORTCUTMOD) == (MODBITS)) - quickreshape(current, GAPSZ, ra.height/2 + GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 2*GAPSZ); - if (e->keycode == kcode && (e->state&SHORTCUTMOD) == (MODBITS)) - quickreshape(current, GAPSZ, GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 2*GAPSZ); + else if (e->keycode == hcode && (e->state&SHORTCUTMOD) == (MODBITS)) + quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height - 2*GAPSZ); + else if (e->keycode == lcode && (e->state&SHORTCUTMOD) == (MODBITS)) + quickreshape(current, ra.width/2 + 0.5*GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height - 2*GAPSZ); + else if (e->keycode == jcode && (e->state&SHORTCUTMOD) == (MODBITS)) + quickreshape(current, GAPSZ, ra.height/2 + 0.5*GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 1.5*GAPSZ); + else if (e->keycode == kcode && (e->state&SHORTCUTMOD) == (MODBITS)) + quickreshape(current, GAPSZ, GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 1.5*GAPSZ); /* quarter snap */ - if (e->keycode == qcode && (e->state&SHORTCUTMOD) == (MODBITS)) - quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ); - 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); - 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); - 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); + else if (e->keycode == qcode && (e->state&SHORTCUTMOD) == (MODBITS)) + quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ); + else if (e->keycode == wcode && (e->state&SHORTCUTMOD) == (MODBITS)) + quickreshape(current, GAPSZ, ra.height/2 + 0.5*GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ); + else if (e->keycode == ocode && (e->state&SHORTCUTMOD) == (MODBITS)) + 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); + else if (e->keycode == pcode && (e->state&SHORTCUTMOD) == (MODBITS)) + quickreshape(current, ra.width/2 + 0.5*GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ); /* center snap */ - if (e->keycode == ccode && (e->state&SHORTCUTMOD) == (MODBITS)) - quickreshape(current, ra.width/5, ra.height/5, 3*ra.width/5, 3*ra.height/5); - + else if (e->keycode == ccode && (e->state&SHORTCUTMOD) == (MODBITS)) + quickreshape(current, ra.width/6, GAPSZ, 2*ra.width/3, ra.height - 2*GAPSZ); + #ifdef DEVEL /* manage autostuck windows */ if (e->keycode == tcode && (e->state&SHORTCUTMOD) == (MODBITS))