mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Add tapresize patch
This commit is contained in:
parent
4751d7388d
commit
07277cc460
19
config.def.h
19
config.def.h
@ -532,6 +532,19 @@ static const int decorhints = 1; /* 1 means respect decoration hints */
|
|||||||
#define FORCE_VSPLIT 1
|
#define FORCE_VSPLIT 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if TAPRESIZE_PATCH
|
||||||
|
/* mouse scroll resize */
|
||||||
|
static const int scrollsensetivity = 30; /* 1 means resize window by 1 pixel for each scroll event */
|
||||||
|
/* resizemousescroll direction argument list */
|
||||||
|
static const int scrollargs[][2] = {
|
||||||
|
/* width change height change */
|
||||||
|
{ +scrollsensetivity, 0 },
|
||||||
|
{ -scrollsensetivity, 0 },
|
||||||
|
{ 0, +scrollsensetivity },
|
||||||
|
{ 0, -scrollsensetivity },
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FLEXTILE_DELUXE_LAYOUT
|
#if FLEXTILE_DELUXE_LAYOUT
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function, { nmaster, nstack, layout, master axis, stack axis, secondary stack axis, symbol func } */
|
/* symbol arrange function, { nmaster, nstack, layout, master axis, stack axis, secondary stack axis, symbol func } */
|
||||||
@ -1207,6 +1220,12 @@ static Button buttons[] = {
|
|||||||
#endif // PLACEMOUSE_PATCH
|
#endif // PLACEMOUSE_PATCH
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
|
||||||
|
#if TAPRESIZE_PATCH
|
||||||
|
{ ClkClientWin, MODKEY, Button4, resizemousescroll, {.v = &scrollargs[0]} },
|
||||||
|
{ ClkClientWin, MODKEY, Button5, resizemousescroll, {.v = &scrollargs[1]} },
|
||||||
|
{ ClkClientWin, MODKEY, Button6, resizemousescroll, {.v = &scrollargs[2]} },
|
||||||
|
{ ClkClientWin, MODKEY, Button7, resizemousescroll, {.v = &scrollargs[3]} },
|
||||||
|
#endif // TAPRESIZE_PATCH
|
||||||
#if DRAGCFACT_PATCH && CFACTS_PATCH
|
#if DRAGCFACT_PATCH && CFACTS_PATCH
|
||||||
{ ClkClientWin, MODKEY|ShiftMask, Button3, dragcfact, {0} },
|
{ ClkClientWin, MODKEY|ShiftMask, Button3, dragcfact, {0} },
|
||||||
#endif // DRAGCFACT_PATCH
|
#endif // DRAGCFACT_PATCH
|
||||||
|
@ -268,6 +268,9 @@
|
|||||||
#if TAGSWAPMON_PATCH
|
#if TAGSWAPMON_PATCH
|
||||||
#include "tagswapmon.c"
|
#include "tagswapmon.c"
|
||||||
#endif
|
#endif
|
||||||
|
#if TAPRESIZE_PATCH
|
||||||
|
#include "tapresize.c"
|
||||||
|
#endif
|
||||||
#if TOGGLEFULLSCREEN_PATCH
|
#if TOGGLEFULLSCREEN_PATCH
|
||||||
#include "togglefullscreen.c"
|
#include "togglefullscreen.c"
|
||||||
#endif
|
#endif
|
||||||
|
@ -264,6 +264,9 @@
|
|||||||
#if TAGSWAPMON_PATCH
|
#if TAGSWAPMON_PATCH
|
||||||
#include "tagswapmon.h"
|
#include "tagswapmon.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if TAPRESIZE_PATCH
|
||||||
|
#include "tapresize.h"
|
||||||
|
#endif
|
||||||
#if TOGGLEFULLSCREEN_PATCH
|
#if TOGGLEFULLSCREEN_PATCH
|
||||||
#include "togglefullscreen.h"
|
#include "togglefullscreen.h"
|
||||||
#endif
|
#endif
|
||||||
|
38
patch/tapresize.c
Normal file
38
patch/tapresize.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
void
|
||||||
|
resizemousescroll(const Arg *arg)
|
||||||
|
{
|
||||||
|
int nw, nh;
|
||||||
|
Client *c;
|
||||||
|
Monitor *m;
|
||||||
|
XEvent ev;
|
||||||
|
int dw = *((int*)arg->v + 1);
|
||||||
|
int dh = *(int*)arg->v;
|
||||||
|
|
||||||
|
if (!(c = selmon->sel))
|
||||||
|
return;
|
||||||
|
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
||||||
|
return;
|
||||||
|
restack(selmon);
|
||||||
|
if (XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
|
None, cursor[CurResize]->cursor, CurrentTime) != GrabSuccess)
|
||||||
|
return;
|
||||||
|
nw = MAX(c->w + dw, 1);
|
||||||
|
nh = MAX(c->h + dh, 1);
|
||||||
|
if (c->mon->wx + nw >= selmon->wx && c->mon->wx + nw <= selmon->wx + selmon->ww
|
||||||
|
&& c->mon->wy + nh >= selmon->wy && c->mon->wy + nh <= selmon->wy + selmon->wh)
|
||||||
|
{
|
||||||
|
if (!c->isfloating && selmon->lt[selmon->sellt]->arrange
|
||||||
|
&& (abs(nw - c->w) > snap || abs(nh - c->h) > snap))
|
||||||
|
togglefloating(NULL);
|
||||||
|
}
|
||||||
|
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
||||||
|
resize(c, c->x, c->y, nw, nh, 1);
|
||||||
|
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
||||||
|
XUngrabPointer(dpy, CurrentTime);
|
||||||
|
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
|
if ((m = recttomon(c->x, c->y, c->w, c->h)) != selmon) {
|
||||||
|
sendmon(c, m);
|
||||||
|
selmon = m;
|
||||||
|
focus(NULL);
|
||||||
|
}
|
||||||
|
}
|
1
patch/tapresize.h
Normal file
1
patch/tapresize.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
static void resizemousescroll(const Arg *arg);
|
@ -1017,6 +1017,13 @@
|
|||||||
*/
|
*/
|
||||||
#define TAGSWAPMON_PATCH 0
|
#define TAGSWAPMON_PATCH 0
|
||||||
|
|
||||||
|
/* This patch can be useful to the touchpad users because it allows to
|
||||||
|
* resize windows using Mod + two-finger scroll. It is useful when
|
||||||
|
* two-finger scrolling is configured in libinput.
|
||||||
|
* https://dwm.suckless.org/patches/tapresize/
|
||||||
|
*/
|
||||||
|
#define TAPRESIZE_PATCH 0
|
||||||
|
|
||||||
/* This patch allows you to toggle fullscreen on and off using a single shortcut key.
|
/* This patch allows you to toggle fullscreen on and off using a single shortcut key.
|
||||||
* https://github.com/bakkeby/patches/blob/master/dwm/dwm-togglefullscreen-6.2.diff
|
* https://github.com/bakkeby/patches/blob/master/dwm/dwm-togglefullscreen-6.2.diff
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user