fix first mouse resize
This commit is contained in:
26
kbfunc.c
26
kbfunc.c
@@ -47,6 +47,7 @@ static void kbfunc_client_move_kb(void *, struct cargs *);
|
||||
static void kbfunc_client_move_mb(void *, struct cargs *);
|
||||
static void kbfunc_client_resize_kb(void *, struct cargs *);
|
||||
static void kbfunc_client_resize_mb(void *, struct cargs *);
|
||||
static Bool kbfunc_discard_configurerequest(Display *, XEvent *, XPointer);
|
||||
|
||||
void
|
||||
kbfunc_cwm_status(void *ctx, struct cargs *cargs)
|
||||
@@ -54,6 +55,17 @@ kbfunc_cwm_status(void *ctx, struct cargs *cargs)
|
||||
cwm_status = cargs->flag;
|
||||
}
|
||||
|
||||
static Bool
|
||||
kbfunc_discard_configurerequest(Display *dpy, XEvent *ev, XPointer arg)
|
||||
{
|
||||
Window *win = (Window *)arg;
|
||||
|
||||
(void)dpy;
|
||||
|
||||
return (ev->type == ConfigureRequest &&
|
||||
ev->xconfigurerequest.window == *win);
|
||||
}
|
||||
|
||||
static void
|
||||
kbfunc_amount(int flags, int amt, int *mx, int *my)
|
||||
{
|
||||
@@ -242,6 +254,7 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
|
||||
{
|
||||
struct client_ctx *cc = ctx;
|
||||
XEvent ev;
|
||||
XEvent cev;
|
||||
Time ltime = 0;
|
||||
struct screen_ctx *sc = cc->sc;
|
||||
int resize = 1;
|
||||
@@ -282,8 +295,19 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ltime)
|
||||
if (ltime) {
|
||||
/*
|
||||
* A newly mapped client can queue a ConfigureRequest while the
|
||||
* resize loop is consuming only mouse events. Drop those stale
|
||||
* requests so the final drag geometry is not immediately
|
||||
* overwritten when the main event loop resumes.
|
||||
*/
|
||||
while (XCheckIfEvent(X_Dpy, &cev,
|
||||
kbfunc_discard_configurerequest,
|
||||
(XPointer)&cc->win))
|
||||
;
|
||||
client_resize(cc, 1);
|
||||
}
|
||||
screen_prop_win_destroy(sc);
|
||||
XUngrabPointer(X_Dpy, CurrentTime);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user