mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
placemouse: upgrade to include moveorplace function
This commit is contained in:
parent
9fcfa8d6ce
commit
009b84cbdc
10
config.def.h
10
config.def.h
@ -1171,14 +1171,20 @@ static Button buttons[] = {
|
|||||||
#else
|
#else
|
||||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
#endif // BAR_STATUSCMD_PATCH
|
#endif // BAR_STATUSCMD_PATCH
|
||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
|
||||||
#if PLACEMOUSE_PATCH
|
#if PLACEMOUSE_PATCH
|
||||||
/* placemouse options, choose which feels more natural:
|
/* placemouse options, choose which feels more natural:
|
||||||
* 0 - tiled position is relative to mouse cursor
|
* 0 - tiled position is relative to mouse cursor
|
||||||
* 1 - tiled postiion is relative to window center
|
* 1 - tiled postiion is relative to window center
|
||||||
* 2 - mouse pointer warps to window center
|
* 2 - mouse pointer warps to window center
|
||||||
|
*
|
||||||
|
* The moveorplace uses movemouse or placemouse depending on the floating state
|
||||||
|
* of the selected client. Set up individual keybindings for the two if you want
|
||||||
|
* to control these separately (i.e. to retain the feature to move a tiled window
|
||||||
|
* into a floating position).
|
||||||
*/
|
*/
|
||||||
{ ClkClientWin, MODKEY|ControlMask, Button1, placemouse, {.i = 1} },
|
{ ClkClientWin, MODKEY, Button1, moveorplace, {.i = 1} },
|
||||||
|
#else
|
||||||
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
#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} },
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
void
|
||||||
|
moveorplace(const Arg *arg) {
|
||||||
|
if ((!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating))
|
||||||
|
movemouse(arg);
|
||||||
|
else
|
||||||
|
placemouse(arg);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
placemouse(const Arg *arg)
|
placemouse(const Arg *arg)
|
||||||
{
|
{
|
||||||
@ -117,9 +125,9 @@ placemouse(const Arg *arg)
|
|||||||
attach(c);
|
attach(c);
|
||||||
attachstack(c);
|
attachstack(c);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focus(c);
|
||||||
c->beingmoved = 0;
|
c->beingmoved = 0;
|
||||||
|
|
||||||
if (nx != -9999)
|
if (nx != -9999)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#define INTERSECTC(x,y,w,h,z) (MAX(0, MIN((x)+(w),(z)->x+(z)->w) - MAX((x),(z)->x)) \
|
#define INTERSECTC(x,y,w,h,z) (MAX(0, MIN((x)+(w),(z)->x+(z)->w) - MAX((x),(z)->x)) \
|
||||||
* MAX(0, MIN((y)+(h),(z)->y+(z)->h) - MAX((y),(z)->y)))
|
* MAX(0, MIN((y)+(h),(z)->y+(z)->h) - MAX((y),(z)->y)))
|
||||||
|
|
||||||
|
static void moveorplace(const Arg *arg);
|
||||||
static void placemouse(const Arg *arg);
|
static void placemouse(const Arg *arg);
|
||||||
static Client *recttoclient(int x, int y, int w, int h);
|
static Client *recttoclient(int x, int y, int w, int h);
|
||||||
|
Loading…
Reference in New Issue
Block a user