]> Pileus Git - wmpus/commitdiff
Try to fix resizing for things like urxvtd
authorAndy Spencer <andy753421@gmail.com>
Sun, 18 Sep 2011 21:19:57 +0000 (21:19 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 18 Sep 2011 21:19:57 +0000 (21:19 +0000)
For some reason if we set the correct configure size, and even if we
send configure notify, the terminal doesn't resize itself correctly, not
sure why this happens.

Doing the incorrect configure, then resizing appears to fix it, but
causes flicker..

sys-x11.c

index 75c2edd8a88b600a82f4e4e73c1bf22dfe657c56..8d3887e925e1f7a153a6f4b62f66fb2383c973ea 100644 (file)
--- a/sys-x11.c
+++ b/sys-x11.c
@@ -300,20 +300,20 @@ static void process_event(int type, XEvent *ev, win_t *root)
        }
        else if (type == ConfigureRequest) {
                XConfigureRequestEvent *cre = &ev->xconfigurerequest;
-               XWindowChanges wc = {
-                       .x     = cre->x,     .y      = cre->y,
-                       .width = cre->width, .height = cre->height,
-               };
-               if ((win = win_find(dpy,ev->xmaprequest.window,1))) {
-                       wc.x      = win->x;
-                       wc.y      = win->y;
-                       wc.width  = win->w;
-                       wc.height = win->h;
-               }
                printf("configure_req: %d - %x, (0x%lx) %dx%d @ %d,%d\n",
                                type, (int)cre->window, cre->value_mask,
                                cre->height, cre->width, cre->x, cre->y);
-               XConfigureWindow(dpy, cre->window, cre->value_mask, &wc);
+               XConfigureWindow(dpy, cre->window, cre->value_mask, &(XWindowChanges){
+                       .x      = cre->x,
+                       .y      = cre->y,
+                       .width  = cre->width,
+                       .height = cre->height,
+               });
+
+               /* This seems necessasairy for, but causes flicker
+                * there could be a better way to do this */
+               if ((win = win_find(dpy,ev->xmaprequest.window,0)))
+                       sys_move(win, win->x, win->y, win->w, win->h);
        }
        else if (type == MapRequest) {
                printf("map_req: %d\n", type);
@@ -373,19 +373,16 @@ void sys_raise(win_t *win)
 void sys_focus(win_t *win)
 {
        printf("sys_focus: %p\n", win);
-       XEvent ev = {
+       XSetInputFocus(win->sys->dpy, win->sys->xid,
+                       RevertToPointerRoot, CurrentTime);
+       XSendEvent(win->sys->dpy, win->sys->xid, False, NoEventMask, &(XEvent){
                .type                 = ClientMessage,
                .xclient.window       = win->sys->xid,
                .xclient.message_type = atoms[wm_proto],
                .xclient.format       = 32,
                .xclient.data.l[0]    = atoms[wm_focus],
                .xclient.data.l[1]    = CurrentTime,
-       };
-       XSetInputFocus(win->sys->dpy, win->sys->xid,
-                       RevertToPointerRoot, CurrentTime);
-       //XSetInputFocus(win->sys->dpy, PointerRoot,
-       //              RevertToPointerRoot, CurrentTime);
-       XSendEvent(win->sys->dpy, win->sys->xid, False, NoEventMask, &ev);
+       });
 }
 
 void sys_watch(win_t *win, Key_t key, mod_t mod)