From 62959ded52b3ac806e2c27178397f7c560db772b Mon Sep 17 00:00:00 2001 From: Seungheon Oh Date: Sat, 14 Dec 2019 21:58:12 -0600 Subject: [PATCH 1/3] README.md: Instruction for applying multiple patches --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4f6db91..bb52953 100644 --- a/README.md +++ b/README.md @@ -65,8 +65,8 @@ An itsy bitsy floating window manager (*220~ sloc / 24kb compiled!*). 2) Run `make` to build `sowm`. 3) Copy it to your path or run `make install`. - `DESTDIR` and `PREFIX` are supported. - 4) (Optional) Apply patch with `git apply patches/patch-name` + - In case of applying multiple patches, it has to be done **manually**. ## Thanks From 1d376513914a0eca4c5d50b63afc1efbdf2a36c3 Mon Sep 17 00:00:00 2001 From: Seungheon Oh Date: Sat, 14 Dec 2019 22:41:15 -0600 Subject: [PATCH 2/3] Patch: Wheel for resizing window --- patches/sowm-wheelresize.patch | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 patches/sowm-wheelresize.patch diff --git a/patches/sowm-wheelresize.patch b/patches/sowm-wheelresize.patch new file mode 100644 index 0000000..28a2ff8 --- /dev/null +++ b/patches/sowm-wheelresize.patch @@ -0,0 +1,43 @@ +diff --git a/config.def.h b/config.def.h +index aaaf38d..5a95d71 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -2,6 +2,7 @@ + #define CONFIG_H + + #define MOD Mod4Mask ++#define WheelResizeStep 5 + + const char* menu[] = {"dmenu_run", 0}; + const char* term[] = {"st", 0}; +diff --git a/sowm.c b/sowm.c +index bc14c4e..3b95c28 100644 +--- a/sowm.c ++++ b/sowm.c +@@ -120,6 +120,17 @@ void button_press(XEvent *e) { + + win_size(e->xbutton.subwindow, &wx, &wy, &ww, &wh); + XRaiseWindow(d, e->xbutton.subwindow); ++ ++ int sd = 0; ++ if(e->xbutton.button == Button4) sd = WheelResizeStep; ++ else if(e->xbutton.button == Button5) sd = -WheelResizeStep; ++ ++ XMoveResizeWindow(d, e->xbutton.subwindow, ++ wx - sd, ++ wy - sd, ++ ww + sd*2, ++ wh + sd*2); ++ + mouse = e->xbutton; + } + +@@ -285,7 +296,7 @@ int main(void) { + XGrabKey(d, XKeysymToKeycode(d, keys[i].keysym), keys[i].mod, + root, True, GrabModeAsync, GrabModeAsync); + +- for (int i=1; i<4; i+=2) ++ for (int i=1; i<6; i++) + XGrabButton(d, i, MOD, root, True, + ButtonPressMask|ButtonReleaseMask|PointerMotionMask, + GrabModeAsync, GrabModeAsync, 0, 0); From 3efaa6decc5ac1bac1cb0005efff58555b7df523 Mon Sep 17 00:00:00 2001 From: Seungheon Oh Date: Sat, 14 Dec 2019 23:16:33 -0600 Subject: [PATCH 3/3] Patch: Bug fix --- patches/sowm-rect-to-move.patch | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/patches/sowm-rect-to-move.patch b/patches/sowm-rect-to-move.patch index 6d66aeb..42146cf 100644 --- a/patches/sowm-rect-to-move.patch +++ b/patches/sowm-rect-to-move.patch @@ -1,5 +1,5 @@ diff --git a/sowm.c b/sowm.c -index bc14c4e..83ed0fb 100644 +index bc14c4e..4ae3a8f 100644 --- a/sowm.c +++ b/sowm.c @@ -65,6 +65,9 @@ static void (*events[LASTEvent])(XEvent *e) = { @@ -16,7 +16,7 @@ index bc14c4e..83ed0fb 100644 XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \ &(unsigned int){0}, &(unsigned int){0}) -+#define abs(a) a < 0 ? -a : a ++#define ABS(N) (((N)<0)?-(N):(N)) + +void draw_outline(int x1, int y1, int x2, int y2) { + XClearWindow(d, RootWindow(d, DefaultScreen(d))); @@ -48,7 +48,7 @@ index bc14c4e..83ed0fb 100644 while(XCheckTypedEvent(d, MotionNotify, e)); -@@ -116,15 +139,42 @@ void key_press(XEvent *e) { +@@ -116,15 +139,43 @@ void key_press(XEvent *e) { } void button_press(XEvent *e) { @@ -73,10 +73,10 @@ index bc14c4e..83ed0fb 100644 + cur = list->prev; + + XMoveResizeWindow(d, cur->w, -+ mouse.x_root, -+ mouse.y_root, -+ abs(e->xbutton.x_root - mouse.x_root), -+ abs(e->xbutton.y_root - mouse.y_root)); ++ e->xbutton.x_root > mouse.x_root ? mouse.x_root : e->xbutton.x_root, ++ e->xbutton.y_root > mouse.y_root ? mouse.y_root : e->xbutton.y_root, ++ ABS(mouse.x_root - e->xbutton.x_root), ++ ABS(mouse.y_root - e->xbutton.y_root)); + + XMapWindow(d, WaitingWindow); + win_focus(list->prev); @@ -84,18 +84,19 @@ index bc14c4e..83ed0fb 100644 + WaitingWindow = 0; + + } else if(!mouse.subwindow && cur) { ++ + XMoveResizeWindow(d, cur->w, -+ mouse.x_root, -+ mouse.y_root, -+ abs(e->xbutton.x_root - mouse.x_root), -+ abs(e->xbutton.y_root - mouse.y_root)); ++ e->xbutton.x_root > mouse.x_root ? mouse.x_root : e->xbutton.x_root, ++ e->xbutton.y_root > mouse.y_root ? mouse.y_root : e->xbutton.y_root, ++ ABS(mouse.x_root - e->xbutton.x_root), ++ ABS(mouse.y_root - e->xbutton.y_root)); + + mouse.subwindow = 0; + } } void win_add(Window w) { -@@ -244,17 +294,7 @@ void configure_request(XEvent *e) { +@@ -244,17 +295,7 @@ void configure_request(XEvent *e) { } void map_request(XEvent *e) {