fix first mouse resize
This commit is contained in:
2
client.c
2
client.c
@@ -79,6 +79,8 @@ client_init(Window win, struct screen_ctx *sc)
|
|||||||
cc->geom.y = wattr.y;
|
cc->geom.y = wattr.y;
|
||||||
cc->geom.w = wattr.width;
|
cc->geom.w = wattr.width;
|
||||||
cc->geom.h = wattr.height;
|
cc->geom.h = wattr.height;
|
||||||
|
cc->savegeom = cc->geom;
|
||||||
|
cc->fullgeom = cc->geom;
|
||||||
cc->colormap = wattr.colormap;
|
cc->colormap = wattr.colormap;
|
||||||
cc->obwidth = wattr.border_width;
|
cc->obwidth = wattr.border_width;
|
||||||
cc->bwidth = Conf.bwidth;
|
cc->bwidth = Conf.bwidth;
|
||||||
|
|||||||
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_move_mb(void *, struct cargs *);
|
||||||
static void kbfunc_client_resize_kb(void *, struct cargs *);
|
static void kbfunc_client_resize_kb(void *, struct cargs *);
|
||||||
static void kbfunc_client_resize_mb(void *, struct cargs *);
|
static void kbfunc_client_resize_mb(void *, struct cargs *);
|
||||||
|
static Bool kbfunc_discard_configurerequest(Display *, XEvent *, XPointer);
|
||||||
|
|
||||||
void
|
void
|
||||||
kbfunc_cwm_status(void *ctx, struct cargs *cargs)
|
kbfunc_cwm_status(void *ctx, struct cargs *cargs)
|
||||||
@@ -54,6 +55,17 @@ kbfunc_cwm_status(void *ctx, struct cargs *cargs)
|
|||||||
cwm_status = cargs->flag;
|
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
|
static void
|
||||||
kbfunc_amount(int flags, int amt, int *mx, int *my)
|
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;
|
struct client_ctx *cc = ctx;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
XEvent cev;
|
||||||
Time ltime = 0;
|
Time ltime = 0;
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
int resize = 1;
|
int resize = 1;
|
||||||
@@ -282,8 +295,19 @@ kbfunc_client_resize_mb(void *ctx, struct cargs *cargs)
|
|||||||
break;
|
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);
|
client_resize(cc, 1);
|
||||||
|
}
|
||||||
screen_prop_win_destroy(sc);
|
screen_prop_win_destroy(sc);
|
||||||
XUngrabPointer(X_Dpy, CurrentTime);
|
XUngrabPointer(X_Dpy, CurrentTime);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user