---
x.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/x.c b/x.c
index bc3ad5a..b53ede6 100644
--- a/x.c
+++ b/x.c
_AT_@ -246,8 +246,6 @@ static char *opt_line = NULL;
static char *opt_name = NULL;
static char *opt_title = NULL;
-static int oldbutton = 3; /* button event on startup: 3 = release */
-
void
clipcopy(const Arg *dummy)
{
_AT_@ -362,6 +360,7 @@ mousereport(XEvent *e)
button = e->xbutton.button, state = e->xbutton.state;
char buf[40];
static int ox, oy;
+ static int dragbutton = -1; /* -1 = off */
/* from urxvt */
if (e->xbutton.type == MotionNotify) {
_AT_@ -370,10 +369,10 @@ mousereport(XEvent *e)
if (!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY))
return;
/* MOUSE_MOTION: no reporting if no button is pressed */
- if (IS_SET(MODE_MOUSEMOTION) && oldbutton == 3)
+ if (IS_SET(MODE_MOUSEMOTION) && dragbutton == -1)
return;
- button = oldbutton + 32;
+ button = dragbutton + 32;
ox = x;
oy = y;
} else {
_AT_@ -385,11 +384,14 @@ mousereport(XEvent *e)
button += 64 - 3;
}
if (e->xbutton.type == ButtonPress) {
- oldbutton = button;
- ox = x;
- oy = y;
+ if (dragbutton == -1) {
+ dragbutton = button;
+ ox = x;
+ oy = y;
+ }
} else if (e->xbutton.type == ButtonRelease) {
- oldbutton = 3;
+ if (button == dragbutton)
+ dragbutton = -1;
/* MODE_MOUSEX10: no button release reporting */
if (IS_SET(MODE_MOUSEX10))
return;
--
2.20.1
Received on Sat Nov 23 2019 - 20:29:39 CET
This archive was generated by hypermail 2.3.0 : Sat Nov 23 2019 - 21:12:23 CET