*
* 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 <string.h>
static void clientwin_get_winprops(WClientWin *cwin)
{
ExtlTab tab, tab2;
+ char *s;
int i1, i2;
tab=ioncore_get_winprop(cwin);
if(extl_table_is_bool_set(tab, "ignore_cfgrq"))
cwin->flags|=CLIENTWIN_PROP_IGNORE_CFGRQ;
-#if 0
- cwin->szplcy=get_sizepolicy_winprop(cwin, "sizepolicy",
- SIZEPOLICY_DEFAULT);
- cwin->transient_szplcy=get_sizepolicy_winprop(cwin,
- "transient_sizepolicy",
- DFLT_SZPLCY);
-#endif
+ if(extl_table_gets_s(tab, "orientation", &s)){
+ if(strcmp(s, "vertical")==0)
+ cwin->flags|=CLIENTWIN_PROP_O_VERT;
+ else if(strcmp(s, "horizontal")==0)
+ cwin->flags|=CLIENTWIN_PROP_O_HORIZ;
+ free(s);
+ }
}
set_sane_gravity(cwin->win);
- cwin->transient_for=None;
-
cwin->n_cmapwins=0;
cwin->cmap=attr->colormap;
cwin->cmaps=NULL;
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;
}
/*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)
}
+static int clientwin_orientation(WClientWin *cwin)
+{
+ return (cwin->flags&CLIENTWIN_PROP_O_VERT
+ ? REGION_ORIENTATION_VERTICAL
+ : (cwin->flags&CLIENTWIN_PROP_O_HORIZ
+ ? REGION_ORIENTATION_HORIZONTAL
+ : REGION_ORIENTATION_NONE));
+}
+
+
/*}}}*/
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)
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);
if(!region_fullscreen_scr(grp, scr, sw))
cwin->flags&=~CLIENTWIN_FS_RQ;
+
+ return TRUE;
}
-
- return TRUE;
}
return FALSE;
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;
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)
{region_size_hints,
clientwin_size_hints},
+
+ {(DynFun*)region_orientation,
+ (DynFun*)clientwin_orientation},
{(DynFun*)region_rqclose,
(DynFun*)clientwin_rqclose},