X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Frootwin.c;h=fd2d2584d054fc68aa0e4b88915599d4488372ed;hb=29aae1975d46f66b97a2b873f1875eded8c6fbc3;hp=6e75ee3b5de1ed3a33000a7b3fe7bbe8da6dd1ff;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d;p=ion3.git diff --git a/ioncore/rootwin.c b/ioncore/rootwin.c index 6e75ee3..fd2d258 100644 --- a/ioncore/rootwin.c +++ b/ioncore/rootwin.c @@ -1,12 +1,9 @@ /* * ion/ioncore/rootwin.c * - * Copyright (c) Tuomo Valkonen 1999-2007. + * Copyright (c) Tuomo Valkonen 1999-2008. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -62,9 +59,13 @@ static int my_error_handler(Display *dpy, XErrorEvent *ev) /* Just ignore bad window and similar errors; makes the rest of * the code simpler. + * + * Apparently XGetWindowProperty can return BadMatch on a race + * condition where the server is already reusing the XID for a + * non-window drawable, so let's just ignore BadMatch entirely... */ if((ev->error_code==BadWindow || - (ev->error_code==BadMatch && ev->request_code==X_SetInputFocus) || + (ev->error_code==BadMatch /*&& ev->request_code==X_SetInputFocus*/) || (ev->error_code==BadDrawable && ev->request_code==X_GetGeometry)) && ignore_badwindow) return 0; @@ -252,12 +253,7 @@ static bool rootwin_init(WRootWin *rootwin, int xscr) net_virtual_roots=XInternAtom(ioncore_g.dpy, "_NET_VIRTUAL_ROOTS", False); XDeleteProperty(ioncore_g.dpy, root, net_virtual_roots); - /* */ { - /* TODO: typed LINK_ITEM */ - WRegion *tmp=(WRegion*)ioncore_g.rootwins; - LINK_ITEM(tmp, (WRegion*)rootwin, p_next, p_prev); - ioncore_g.rootwins=(WRootWin*)tmp; - } + LINK_ITEM(*(WRegion**)&ioncore_g.rootwins, (WRegion*)rootwin, p_next, p_prev); xwindow_set_cursor(root, IONCORE_CURSOR_DEFAULT); @@ -280,11 +276,7 @@ void rootwin_deinit(WRootWin *rw) destroy_obj((Obj*)scr); } - /* */ { - WRegion *tmp=(WRegion*)ioncore_g.rootwins; - UNLINK_ITEM(tmp, (WRegion*)rw, p_next, p_prev); - ioncore_g.rootwins=(WRootWin*)tmp; - } + UNLINK_ITEM(*(WRegion**)&ioncore_g.rootwins, (WRegion*)rw, p_next, p_prev); XSelectInput(ioncore_g.dpy, WROOTWIN_ROOT(rw), 0);