X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fclientwin.c;h=35164de70388ada767bc3a32a7711a96b255fbcb;hb=7c392448b0d2efcc6bb959063dcaa8b2c5ea0964;hp=4a5b4dacfd40ae08492058395d0d826df1b6c6dc;hpb=768d45580fc176cedd04db0b05621cdf596751d5;p=ion3.git diff --git a/ioncore/clientwin.c b/ioncore/clientwin.c index 4a5b4da..35164de 100644 --- a/ioncore/clientwin.c +++ b/ioncore/clientwin.c @@ -3,10 +3,7 @@ * * 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 @@ -323,8 +320,6 @@ static bool clientwin_init(WClientWin *cwin, WWindow *par, Window win, set_sane_gravity(cwin->win); - cwin->transient_for=None; - cwin->n_cmapwins=0; cwin->cmap=attr->colormap; cwin->cmaps=NULL; @@ -481,11 +476,30 @@ again: xwindow_unmanaged_selectinput(win, 0); - win=hints->icon_window; + /* Copy WM_CLASS as _ION_DOCKAPP_HACK */ + { + char **p=NULL; + int n=0; + + p=xwindow_get_text_property(win, XA_WM_CLASS, &n); + + if(p!=NULL){ + xwindow_set_text_property(hints->icon_window, + ioncore_g.atom_dockapp_hack, + (const char **)p, n); + XFreeStringList(p); + }else{ + const char *pdummy[2]={"unknowndockapp", "UnknownDockapp"}; + xwindow_set_text_property(hints->icon_window, + ioncore_g.atom_dockapp_hack, + pdummy, 2); + } + } /* It is a dockapp, do everything again from the beginning, now * with the icon window. */ + win=hints->icon_window; param.dockapp=TRUE; goto again; } @@ -754,8 +768,8 @@ static bool send_clientmsg(Window win, Atom a, Time stmp) /*EXTL_DOC - * Attempt to kill (with XKillWindow) the client that owns the X - * window correspoding to \var{cwin}. + * Attempt to kill (with \code{XKillWindow}) the client that owns + * the X window correspoding to \var{cwin}. */ EXTL_EXPORT_MEMBER void clientwin_kill(WClientWin *cwin) @@ -1041,12 +1055,27 @@ EXTL_SAFE EXTL_EXPORT_MEMBER ExtlTab clientwin_get_ident(WClientWin *cwin) { - char **p=NULL, *wrole=NULL; + char **p=NULL, **p2=NULL, *wrole=NULL; int n=0, n2=0, n3=0, tmp=0; + Window tforwin=None; ExtlTab tab; + bool dockapp_hack=FALSE; p=xwindow_get_text_property(cwin->win, XA_WM_CLASS, &n); - wrole=xwindow_get_string_property(cwin->win, ioncore_g.atom_wm_window_role, &n2); + + p2=xwindow_get_text_property(cwin->win, ioncore_g.atom_dockapp_hack, &n2); + + dockapp_hack=(n2>0); + + if(p==NULL){ + /* Some dockapps do actually have WM_CLASS, so use it. */ + p=p2; + n=n2; + p2=NULL; + } + + wrole=xwindow_get_string_property(cwin->win, ioncore_g.atom_wm_window_role, + &n3); tab=extl_create_table(); if(n>=2 && p[1]!=NULL) @@ -1056,8 +1085,18 @@ ExtlTab clientwin_get_ident(WClientWin *cwin) if(wrole!=NULL) extl_table_sets_s(tab, "role", wrole); + if(XGetTransientForHint(ioncore_g.dpy, cwin->win, &tforwin) + && tforwin!=None){ + extl_table_sets_b(tab, "is_transient", TRUE); + } + + if(dockapp_hack) + extl_table_sets_b(tab, "is_dockapp", TRUE); + if(p!=NULL) XFreeStringList(p); + if(p2!=NULL) + XFreeStringList(p2); if(wrole!=NULL) free(wrole); @@ -1085,9 +1124,9 @@ static bool check_fs_cfgrq(WClientWin *cwin, XConfigureRequestEvent *ev) if(!region_fullscreen_scr(grp, scr, sw)) cwin->flags&=~CLIENTWIN_FS_RQ; + + return TRUE; } - - return TRUE; } return FALSE; @@ -1260,8 +1299,8 @@ WRegion *clientwin_load(WWindow *par, const WFitParams *fp, ExtlTab tab) WClientWin *cwin=NULL; XWindowAttributes attr; WRectangle rg; - bool got_chkc; - + bool got_chkc=FALSE; + if(!extl_table_gets_d(tab, "windowid", &wind) || !extl_table_gets_i(tab, "checkcode", &chkc)){ return NULL; @@ -1294,14 +1333,7 @@ WRegion *clientwin_load(WWindow *par, const WFitParams *fp, ExtlTab tab) warn(TR("Saved client window does not want to be managed.")); return NULL; } - - /* - attr.x=fp->g.x; - attr.y=fp->g.y; - attr.width=fp->g.w; - attr.height=fp->g.h; - */ - + cwin=create_clientwin(par, win, &attr); if(cwin==NULL)