diff options
-rw-r--r-- | calmwm.c | 26 | ||||
-rw-r--r-- | calmwm.h | 19 | ||||
-rw-r--r-- | client.c | 190 | ||||
-rw-r--r-- | conf.c | 6 | ||||
-rw-r--r-- | group.c | 4 | ||||
-rw-r--r-- | headers.h | 3 | ||||
-rw-r--r-- | kbfunc.c | 12 | ||||
-rw-r--r-- | mousefunc.c | 11 | ||||
-rw-r--r-- | xevents.c | 53 |
9 files changed, 73 insertions, 251 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.c,v 1.32 2009/01/15 17:23:12 oga Exp $ + * $Id: calmwm.c,v 1.33 2009/01/16 15:24:14 okan Exp $ */ #include "headers.h" @@ -35,16 +35,10 @@ u_int Nscreens; struct client_ctx_q Clientq; -int Doshape, Shape_ev; int HasXinerama, HasRandr, Randr_ev; int Starting; struct conf Conf; -/* From TWM */ -#define gray_width 2 -#define gray_height 2 -static char gray_bits[] = {0x02, 0x01}; - static void _sigchld_cb(int); static void dpy_init(const char *); @@ -116,8 +110,6 @@ dpy_init(const char *dpyname) XSetErrorHandler(x_errorhandler); - Doshape = XShapeQueryExtension(X_Dpy, &Shape_ev, &i); - HasRandr = XRRQueryExtension(X_Dpy, &Randr_ev, &i); TAILQ_INIT(&Screenq); @@ -181,7 +173,7 @@ x_setupscreen(struct screen_ctx *sc, u_int which) XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which), "red", &sc->redcolor, &tmp); XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which), - "#00ccc8", &sc->cyancolor, &tmp); + "#666666", &sc->graycolor, &tmp); XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which), "white", &sc->whitecolor, &tmp); XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, which), @@ -191,19 +183,7 @@ x_setupscreen(struct screen_ctx *sc, u_int which) sc->whitepixl = WhitePixel(X_Dpy, sc->which); sc->bluepixl = sc->fccolor.pixel; sc->redpixl = sc->redcolor.pixel; - sc->cyanpixl = sc->cyancolor.pixel; - - sc->gray = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin, - gray_bits, gray_width, gray_height, - sc->blackpixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which)); - - sc->blue = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin, - gray_bits, gray_width, gray_height, - sc->bluepixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which)); - - sc->red = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin, - gray_bits, gray_width, gray_height, - sc->redpixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which)); + sc->graypixl = sc->graycolor.pixel; gv.foreground = sc->blackpixl^sc->whitepixl; gv.background = sc->whitepixl; @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.h,v 1.73 2009/01/15 00:32:35 okan Exp $ + * $Id: calmwm.h,v 1.74 2009/01/16 15:24:14 okan Exp $ */ #ifndef _CALMWM_H_ @@ -45,14 +45,12 @@ struct screen_ctx { Window rootwin; Window menuwin; Colormap colormap; - XColor bgcolor, fgcolor, fccolor, redcolor, cyancolor, + XColor bgcolor, fgcolor, fccolor, redcolor, graycolor, whitecolor, blackcolor; char *display; - unsigned long blackpixl, whitepixl, redpixl, bluepixl, cyanpixl; + unsigned long blackpixl, whitepixl, redpixl, bluepixl, graypixl; GC gc; - Pixmap gray, blue, red; - int altpersist; int xmax; @@ -81,10 +79,10 @@ TAILQ_HEAD(screen_ctx_q, screen_ctx); #define CLIENT_DOVMAXIMIZE 0x10 #define CLIENT_VMAXIMIZED 0x20 +#define CLIENT_BWIDTH 1 #define CLIENT_HIGHLIGHT_BLUE 1 #define CLIENT_HIGHLIGHT_RED 2 - struct winname { TAILQ_ENTRY(winname) entry; char *name; @@ -104,8 +102,6 @@ struct client_ctx { Colormap cmap; - Window pwin; - u_int bwidth; struct { int x, y, width, height; @@ -316,7 +312,6 @@ void client_setup(void); struct client_ctx *client_new(Window, struct screen_ctx *, int); int client_delete(struct client_ctx *, int, int); void client_setactive(struct client_ctx *, int); -void client_gravitate(struct client_ctx *, int); void client_resize(struct client_ctx *); void client_lower(struct client_ctx *); void client_raise(struct client_ctx *); @@ -336,8 +331,6 @@ void client_update(struct client_ctx *); void client_placecalc(struct client_ctx *); void client_maximize(struct client_ctx *); void client_vertmaximize(struct client_ctx *); -u_long client_bg_pixel(struct client_ctx *); -Pixmap client_bg_pixmap(struct client_ctx *); void client_map(struct client_ctx *); void client_mtf(struct client_ctx *); struct client_ctx *client_cycle(int); @@ -345,7 +338,6 @@ struct client_ctx *client_mrunext(struct client_ctx *); struct client_ctx *client_mruprev(struct client_ctx *); void client_gethints(struct client_ctx *); void client_freehints(struct client_ctx *); -void client_do_shape(struct client_ctx *); struct menu *menu_filter(struct menu_q *, char *, char *, int, void (*)(struct menu_q *, struct menu_q *, char *), @@ -365,7 +357,6 @@ void xev_handle_keypress(struct xevent *, XEvent *); void xev_handle_keyrelease(struct xevent *, XEvent *); void xev_handle_expose(struct xevent *, XEvent *); void xev_handle_clientmessage(struct xevent *, XEvent *); -void xev_handle_shape(struct xevent *, XEvent *); void xev_handle_randr(struct xevent *, XEvent *); void xev_handle_mapping(struct xevent *, XEvent *); @@ -512,8 +503,6 @@ extern u_int Nscreens; extern struct client_ctx_q Clientq; -extern int Doshape, Shape_ev; -extern int Doshape, Shape_ev; extern int HasXinerama, HasRandr, Randr_ev; extern struct conf Conf; @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: client.c,v 1.42 2009/01/15 00:32:35 okan Exp $ + * $Id: client.c,v 1.43 2009/01/16 15:24:14 okan Exp $ */ #include "headers.h" @@ -38,7 +38,7 @@ client_find(Window win) struct client_ctx *cc; TAILQ_FOREACH(cc, &Clientq, entry) - if (cc->pwin == win || cc->win == win) + if (cc->win == win) return (cc); return (NULL); @@ -48,11 +48,10 @@ struct client_ctx * client_new(Window win, struct screen_ctx *sc, int mapped) { struct client_ctx *cc; - XSetWindowAttributes pxattr; XWindowAttributes wattr; XWMHints *wmhints; long tmp; - int x, y, height, width, state; + int state; if (win == None) return (NULL); @@ -65,6 +64,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped) cc->sc = sc; cc->win = win; cc->size = XAllocSizeHints(); + XGetWMNormalHints(X_Dpy, cc->win, cc->size, &tmp); if (cc->size->width_inc == 0) cc->size->width_inc = 1; if (cc->size->height_inc == 0) @@ -78,7 +78,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped) */ conf_client(cc); - XGetWMNormalHints(X_Dpy, cc->win, cc->size, &tmp); XGetWindowAttributes(X_Dpy, cc->win, &wattr); if (cc->size->flags & PBaseSize) { @@ -93,8 +92,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped) cc->ptr.x = -1; cc->ptr.y = -1; - client_gravitate(cc, 1); - cc->geom.x = wattr.x; cc->geom.y = wattr.y; cc->geom.width = wattr.width; @@ -106,10 +103,12 @@ client_new(Window win, struct screen_ctx *sc, int mapped) if ((wmhints = XGetWMHints(X_Dpy, cc->win)) != NULL) { if (wmhints->flags & StateHint) xu_setstate(cc, wmhints->initial_state); - + XFree(wmhints); } + client_move(cc); } + client_draw_border(cc); if (xu_getstate(cc, &state) < 0) state = NormalState; @@ -117,41 +116,15 @@ client_new(Window win, struct screen_ctx *sc, int mapped) XSelectInput(X_Dpy, cc->win, ColormapChangeMask | EnterWindowMask | PropertyChangeMask | KeyReleaseMask); - x = cc->geom.x - cc->bwidth; - y = cc->geom.y - cc->bwidth; - - width = cc->geom.width; - height = cc->geom.height; - if (cc->bwidth > 1) { - width += (cc->bwidth)*2; - height += (cc->bwidth)*2; - } - pxattr.override_redirect = True; - pxattr.background_pixel = sc->bgcolor.pixel; - pxattr.event_mask = ChildMask | ButtonPressMask | ButtonReleaseMask | - ExposureMask | EnterWindowMask; - - cc->pwin = XCreateWindow(X_Dpy, sc->rootwin, x, y, - width, height, 0, /* XXX */ - DefaultDepth(X_Dpy, sc->which), CopyFromParent, - DefaultVisual(X_Dpy, sc->which), - CWOverrideRedirect | CWBackPixel | CWEventMask, &pxattr); - - cc->active = 0; - XAddToSaveSet(X_Dpy, cc->win); - XSetWindowBorderWidth(X_Dpy, cc->win, 0); - XReparentWindow(X_Dpy, cc->win, cc->pwin, cc->bwidth, cc->bwidth); /* Notify client of its configuration. */ xev_reconfig(cc); if (state == IconicState) client_hide(cc); - else { - XMapRaised(X_Dpy, cc->pwin); - XMapWindow(X_Dpy, cc->win); - } + else + client_unhide(cc); xu_setstate(cc, cc->state); @@ -170,27 +143,6 @@ client_new(Window win, struct screen_ctx *sc, int mapped) return (cc); } -void -client_do_shape(struct client_ctx *cc) -{ - /* Windows not rectangular require more effort */ - XRectangle *r; - int n, tmp; - - if (Doshape) { - XShapeSelectInput(X_Dpy, cc->win, ShapeNotifyMask); - - r = XShapeGetRectangles(X_Dpy, cc->win, ShapeBounding, - &n, &tmp); - - if (n > 1) - XShapeCombineShape(X_Dpy, cc->pwin, ShapeBounding, - cc->bwidth, cc->bwidth, cc->win, ShapeBounding, - ShapeSet); - XFree(r); - } -} - int client_delete(struct client_ctx *cc, int sendevent, int ignorewindow) { @@ -206,15 +158,6 @@ client_delete(struct client_ctx *cc, int sendevent, int ignorewindow) xu_setstate(cc, WithdrawnState); XRemoveFromSaveSet(X_Dpy, cc->win); - if (!ignorewindow) { - client_gravitate(cc, 0); - XSetWindowBorderWidth(X_Dpy, cc->win, 1); /* XXX */ - XReparentWindow(X_Dpy, cc->win, - sc->rootwin, cc->geom.x, cc->geom.y); - } - if (cc->pwin) - XDestroyWindow(X_Dpy, cc->pwin); - XSync(X_Dpy, False); XUngrabServer(X_Dpy); @@ -296,28 +239,6 @@ client_current(void) } void -client_gravitate(struct client_ctx *cc, int yes) -{ - int dx = 0, dy = 0, mult = yes ? 1 : -1; - int gravity = (cc->size->flags & PWinGravity) ? - cc->size->win_gravity : NorthWestGravity; - - switch (gravity) { - case NorthWestGravity: - case SouthWestGravity: - case NorthEastGravity: - case StaticGravity: - dx = cc->bwidth; - case NorthGravity: - dy = cc->bwidth; - break; - } - - cc->geom.x += mult * dx; - cc->geom.y += mult * dy; -} - -void client_maximize(struct client_ctx *cc) { struct screen_ctx *sc = CCTOSC(cc); @@ -402,18 +323,15 @@ client_resize(struct client_ctx *cc) cc->flags |= CLIENT_VMAXIMIZED; } - XMoveResizeWindow(X_Dpy, cc->pwin, cc->geom.x - cc->bwidth, - cc->geom.y - cc->bwidth, cc->geom.width + cc->bwidth*2, - cc->geom.height + cc->bwidth*2); - XMoveResizeWindow(X_Dpy, cc->win, cc->bwidth, cc->bwidth, - cc->geom.width, cc->geom.height); + XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x - cc->bwidth, + cc->geom.y - cc->bwidth, cc->geom.width, cc->geom.height); xev_reconfig(cc); } void client_move(struct client_ctx *cc) { - XMoveWindow(X_Dpy, cc->pwin, + XMoveWindow(X_Dpy, cc->win, cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth); xev_reconfig(cc); } @@ -421,13 +339,13 @@ client_move(struct client_ctx *cc) void client_lower(struct client_ctx *cc) { - XLowerWindow(X_Dpy, cc->pwin); + XLowerWindow(X_Dpy, cc->win); } void client_raise(struct client_ctx *cc) { - XRaiseWindow(X_Dpy, cc->pwin); + XRaiseWindow(X_Dpy, cc->win); } void @@ -445,7 +363,7 @@ client_ptrwarp(struct client_ctx *cc) else client_raise(cc); - xu_ptr_setpos(cc->pwin, x, y); + xu_ptr_setpos(cc->win, x, y); } void @@ -453,7 +371,7 @@ client_ptrsave(struct client_ctx *cc) { int x, y; - xu_ptr_getpos(cc->pwin, &x, &y); + xu_ptr_getpos(cc->win, &x, &y); if (_client_inbound(cc, x, y)) { cc->ptr.x = x; cc->ptr.y = y; @@ -464,7 +382,7 @@ void client_hide(struct client_ctx *cc) { /* XXX - add wm_state stuff */ - XUnmapWindow(X_Dpy, cc->pwin); + XUnmapWindow(X_Dpy, cc->win); cc->active = 0; cc->flags |= CLIENT_HIDDEN; @@ -477,7 +395,7 @@ client_hide(struct client_ctx *cc) void client_unhide(struct client_ctx *cc) { - XMapRaised(X_Dpy, cc->pwin); + XMapRaised(X_Dpy, cc->win); cc->highlight = 0; cc->flags &= ~CLIENT_HIDDEN; @@ -488,64 +406,24 @@ void client_draw_border(struct client_ctx *cc) { struct screen_ctx *sc = CCTOSC(cc); - - if (cc->active) { - XSetWindowBackground(X_Dpy, cc->pwin, client_bg_pixel(cc)); - XClearWindow(X_Dpy, cc->pwin); - - if (!cc->highlight && cc->bwidth > 1) - XDrawRectangle(X_Dpy, cc->pwin, sc->gc, 1, 1, - cc->geom.width + cc->bwidth, - cc->geom.height + cc->bwidth); - } else { - if (cc->bwidth > 1) - XSetWindowBackgroundPixmap(X_Dpy, - cc->pwin, client_bg_pixmap(cc)); - - XClearWindow(X_Dpy, cc->pwin); - } -} - -u_long -client_bg_pixel(struct client_ctx *cc) -{ - struct screen_ctx *sc = CCTOSC(cc); u_long pixl; - switch (cc->highlight) { - case CLIENT_HIGHLIGHT_BLUE: - pixl = sc->bluepixl; - break; - case CLIENT_HIGHLIGHT_RED: - pixl = sc->redpixl; - break; - default: - pixl = sc->blackpixl; - break; - } - - return (pixl); -} - -Pixmap -client_bg_pixmap(struct client_ctx *cc) -{ - struct screen_ctx *sc = CCTOSC(cc); - Pixmap pix; - - switch (cc->highlight) { - case CLIENT_HIGHLIGHT_BLUE: - pix = sc->blue; - break; - case CLIENT_HIGHLIGHT_RED: - pix = sc->red; - break; - default: - pix = sc->gray; - break; - } - - return (pix); + if (cc->active) + switch (cc->highlight) { + case CLIENT_HIGHLIGHT_BLUE: + pixl = sc->bluepixl; + break; + case CLIENT_HIGHLIGHT_RED: + pixl = sc->redpixl; + break; + default: + pixl = sc->whitepixl; + break; + } + else + pixl = sc->graypixl; + XSetWindowBorderWidth(X_Dpy, cc->win, cc->bwidth); + XSetWindowBorder(X_Dpy, cc->win, pixl); } void @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: conf.c,v 1.51 2009/01/08 21:35:19 oga Exp $ + * $Id: conf.c,v 1.52 2009/01/16 15:24:14 okan Exp $ */ #include "headers.h" @@ -201,7 +201,7 @@ conf_client(struct client_ctx *cc) } else ignore = 1; - cc->bwidth = ignore ? 0 : 3; + cc->bwidth = ignore ? 0 : CLIENT_BWIDTH; cc->flags |= ignore ? CLIENT_IGNORE : 0; } @@ -530,6 +530,6 @@ conf_grab_mouse(struct client_ctx *cc) warnx("strange button in mousebinding\n"); continue; } - xu_btn_grab(cc->pwin, mb->modmask, button); + xu_btn_grab(cc->win, mb->modmask, button); } } @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: group.c,v 1.21 2009/01/15 00:32:35 okan Exp $ + * $Id: group.c,v 1.22 2009/01/16 15:24:14 okan Exp $ */ #include "headers.h" @@ -99,7 +99,7 @@ _group_show(struct group_ctx *gc) * top-to-bottom. */ TAILQ_FOREACH(cc, &gc->clients, group_entry) { - winlist[gc->highstack - cc->stackingorder] = cc->pwin; + winlist[gc->highstack - cc->stackingorder] = cc->win; client_unhide(cc); } @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: headers.h,v 1.8 2008/09/29 23:16:46 oga Exp $ + * $Id: headers.h,v 1.9 2009/01/16 15:24:14 okan Exp $ */ #ifndef _CALMWM_HEADERS_H_ @@ -40,7 +40,6 @@ #include <ctype.h> #include <X11/cursorfont.h> -#include <X11/extensions/shape.h> #include <X11/extensions/Xinerama.h> #include <X11/extensions/Xrandr.h> #include <X11/Xlib.h> @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: kbfunc.c,v 1.32 2008/07/11 15:18:29 okan Exp $ + * $Id: kbfunc.c,v 1.33 2009/01/16 15:24:14 okan Exp $ */ #include <paths.h> @@ -90,7 +90,7 @@ kbfunc_moveresize(struct client_ctx *cc, void *arg) cc->geom.x = cc->sc->xmax; client_move(cc); - xu_ptr_getpos(cc->pwin, &x, &y); + xu_ptr_getpos(cc->win, &x, &y); cc->ptr.y = y + my; cc->ptr.x = x + mx; client_ptrwarp(cc); @@ -103,7 +103,7 @@ kbfunc_moveresize(struct client_ctx *cc, void *arg) client_resize(cc); /* Make sure the pointer stays within the window. */ - xu_ptr_getpos(cc->pwin, &cc->ptr.x, &cc->ptr.y); + xu_ptr_getpos(cc->win, &cc->ptr.x, &cc->ptr.y); if (cc->ptr.x > cc->geom.width) cc->ptr.x = cc->geom.width - cc->bwidth; if (cc->ptr.y > cc->geom.height) @@ -112,8 +112,8 @@ kbfunc_moveresize(struct client_ctx *cc, void *arg) break; case CWM_PTRMOVE: if (cc) { - xu_ptr_getpos(cc->pwin, &x, &y); - xu_ptr_setpos(cc->pwin, x + mx, y + my); + xu_ptr_getpos(cc->win, &x, &y); + xu_ptr_setpos(cc->win, x + mx, y + my); } else { xu_ptr_getpos(sc->rootwin, &x, &y); xu_ptr_setpos(sc->rootwin, x + mx, y + my); @@ -455,7 +455,7 @@ void kbfunc_client_grouptoggle(struct client_ctx *cc, void *arg) { /* XXX for stupid X apps like xpdf and gvim */ - XGrabKeyboard(X_Dpy, cc->pwin, True, + XGrabKeyboard(X_Dpy, cc->win, True, GrabModeAsync, GrabModeAsync, CurrentTime); group_sticky_toggle_enter(cc); diff --git a/mousefunc.c b/mousefunc.c index 4e6897f..25ec837 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: mousefunc.c,v 1.5 2009/01/11 18:34:46 okan Exp $ + * $Id: mousefunc.c,v 1.6 2009/01/16 15:24:14 okan Exp $ */ #include "headers.h" @@ -117,16 +117,11 @@ mousefunc_window_resize(struct client_ctx *cc, void *arg) /* Recompute window output */ _mousefunc_sweep_draw(cc, dx, dy); - XMoveResizeWindow(X_Dpy, cc->pwin, + XMoveResizeWindow(X_Dpy, cc->win, cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth, cc->geom.width + cc->bwidth * 2, cc->geom.height + cc->bwidth * 2); - XMoveResizeWindow(X_Dpy, cc->win, - cc->bwidth, cc->bwidth, - cc->geom.width, cc->geom.height); - - client_do_shape(cc); break; case ButtonRelease: XUnmapWindow(X_Dpy, sc->menuwin); @@ -172,7 +167,7 @@ mousefunc_window_move(struct client_ctx *cc, void *arg) cc->geom.x = x + (ev.xmotion.x - mx); cc->geom.y = y + (ev.xmotion.y - my); - XMoveWindow(X_Dpy, cc->pwin, + XMoveWindow(X_Dpy, cc->win, cc->geom.x - cc->bwidth, cc->geom.y - cc->bwidth); break; @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: xevents.c,v 1.32 2009/01/11 18:25:49 okan Exp $ + * $Id: xevents.c,v 1.33 2009/01/16 15:24:14 okan Exp $ */ /* @@ -68,7 +68,7 @@ xev_handle_unmapnotify(struct xevent *xev, XEvent *ee) struct client_ctx *cc; if ((cc = client_find(e->window)) != NULL) - client_delete(cc, e->send_event, 0); + client_hide(cc); xev_register(xev); } @@ -96,7 +96,6 @@ xev_handle_configurerequest(struct xevent *xev, XEvent *ee) if ((cc = client_find(e->window)) != NULL) { sc = CCTOSC(cc); - client_gravitate(cc, 0); if (e->value_mask & CWWidth) cc->geom.width = e->width; if (e->value_mask & CWHeight) @@ -114,30 +113,26 @@ xev_handle_configurerequest(struct xevent *xev, XEvent *ee) cc->geom.height >= DisplayHeight(X_Dpy, sc->which)) cc->geom.y -= cc->bwidth; - client_gravitate(cc, 1); - wc.x = cc->geom.x - cc->bwidth; wc.y = cc->geom.y - cc->bwidth; wc.width = cc->geom.width + cc->bwidth*2; wc.height = cc->geom.height + cc->bwidth*2; - wc.border_width = 0; + wc.border_width = cc->bwidth; - /* We need to move the parent window, too. */ - XConfigureWindow(X_Dpy, cc->pwin, e->value_mask, &wc); + XConfigureWindow(X_Dpy, cc->win, e->value_mask, &wc); xev_reconfig(cc); + } else { + /* let it do what it wants, it'll be ours when we map it. */ + wc.x = e->x; + wc.y = e->y; + wc.width = e->width; + wc.height = e->height; + wc.stack_mode = Above; + e->value_mask &= ~CWStackMode; + + XConfigureWindow(X_Dpy, e->window, e->value_mask, &wc); } - wc.x = cc != NULL ? cc->bwidth : e->x; - wc.y = cc != NULL ? cc->bwidth : e->y; - wc.width = e->width; - wc.height = e->height; - wc.stack_mode = Above; - wc.border_width = 0; - e->value_mask &= ~CWStackMode; - e->value_mask |= CWBorderWidth; - - XConfigureWindow(X_Dpy, e->window, e->value_mask, &wc); - xev_register(xev); } @@ -177,7 +172,7 @@ xev_reconfig(struct client_ctx *cc) ce.y = cc->geom.y; ce.width = cc->geom.width; ce.height = cc->geom.height; - ce.border_width = 0; + ce.border_width = cc->bwidth; ce.above = None; ce.override_redirect = 0; @@ -362,16 +357,6 @@ out: } void -xev_handle_shape(struct xevent *xev, XEvent *ee) -{ - XShapeEvent *sev = (XShapeEvent *) ee; - struct client_ctx *cc; - - if ((cc = client_find(sev->window)) != NULL) - client_do_shape(cc); -} - -void xev_handle_randr(struct xevent *xev, XEvent *ee) { XRRScreenChangeNotifyEvent *rev = (XRRScreenChangeNotifyEvent *)ee; @@ -465,10 +450,8 @@ xev_handle_expose(struct xevent *xev, XEvent *ee) XExposeEvent *e = &ee->xexpose; struct client_ctx *cc; - if ((cc = client_find(e->window)) != NULL && e->count == 0) { + if ((cc = client_find(e->window)) != NULL && e->count == 0) client_draw_border(cc); - client_do_shape(cc); - } xev_register(xev); } @@ -535,9 +518,7 @@ xev_loop(void) ASSIGN1(xclient); break; default: - if (e.type == Shape_ev) - xev_handle_shape(xev, &e); - else if (e.type == Randr_ev) + if (e.type == Randr_ev) xev_handle_randr(xev, &e); break; } |