X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fwindow.c;h=3de0eefed3f17c1b7934f58e56f65cd6a132799f;hb=ae4260bb64817c11f9a7140324cd3e3ba113e297;hp=8d2986fe6fb9ccf12b1ec8ec1e919f78f44d4fbe;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/ioncore/window.c b/ioncore/window.c index 8d2986f..3de0eef 100644 --- a/ioncore/window.c +++ b/ioncore/window.c @@ -1,12 +1,9 @@ /* * ion/ioncore/window.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * Copyright (c) Tuomo Valkonen 1999-2007. * - * 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 @@ -57,9 +54,17 @@ void window_release(WWindow *wwin) /*{{{ Init, create */ -bool window_do_init(WWindow *wwin, WWindow *par, Window win, - const WFitParams *fp) +bool window_do_init(WWindow *wwin, WWindow *par, + const WFitParams *fp, Window win) { + if(win==None){ + assert(par!=NULL); + win=create_xwindow(region_rootwin_of((WRegion*)par), + par->win, &(fp->g)); + if(win==None) + return FALSE; + } + wwin->win=win; wwin->xic=NULL; wwin->event_mask=0; @@ -67,10 +72,8 @@ bool window_do_init(WWindow *wwin, WWindow *par, Window win, region_init(&(wwin->region), par, fp); - if(win!=None){ - XSaveContext(ioncore_g.dpy, win, ioncore_g.win_context, - (XPointer)wwin); - } + XSaveContext(ioncore_g.dpy, win, ioncore_g.win_context, + (XPointer)wwin); return TRUE; } @@ -78,14 +81,7 @@ bool window_do_init(WWindow *wwin, WWindow *par, Window win, bool window_init(WWindow *wwin, WWindow *par, const WFitParams *fp) { - Window win; - - win=create_xwindow(region_rootwin_of((WRegion*)par), - par->win, &(fp->g)); - if(win==None) - return FALSE; - /* window_init does not fail */ - return window_do_init(wwin, par, win, fp); + return window_do_init(wwin, par, fp, None); } @@ -93,11 +89,14 @@ void window_deinit(WWindow *wwin) { region_deinit((WRegion*)wwin); + region_pointer_focus_hack(&wwin->region); + if(wwin->xic!=NULL) XDestroyIC(wwin->xic); - + if(wwin->win!=None){ XDeleteContext(ioncore_g.dpy, wwin->win, ioncore_g.win_context); + /* Probably should not try destroy if root window... */ XDestroyWindow(ioncore_g.dpy, wwin->win); } @@ -174,6 +173,8 @@ void window_map(WWindow *wwin) void window_unmap(WWindow *wwin) { + region_pointer_focus_hack(&wwin->region); + XUnmapWindow(ioncore_g.dpy, wwin->win); REGION_MARK_UNMAPPED(wwin); }