/*
* ion/ioncore/saveload.c
*
- * Copyright (c) Tuomo Valkonen 1999-2006.
+ * 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 <string.h>
static SMAddCallback *add_cb;
static SMCfgCallback *cfg_cb;
-static SMPHolderCallback *ph_cb;
-static bool clientwin_was_missing=FALSE;
void ioncore_set_sm_callbacks(SMAddCallback *add, SMCfgCallback *cfg)
}
-void ioncore_set_sm_pholder_callback(SMPHolderCallback *phcb)
-{
- ph_cb=phcb;
-}
+/*}}}*/
-void ioncore_clientwin_load_missing()
-{
- clientwin_was_missing=TRUE;
-}
+/*{{{ Load support functions */
-/*}}}*/
+static WPHolder **current_ph_p=NULL;
-/*{{{ Load support functions */
+WPHolder *ioncore_get_load_pholder()
+{
+ if(current_ph_p==NULL){
+ return NULL;
+ }else{
+ WPHolder *ph=*current_ph_p;
+ *current_ph_p=NULL;
+ return ph;
+ }
+}
WRegion *create_region_load(WWindow *par, const WFitParams *fp,
- ExtlTab tab)
+ ExtlTab tab, WPHolder **sm_ph_p)
{
char *objclass=NULL, *name=NULL;
WRegionLoadCreateFn* fn=NULL;
WRegion *reg=NULL;
bool grouped=FALSE;
char *grouped_name=NULL;
+ WPHolder **old_ph_p;
if(!extl_table_gets_s(tab, "type", &objclass))
return NULL;
-
- /* Backwards compatibility hack. */
- if(strcmp(objclass, "WFloatWS")==0){
- objclass=scopy("WGroupWS");
- }else if(strcmp(objclass, "WIonWS")==0){
- WGroupWS *ws=create_groupws(par, fp);
- if(ws!=NULL){
- extl_table_gets_s(tab, "name", &name);
- extl_table_sets_s(tab, "type", "WTiling");
- extl_table_sets_b(tab, "bottom", TRUE);
- extl_table_sets_b(tab, "bottom_last_close", TRUE);
- extl_table_sets_i(tab, "sizepolicy", SIZEPOLICY_FULL_EXACT);
-
- if(name!=NULL)
- region_set_name((WRegion*)ws, name);
-
- reg=group_attach_new((WGroup*)ws, tab);
-
- if(reg!=NULL)
- return (WRegion*)ws;
-
- destroy_obj((Obj*)ws);
- }
- objclass=scopy("WTiling");
- }else if(strcmp(objclass, "WFloatFrame")==0){
- objclass=scopy("WFrame");
- }
if(objclass==NULL)
return NULL;
free(objclass);
- clientwin_was_missing=FALSE;
+ old_ph_p=current_ph_p;
+ current_ph_p=sm_ph_p;
reg=fn(par, fp, tab);
- if(reg==NULL){
- if(clientwin_was_missing && add_cb!=NULL && ph_cb!=NULL){
- WPHolder *ph=ph_cb();
- if(ph!=NULL){
- if(!add_cb(ph, tab))
- destroy_obj((Obj*)ph);
- }
- }
- }else{
+ current_ph_p=old_ph_p;
+
+ if(reg!=NULL){
if(!OBJ_IS(reg, WClientWin)){
if(extl_table_gets_s(tab, "name", &name)){
region_set_name(reg, name);
}
}
- ph_cb=NULL;
-
return reg;
}
}
+static bool get_config_clientwins=TRUE;
+
+
ExtlTab region_get_configuration(WRegion *reg)
{
ExtlTab tab=extl_table_none();
- CALL_DYN_RET(tab, ExtlTab, region_get_configuration, reg, (reg));
+ if(get_config_clientwins || !OBJ_IS(reg, WClientWin)){
+ CALL_DYN_RET(tab, ExtlTab, region_get_configuration, reg, (reg));
+ }
+ return tab;
+}
+
+
+/*EXTL_DOC
+ * Get configuration tree. If \var{clientwins} is unset, client windows
+ * are filtered out.
+ */
+EXTL_EXPORT_AS(WRegion, get_configuration)
+ExtlTab region_get_configuration_extl(WRegion *reg, bool clientwins)
+{
+ ExtlTab tab;
+
+ get_config_clientwins=clientwins;
+
+ tab=region_get_configuration(reg);
+
+ get_config_clientwins=TRUE;
+
return tab;
}
FOR_ALL_SCREENS(scr){
ExtlTab scrtab=extl_table_none();
bool scrok=FALSE;
+
+ /* Potential Xinerama or such support should set the screen ID
+ * of the root window to less than zero, and number its own
+ * fake screens up from 0.
+ */
+ if(screen_id(scr)<0)
+ continue;
+
if(ok)
scrok=extl_table_geti_t(tab, screen_id(scr), &scrtab);
return FALSE;
FOR_ALL_SCREENS(scr){
- ExtlTab scrtab=region_get_configuration((WRegion*)scr);
+ ExtlTab scrtab;
+
+ /* See note above */
+ if(screen_id(scr)<0)
+ continue;
+
+ scrtab=region_get_configuration((WRegion*)scr);
+
if(scrtab==extl_table_none()){
warn(TR("Unable to get configuration for screen %d."),
screen_id(scr));