event: Add configureevent function (to replace configurerequest)
This commit is contained in:
parent
fdb38b5dec
commit
11808514b4
@ -72,8 +72,6 @@ client_configure(Client *c)
|
|||||||
{
|
{
|
||||||
XConfigureEvent ev;
|
XConfigureEvent ev;
|
||||||
|
|
||||||
client_moveresize(c, c->geo, True);
|
|
||||||
|
|
||||||
ev.type = ConfigureNotify;
|
ev.type = ConfigureNotify;
|
||||||
ev.event = c->win;
|
ev.event = c->win;
|
||||||
ev.window = c->win;
|
ev.window = c->win;
|
||||||
|
|||||||
75
src/event.c
75
src/event.c
@ -98,49 +98,58 @@ buttonpress(XButtonEvent *ev)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ConfigureRequest handle event
|
/** ConfigureRequest & ConfigureNotify handle event
|
||||||
* \param ev XConfigureRequestEvent pointer
|
* \param ev XEvent pointer
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
configurerequest(XConfigureRequestEvent *ev)
|
configureevent(XEvent *ev)
|
||||||
{
|
{
|
||||||
Client *c;
|
|
||||||
XWindowChanges wc;
|
XWindowChanges wc;
|
||||||
|
XWindowAttributes win_at, ev_at;
|
||||||
|
XRectangle geo = { 0 };
|
||||||
|
Client *c;
|
||||||
|
|
||||||
if((c = client_gb_win(ev->window)))
|
/* Check part */
|
||||||
|
if((c = client_gb_win(ev->xconfigurerequest.window))
|
||||||
|
|| (c = client_gb_win(ev->xconfigure.window)))
|
||||||
{
|
{
|
||||||
CHECK(!c->tile);
|
CHECK(!c->tile);
|
||||||
CHECK(!c->lmax);
|
CHECK(!c->lmax);
|
||||||
|
|
||||||
c->geo.x = ev->x + BORDH;
|
|
||||||
c->geo.y = ev->y + TBARH;
|
|
||||||
c->geo.width = ev->width;
|
|
||||||
c->geo.height = ev->height;
|
|
||||||
|
|
||||||
wc.x = BORDH;
|
|
||||||
wc.y = TBARH + BORDH;
|
|
||||||
wc.width = c->geo.width;
|
|
||||||
wc.height = c->geo.height;
|
|
||||||
wc.border_width = ev->border_width;
|
|
||||||
wc.sibling = ev->above;
|
|
||||||
wc.stack_mode = ev->detail;
|
|
||||||
|
|
||||||
XConfigureWindow(dpy, c->win, ev->value_mask, &wc);
|
|
||||||
|
|
||||||
client_configure(c);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
/* Configure Request Part {{{ */
|
||||||
|
wc.x = ev->xconfigurerequest.x;
|
||||||
|
wc.y = ev->xconfigurerequest.y;
|
||||||
|
wc.width = ev->xconfigurerequest.width;
|
||||||
|
wc.height = ev->xconfigurerequest.height;
|
||||||
|
wc.border_width = ev->xconfigurerequest.border_width;
|
||||||
|
wc.sibling = ev->xconfigurerequest.above;
|
||||||
|
wc.stack_mode = ev->xconfigurerequest.detail;
|
||||||
|
XConfigureWindow(dpy, ev->xconfigurerequest.window,
|
||||||
|
ev->xconfigurerequest.value_mask, &wc);
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
/* Configure Notify Part {{{*/
|
||||||
|
if((c = client_gb_win(ev->xconfigure.window)))
|
||||||
{
|
{
|
||||||
wc.x = ev->x;
|
XGetWindowAttributes(dpy, ev->xconfigure.window, &win_at);
|
||||||
wc.y = ev->y;
|
XGetWindowAttributes(dpy, ev->xconfigure.event, &ev_at);
|
||||||
wc.width = ev->width;
|
|
||||||
wc.height = ev->height;
|
/* Frame config */
|
||||||
wc.border_width = ev->border_width;
|
if(win_at.width != ev_at.width
|
||||||
wc.sibling = ev->above;
|
|| win_at.height != ev_at.height)
|
||||||
wc.stack_mode = ev->detail;
|
{
|
||||||
XConfigureWindow(dpy, ev->window, ev->value_mask, &wc);
|
c->geo.width = geo.width = ev->xconfigure.width;
|
||||||
|
c->geo.height = geo.height = ev->xconfigure.height;
|
||||||
|
frame_moveresize(c, geo);
|
||||||
}
|
}
|
||||||
XSync(dpy, False);
|
|
||||||
|
/* Win config (re-adjust it with the frame) */
|
||||||
|
if(ev->xconfigure.x != BORDH
|
||||||
|
|| ev->xconfigure.y != BORDH + TBARH)
|
||||||
|
XMoveWindow(dpy, ev->xconfigure.window, BORDH, BORDH + TBARH);
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -358,7 +367,7 @@ getevent(XEvent ev)
|
|||||||
switch (ev.type)
|
switch (ev.type)
|
||||||
{
|
{
|
||||||
case ButtonPress: buttonpress(&ev.xbutton); break;
|
case ButtonPress: buttonpress(&ev.xbutton); break;
|
||||||
case ConfigureRequest: configurerequest(&ev.xconfigurerequest); break;
|
case ConfigureRequest: configureevent(&ev); break;
|
||||||
case DestroyNotify: destroynotify(&ev.xdestroywindow); break;
|
case DestroyNotify: destroynotify(&ev.xdestroywindow); break;
|
||||||
case EnterNotify: enternotify(&ev.xcrossing); break;
|
case EnterNotify: enternotify(&ev.xcrossing); break;
|
||||||
case Expose: expose(&ev.xexpose); break;
|
case Expose: expose(&ev.xexpose); break;
|
||||||
|
|||||||
@ -125,10 +125,10 @@ frame_delete(Client *c)
|
|||||||
void
|
void
|
||||||
frame_moveresize(Client *c, XRectangle geo)
|
frame_moveresize(Client *c, XRectangle geo)
|
||||||
{
|
{
|
||||||
c->frame_geo.x = geo.x - BORDH;
|
c->frame_geo.x = (geo.x) ? geo.x - BORDH : c->frame_geo.x;
|
||||||
c->frame_geo.y = geo.y - TBARH;
|
c->frame_geo.y = (geo.y) ? geo.y - TBARH : c->frame_geo.y;
|
||||||
c->frame_geo.width = FRAMEW(geo.width);
|
c->frame_geo.width = (geo.width) ? FRAMEW(geo.width) : c->frame_geo.width;
|
||||||
c->frame_geo.height = FRAMEH(geo.height);
|
c->frame_geo.height = (geo.height) ? FRAMEH(geo.height) : c->frame_geo.height;
|
||||||
|
|
||||||
/* Frame */
|
/* Frame */
|
||||||
XMoveResizeWindow(dpy, c->frame,
|
XMoveResizeWindow(dpy, c->frame,
|
||||||
|
|||||||
@ -145,7 +145,7 @@ void init_conf(void);
|
|||||||
|
|
||||||
/* event.c */
|
/* event.c */
|
||||||
void buttonpress(XButtonEvent *ev);
|
void buttonpress(XButtonEvent *ev);
|
||||||
void configurerequest(XConfigureRequestEvent *ev);
|
void configureevent(XEvent *ev);
|
||||||
void destroynotify(XDestroyWindowEvent *ev);
|
void destroynotify(XDestroyWindowEvent *ev);
|
||||||
void enternotify(XCrossingEvent *ev);
|
void enternotify(XCrossingEvent *ev);
|
||||||
void expose(XExposeEvent *ev);
|
void expose(XExposeEvent *ev);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user