1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-24 15:12:32 +01:00

- Finished moving to the new proplist handling code in WINGs.

- Also tested the backward compatibility ability of the WINGs proplist code
  which seems to work quite well.

Starting with this moment, Window Maker no longer needs libPropList and is
now using the better and much more robust proplist code from WINGs. Also the
WINGs based proplist code is actively maintained while the old libPropList
code is practically dead and flawed by the fact that it borrowed concepts
from the UserDefaults which conflicted with the retain/release mechanism,
making some problems that libPropList had, practically unsolvable without a
complete redesign (which can be found in the more robust WINGs code).
This commit is contained in:
dan
2001-10-04 03:07:34 +00:00
parent 8bb50a6320
commit 33cc542e85
79 changed files with 2126 additions and 2638 deletions

View File

@@ -24,23 +24,8 @@
#ifndef WMGNUSTEP_H_
#define WMGNUSTEP_H_
/*
* Kluge for when proplist.h is included too. proplist.h #defines BOOL
* and Xmd.h (which is indirectly included from Xproto.h) typedefs BOOL.
* The worst is that the BOOL from Xmd.h is a 8bit type, while BOOL from
* proplist.h is int...
*/
#ifdef BOOL
#define WINGS_BOOL_FLAG
#undef BOOL
#endif
#include <X11/Xproto.h>
#ifdef WINGS_BOOL_FLAG
#define BOOL int
#undef WINGS_BOOL_FLAG
#endif
#define GNUSTEP_WM_MINIATURIZE_WINDOW "_GNUSTEP_WM_MINIATURIZE_WINDOW"

View File

@@ -60,7 +60,6 @@ wmaker_SOURCES = \
placement.c \
properties.c \
properties.h \
proplist.c \
resources.c \
resources.h \
rootmenu.c \
@@ -114,7 +113,6 @@ INCLUDES = \
wmaker_LDADD = \
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.la\
@LIBPL@ \
@XLIBS@ \
@INTLIBS@ \
@DLLIBS@

View File

@@ -382,7 +382,6 @@ Bool
wAppIconIsFirstInstance(WAppIcon *icon)
{
WAppIcon *list = icon->icon->core->screen_ptr->app_icon_list;
int index = 0;
if (!WFLAGP(icon->icon->owner, collapse_appicons))
return True;

View File

@@ -139,12 +139,12 @@ extractIcon(WWindow *wwin)
static void
saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
{
proplist_t dict = WDWindowAttributes->dictionary;
proplist_t adict, key, iconk;
proplist_t val;
WMPropList *dict = WDWindowAttributes->dictionary;
WMPropList *adict, *key, *iconk;
WMPropList *val;
char *tmp;
int i;
i = 0;
if (wm_instance)
i += strlen(wm_instance);
@@ -162,31 +162,31 @@ saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
strcat(tmp, wm_class);
}
key = PLMakeString(tmp);
key = WMCreatePLString(tmp);
wfree(tmp);
adict = PLGetDictionaryEntry(dict, key);
adict = WMGetFromPLDictionary(dict, key);
iconk = PLMakeString("Icon");
iconk = WMCreatePLString("Icon");
if (adict) {
val = PLGetDictionaryEntry(adict, iconk);
val = WMGetFromPLDictionary(adict, iconk);
} else {
/* no dictionary for app, so create one */
adict = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
PLInsertDictionaryEntry(dict, key, adict);
PLRelease(adict);
adict = WMCreatePLDictionary(NULL, NULL, NULL);
WMPutInPLDictionary(dict, key, adict);
WMReleasePropList(adict);
val = NULL;
}
if (!val) {
val = PLMakeString(iconPath);
PLInsertDictionaryEntry(adict, iconk, val);
PLRelease(val);
val = WMCreatePLString(iconPath);
WMPutInPLDictionary(adict, iconk, val);
WMReleasePropList(val);
}
PLRelease(key);
PLRelease(iconk);
WMReleasePropList(key);
WMReleasePropList(iconk);
if (val && !wPreferences.flags.noupdates)
PLSave(dict, YES);
WMWritePropListToFile(dict, WDWindowAttributes->path, True);
}
@@ -549,7 +549,6 @@ void
wApplicationSetCollapse(WApplication *app, Bool flag)
{
WApplication *list = app->main_window_desc->screen_ptr->wapp_list;
int index = 0;
WWindow *wwin = app->main_window_desc;
if (WFLAGP(app->main_window_desc, collapse_appicons) == flag)

File diff suppressed because it is too large Load Diff

View File

@@ -24,25 +24,25 @@
typedef struct WDDomain {
char *domain_name;
proplist_t dictionary;
WMPropList *dictionary;
char *path;
time_t timestamp;
} WDDomain;
#if 0
proplist_t wDefaultsInit(int screen_number);
WMPropList* wDefaultsInit(int screen_number);
#endif
WDDomain*wDefaultsInitDomain(char *domain, Bool requireDictionary);
WDDomain* wDefaultsInitDomain(char *domain, Bool requireDictionary);
void wDefaultsDestroyDomain(WDDomain *domain);
void wReadDefaults(WScreen *scr, proplist_t new_dict);
void wReadDefaults(WScreen *scr, WMPropList *new_dict);
void wDefaultUpdateIcons(WScreen *scr);
void wReadStaticDefaults(proplist_t dict);
void wReadStaticDefaults(WMPropList *dict);
void wDefaultsCheckDomains(void *screen);

View File

@@ -503,7 +503,6 @@ static void
keyPressHandler(XEvent *event, void *data)
{
IconPanel *panel = (IconPanel*)data;
Display *dpy = event->xany.display;
char buffer[32];
int count;
KeySym ksym;
@@ -1592,28 +1591,28 @@ setCrashAction(void *self, void *clientData)
static WMPixmap*
getWindowMakerIconImage(WMScreen *scr)
{
proplist_t dict, key, option, value=NULL;
WMPropList *dict, *key, *option, *value=NULL;
WMPixmap *pix=NULL;
char *path;
PLSetStringCmpHook(NULL);
WMPLSetCaseSensitive(True);
key = PLMakeString("Logo.WMPanel");
option = PLMakeString("Icon");
key = WMCreatePLString("Logo.WMPanel");
option = WMCreatePLString("Icon");
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
if (dict) {
value = PLGetDictionaryEntry(dict, option);
value = WMGetFromPLDictionary(dict, option);
}
PLRelease(key);
PLRelease(option);
WMReleasePropList(key);
WMReleasePropList(option);
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
if (value && PLIsString(value)) {
path = FindImage(wPreferences.icon_path, PLGetString(value));
if (value && WMIsPLString(value)) {
path = FindImage(wPreferences.icon_path, WMGetFromPLString(value));
if (path) {
RColor gray;

View File

@@ -56,7 +56,7 @@
#include "wsound.h"
#include <proplist.h>
#include <WINGs/WUtil.h>
@@ -97,19 +97,19 @@ extern void appIconMouseDown(WObjDescriptor *desc, XEvent *event);
/***** Local variables ****/
static proplist_t dCommand=NULL;
static proplist_t dPasteCommand=NULL;
static WMPropList *dCommand=NULL;
static WMPropList *dPasteCommand=NULL;
#ifdef OFFIX_DND
static proplist_t dDropCommand=NULL;
static WMPropList *dDropCommand=NULL;
#endif
static proplist_t dAutoLaunch, dLock;
static proplist_t dName, dForced, dBuggyApplication, dYes, dNo;
static proplist_t dHost, dDock, dClip;
static proplist_t dAutoAttractIcons;
static WMPropList *dAutoLaunch, *dLock;
static WMPropList *dName, *dForced, *dBuggyApplication, *dYes, *dNo;
static WMPropList *dHost, *dDock, *dClip;
static WMPropList *dAutoAttractIcons;
static proplist_t dPosition, dApplications, dLowered, dCollapsed, dAutoCollapse;
static WMPropList *dPosition, *dApplications, *dLowered, *dCollapsed;
static proplist_t dAutoRaiseLower, dOmnipresent;
static WMPropList *dAutoCollapse, *dAutoRaiseLower, *dOmnipresent;
static void dockIconPaint(WAppIcon *btn);
@@ -168,30 +168,30 @@ make_keys()
if (dCommand!=NULL)
return;
dCommand = PLRetain(PLMakeString("Command"));
dPasteCommand = PLRetain(PLMakeString("PasteCommand"));
dDropCommand = PLRetain(PLMakeString("DropCommand"));
dLock = PLRetain(PLMakeString("Lock"));
dAutoLaunch = PLRetain(PLMakeString("AutoLaunch"));
dName = PLRetain(PLMakeString("Name"));
dForced = PLRetain(PLMakeString("Forced"));
dBuggyApplication = PLRetain(PLMakeString("BuggyApplication"));
dYes = PLRetain(PLMakeString("Yes"));
dNo = PLRetain(PLMakeString("No"));
dHost = PLRetain(PLMakeString("Host"));
dCommand = WMRetainPropList(WMCreatePLString("Command"));
dPasteCommand = WMRetainPropList(WMCreatePLString("PasteCommand"));
dDropCommand = WMRetainPropList(WMCreatePLString("DropCommand"));
dLock = WMRetainPropList(WMCreatePLString("Lock"));
dAutoLaunch = WMRetainPropList(WMCreatePLString("AutoLaunch"));
dName = WMRetainPropList(WMCreatePLString("Name"));
dForced = WMRetainPropList(WMCreatePLString("Forced"));
dBuggyApplication = WMRetainPropList(WMCreatePLString("BuggyApplication"));
dYes = WMRetainPropList(WMCreatePLString("Yes"));
dNo = WMRetainPropList(WMCreatePLString("No"));
dHost = WMRetainPropList(WMCreatePLString("Host"));
dPosition = PLMakeString("Position");
dApplications = PLMakeString("Applications");
dLowered = PLMakeString("Lowered");
dCollapsed = PLMakeString("Collapsed");
dAutoCollapse = PLMakeString("AutoCollapse");
dAutoRaiseLower = PLMakeString("AutoRaiseLower");
dAutoAttractIcons = PLMakeString("AutoAttractIcons");
dPosition = WMCreatePLString("Position");
dApplications = WMCreatePLString("Applications");
dLowered = WMCreatePLString("Lowered");
dCollapsed = WMCreatePLString("Collapsed");
dAutoCollapse = WMCreatePLString("AutoCollapse");
dAutoRaiseLower = WMCreatePLString("AutoRaiseLower");
dAutoAttractIcons = WMCreatePLString("AutoAttractIcons");
dOmnipresent = PLMakeString("Omnipresent");
dOmnipresent = WMCreatePLString("Omnipresent");
dDock = PLMakeString("Dock");
dClip = PLMakeString("Clip");
dDock = WMCreatePLString("Dock");
dClip = WMCreatePLString("Clip");
}
@@ -1307,20 +1307,20 @@ dockIconPaint(WAppIcon *btn)
}
static proplist_t
static WMPropList*
make_icon_state(WAppIcon *btn)
{
proplist_t node = NULL;
proplist_t command, autolaunch, lock, name, forced, host, position, buggy;
proplist_t omnipresent;
WMPropList *node = NULL;
WMPropList *command, *autolaunch, *lock, *name, *forced, *host;
WMPropList *position, *buggy, *omnipresent;
char *tmp;
char buffer[64];
if (btn) {
if (!btn->command)
command = PLMakeString("-");
command = WMCreatePLString("-");
else
command = PLMakeString(btn->command);
command = WMCreatePLString(btn->command);
autolaunch = btn->auto_launch ? dYes : dNo;
@@ -1328,7 +1328,7 @@ make_icon_state(WAppIcon *btn)
tmp = EscapeWM_CLASS(btn->wm_instance, btn->wm_class);
name = PLMakeString(tmp);
name = WMCreatePLString(tmp);
wfree(tmp);
@@ -1340,9 +1340,9 @@ make_icon_state(WAppIcon *btn)
snprintf(buffer, sizeof(buffer), "%i,%i", btn->x_pos, btn->y_pos);
else
snprintf(buffer, sizeof(buffer), "%hi,%hi", btn->xindex, btn->yindex);
position = PLMakeString(buffer);
position = WMCreatePLString(buffer);
node = PLMakeDictionaryFromEntries(dCommand, command,
node = WMCreatePLDictionary(dCommand, command,
dName, name,
dAutoLaunch, autolaunch,
dLock, lock,
@@ -1350,33 +1350,33 @@ make_icon_state(WAppIcon *btn)
dBuggyApplication, buggy,
dPosition, position,
NULL);
PLRelease(command);
PLRelease(name);
PLRelease(position);
WMReleasePropList(command);
WMReleasePropList(name);
WMReleasePropList(position);
omnipresent = btn->omnipresent ? dYes : dNo;
if (btn->dock != btn->icon->core->screen_ptr->dock &&
(btn->xindex != 0 || btn->yindex != 0))
PLInsertDictionaryEntry(node, dOmnipresent, omnipresent);
WMPutInPLDictionary(node, dOmnipresent, omnipresent);
#ifdef OFFIX_DND
if (btn->dnd_command) {
command = PLMakeString(btn->dnd_command);
PLInsertDictionaryEntry(node, dDropCommand, command);
PLRelease(command);
command = WMCreatePLString(btn->dnd_command);
WMPutInPLDictionary(node, dDropCommand, command);
WMReleasePropList(command);
}
#endif /* OFFIX_DND */
if (btn->paste_command) {
command = PLMakeString(btn->paste_command);
PLInsertDictionaryEntry(node, dPasteCommand, command);
PLRelease(command);
command = WMCreatePLString(btn->paste_command);
WMPutInPLDictionary(node, dPasteCommand, command);
WMReleasePropList(command);
}
if (btn->client_machine && btn->remote_start) {
host = PLMakeString(btn->client_machine);
PLInsertDictionaryEntry(node, dHost, host);
PLRelease(host);
host = WMCreatePLString(btn->client_machine);
WMPutInPLDictionary(node, dHost, host);
WMReleasePropList(host);
}
}
@@ -1384,16 +1384,16 @@ make_icon_state(WAppIcon *btn)
}
static proplist_t
static WMPropList*
dockSaveState(WDock *dock)
{
int i;
proplist_t icon_info;
proplist_t list=NULL, dock_state=NULL;
proplist_t value, key;
WMPropList *icon_info;
WMPropList *list=NULL, *dock_state=NULL;
WMPropList *value, *key;
char buffer[256];
list = PLMakeArrayFromElements(NULL);
list = WMCreatePLArray(NULL);
for (i=(dock->type==WM_DOCK ? 0 : 1); i<dock->max_icons; i++) {
WAppIcon *btn = dock->icon_array[i];
@@ -1402,45 +1402,45 @@ dockSaveState(WDock *dock)
continue;
if ((icon_info = make_icon_state(dock->icon_array[i]))) {
list = PLAppendArrayElement(list, icon_info);
PLRelease(icon_info);
WMAddToPLArray(list, icon_info);
WMReleasePropList(icon_info);
}
}
dock_state = PLMakeDictionaryFromEntries(dApplications, list,
dock_state = WMCreatePLDictionary(dApplications, list,
NULL);
if (dock->type == WM_DOCK) {
snprintf(buffer, sizeof(buffer), "Applications%i", dock->screen_ptr->scr_height);
key = PLMakeString(buffer);
PLInsertDictionaryEntry(dock_state, key, list);
PLRelease(key);
key = WMCreatePLString(buffer);
WMPutInPLDictionary(dock_state, key, list);
WMReleasePropList(key);
snprintf(buffer, sizeof(buffer), "%i,%i", (dock->on_right_side ? -ICON_SIZE : 0),
dock->y_pos);
value = PLMakeString(buffer);
PLInsertDictionaryEntry(dock_state, dPosition, value);
PLRelease(value);
value = WMCreatePLString(buffer);
WMPutInPLDictionary(dock_state, dPosition, value);
WMReleasePropList(value);
}
PLRelease(list);
WMReleasePropList(list);
value = (dock->lowered ? dYes : dNo);
PLInsertDictionaryEntry(dock_state, dLowered, value);
WMPutInPLDictionary(dock_state, dLowered, value);
if (dock->type == WM_CLIP) {
value = (dock->collapsed ? dYes : dNo);
PLInsertDictionaryEntry(dock_state, dCollapsed, value);
WMPutInPLDictionary(dock_state, dCollapsed, value);
value = (dock->auto_collapse ? dYes : dNo);
PLInsertDictionaryEntry(dock_state, dAutoCollapse, value);
WMPutInPLDictionary(dock_state, dAutoCollapse, value);
value = (dock->auto_raise_lower ? dYes : dNo);
PLInsertDictionaryEntry(dock_state, dAutoRaiseLower, value);
WMPutInPLDictionary(dock_state, dAutoRaiseLower, value);
value = (dock->attract_icons ? dYes : dNo);
PLInsertDictionaryEntry(dock_state, dAutoAttractIcons, value);
WMPutInPLDictionary(dock_state, dAutoAttractIcons, value);
}
return dock_state;
@@ -1448,10 +1448,10 @@ dockSaveState(WDock *dock)
void
wDockSaveState(WScreen *scr, proplist_t old_state)
wDockSaveState(WScreen *scr, WMPropList *old_state)
{
proplist_t dock_state;
proplist_t keys;
WMPropList *dock_state;
WMPropList *keys;
dock_state = dockSaveState(scr->dock);
@@ -1460,44 +1460,44 @@ wDockSaveState(WScreen *scr, proplist_t old_state)
*/
if (old_state) {
int i;
proplist_t tmp;
WMPropList *tmp;
keys = PLGetAllDictionaryKeys(old_state);
for (i = 0; i < PLGetNumberOfElements(keys); i++) {
tmp = PLGetArrayElement(keys, i);
keys = WMGetPLDictionaryKeys(old_state);
for (i = 0; i < WMGetPropListItemCount(keys); i++) {
tmp = WMGetFromPLArray(keys, i);
if (strncasecmp(PLGetString(tmp), "applications", 12) == 0
&& !PLGetDictionaryEntry(dock_state, tmp)) {
if (strncasecmp(WMGetFromPLString(tmp), "applications", 12) == 0
&& !WMGetFromPLDictionary(dock_state, tmp)) {
PLInsertDictionaryEntry(dock_state,
WMPutInPLDictionary(dock_state,
tmp,
PLGetDictionaryEntry(old_state, tmp));
WMGetFromPLDictionary(old_state, tmp));
}
}
PLRelease(keys);
WMReleasePropList(keys);
}
PLInsertDictionaryEntry(scr->session_state, dDock, dock_state);
WMPutInPLDictionary(scr->session_state, dDock, dock_state);
PLRelease(dock_state);
WMReleasePropList(dock_state);
}
void
wClipSaveState(WScreen *scr)
{
proplist_t clip_state;
WMPropList *clip_state;
clip_state = make_icon_state(scr->clip_icon);
PLInsertDictionaryEntry(scr->session_state, dClip, clip_state);
WMPutInPLDictionary(scr->session_state, dClip, clip_state);
PLRelease(clip_state);
WMReleasePropList(clip_state);
}
proplist_t
WMPropList*
wClipSaveWorkspaceState(WScreen *scr, int workspace)
{
return dockSaveState(scr->workspaces[workspace]->clip);
@@ -1505,15 +1505,15 @@ wClipSaveWorkspaceState(WScreen *scr, int workspace)
static Bool
getBooleanDockValue(proplist_t value, proplist_t key)
getBooleanDockValue(WMPropList *value, WMPropList *key)
{
if (value) {
if (PLIsString(value)) {
if (strcasecmp(PLGetString(value), "YES")==0)
if (WMIsPLString(value)) {
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
return True;
} else {
wwarning(_("bad value in docked icon state info %s"),
PLGetString(key));
WMGetFromPLString(key));
}
}
return False;
@@ -1521,19 +1521,19 @@ getBooleanDockValue(proplist_t value, proplist_t key)
static WAppIcon*
restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
restore_icon_state(WScreen *scr, WMPropList *info, int type, int index)
{
WAppIcon *aicon;
proplist_t cmd, value;
WMPropList *cmd, *value;
cmd = PLGetDictionaryEntry(info, dCommand);
if (!cmd || !PLIsString(cmd)) {
cmd = WMGetFromPLDictionary(info, dCommand);
if (!cmd || !WMIsPLString(cmd)) {
return NULL;
}
/* parse window name */
value = PLGetDictionaryEntry(info, dName);
value = WMGetFromPLDictionary(info, dName);
if (!value)
return NULL;
@@ -1550,7 +1550,7 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
/* get commands */
if (cmd)
command = wstrdup(PLGetString(cmd));
command = wstrdup(WMGetFromPLString(cmd));
else
command = NULL;
@@ -1585,42 +1585,42 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
#ifdef OFFIX_DND
cmd = PLGetDictionaryEntry(info, dDropCommand);
cmd = WMGetFromPLDictionary(info, dDropCommand);
if (cmd)
aicon->dnd_command = wstrdup(PLGetString(cmd));
aicon->dnd_command = wstrdup(WMGetFromPLString(cmd));
#endif
cmd = PLGetDictionaryEntry(info, dPasteCommand);
cmd = WMGetFromPLDictionary(info, dPasteCommand);
if (cmd)
aicon->paste_command = wstrdup(PLGetString(cmd));
aicon->paste_command = wstrdup(WMGetFromPLString(cmd));
/* check auto launch */
value = PLGetDictionaryEntry(info, dAutoLaunch);
value = WMGetFromPLDictionary(info, dAutoLaunch);
aicon->auto_launch = getBooleanDockValue(value, dAutoLaunch);
/* check lock */
value = PLGetDictionaryEntry(info, dLock);
value = WMGetFromPLDictionary(info, dLock);
aicon->lock = getBooleanDockValue(value, dLock);
/* check if it wasn't normally docked */
value = PLGetDictionaryEntry(info, dForced);
value = WMGetFromPLDictionary(info, dForced);
aicon->forced_dock = getBooleanDockValue(value, dForced);
/* check if we can rely on the stuff in the app */
value = PLGetDictionaryEntry(info, dBuggyApplication);
value = WMGetFromPLDictionary(info, dBuggyApplication);
aicon->buggy_app = getBooleanDockValue(value, dBuggyApplication);
/* get position in the dock */
value = PLGetDictionaryEntry(info, dPosition);
if (value && PLIsString(value)) {
if (sscanf(PLGetString(value), "%hi,%hi", &aicon->xindex,
value = WMGetFromPLDictionary(info, dPosition);
if (value && WMIsPLString(value)) {
if (sscanf(WMGetFromPLString(value), "%hi,%hi", &aicon->xindex,
&aicon->yindex)!=2)
wwarning(_("bad value in docked icon state info %s"),
PLGetString(dPosition));
WMGetFromPLString(dPosition));
/* check position sanity */
/* incomplete section! */
@@ -1636,7 +1636,7 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
}
/* check if icon is omnipresent */
value = PLGetDictionaryEntry(info, dOmnipresent);
value = WMGetFromPLDictionary(info, dOmnipresent);
aicon->omnipresent = getBooleanDockValue(value, dOmnipresent);
@@ -1651,10 +1651,10 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
WAppIcon*
wClipRestoreState(WScreen *scr, proplist_t clip_state)
wClipRestoreState(WScreen *scr, WMPropList *clip_state)
{
WAppIcon *icon;
proplist_t value;
WMPropList *value;
icon = mainIconCreate(scr, WM_CLIP);
@@ -1662,17 +1662,17 @@ wClipRestoreState(WScreen *scr, proplist_t clip_state)
if (!clip_state)
return icon;
else
PLRetain(clip_state);
WMRetainPropList(clip_state);
/* restore position */
value = PLGetDictionaryEntry(clip_state, dPosition);
value = WMGetFromPLDictionary(clip_state, dPosition);
if (value) {
if (!PLIsString(value))
if (!WMIsPLString(value))
COMPLAIN("Position");
else {
if (sscanf(PLGetString(value), "%i,%i", &icon->x_pos,
if (sscanf(WMGetFromPLString(value), "%i,%i", &icon->x_pos,
&icon->y_pos)!=2)
COMPLAIN("Position");
@@ -1690,27 +1690,27 @@ wClipRestoreState(WScreen *scr, proplist_t clip_state)
}
#ifdef OFFIX_DND
value = PLGetDictionaryEntry(clip_state, dDropCommand);
if (value && PLIsString(value))
icon->dnd_command = wstrdup(PLGetString(value));
value = WMGetFromPLDictionary(clip_state, dDropCommand);
if (value && WMIsPLString(value))
icon->dnd_command = wstrdup(WMGetFromPLString(value));
#endif
value = PLGetDictionaryEntry(clip_state, dPasteCommand);
if (value && PLIsString(value))
icon->paste_command = wstrdup(PLGetString(value));
value = WMGetFromPLDictionary(clip_state, dPasteCommand);
if (value && WMIsPLString(value))
icon->paste_command = wstrdup(WMGetFromPLString(value));
PLRelease(clip_state);
WMReleasePropList(clip_state);
return icon;
}
WDock*
wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
{
WDock *dock;
proplist_t apps;
proplist_t value;
WMPropList *apps;
WMPropList *value;
WAppIcon *aicon, *old_top;
int count, i;
@@ -1721,18 +1721,18 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
return dock;
if (dock_state)
PLRetain(dock_state);
WMRetainPropList(dock_state);
/* restore position */
value = PLGetDictionaryEntry(dock_state, dPosition);
value = WMGetFromPLDictionary(dock_state, dPosition);
if (value) {
if (!PLIsString(value))
if (!WMIsPLString(value))
COMPLAIN("Position");
else {
if (sscanf(PLGetString(value), "%i,%i", &dock->x_pos,
if (sscanf(WMGetFromPLString(value), "%i,%i", &dock->x_pos,
&dock->y_pos)!=2)
COMPLAIN("Position");
@@ -1764,13 +1764,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
dock->lowered = 0;
value = PLGetDictionaryEntry(dock_state, dLowered);
value = WMGetFromPLDictionary(dock_state, dLowered);
if (value) {
if (!PLIsString(value))
if (!WMIsPLString(value))
COMPLAIN("Lowered");
else {
if (strcasecmp(PLGetString(value), "YES")==0)
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
dock->lowered = 1;
}
}
@@ -1780,13 +1780,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
dock->collapsed = 0;
value = PLGetDictionaryEntry(dock_state, dCollapsed);
value = WMGetFromPLDictionary(dock_state, dCollapsed);
if (value) {
if (!PLIsString(value))
if (!WMIsPLString(value))
COMPLAIN("Collapsed");
else {
if (strcasecmp(PLGetString(value), "YES")==0)
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
dock->collapsed = 1;
}
}
@@ -1794,13 +1794,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
/* restore auto-collapsed state */
value = PLGetDictionaryEntry(dock_state, dAutoCollapse);
value = WMGetFromPLDictionary(dock_state, dAutoCollapse);
if (value) {
if (!PLIsString(value))
if (!WMIsPLString(value))
COMPLAIN("AutoCollapse");
else {
if (strcasecmp(PLGetString(value), "YES")==0) {
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
dock->auto_collapse = 1;
dock->collapsed = 1;
}
@@ -1810,13 +1810,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
/* restore auto-raise/lower state */
value = PLGetDictionaryEntry(dock_state, dAutoRaiseLower);
value = WMGetFromPLDictionary(dock_state, dAutoRaiseLower);
if (value) {
if (!PLIsString(value))
if (!WMIsPLString(value))
COMPLAIN("AutoRaiseLower");
else {
if (strcasecmp(PLGetString(value), "YES")==0) {
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
dock->auto_raise_lower = 1;
}
}
@@ -1826,13 +1826,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
dock->attract_icons = 0;
value = PLGetDictionaryEntry(dock_state, dAutoAttractIcons);
value = WMGetFromPLDictionary(dock_state, dAutoAttractIcons);
if (value) {
if (!PLIsString(value))
if (!WMIsPLString(value))
COMPLAIN("AutoAttractIcons");
else {
if (strcasecmp(PLGetString(value), "YES")==0)
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
dock->attract_icons = 1;
}
}
@@ -1841,7 +1841,7 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
/* application list */
{
proplist_t tmp;
WMPropList *tmp;
char buffer[64];
/*
@@ -1854,12 +1854,12 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
snprintf(buffer, sizeof(buffer), "Applications%i", scr->scr_height);
tmp = PLMakeString(buffer);
apps = PLGetDictionaryEntry(dock_state, tmp);
PLRelease(tmp);
tmp = WMCreatePLString(buffer);
apps = WMGetFromPLDictionary(dock_state, tmp);
WMReleasePropList(tmp);
if (!apps) {
apps = PLGetDictionaryEntry(dock_state, dApplications);
apps = WMGetFromPLDictionary(dock_state, dApplications);
}
}
@@ -1867,7 +1867,7 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
goto finish;
}
count = PLGetNumberOfElements(apps);
count = WMGetPropListItemCount(apps);
if (count==0)
goto finish;
@@ -1887,7 +1887,7 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
break;
}
value = PLGetArrayElement(apps, i);
value = WMGetFromPLArray(apps, i);
aicon = restore_icon_state(scr, value, type, dock->icon_count);
dock->icon_array[dock->icon_count] = aicon;
@@ -1936,7 +1936,7 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
finish:
if (dock_state)
PLRelease(dock_state);
WMReleasePropList(dock_state);
return dock;
}

View File

@@ -70,7 +70,7 @@ typedef struct WDock {
WDock *wDockCreate(WScreen *scr, int type);
WDock *wDockRestoreState(WScreen *scr, proplist_t dock_state, int type);
WDock *wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type);
void wDockDestroy(WDock *dock);
void wDockHideIcons(WDock *dock);
@@ -78,7 +78,7 @@ void wDockShowIcons(WDock *dock);
void wDockLower(WDock *dock);
void wDockRaise(WDock *dock);
void wDockRaiseLower(WDock *dock);
void wDockSaveState(WScreen *scr, proplist_t old_state);
void wDockSaveState(WScreen *scr, WMPropList *old_state);
Bool wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y);
Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_y,
@@ -97,8 +97,8 @@ int wDockReceiveDNDDrop(WScreen *scr, XEvent *event);
void wClipIconPaint(WAppIcon *aicon);
void wClipSaveState(WScreen *scr);
proplist_t wClipSaveWorkspaceState(WScreen *scr, int workspace);
WAppIcon* wClipRestoreState(WScreen *scr, proplist_t clip_state);
WMPropList *wClipSaveWorkspaceState(WScreen *scr, int workspace);
WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state);
void wClipUpdateForWorkspaceChange(WScreen *scr, int workspace);

View File

@@ -111,11 +111,9 @@ char *FindImage(char *paths, char *file);
RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
BOOL StringCompareHook(proplist_t pl1, proplist_t pl2);
int IsEof(FILE * stream); /* feof that stats pipes */
void ParseWindowName(proplist_t value, char **winstance, char **wclass,
void ParseWindowName(WMPropList *value, char **winstance, char **wclass,
char *where);
void SendHelperMessage(WScreen *scr, char type, int workspace, char *msg);

View File

@@ -48,6 +48,7 @@
#include "funcs.h"
#include "actions.h"
#include "stacking.h"
#include "client.h"
#include "gnome.h"

View File

@@ -51,7 +51,7 @@
#include "session.h"
#include "dialog.h"
#include <proplist.h>
#include <WINGs/WUtil.h>
/****** Global Variables ******/
@@ -71,8 +71,8 @@ int wScreenCount=0;
WPreferences wPreferences;
proplist_t wDomainName;
proplist_t wAttributeDomainName;
WMPropList *wDomainName;
WMPropList *wAttributeDomainName;
WShortKey wKeyBindings[WKBD_LAST];

View File

@@ -87,8 +87,8 @@ static void menuCloseClick(WCoreWindow *sender, void *data, XEvent *event);
static void updateTexture(WMenu *menu);
#ifndef LITE
static int saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu);
static int restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path);
static int saveMenuRecurs(WMPropList *menus, WScreen *scr, WMenu *menu);
static int restoreMenuRecurs(WScreen *scr, WMPropList *menus, WMenu *menu, char *path);
#endif /* !LITE */
static void selectEntry(WMenu *menu, int entry_no);
@@ -632,7 +632,7 @@ wMenuDestroy(WMenu *menu, int recurse)
#ifdef USER_MENU
if (menu->entries[i]->instances){
PLRelease(menu->entries[i]->instances);
WMReleasePropList(menu->entries[i]->instances);
}
#endif /* USER_MENU */
@@ -2450,35 +2450,35 @@ menuCloseClick(WCoreWindow *sender, void *data, XEvent *event)
static void
saveMenuInfo(proplist_t dict, WMenu *menu, proplist_t key)
saveMenuInfo(WMPropList *dict, WMenu *menu, WMPropList *key)
{
proplist_t value, list;
WMPropList *value, *list;
char buffer[256];
snprintf(buffer, sizeof(buffer), "%i,%i", menu->frame_x, menu->frame_y);
value = PLMakeString(buffer);
list = PLMakeArrayFromElements(value, NULL);
value = WMCreatePLString(buffer);
list = WMCreatePLArray(value, NULL);
if (menu->flags.lowered)
PLAppendArrayElement(list, PLMakeString("lowered"));
PLInsertDictionaryEntry(dict, key, list);
PLRelease(value);
PLRelease(list);
WMAddToPLArray(list, WMCreatePLString("lowered"));
WMPutInPLDictionary(dict, key, list);
WMReleasePropList(value);
WMReleasePropList(list);
}
void
wMenuSaveState(WScreen *scr)
{
proplist_t menus, key;
WMPropList *menus, *key;
int save_menus = 0;
menus = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
menus = WMCreatePLDictionary(NULL, NULL, NULL);
#ifndef LITE
if (scr->switch_menu && scr->switch_menu->flags.buttoned) {
key = PLMakeString("SwitchMenu");
key = WMCreatePLString("SwitchMenu");
saveMenuInfo(menus, scr->switch_menu, key);
PLRelease(key);
WMReleasePropList(key);
save_menus = 1;
}
@@ -2487,18 +2487,18 @@ wMenuSaveState(WScreen *scr)
#endif /* !LITE */
if (scr->workspace_menu && scr->workspace_menu->flags.buttoned) {
key = PLMakeString("WorkspaceMenu");
key = WMCreatePLString("WorkspaceMenu");
saveMenuInfo(menus, scr->workspace_menu, key);
PLRelease(key);
WMReleasePropList(key);
save_menus = 1;
}
if (save_menus) {
key = PLMakeString("Menus");
PLInsertDictionaryEntry(scr->session_state, key, menus);
PLRelease(key);
key = WMCreatePLString("Menus");
WMPutInPLDictionary(scr->session_state, key, menus);
WMReleasePropList(key);
}
PLRelease(menus);
WMReleasePropList(menus);
}
@@ -2531,9 +2531,9 @@ getMenuPath(WMenu *menu, char *buffer, int bufSize)
static Bool
saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu)
saveMenuRecurs(WMPropList *menus, WScreen *scr, WMenu *menu)
{
proplist_t key;
WMPropList *key;
int save_menus = 0, i;
char buffer[512];
Bool ok = True;
@@ -2548,9 +2548,9 @@ saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu)
ok = getMenuPath(menu, buffer, 510);
if (ok) {
key = PLMakeString(buffer);
key = WMCreatePLString(buffer);
saveMenuInfo(menus, menu, key);
PLRelease(key);
WMReleasePropList(key);
save_menus = 1;
}
}
@@ -2570,26 +2570,26 @@ saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu)
static Bool
getMenuInfo(proplist_t info, int *x, int *y, Bool *lowered)
getMenuInfo(WMPropList *info, int *x, int *y, Bool *lowered)
{
proplist_t pos;
WMPropList *pos;
*lowered = False;
if (PLIsArray(info)) {
proplist_t flags;
pos = PLGetArrayElement(info, 0);
flags = PLGetArrayElement(info, 1);
if (flags != NULL && PLIsString(flags) && PLGetString(flags) != NULL
&& strcmp(PLGetString(flags), "lowered") == 0) {
if (WMIsPLArray(info)) {
WMPropList *flags;
pos = WMGetFromPLArray(info, 0);
flags = WMGetFromPLArray(info, 1);
if (flags != NULL && WMIsPLString(flags) && WMGetFromPLString(flags) != NULL
&& strcmp(WMGetFromPLString(flags), "lowered") == 0) {
*lowered = True;
}
} else {
pos = info;
}
if (pos != NULL && PLIsString(pos)) {
if (sscanf(PLGetString(pos), "%i,%i", x, y)!=2)
if (pos != NULL && WMIsPLString(pos)) {
if (sscanf(WMGetFromPLString(pos), "%i,%i", x, y)!=2)
COMPLAIN("Position");
} else {
COMPLAIN("(position, flags...)");
@@ -2601,7 +2601,7 @@ getMenuInfo(proplist_t info, int *x, int *y, Bool *lowered)
static int
restoreMenu(WScreen *scr, proplist_t menu, int which)
restoreMenu(WScreen *scr, WMPropList *menu, int which)
{
int x, y;
Bool lowered = False;
@@ -2644,9 +2644,9 @@ restoreMenu(WScreen *scr, proplist_t menu, int which)
#ifndef LITE
static int
restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path)
restoreMenuRecurs(WScreen *scr, WMPropList *menus, WMenu *menu, char *path)
{
proplist_t key, entry;
WMPropList *key, *entry;
char buffer[512];
int i, x, y, res;
Bool lowered;
@@ -2655,8 +2655,8 @@ restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path)
return False;
snprintf(buffer, sizeof(buffer), "%s\\%s", path, menu->frame->title);
key = PLMakeString(buffer);
entry = PLGetDictionaryEntry(menus, key);
key = WMCreatePLString(buffer);
entry = WMGetFromPLDictionary(menus, key);
res = False;
if (entry && getMenuInfo(entry, &x, &y, &lowered)) {
@@ -2690,7 +2690,7 @@ restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path)
}
}
PLRelease(key);
WMReleasePropList(key);
for (i=0; i<menu->cascade_no; i++) {
if (restoreMenuRecurs(scr, menus, menu->cascades[i], buffer) != False)
@@ -2705,20 +2705,20 @@ restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path)
void
wMenuRestoreState(WScreen *scr)
{
proplist_t menus, menu, key, skey;
WMPropList *menus, *menu, *key, *skey;
key = PLMakeString("Menus");
menus = PLGetDictionaryEntry(scr->session_state, key);
PLRelease(key);
key = WMCreatePLString("Menus");
menus = WMGetFromPLDictionary(scr->session_state, key);
WMReleasePropList(key);
if (!menus)
return;
/* restore menus */
skey = PLMakeString("SwitchMenu");
menu = PLGetDictionaryEntry(menus, skey);
PLRelease(skey);
skey = WMCreatePLString("SwitchMenu");
menu = WMGetFromPLDictionary(menus, skey);
WMReleasePropList(skey);
restoreMenu(scr, menu, WSS_SWITCHMENU);
#ifndef LITE

View File

@@ -39,7 +39,7 @@ typedef struct WMenuEntry {
void *clientdata; /* data to pass to callback */
int cascade; /* cascade menu index */
#ifdef USER_MENU
proplist_t instances; /* allowed instances */
WMPropList *instances; /* allowed instances */
#endif /* USER_MENU */
struct {
unsigned int enabled:1; /* entry is selectable */

View File

@@ -37,10 +37,10 @@
typedef struct PLMenuReaderData {
WRootMenuReader *reader;
proplist_t pl;
WMPropList *pl;
int curIndex;
proplist_t *submenu;
WMPropList **submenu;
int *curSubIndex;
int submenuDepth;
@@ -78,7 +78,7 @@ typedef struct GNOMEMenuReaderData {
static WRootMenuData *pl_openMenu(proplist_t pl);
static WRootMenuData *pl_openMenu(WMPropList *pl);
static Bool pl_hasMoreData(WRootMenuData *data);
static Bool pl_nextCommand(WRootMenuData *data,
char **title,
@@ -148,7 +148,7 @@ static char linebuf[LINESIZE];
/* ---------- proplist ---------- */
static WRootMenuData *pl_openMenuFile(proplist_t pl)
static WRootMenuData *pl_openMenuFile(WMPropList *pl)
{
PLRootMenuData *data = wmalloc(sizeof(PLRootMenuData));
@@ -186,7 +186,7 @@ static void pl_closeMenuFile(WRootMenuData *data)
if (data->curSubIndex)
wfree(data->curSubIndex);
PLRelease(data->pl);
WMReleasePropList(data->pl);
wfree(data);
}
@@ -354,8 +354,8 @@ WRootMenuData *OpenMenu(char *path, time_t *menuTime)
}
/* then check whether it's a proplist menu */
pl = ReadProplistFromFile(path);
if (pl && PLIsArray(pl)) {
pl = WMReadPropListFromFile(path);
if (pl && WMIsPLArray(pl)) {
*menuTime = stat_buf.st_mtime;
return pl_openMenu(pl);
}
@@ -392,19 +392,19 @@ WRootMenuData *ReopenRootMenu(time_t *checkTime,
*checkTime = stat_buf.st_mtime;
pl = ReadProplistFromFile(path);
pl = WMReadPropListFromFile(path);
if (!pl) {
wwarning(_("could not load domain %s from user defaults database"),
"WMRootMenu");
return NULL;
}
if (PLIsString(pl)) {
if (WMIsPLString(pl)) {
char *tmp;
char *path;
Bool menu_is_default = False;
tmp = wexpandpath(PLGetString(pl));
tmp = wexpandpath(WMGetFromPLString(pl));
path = getLocalizedMenuFile(tmp);
@@ -448,7 +448,7 @@ WRootMenuData *ReopenRootMenu(time_t *checkTime,
}
return OpenMenu(*menuPath, menuTimestamp);
} else if (PLIsArray(pl)) {
} else if (WMIsPLArray(pl)) {
*menuTimestamp = stat_buf.st_mtime;

View File

@@ -947,23 +947,6 @@ ExpandOptions(WScreen *scr, char *cmdline)
}
/* We don't care for upper/lower case in comparing the keys; so we
have to define our own comparison function here */
BOOL
StringCompareHook(proplist_t pl1, proplist_t pl2)
{
char *str1, *str2;
str1 = PLGetString(pl1);
str2 = PLGetString(pl2);
if (strcasecmp(str1, str2)==0)
return YES;
else
return NO;
}
/* feof doesn't seem to work on pipes */
int
IsEof(FILE * stream)
@@ -977,18 +960,18 @@ IsEof(FILE * stream)
void
ParseWindowName(proplist_t value, char **winstance, char **wclass, char *where)
ParseWindowName(WMPropList *value, char **winstance, char **wclass, char *where)
{
char *name;
*winstance = *wclass = NULL;
if (!PLIsString(value)) {
if (!WMIsPLString(value)) {
wwarning(_("bad window name value in %s state info"), where);
return;
}
name = PLGetString(value);
name = WMGetFromPLString(value);
if (!name || strlen(name)==0) {
wwarning(_("bad window name value in %s state info"), where);
return;

View File

@@ -1,491 +0,0 @@
/* proplist.c- Hand made proplist parser.
* The one in libPropList causes wmaker to crash if an error is found in
* the parsed file. This parser is also more rigid: it will not accept any
* property lists with errors, but will print more descriptive error messages
* and will hopefully not crash.
*
* Window Maker window manager
*
* Copyright (c) 1998 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
#include "wconfig.h"
#include "WindowMaker.h"
#include <proplist.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#if 0
#define DPUT(s) puts(s)
#else
#define DPUT(s)
#endif
#define INITIAL_BUFFER_SIZE (16*1024)
#define BUFFER_SIZE_INCREMENT 1024
static int line_number = 1;
static int buffer_size = 0;
static char *buffer = NULL;
static char *file_name;
static proplist_t get_object(FILE *f);
static proplist_t get_array(FILE *f);
static proplist_t get_string(FILE *f);
static proplist_t get_qstring(FILE *f);
static proplist_t get_dictionary(FILE *f);
static INLINE int
get_char(FILE *f)
{
int c;
c = fgetc(f);
if (c=='\n')
line_number++;
return c;
}
static INLINE int
get_non_space_char(FILE *f)
{
int c;
while (1) {
c = fgetc(f);
if (c=='\n')
line_number++;
else if (!isspace(c))
break;
}
if (c!=EOF) {
return c;
} else {
return EOF;
}
}
static char *
unescapestr(char *src)
{
char *dest = wmalloc(strlen(src)+1);
char *src_ptr, *dest_ptr;
char ch;
for (src_ptr=src, dest_ptr=dest; *src_ptr; src_ptr++, dest_ptr++)
{
if(*src_ptr != '\\')
*dest_ptr = *src_ptr;
else
{
ch = *(++src_ptr);
if((ch>='0') && (ch<='3')) /* assume next 2 chars are octal too */
{
*dest_ptr = ((ch & 07) << 6);
*dest_ptr |= ((*(++src_ptr)&07)<<3);
*dest_ptr |= *(++src_ptr)&07;
}
else
{
switch(ch)
{
case 'a' : *dest_ptr = '\a'; break;
case 'b' : *dest_ptr = '\b'; break;
case 't' : *dest_ptr = '\t'; break;
case 'r' : *dest_ptr = '\r'; break;
case 'n' : *dest_ptr = '\n'; break;
case 'v' : *dest_ptr = '\v'; break;
case 'f' : *dest_ptr = '\f'; break;
default : *dest_ptr = *src_ptr;
}
}
}
}
*dest_ptr = 0;
return dest;
}
#define CHECK_BUFFER_SIZE(ptr) \
if ((ptr) >= buffer_size-1) {\
buffer_size += BUFFER_SIZE_INCREMENT;\
buffer = wrealloc(buffer, buffer_size);\
}
#define ISSTRINGABLE(c) (isalnum(c) || (c)=='.' || (c)=='_' || (c)=='/' \
|| (c)=='+')
#define COMPLAIN(msg) wwarning(_("syntax error in %s, line %i:%s"), \
file_name, line_number, msg)
static proplist_t
get_qstring(FILE *f)
{
int c;
int ptr = 0;
int escaping = 0;
int ok = 1;
while (1) {
c = get_char(f);
if (!escaping) {
if (c=='\\') {
escaping = 1;
continue;
}
if (c=='"')
break;
} else {
CHECK_BUFFER_SIZE(ptr);
buffer[ptr++] = '\\';
escaping = 0;
}
if (c==EOF) {
ptr--;
ok = 0;
COMPLAIN(_("unterminated string"));
break;
} else {
CHECK_BUFFER_SIZE(ptr);
buffer[ptr++] = c;
}
}
buffer[ptr] = 0;
if (!ok)
return NULL;
else {
char *tmp = unescapestr(buffer);
proplist_t pl = PLMakeString(tmp);
wfree(tmp);
return pl;
}
}
static proplist_t
get_string(FILE *f)
{
int c;
int ptr = 0;
while (1) {
c = get_char(f);
if (ISSTRINGABLE(c)) {
CHECK_BUFFER_SIZE(ptr);
buffer[ptr++] = c;
} else {
if (c!=EOF) {
ungetc(c, f);
}
break;
}
}
buffer[ptr] = 0;
if (ptr==0)
return NULL;
else {
char *tmp = unescapestr(buffer);
proplist_t pl = PLMakeString(tmp);
wfree(tmp);
return pl;
}
}
static proplist_t
get_array(FILE *f)
{
int c;
int ok=1, first=1;
proplist_t list, obj;
list = PLMakeArrayFromElements(NULL);
while (1) {
c = get_non_space_char(f);
if (c==EOF) {
COMPLAIN(_("unterminated array"));
ok = 0;
break;
} else if (c==')') {
break;
} else if (c==',') {
/* continue normally */
} else {
if (!first) {
COMPLAIN(_("missing , in array or unterminated array"));
ok = 0;
break;
} else {
ungetc(c, f);
}
}
first = 0;
/* get the data */
obj = get_object(f);
if (!obj) {
COMPLAIN(_("could not get array element"));
ok = 0;
break;
}
list = PLAppendArrayElement(list, obj);
PLRelease(obj);
}
if (ok)
return list;
else {
PLRelease(list);
return NULL;
}
}
static proplist_t
get_dictionary(FILE *f)
{
int c;
int ok = 1;
proplist_t dict, key, value;
dict = PLMakeDictionaryFromEntries(NULL, NULL);
while (1) {
c = get_non_space_char(f);
if (c==EOF) {
COMPLAIN(_("unterminated dictionary"));
ok = 0;
break;
} else if (c=='}') {
break;
}
/* get the entry */
/* get key */
DPUT("getting dict key");
if (c=='"')
key = get_qstring(f);
else if (ISSTRINGABLE(c)) {
ungetc(c, f);
key = get_string(f);
} else {
if (c=='=')
COMPLAIN(_("missing dictionary key"));
else
COMPLAIN(_("missing dictionary entry key or unterminated dictionary"));
ok = 0;
break;
}
if (!key) {
COMPLAIN(_("error parsing dictionary key"));
ok = 0;
break;
}
DPUT("getting =");
/* get = */
c = get_non_space_char(f);
if (c!='=') {
PLRelease(key);
COMPLAIN(_("missing = in dictionary entry"));
ok = 0;
break;
}
DPUT("getting dict entry data");
/* get data */
value = get_object(f);
if (!value) {
/*
COMPLAIN(_("error parsing dictionary entry value"));
*/
ok = 0;
PLRelease(key);
break;
}
DPUT("getting ;");
/* get ; */
c = get_non_space_char(f);
if (c!=';') {
COMPLAIN(_("missing ; in dictionary entry"));
ok = 0;
PLRelease(key);
PLRelease(value);
break;
}
dict = PLInsertDictionaryEntry(dict, key, value);
PLRelease(key);
PLRelease(value);
}
if (!ok) {
PLRelease(dict);
return NULL;
} else {
return dict;
}
}
static proplist_t
get_data(FILE *f)
{
COMPLAIN("the data datatype is not yet implemented");
return NULL;
}
static proplist_t
get_object(FILE *f)
{
int c;
proplist_t pl;
c = get_non_space_char(f);
switch (c) {
/* END OF FILE */
case EOF:
DPUT("EOF");
pl = NULL;
break;
/* dictionary */
case '{':
DPUT("getting dictionary");
pl = get_dictionary(f);
break;
/* array */
case '(':
DPUT("getting array");
pl = get_array(f);
break;
/* data */
case '<':
DPUT("getting data");
pl = get_data(f);
break;
/* quoted string */
case '"':
DPUT("getting quoted string");
pl = get_qstring(f);
break;
/* string */
default:
if (ISSTRINGABLE(c)) {
DPUT("getting string");
/* put back */
ungetc(c, f);
pl = get_string(f);
} else {
COMPLAIN(_("was expecting a string, dictionary, data or array. If it's a string, try enclosing it with \"."));
if (c=='#' || c=='/') {
wwarning(_("Comments are not allowed inside WindowMaker owned domain files."));
}
pl = NULL;
}
break;
}
return pl;
}
proplist_t
ReadProplistFromFile(char *file)
{
FILE *f;
proplist_t pl = NULL;
f = fopen(file, "r");
if (!f) {
wsyserror(_("could not open domain file %s"), file);
return NULL;
}
file_name = file;
line_number = 1;
buffer_size = INITIAL_BUFFER_SIZE;
buffer = wmalloc(buffer_size);
pl = get_object(f);
/* check for illegal characters after EOF */
if (get_non_space_char(f)!=EOF && pl) {
COMPLAIN(_("extra data after end of file"));
/*
* We can't just ignore garbage after the file because the "garbage"
* could be the data and the real garbage be in the beginning of
* the file (wich is now, inside pl)
*/
PLRelease(pl);
pl = NULL;
}
wfree(buffer);
fclose(f);
if (pl) {
proplist_t fpl;
fpl = PLMakeString(file);
PLSetFilename(pl, fpl);
PLRelease(fpl);
}
return pl;
}

View File

@@ -52,7 +52,8 @@
#include "framewin.h"
#include "session.h"
#include "xmodifier.h"
#include <proplist.h>
#include <WINGs/WUtil.h>
@@ -1579,23 +1580,23 @@ makeDefaultMenu(WScreen *scr)
*----------------------------------------------------------------------
*/
static WMenu*
configureMenu(WScreen *scr, proplist_t definition)
configureMenu(WScreen *scr, WMPropList *definition)
{
WMenu *menu = NULL;
proplist_t elem;
WMPropList *elem;
int i, count;
proplist_t title, command, params;
WMPropList *title, *command, *params;
char *tmp, *mtitle;
if (PLIsString(definition)) {
if (WMIsPLString(definition)) {
struct stat stat_buf;
char *path = NULL;
Bool menu_is_default = False;
/* menu definition is a string. Probably a path, so parse the file */
tmp = wexpandpath(PLGetString(definition));
tmp = wexpandpath(WMGetFromPLString(definition));
path = getLocalizedMenuFile(tmp);
@@ -1642,19 +1643,19 @@ configureMenu(WScreen *scr, proplist_t definition)
return menu;
}
count = PLGetNumberOfElements(definition);
count = WMGetPropListItemCount(definition);
if (count==0)
return NULL;
elem = PLGetArrayElement(definition, 0);
if (!PLIsString(elem)) {
tmp = PLGetDescription(elem);
elem = WMGetFromPLArray(definition, 0);
if (!WMIsPLString(elem)) {
tmp = WMGetPropListDescription(elem, False);
wwarning(_("%s:format error in root menu configuration \"%s\""),
"WMRootMenu", tmp);
wfree(tmp);
return NULL;
}
mtitle = PLGetString(elem);
mtitle = WMGetFromPLString(elem);
menu = wMenuCreate(scr, mtitle, False);
menu->on_destroy = removeShortcutsForMenu;
@@ -1674,19 +1675,19 @@ configureMenu(WScreen *scr, proplist_t definition)
#endif
for (i=1; i<count; i++) {
elem = PLGetArrayElement(definition, i);
elem = WMGetFromPLArray(definition, i);
#if 0
if (PLIsString(elem)) {
if (WMIsPLString(elem)) {
char *file;
file = PLGetString(elem);
file = WMGetFromPLString(elem);
}
#endif
if (!PLIsArray(elem) || PLGetNumberOfElements(elem) < 2)
if (!WMIsPLArray(elem) || WMGetPropListItemCount(elem) < 2)
goto error;
if (PLIsArray(PLGetArrayElement(elem,1))) {
if (WMIsPLArray(WMGetFromPLArray(elem,1))) {
WMenu *submenu;
WMenuEntry *mentry;
@@ -1699,32 +1700,32 @@ configureMenu(WScreen *scr, proplist_t definition)
}
} else {
int idx = 0;
char *shortcut;
WMPropList *shortcut;
/* normal entry */
title = PLGetArrayElement(elem, idx++);
shortcut = PLGetArrayElement(elem, idx++);
if (strcmp(PLGetString(shortcut), "SHORTCUT")==0) {
shortcut = PLGetArrayElement(elem, idx++);
command = PLGetArrayElement(elem, idx++);
title = WMGetFromPLArray(elem, idx++);
shortcut = WMGetFromPLArray(elem, idx++);
if (strcmp(WMGetFromPLString(shortcut), "SHORTCUT")==0) {
shortcut = WMGetFromPLArray(elem, idx++);
command = WMGetFromPLArray(elem, idx++);
} else {
command = shortcut;
shortcut = NULL;
}
params = PLGetArrayElement(elem, idx++);
params = WMGetFromPLArray(elem, idx++);
if (!title || !command)
goto error;
addMenuEntry(menu, PLGetString(title),
shortcut ? PLGetString(shortcut) : NULL,
PLGetString(command),
params ? PLGetString(params) : NULL, "WMRootMenu");
addMenuEntry(menu, WMGetFromPLString(title),
shortcut ? WMGetFromPLString(shortcut) : NULL,
WMGetFromPLString(command),
params ? WMGetFromPLString(params) : NULL, "WMRootMenu");
}
continue;
error:
tmp = PLGetDescription(elem);
tmp = WMGetPropListDescription(elem, False);
wwarning(_("%s:format error in root menu configuration \"%s\""),
"WMRootMenu", tmp);
wfree(tmp);
@@ -1760,12 +1761,12 @@ void
OpenRootMenu(WScreen *scr, int x, int y, int keyboard)
{
WMenu *menu=NULL;
proplist_t definition;
WMPropList *definition;
/*
static proplist_t domain=NULL;
static WMPropList *domain=NULL;
if (!domain) {
domain = PLMakeString("WMRootMenu");
domain = WMCreatePLString("WMRootMenu");
}
*/
@@ -1795,7 +1796,7 @@ OpenRootMenu(WScreen *scr, int x, int y, int keyboard)
definition = PLGetDomain(domain);
*/
if (definition) {
if (PLIsArray(definition)) {
if (WMIsPLArray(definition)) {
if (!scr->root_menu
|| WDRootMenu->timestamp > scr->root_menu->timestamp) {
menu = configureMenu(scr, definition);

View File

@@ -63,7 +63,7 @@
# include "openlook.h"
#endif
#include <proplist.h>
#include <WINGs/WUtil.h>
#include "defaults.h"
@@ -104,10 +104,10 @@ static char STIPPLE_DATA[] = {0x02, 0x01};
static int CantManageScreen = 0;
static proplist_t dApplications = NULL;
static proplist_t dWorkspace;
static proplist_t dDock;
static proplist_t dClip;
static WMPropList *dApplications = NULL;
static WMPropList *dWorkspace;
static WMPropList *dDock;
static WMPropList *dClip;
static void
@@ -116,10 +116,10 @@ make_keys()
if (dApplications!=NULL)
return;
dApplications = PLMakeString("Applications");
dWorkspace = PLMakeString("Workspace");
dDock = PLMakeString("Dock");
dClip = PLMakeString("Clip");
dApplications = WMCreatePLString("Applications");
dWorkspace = WMCreatePLString("Workspace");
dDock = WMCreatePLString("Dock");
dClip = WMCreatePLString("Clip");
}
@@ -1007,7 +1007,7 @@ wScreenUpdateUsableArea(WScreen *scr)
void
wScreenRestoreState(WScreen *scr)
{
proplist_t state;
WMPropList *state;
char *path;
@@ -1025,18 +1025,18 @@ wScreenRestoreState(WScreen *scr)
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
path = wdefaultspathfordomain(buf);
}
scr->session_state = PLGetProplistWithPath(path);
scr->session_state = WMReadPropListFromFile(path);
wfree(path);
if (!scr->session_state && wScreenCount>1) {
char buf[16];
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
path = wdefaultspathfordomain(buf);
scr->session_state = PLGetProplistWithPath(path);
scr->session_state = WMReadPropListFromFile(path);
wfree(path);
}
if (!wPreferences.flags.noclip) {
state = PLGetDictionaryEntry(scr->session_state, dClip);
state = WMGetFromPLDictionary(scr->session_state, dClip);
scr->clip_icon = wClipRestoreState(scr, state);
}
@@ -1050,7 +1050,7 @@ wScreenRestoreState(WScreen *scr)
#endif
if (!wPreferences.flags.nodock) {
state = PLGetDictionaryEntry(scr->session_state, dDock);
state = WMGetFromPLDictionary(scr->session_state, dDock);
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
}
@@ -1063,7 +1063,7 @@ wScreenSaveState(WScreen *scr)
{
WWindow *wwin;
char *str;
proplist_t path, old_state, foo;
WMPropList *old_state, *foo;
CARD32 data[2];
@@ -1090,23 +1090,23 @@ wScreenSaveState(WScreen *scr)
old_state = scr->session_state;
scr->session_state = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
scr->session_state = WMCreatePLDictionary(NULL, NULL, NULL);
PLSetStringCmpHook(NULL);
WMPLSetCaseSensitive(True);
/* save dock state to file */
if (!wPreferences.flags.nodock) {
wDockSaveState(scr, old_state);
} else {
if ((foo = PLGetDictionaryEntry(old_state, dDock))!=NULL) {
PLInsertDictionaryEntry(scr->session_state, dDock, foo);
if ((foo = WMGetFromPLDictionary(old_state, dDock))!=NULL) {
WMPutInPLDictionary(scr->session_state, dDock, foo);
}
}
if (!wPreferences.flags.noclip) {
wClipSaveState(scr);
} else {
if ((foo = PLGetDictionaryEntry(old_state, dClip))!=NULL) {
PLInsertDictionaryEntry(scr->session_state, dClip, foo);
if ((foo = WMGetFromPLDictionary(old_state, dClip))!=NULL) {
WMPutInPLDictionary(scr->session_state, dClip, foo);
}
}
@@ -1115,16 +1115,16 @@ wScreenSaveState(WScreen *scr)
if (wPreferences.save_session_on_exit) {
wSessionSaveState(scr);
} else {
if ((foo = PLGetDictionaryEntry(old_state, dApplications))!=NULL) {
PLInsertDictionaryEntry(scr->session_state, dApplications, foo);
if ((foo = WMGetFromPLDictionary(old_state, dApplications))!=NULL) {
WMPutInPLDictionary(scr->session_state, dApplications, foo);
}
if ((foo = PLGetDictionaryEntry(old_state, dWorkspace))!=NULL) {
PLInsertDictionaryEntry(scr->session_state, dWorkspace, foo);
if ((foo = WMGetFromPLDictionary(old_state, dWorkspace))!=NULL) {
WMPutInPLDictionary(scr->session_state, dWorkspace, foo);
}
}
/* clean up */
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
wMenuSaveState(scr);
@@ -1135,14 +1135,11 @@ wScreenSaveState(WScreen *scr)
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
str = wdefaultspathfordomain(buf);
}
path = PLMakeString(str);
wfree(str);
PLSetFilename(scr->session_state, path);
if (!PLSave(scr->session_state, YES)) {
wsyserror(_("could not save session state in %s"), PLGetString(path));
if (!WMWritePropListToFile(scr->session_state, str, True)) {
wsyserror(_("could not save session state in %s"), str);
}
PLRelease(path);
PLRelease(old_state);
wfree(str);
WMReleasePropList(old_state);
}

View File

@@ -26,7 +26,7 @@
#include "WindowMaker.h"
#include <sys/types.h>
#include <proplist.h>
#include <WINGs/WUtil.h>
#ifdef XINERAMA
#include <X11/Xinerama.h>
@@ -264,7 +264,7 @@ typedef struct _WScreen {
/* state and other informations */
short cascade_index; /* for cascade window placement */
proplist_t session_state;
WMPropList *session_state;
/* for double-click detection */
Time last_click_time;

View File

@@ -92,7 +92,7 @@
#include "dock.h"
#include <proplist.h>
#include <WINGs/WUtil.h>
/** Global **/
@@ -116,20 +116,20 @@ static char *sClientID = NULL;
#endif
static proplist_t sApplications = NULL;
static proplist_t sCommand;
static proplist_t sName;
static proplist_t sHost;
static proplist_t sWorkspace;
static proplist_t sShaded;
static proplist_t sMiniaturized;
static proplist_t sHidden;
static proplist_t sGeometry;
static proplist_t sShortcutMask;
static WMPropList *sApplications = NULL;
static WMPropList *sCommand;
static WMPropList *sName;
static WMPropList *sHost;
static WMPropList *sWorkspace;
static WMPropList *sShaded;
static WMPropList *sMiniaturized;
static WMPropList *sHidden;
static WMPropList *sGeometry;
static WMPropList *sShortcutMask;
static proplist_t sDock;
static WMPropList *sDock;
static proplist_t sYes, sNo;
static WMPropList *sYes, *sNo;
static void
@@ -138,33 +138,33 @@ make_keys()
if (sApplications!=NULL)
return;
sApplications = PLMakeString("Applications");
sCommand = PLMakeString("Command");
sName = PLMakeString("Name");
sHost = PLMakeString("Host");
sWorkspace = PLMakeString("Workspace");
sShaded = PLMakeString("Shaded");
sMiniaturized = PLMakeString("Miniaturized");
sHidden = PLMakeString("Hidden");
sGeometry = PLMakeString("Geometry");
sDock = PLMakeString("Dock");
sShortcutMask = PLMakeString("ShortcutMask");
sApplications = WMCreatePLString("Applications");
sCommand = WMCreatePLString("Command");
sName = WMCreatePLString("Name");
sHost = WMCreatePLString("Host");
sWorkspace = WMCreatePLString("Workspace");
sShaded = WMCreatePLString("Shaded");
sMiniaturized = WMCreatePLString("Miniaturized");
sHidden = WMCreatePLString("Hidden");
sGeometry = WMCreatePLString("Geometry");
sDock = WMCreatePLString("Dock");
sShortcutMask = WMCreatePLString("ShortcutMask");
sYes = PLMakeString("Yes");
sNo = PLMakeString("No");
sYes = WMCreatePLString("Yes");
sNo = WMCreatePLString("No");
}
static int
getBool(proplist_t value)
getBool(WMPropList *value)
{
char *val;
if (!PLIsString(value)) {
if (!WMIsPLString(value)) {
return 0;
}
if (!(val = PLGetString(value))) {
if (!(val = WMGetFromPLString(value))) {
return 0;
}
@@ -188,14 +188,14 @@ getBool(proplist_t value)
static unsigned
getInt(proplist_t value)
getInt(WMPropList *value)
{
char *val;
unsigned n;
if (!PLIsString(value))
if (!WMIsPLString(value))
return 0;
val = PLGetString(value);
val = WMGetFromPLString(value);
if (!val)
return 0;
if (sscanf(val, "%u", &n) != 1)
@@ -206,7 +206,7 @@ getInt(proplist_t value)
static proplist_t
static WMPropList*
makeWindowState(WWindow *wwin, WApplication *wapp)
{
WScreen *scr = wwin->screen_ptr;
@@ -216,9 +216,9 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
int i;
unsigned mask;
char *class, *instance, *command=NULL, buffer[512];
proplist_t win_state, cmd, name, workspace;
proplist_t shaded, miniaturized, hidden, geometry;
proplist_t dock, shortcut;
WMPropList *win_state, *cmd, *name, *workspace;
WMPropList *shaded, *miniaturized, *hidden, *geometry;
WMPropList *dock, *shortcut;
if (wwin->main_window!=None && wwin->main_window!=wwin->client_win)
win = wwin->main_window;
@@ -242,18 +242,18 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
else
snprintf(buffer, sizeof(buffer), ".");
name = PLMakeString(buffer);
cmd = PLMakeString(command);
name = WMCreatePLString(buffer);
cmd = WMCreatePLString(command);
/*sprintf(buffer, "%d", wwin->frame->workspace+1);
workspace = PLMakeString(buffer);*/
workspace = PLMakeString(scr->workspaces[wwin->frame->workspace]->name);
workspace = WMCreatePLString(buffer);*/
workspace = WMCreatePLString(scr->workspaces[wwin->frame->workspace]->name);
shaded = wwin->flags.shaded ? sYes : sNo;
miniaturized = wwin->flags.miniaturized ? sYes : sNo;
hidden = wwin->flags.hidden ? sYes : sNo;
snprintf(buffer, sizeof(buffer), "%ix%i+%i+%i",
wwin->client.width, wwin->client.height,
wwin->frame_x, wwin->frame_y);
geometry = PLMakeString(buffer);
geometry = WMCreatePLString(buffer);
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
if (scr->shortcutWindows[i] != NULL &&
@@ -263,9 +263,9 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
}
snprintf(buffer, sizeof(buffer), "%u", mask);
shortcut = PLMakeString(buffer);
shortcut = WMCreatePLString(buffer);
win_state = PLMakeDictionaryFromEntries(sName, name,
win_state = WMCreatePLDictionary(sName, name,
sCommand, cmd,
sWorkspace, workspace,
sShaded, shaded,
@@ -275,11 +275,11 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
sGeometry, geometry,
NULL);
PLRelease(name);
PLRelease(cmd);
PLRelease(workspace);
PLRelease(geometry);
PLRelease(shortcut);
WMReleasePropList(name);
WMReleasePropList(cmd);
WMReleasePropList(workspace);
WMReleasePropList(geometry);
WMReleasePropList(shortcut);
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
int i;
char *name;
@@ -293,9 +293,9 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
/*n = i+1;*/
name = scr->workspaces[i]->name;
}
dock = PLMakeString(name);
PLInsertDictionaryEntry(win_state, sDock, dock);
PLRelease(dock);
dock = WMCreatePLString(name);
WMPutInPLDictionary(win_state, sDock, dock);
WMReleasePropList(dock);
}
} else {
win_state = NULL;
@@ -313,20 +313,20 @@ void
wSessionSaveState(WScreen *scr)
{
WWindow *wwin = scr->focused_window;
proplist_t win_info, wks;
proplist_t list=NULL;
WMPropList *win_info, *wks;
WMPropList *list=NULL;
WMArray *wapp_list=NULL;
make_keys();
if (!scr->session_state) {
scr->session_state = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
scr->session_state = WMCreatePLDictionary(NULL, NULL, NULL);
if (!scr->session_state)
return;
}
list = PLMakeArrayFromElements(NULL);
list = WMCreatePLArray(NULL);
wapp_list = WMCreateArray(16);
@@ -338,8 +338,8 @@ wSessionSaveState(WScreen *scr)
&& !WFLAGP(wwin, dont_save_session)) {
/* A entry for this application was not yet saved. Save one. */
if ((win_info = makeWindowState(wwin, wapp))!=NULL) {
list = PLAppendArrayElement(list, win_info);
PLRelease(win_info);
WMAddToPLArray(list, win_info);
WMReleasePropList(win_info);
/* If we were succesful in saving the info for this window
* add the application the window belongs to, to the
* application list, so no multiple entries for the same
@@ -350,13 +350,13 @@ wSessionSaveState(WScreen *scr)
}
wwin = wwin->prev;
}
PLRemoveDictionaryEntry(scr->session_state, sApplications);
PLInsertDictionaryEntry(scr->session_state, sApplications, list);
PLRelease(list);
WMRemoveFromPLDictionary(scr->session_state, sApplications);
WMPutInPLDictionary(scr->session_state, sApplications, list);
WMReleasePropList(list);
wks = PLMakeString(scr->workspaces[scr->current_workspace]->name);
PLInsertDictionaryEntry(scr->session_state, sWorkspace, wks);
PLRelease(wks);
wks = WMCreatePLString(scr->workspaces[scr->current_workspace]->name);
WMPutInPLDictionary(scr->session_state, sWorkspace, wks);
WMReleasePropList(wks);
WMFreeArray(wapp_list);
}
@@ -370,8 +370,8 @@ wSessionClearState(WScreen *scr)
if (!scr->session_state)
return;
PLRemoveDictionaryEntry(scr->session_state, sApplications);
PLRemoveDictionaryEntry(scr->session_state, sWorkspace);
WMRemoveFromPLDictionary(scr->session_state, sApplications);
WMRemoveFromPLDictionary(scr->session_state, sWorkspace);
}
@@ -412,19 +412,19 @@ execCommand(WScreen *scr, char *command, char *host)
static WSavedState*
getWindowState(WScreen *scr, proplist_t win_state)
getWindowState(WScreen *scr, WMPropList *win_state)
{
WSavedState *state = wmalloc(sizeof(WSavedState));
proplist_t value;
WMPropList *value;
char *tmp;
unsigned mask;
int i;
memset(state, 0, sizeof(WSavedState));
state->workspace = -1;
value = PLGetDictionaryEntry(win_state, sWorkspace);
if (value && PLIsString(value)) {
tmp = PLGetString(value);
value = WMGetFromPLDictionary(win_state, sWorkspace);
if (value && WMIsPLString(value)) {
tmp = WMGetFromPLString(value);
if (sscanf(tmp, "%i", &state->workspace)!=1) {
state->workspace = -1;
for (i=0; i < scr->workspace_count; i++) {
@@ -437,20 +437,20 @@ getWindowState(WScreen *scr, proplist_t win_state)
state->workspace--;
}
}
if ((value = PLGetDictionaryEntry(win_state, sShaded))!=NULL)
if ((value = WMGetFromPLDictionary(win_state, sShaded))!=NULL)
state->shaded = getBool(value);
if ((value = PLGetDictionaryEntry(win_state, sMiniaturized))!=NULL)
if ((value = WMGetFromPLDictionary(win_state, sMiniaturized))!=NULL)
state->miniaturized = getBool(value);
if ((value = PLGetDictionaryEntry(win_state, sHidden))!=NULL)
if ((value = WMGetFromPLDictionary(win_state, sHidden))!=NULL)
state->hidden = getBool(value);
if ((value = PLGetDictionaryEntry(win_state, sShortcutMask))!=NULL) {
if ((value = WMGetFromPLDictionary(win_state, sShortcutMask))!=NULL) {
mask = getInt(value);
state->window_shortcuts = mask;
}
value = PLGetDictionaryEntry(win_state, sGeometry);
if (value && PLIsString(value)) {
if (!(sscanf(PLGetString(value), "%ix%i+%i+%i",
value = WMGetFromPLDictionary(win_state, sGeometry);
if (value && WMIsPLString(value)) {
if (!(sscanf(WMGetFromPLString(value), "%ix%i+%i+%i",
&state->w, &state->h, &state->x, &state->y)==4 &&
(state->w>0 && state->h>0))) {
state->w = 0;
@@ -469,7 +469,7 @@ wSessionRestoreState(WScreen *scr)
{
WSavedState *state;
char *instance, *class, *command, *host;
proplist_t win_info, apps, cmd, value;
WMPropList *win_info, *apps, *cmd, *value;
pid_t pid;
int i, count;
WDock *dock;
@@ -482,25 +482,25 @@ wSessionRestoreState(WScreen *scr)
if (!scr->session_state)
return;
PLSetStringCmpHook(NULL);
WMPLSetCaseSensitive(True);
apps = PLGetDictionaryEntry(scr->session_state, sApplications);
apps = WMGetFromPLDictionary(scr->session_state, sApplications);
if (!apps)
return;
count = PLGetNumberOfElements(apps);
count = WMGetPropListItemCount(apps);
if (count==0)
return;
for (i=0; i<count; i++) {
win_info = PLGetArrayElement(apps, i);
win_info = WMGetFromPLArray(apps, i);
cmd = PLGetDictionaryEntry(win_info, sCommand);
if (!cmd || !PLIsString(cmd) || !(command = PLGetString(cmd))) {
cmd = WMGetFromPLDictionary(win_info, sCommand);
if (!cmd || !WMIsPLString(cmd) || !(command = WMGetFromPLString(cmd))) {
continue;
}
value = PLGetDictionaryEntry(win_info, sName);
value = WMGetFromPLDictionary(win_info, sName);
if (!value)
continue;
@@ -508,17 +508,17 @@ wSessionRestoreState(WScreen *scr)
if (!instance && !class)
continue;
value = PLGetDictionaryEntry(win_info, sHost);
if (value && PLIsString(value))
host = PLGetString(value);
value = WMGetFromPLDictionary(win_info, sHost);
if (value && WMIsPLString(value))
host = WMGetFromPLString(value);
else
host = NULL;
state = getWindowState(scr, win_info);
dock = NULL;
value = PLGetDictionaryEntry(win_info, sDock);
if (value && PLIsString(value) && (tmp = PLGetString(value))!=NULL) {
value = WMGetFromPLDictionary(win_info, sDock);
if (value && WMIsPLString(value) && (tmp = WMGetFromPLString(value))!=NULL) {
if (sscanf(tmp, "%i", &n)!=1) {
if (!strcasecmp(tmp, "DOCK")) {
dock = scr->dock;
@@ -565,14 +565,14 @@ wSessionRestoreState(WScreen *scr)
if (class) wfree(class);
}
/* clean up */
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
}
void
wSessionRestoreLastWorkspace(WScreen *scr)
{
proplist_t wks;
WMPropList *wks;
int w, i;
char *tmp;
@@ -581,16 +581,16 @@ wSessionRestoreLastWorkspace(WScreen *scr)
if (!scr->session_state)
return;
PLSetStringCmpHook(NULL);
WMPLSetCaseSensitive(True);
wks = PLGetDictionaryEntry(scr->session_state, sWorkspace);
if (!wks || !PLIsString(wks))
wks = WMGetFromPLDictionary(scr->session_state, sWorkspace);
if (!wks || !WMIsPLString(wks))
return;
tmp = PLGetString(wks);
tmp = WMGetFromPLString(wks);
/* clean up */
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
if (sscanf(tmp, "%i", &w)!=1) {
w = -1;
@@ -757,14 +757,14 @@ getWindowRole(Window window)
* window shortcut #
*/
static proplist_t
static WMPropList*
makeAppState(WWindow *wwin)
{
WApplication *wapp;
proplist_t state;
WMPropList *state;
WScreen *scr = wwin->screen_ptr;
state = PLMakeArrayWithElements(NULL, NULL);
state = WMCreatePLArray(NULL, NULL);
wapp = wApplicationOf(wwin->main_window);
@@ -772,7 +772,7 @@ makeAppState(WWindow *wwin)
if (wapp->app_icon && wapp->app_icon->dock) {
if (wapp->app_icon->dock == scr->dock) {
PLAppendArrayElement(state, PLMakeString("Dock"));
WMAddToPLArray(state, WMCreatePLString("Dock"));
} else {
int i;
@@ -782,12 +782,12 @@ makeAppState(WWindow *wwin)
assert(i < scr->workspace_count);
PLAppendArrayElement(state,
PLMakeString(scr->workspaces[i]->name));
WMAddToPLArray(state,
WMCreatePLString(scr->workspaces[i]->name));
}
}
PLAppendArrayElement(state, PLMakeString(wapp->hidden ? "1" : "0"));
WMAddToPLArray(state, WMCreatePLString(wapp->hidden ? "1" : "0"));
}
return state;
@@ -799,16 +799,16 @@ Bool
wSessionGetStateFor(WWindow *wwin, WSessionData *state)
{
char *str;
proplist_t slist;
proplist_t elem;
proplist_t value;
WMPropList *slist;
WMPropList *elem;
WMPropList *value;
int index = 0;
index = 3;
/* geometry */
value = PLGetArrayElement(slist, index++);
str = PLGetString(value);
value = WMGetFromPLArray(slist, index++);
str = WMGetFromPLString(value);
sscanf(str, "%i %i %i %i %i %i", &state->x, &state->y,
&state->width, &state->height,
@@ -816,43 +816,43 @@ wSessionGetStateFor(WWindow *wwin, WSessionData *state)
/* state */
value = PLGetArrayElement(slist, index++);
str = PLGetString(value);
value = WMGetFromPLArray(slist, index++);
str = WMGetFromPLString(value);
sscanf(str, "%i %i %i", &state->miniaturized, &state->shaded,
&state->maximized);
/* attributes */
value = PLGetArrayElement(slist, index++);
str = PLGetString(value);
value = WMGetFromPLArray(slist, index++);
str = WMGetFromPLString(value);
getAttributeState(str, &state->mflags, &state->flags);
/* workspace */
value = PLGetArrayElement(slist, index++);
str = PLGetString(value);
value = WMGetFromPLArray(slist, index++);
str = WMGetFromPLString(value);
sscanf(str, "%i", &state->workspace);
/* app state (repeated for all windows of the app) */
value = PLGetArrayElement(slist, index++);
str = PLGetString(value);
value = WMGetFromPLArray(slist, index++);
str = WMGetFromPLString(value);
/* ???? */
/* shortcuts */
value = PLGetArrayElement(slist, index++);
str = PLGetString(value);
value = WMGetFromPLArray(slist, index++);
str = WMGetFromPLString(value);
sscanf(str, "%i", &state->shortcuts);
}
static proplist_t
static WMPropList*
makeAttributeState(WWindow *wwin)
{
unsigned int data1, data2;
@@ -892,32 +892,32 @@ makeAttributeState(WWindow *wwin)
W_FLAG(dont_save_session),
W_FLAG(emulate_appicon));
return PLMakeString(buffer);
return WMCreatePLString(buffer);
}
static void
appendStringInArray(proplist_t array, char *str)
appendStringInArray(WMPropList *array, char *str)
{
proplist_t val;
WMPropList *val;
val = PLMakeString(str);
PLAppendArrayElement(array, val);
PLRelease(val);
val = WMCreatePLString(str);
WMAddToPLArray(array, val);
WMReleasePropList(val);
}
static proplist_t
static WMPropList*
makeClientState(WWindow *wwin)
{
proplist_t state;
proplist_t tmp;
WMPropList *state;
WMPropList *tmp;
char *str;
char buffer[512];
int i;
unsigned shortcuts;
state = PLMakeArrayWithElements(NULL, NULL);
state = WMCreatePLArray(NULL, NULL);
/* WM_WINDOW_ROLE */
str = getWindowRole(wwin->client_win);
@@ -953,8 +953,8 @@ makeClientState(WWindow *wwin)
/* attributes */
tmp = makeAttributeState(wwin);
PLAppendArrayElement(state, tmp);
PLRelease(tmp);
WMAddToPLArray(state, tmp);
WMReleasePropList(tmp);
/* workspace */
snprintf(buffer, sizeof(buffer), "%i", wwin->frame->workspace);
@@ -962,8 +962,8 @@ makeClientState(WWindow *wwin)
/* app state (repeated for all windows of the app) */
tmp = makeAppState(wwin);
PLAppendArrayElement(state, tmp);
PLRelease(tmp);
WMAddToPLArray(state, tmp);
WMReleasePropList(tmp);
/* shortcuts */
shortcuts = 0;
@@ -993,7 +993,7 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
Bool gsPrefix = False;
char *discardCmd = NULL;
time_t t;
proplist_t state;
WMPropList *state, *plState;
int len;
#ifdef DEBUG1
@@ -1034,7 +1034,7 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
} while (access(F_OK, statefile)!=-1);
/* save the states of all windows we're managing */
state = PLMakeArrayFromElements(NULL, NULL);
state = WMCreatePLArray(NULL, NULL);
/*
* Format:
@@ -1049,42 +1049,34 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
WScreen *scr;
WWindow *wwin;
char buf[32];
proplist_t pscreen;
WMPropList *pscreen;
scr = wScreenWithNumber(i);
snprintf(buf, sizeof(buf), "%i", scr->screen);
pscreen = PLMakeArrayFromElements(PLMakeString(buf), NULL);
pscreen = WMCreatePLArray(WMCreatePLString(buf), NULL);
wwin = scr->focused_window;
while (wwin) {
proplist_t pwindow;
WMPropList *pwindow;
pwindow = makeClientState(wwin);
PLAppendArrayElement(pscreen, pwindow);
WMAddToPLArray(pscreen, pwindow);
wwin = wwin->prev;
}
PLAppendArrayElement(state, pscreen);
WMAddToPLArray(state, pscreen);
}
{
proplist_t statefile;
plState = WMCreatePLDictionary(WMCreatePLString("Version"),
WMCreatePLString("1.0"),
WMCreatePLString("Screens"),
state, NULL);
statefile = PLMakeDictionaryFromEntries(PLMakeString("Version"),
PLMakeString("1.0"),
WMWritePropListToFile(plState, statefile, False);
PLMakeString("Screens"),
state,
NULL);
PLSetFilename(statefile, PLMakeString(statefile));
PLSave(statefile, NO);
PLRelease(statefile);
}
WMReleasePropList(plState);
/* set the remaining properties that we didn't set at
* startup time */

View File

@@ -80,7 +80,6 @@
#include "framewin.h"
extern proplist_t ReadProplistFromFile(char *file);
/*** var ***/
extern WPreferences wPreferences;
@@ -134,7 +133,7 @@ removeUserMenudata(void *menudata)
static WUserMenuData*
convertShortcuts(WScreen *scr, proplist_t shortcut)
convertShortcuts(WScreen *scr, WMPropList *shortcut)
{
WUserMenuData *data;
KeySym ksym;
@@ -143,11 +142,11 @@ convertShortcuts(WScreen *scr, proplist_t shortcut)
char buf[128], *b;
int keycount,i,j,mod;
if (PLIsString(shortcut)) {
if (WMIsPLString(shortcut)) {
keycount = 1;
}
else if (PLIsArray(shortcut)) {
keycount = PLGetNumberOfElements(shortcut);
else if (WMIsPLArray(shortcut)) {
keycount = WMGetPropListItemCount(shortcut);
}
else return NULL;
/*for (i=0;i<keycount;i++){*/
@@ -163,10 +162,10 @@ convertShortcuts(WScreen *scr, proplist_t shortcut)
for (i=0,j=0;i<keycount;i++) {
data->key[j].modifier = 0;
if (PLIsArray(shortcut)) {
strcpy(buf, PLGetString(PLGetArrayElement(shortcut, i)));
if (WMIsPLArray(shortcut)) {
strcpy(buf, WMGetFromPLString(WMGetFromPLArray(shortcut, i)));
} else {
strcpy(buf, PLGetString(shortcut));
strcpy(buf, WMGetFromPLString(shortcut));
}
b = (char*)buf;
@@ -207,34 +206,34 @@ keyover:
}
static WMenu*
configureUserMenu(WScreen *scr, proplist_t plum)
configureUserMenu(WScreen *scr, WMPropList *plum)
{
char *mtitle;
WMenu *menu=NULL;
proplist_t elem, title, command, params;
WMPropList *elem, *title, *command, *params;
int count,i;
WUserMenuData *data;
if (!plum) return NULL;
if (!PLIsArray(plum)) {
if (!WMIsPLArray(plum)) {
return NULL;
}
count = PLGetNumberOfElements(plum);
count = WMGetPropListItemCount(plum);
if (!count) return NULL;
elem = PLGetArrayElement(plum, 0);
if (!PLIsString(elem)) {
elem = WMGetFromPLArray(plum, 0);
if (!WMIsPLString(elem)) {
return NULL;
}
mtitle = PLGetString(elem);
mtitle = WMGetFromPLString(elem);
menu=wMenuCreateForApp(scr, mtitle, True);
for(i=1; i<count; i++) {
elem = PLGetArrayElement(plum,i);
if(PLIsArray(PLGetArrayElement(elem,1))) {
elem = WMGetFromPLArray(plum,i);
if(WMIsPLArray(WMGetFromPLArray(elem,1))) {
WMenu *submenu;
WMenuEntry *mentry;
@@ -246,36 +245,36 @@ configureUserMenu(WScreen *scr, proplist_t plum)
}
else {
int idx = 0;
proplist_t instances=0;
WMPropList *instances=0;
title = PLGetArrayElement(elem,idx++);
command = PLGetArrayElement(elem,idx++);
if (PLGetNumberOfElements(elem) >= 3)
params = PLGetArrayElement(elem,idx++);
title = WMGetFromPLArray(elem,idx++);
command = WMGetFromPLArray(elem,idx++);
if (WMGetPropListItemCount(elem) >= 3)
params = WMGetFromPLArray(elem,idx++);
if (!title || !command)
return menu;
if (!strcmp("SHORTCUT",PLGetString(command))) {
if (!strcmp("SHORTCUT",WMGetFromPLString(command))) {
WMenuEntry *entry;
data = convertShortcuts(scr, params);
if (data){
entry = wMenuAddCallback(menu, PLGetString(title),
entry = wMenuAddCallback(menu, WMGetFromPLString(title),
notifyClient, data);
if (entry) {
if (PLIsString(params)) {
entry->rtext = GetShortcutString(PLGetString(params));
if (WMIsPLString(params)) {
entry->rtext = GetShortcutString(WMGetFromPLString(params));
}
entry->free_cdata = removeUserMenudata;
if (PLGetNumberOfElements(elem) >= 4) {
instances = PLGetArrayElement(elem,idx++);
if(PLIsArray(instances))
if (instances && PLGetNumberOfElements(instances)
&& PLIsArray(instances)){
entry->instances = PLRetain(instances);
if (WMGetPropListItemCount(elem) >= 4) {
instances = WMGetFromPLArray(elem,idx++);
if(WMIsPLArray(instances))
if (instances && WMGetPropListItemCount(instances)
&& WMIsPLArray(instances)){
entry->instances = WMRetainPropList(instances);
}
}
}
@@ -300,15 +299,15 @@ wUserMenuRefreshInstances(WMenu *menu, WWindow *wwin)
for (i=0; i<menu->entry_no; i++) {
if (menu->entries[i]->instances){
proplist_t ins;
WMPropList *ins;
int oldflag;
count = PLGetNumberOfElements(menu->entries[i]->instances);
count = WMGetPropListItemCount(menu->entries[i]->instances);
oldflag = menu->entries[i]->flags.enabled;
menu->entries[i]->flags.enabled = 0;
for (j=0; j<count;j++) {
ins = PLGetArrayElement(menu->entries[i]->instances,j);
if (!strcmp(wwin->wm_instance,PLGetString(ins))) {
ins = WMGetFromPLArray(menu->entries[i]->instances,j);
if (!strcmp(wwin->wm_instance,WMGetFromPLString(ins))) {
menu->entries[i]->flags.enabled = 1;
break;
}
@@ -334,16 +333,16 @@ readUserMenuFile(WScreen *scr, char *file_name)
{
WMenu *menu;
char *mtitle;
proplist_t plum, elem, title, command, params;
WMPropList *plum, *elem, *title, *command, *params;
int count,i;
menu=NULL;
plum = ReadProplistFromFile(file_name);
plum = WMReadPropListFromFile(file_name);
/**/
if(plum){
menu = configureUserMenu(scr, plum);
PLRelease(plum);
WMReleasePropList(plum);
}
return menu;
}

View File

@@ -48,7 +48,7 @@
extern WPreferences wPreferences;
extern proplist_t wAttributeDomainName;
extern WMPropList *wAttributeDomainName;
extern WDDomain *WDWindowAttributes;
@@ -57,83 +57,83 @@ extern WDDomain *WDWindowAttributes;
/* type converters */
static int getBool(proplist_t, proplist_t);
static int getBool(WMPropList*, WMPropList*);
static char* getString(proplist_t, proplist_t);
static char* getString(WMPropList*, WMPropList*);
static proplist_t ANoTitlebar = NULL;
static proplist_t ANoResizebar;
static proplist_t ANoMiniaturizeButton;
static proplist_t ANoCloseButton;
static proplist_t ANoBorder;
static proplist_t ANoHideOthers;
static proplist_t ANoMouseBindings;
static proplist_t ANoKeyBindings;
static proplist_t ANoAppIcon; /* app */
static proplist_t AKeepOnTop;
static proplist_t AKeepOnBottom;
static proplist_t AOmnipresent;
static proplist_t ASkipWindowList;
static proplist_t AKeepInsideScreen;
static proplist_t AUnfocusable;
static proplist_t AAlwaysUserIcon;
static proplist_t AStartMiniaturized;
static proplist_t AStartMaximized;
static proplist_t AStartHidden; /* app */
static proplist_t ADontSaveSession; /* app */
static proplist_t AEmulateAppIcon;
static proplist_t AFullMaximize;
static proplist_t ACollapseAppIcons; /* app */
static WMPropList *ANoTitlebar = NULL;
static WMPropList *ANoResizebar;
static WMPropList *ANoMiniaturizeButton;
static WMPropList *ANoCloseButton;
static WMPropList *ANoBorder;
static WMPropList *ANoHideOthers;
static WMPropList *ANoMouseBindings;
static WMPropList *ANoKeyBindings;
static WMPropList *ANoAppIcon; /* app */
static WMPropList *AKeepOnTop;
static WMPropList *AKeepOnBottom;
static WMPropList *AOmnipresent;
static WMPropList *ASkipWindowList;
static WMPropList *AKeepInsideScreen;
static WMPropList *AUnfocusable;
static WMPropList *AAlwaysUserIcon;
static WMPropList *AStartMiniaturized;
static WMPropList *AStartMaximized;
static WMPropList *AStartHidden; /* app */
static WMPropList *ADontSaveSession; /* app */
static WMPropList *AEmulateAppIcon;
static WMPropList *AFullMaximize;
static WMPropList *ACollapseAppIcons; /* app */
#ifdef XKB_BUTTON_HINT
static proplist_t ANoLanguageButton;
static WMPropList *ANoLanguageButton;
#endif
static proplist_t AStartWorkspace;
static WMPropList *AStartWorkspace;
static proplist_t AIcon;
static WMPropList *AIcon;
static proplist_t AnyWindow;
static proplist_t No;
static WMPropList *AnyWindow;
static WMPropList *No;
static void
init_wdefaults(WScreen *scr)
{
AIcon = PLMakeString("Icon");
AIcon = WMCreatePLString("Icon");
ANoTitlebar = PLMakeString("NoTitlebar");
ANoResizebar = PLMakeString("NoResizebar");
ANoMiniaturizeButton = PLMakeString("NoMiniaturizeButton");
ANoCloseButton = PLMakeString("NoCloseButton");
ANoBorder = PLMakeString("NoBorder");
ANoHideOthers = PLMakeString("NoHideOthers");
ANoMouseBindings = PLMakeString("NoMouseBindings");
ANoKeyBindings = PLMakeString("NoKeyBindings");
ANoAppIcon = PLMakeString("NoAppIcon");
AKeepOnTop = PLMakeString("KeepOnTop");
AKeepOnBottom = PLMakeString("KeepOnBottom");
AOmnipresent = PLMakeString("Omnipresent");
ASkipWindowList = PLMakeString("SkipWindowList");
AKeepInsideScreen = PLMakeString("KeepInsideScreen");
AUnfocusable = PLMakeString("Unfocusable");
AAlwaysUserIcon = PLMakeString("AlwaysUserIcon");
AStartMiniaturized = PLMakeString("StartMiniaturized");
AStartHidden = PLMakeString("StartHidden");
AStartMaximized = PLMakeString("StartMaximized");
ADontSaveSession = PLMakeString("DontSaveSession");
AEmulateAppIcon = PLMakeString("EmulateAppIcon");
AFullMaximize = PLMakeString("FullMaximize");
ACollapseAppIcons = PLMakeString("CollapseAppIcons");
ANoTitlebar = WMCreatePLString("NoTitlebar");
ANoResizebar = WMCreatePLString("NoResizebar");
ANoMiniaturizeButton = WMCreatePLString("NoMiniaturizeButton");
ANoCloseButton = WMCreatePLString("NoCloseButton");
ANoBorder = WMCreatePLString("NoBorder");
ANoHideOthers = WMCreatePLString("NoHideOthers");
ANoMouseBindings = WMCreatePLString("NoMouseBindings");
ANoKeyBindings = WMCreatePLString("NoKeyBindings");
ANoAppIcon = WMCreatePLString("NoAppIcon");
AKeepOnTop = WMCreatePLString("KeepOnTop");
AKeepOnBottom = WMCreatePLString("KeepOnBottom");
AOmnipresent = WMCreatePLString("Omnipresent");
ASkipWindowList = WMCreatePLString("SkipWindowList");
AKeepInsideScreen = WMCreatePLString("KeepInsideScreen");
AUnfocusable = WMCreatePLString("Unfocusable");
AAlwaysUserIcon = WMCreatePLString("AlwaysUserIcon");
AStartMiniaturized = WMCreatePLString("StartMiniaturized");
AStartHidden = WMCreatePLString("StartHidden");
AStartMaximized = WMCreatePLString("StartMaximized");
ADontSaveSession = WMCreatePLString("DontSaveSession");
AEmulateAppIcon = WMCreatePLString("EmulateAppIcon");
AFullMaximize = WMCreatePLString("FullMaximize");
ACollapseAppIcons = WMCreatePLString("CollapseAppIcons");
#ifdef XKB_BUTTON_HINT
ANoLanguageButton = PLMakeString("NoLanguageButton");
ANoLanguageButton = WMCreatePLString("NoLanguageButton");
#endif
AStartWorkspace = PLMakeString("StartWorkspace");
AStartWorkspace = WMCreatePLString("StartWorkspace");
AnyWindow = PLMakeString("*");
No = PLMakeString("No");
AnyWindow = WMCreatePLString("*");
No = WMCreatePLString("No");
/*
if (!scr->wattribs) {
scr->wattribs = PLGetDomain(wAttributeDomainName);
@@ -142,28 +142,28 @@ init_wdefaults(WScreen *scr)
static proplist_t
get_value(proplist_t dict_win, proplist_t dict_class, proplist_t dict_name,
proplist_t dict_any, proplist_t option, proplist_t default_value,
static WMPropList*
get_value(WMPropList *dict_win, WMPropList *dict_class, WMPropList *dict_name,
WMPropList *dict_any, WMPropList *option, WMPropList *default_value,
Bool useGlobalDefault)
{
proplist_t value;
WMPropList *value;
if (dict_win) {
value = PLGetDictionaryEntry(dict_win, option);
value = WMGetFromPLDictionary(dict_win, option);
if (value)
return value;
}
if (dict_name) {
value = PLGetDictionaryEntry(dict_name, option);
value = WMGetFromPLDictionary(dict_name, option);
if (value)
return value;
}
if (dict_class) {
value = PLGetDictionaryEntry(dict_class, option);
value = WMGetFromPLDictionary(dict_class, option);
if (value)
return value;
}
@@ -172,7 +172,7 @@ get_value(proplist_t dict_win, proplist_t dict_class, proplist_t dict_name,
return NULL;
if (dict_any) {
value = PLGetDictionaryEntry(dict_any, option);
value = WMGetFromPLDictionary(dict_any, option);
if (value)
return value;
}
@@ -198,26 +198,24 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
WWindowAttributes *mask,
Bool useGlobalDefault)
{
proplist_t value;
proplist_t key1, key2, key3;
proplist_t dw, dc, dn, da;
WMPropList *value, *key1, *key2, *key3, *dw, *dc, *dn, *da;
if (class && instance) {
char *buffer = NULL;
buffer = wmalloc(strlen(class)+strlen(instance)+4);
key1 = PLMakeString(strcat(strcat(strcpy(buffer,instance),"."),class));
key1 = WMCreatePLString(strcat(strcat(strcpy(buffer,instance),"."),class));
wfree(buffer);
} else
key1 = NULL;
if (instance)
key2 = PLMakeString(instance);
key2 = WMCreatePLString(instance);
else
key2 = NULL;
if (class)
key3 = PLMakeString(class);
key3 = WMCreatePLString(class);
else
key3 = NULL;
@@ -225,14 +223,14 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
init_wdefaults(scr);
}
PLSetStringCmpHook(NULL);
WMPLSetCaseSensitive(True);
if (WDWindowAttributes->dictionary) {
dw = key1 ? PLGetDictionaryEntry(WDWindowAttributes->dictionary, key1) : NULL;
dn = key2 ? PLGetDictionaryEntry(WDWindowAttributes->dictionary, key2) : NULL;
dc = key3 ? PLGetDictionaryEntry(WDWindowAttributes->dictionary, key3) : NULL;
dw = key1 ? WMGetFromPLDictionary(WDWindowAttributes->dictionary, key1) : NULL;
dn = key2 ? WMGetFromPLDictionary(WDWindowAttributes->dictionary, key2) : NULL;
dc = key3 ? WMGetFromPLDictionary(WDWindowAttributes->dictionary, key3) : NULL;
if (useGlobalDefault)
da = PLGetDictionaryEntry(WDWindowAttributes->dictionary, AnyWindow);
da = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow);
else
da = NULL;
} else {
@@ -242,11 +240,11 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
da = NULL;
}
if (key1)
PLRelease(key1);
WMReleasePropList(key1);
if (key2)
PLRelease(key2);
WMReleasePropList(key2);
if (key3)
PLRelease(key3);
WMReleasePropList(key3);
#define APPLY_VAL(value, flag, attrib) \
if (value) {attr->flag = getBool(attrib, value); \
@@ -328,65 +326,65 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
#endif
/* clean up */
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
}
proplist_t
get_generic_value(WScreen *scr, char *instance, char *class, proplist_t option,
WMPropList*
get_generic_value(WScreen *scr, char *instance, char *class, WMPropList *option,
Bool noDefault)
{
proplist_t value, key, dict;
WMPropList *value, *key, *dict;
value = NULL;
PLSetStringCmpHook(NULL);
WMPLSetCaseSensitive(True);
if (class && instance) {
char *buffer = NULL;
buffer = wmalloc(strlen(class)+strlen(instance)+4);
key = PLMakeString(strcat(strcat(strcpy(buffer,instance),"."),class));
key = WMCreatePLString(strcat(strcat(strcpy(buffer,instance),"."),class));
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
PLRelease(key);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
WMReleasePropList(key);
wfree(buffer);
if (dict) {
value = PLGetDictionaryEntry(dict, option);
value = WMGetFromPLDictionary(dict, option);
}
}
if (!value && instance) {
key = PLMakeString(instance);
key = WMCreatePLString(instance);
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
PLRelease(key);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
WMReleasePropList(key);
if (dict) {
value = PLGetDictionaryEntry(dict, option);
value = WMGetFromPLDictionary(dict, option);
}
}
if (!value && class) {
key = PLMakeString(class);
key = WMCreatePLString(class);
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
PLRelease(key);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
WMReleasePropList(key);
if (dict) {
value = PLGetDictionaryEntry(dict, option);
value = WMGetFromPLDictionary(dict, option);
}
}
if (!value && !noDefault) {
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, AnyWindow);
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow);
if (dict) {
value = PLGetDictionaryEntry(dict, option);
value = WMGetFromPLDictionary(dict, option);
}
}
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
return value;
}
@@ -396,7 +394,7 @@ char*
wDefaultGetIconFile(WScreen *scr, char *instance, char *class,
Bool noDefault)
{
proplist_t value;
WMPropList *value;
char *tmp;
if (!ANoTitlebar) {
@@ -450,7 +448,7 @@ wDefaultGetImage(WScreen *scr, char *winstance, char *wclass)
int
wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class)
{
proplist_t value;
WMPropList *value;
int w, i;
char *tmp;
@@ -492,69 +490,66 @@ void
wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
{
WDDomain *db = WDWindowAttributes;
proplist_t icon_value=NULL, value, attr, key, def_win, def_icon=NULL;
proplist_t dict = db->dictionary;
WMPropList *icon_value=NULL, *value, *attr, *key, *def_win, *def_icon=NULL;
WMPropList *dict = db->dictionary;
int same = 0;
if (!dict) {
dict = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
dict = WMCreatePLDictionary(NULL, NULL, NULL);
if (dict) {
db->dictionary = dict;
value = PLMakeString(db->path);
PLSetFilename(dict, value);
PLRelease(value);
}
else
} else {
return;
}
}
PLSetStringCmpHook(NULL);
WMPLSetCaseSensitive(True);
if (instance && class) {
char *buffer;
buffer = wmalloc(strlen(instance) + strlen(class) + 2);
strcat(strcat(strcpy(buffer, instance), "."), class);
key = PLMakeString(buffer);
key = WMCreatePLString(buffer);
wfree(buffer);
} else if (instance) {
key = PLMakeString(instance);
key = WMCreatePLString(instance);
} else if (class) {
key = PLMakeString(class);
key = WMCreatePLString(class);
} else {
key = PLRetain(AnyWindow);
key = WMRetainPropList(AnyWindow);
}
if (file) {
value = PLMakeString(file);
icon_value = PLMakeDictionaryFromEntries(AIcon, value, NULL);
PLRelease(value);
value = WMCreatePLString(file);
icon_value = WMCreatePLDictionary(AIcon, value, NULL);
WMReleasePropList(value);
if ((def_win = PLGetDictionaryEntry(dict, AnyWindow)) != NULL) {
def_icon = PLGetDictionaryEntry(def_win, AIcon);
if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL) {
def_icon = WMGetFromPLDictionary(def_win, AIcon);
}
if (def_icon && !strcmp(PLGetString(def_icon), file))
if (def_icon && !strcmp(WMGetFromPLString(def_icon), file))
same = 1;
}
if ((attr = PLGetDictionaryEntry(dict, key)) != NULL) {
if (PLIsDictionary(attr)) {
if ((attr = WMGetFromPLDictionary(dict, key)) != NULL) {
if (WMIsPLDictionary(attr)) {
if (icon_value!=NULL && !same)
PLMergeDictionaries(attr, icon_value);
WMMergePLDictionaries(attr, icon_value);
else
PLRemoveDictionaryEntry(attr, AIcon);
WMRemoveFromPLDictionary(attr, AIcon);
}
} else if (icon_value!=NULL && !same) {
PLInsertDictionaryEntry(dict, key, icon_value);
WMPutInPLDictionary(dict, key, icon_value);
}
if (!wPreferences.flags.noupdates)
PLSave(dict, YES);
WMWritePropListToFile(dict, db->path, True);
PLRelease(key);
WMReleasePropList(key);
if(icon_value)
PLRelease(icon_value);
WMReleasePropList(icon_value);
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
}
@@ -562,16 +557,16 @@ wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
/* --------------------------- Local ----------------------- */
static int
getBool(proplist_t key, proplist_t value)
getBool(WMPropList *key, WMPropList *value)
{
char *val;
if (!PLIsString(value)) {
if (!WMIsPLString(value)) {
wwarning(_("Wrong option format for key \"%s\". Should be %s."),
PLGetString(key), "Boolean");
WMGetFromPLString(key), "Boolean");
return 0;
}
val = PLGetString(value);
val = WMGetFromPLString(value);
if ((val[1]=='\0' && (val[0]=='y' || val[0]=='Y' || val[0]=='T'
|| val[0]=='t' || val[0]=='1'))
@@ -600,13 +595,13 @@ getBool(proplist_t key, proplist_t value)
* WARNING: Do not free value returned by this!!
*/
static char*
getString(proplist_t key, proplist_t value)
getString(WMPropList *key, WMPropList *value)
{
if (!PLIsString(value)) {
if (!WMIsPLString(value)) {
wwarning(_("Wrong option format for key \"%s\". Should be %s."),
PLGetString(key), "String");
WMGetFromPLString(key), "String");
return NULL;
}
return PLGetString(value);
return WMGetFromPLString(value);
}

View File

@@ -48,7 +48,7 @@
#include "client.h"
#include <proplist.h>
#include <WINGs/WUtil.h>
@@ -133,43 +133,43 @@ static InspectorPanel *panelList=NULL;
extern WPreferences wPreferences;
static proplist_t ANoTitlebar = NULL;
static proplist_t ANoResizebar;
static proplist_t ANoMiniaturizeButton;
static proplist_t ANoCloseButton;
static proplist_t ANoBorder;
static proplist_t ANoHideOthers;
static proplist_t ANoMouseBindings;
static proplist_t ANoKeyBindings;
static proplist_t ANoAppIcon;
static proplist_t AKeepOnTop;
static proplist_t AKeepOnBottom;
static proplist_t AOmnipresent;
static proplist_t ASkipWindowList;
static proplist_t AKeepInsideScreen;
static proplist_t AUnfocusable;
static proplist_t AAlwaysUserIcon;
static proplist_t AStartMiniaturized;
static proplist_t AStartMaximized;
static proplist_t ADontSaveSession;
static proplist_t AEmulateAppIcon;
static proplist_t AFullMaximize;
static proplist_t ACollapseAppIcons;
static WMPropList *ANoTitlebar = NULL;
static WMPropList *ANoResizebar;
static WMPropList *ANoMiniaturizeButton;
static WMPropList *ANoCloseButton;
static WMPropList *ANoBorder;
static WMPropList *ANoHideOthers;
static WMPropList *ANoMouseBindings;
static WMPropList *ANoKeyBindings;
static WMPropList *ANoAppIcon;
static WMPropList *AKeepOnTop;
static WMPropList *AKeepOnBottom;
static WMPropList *AOmnipresent;
static WMPropList *ASkipWindowList;
static WMPropList *AKeepInsideScreen;
static WMPropList *AUnfocusable;
static WMPropList *AAlwaysUserIcon;
static WMPropList *AStartMiniaturized;
static WMPropList *AStartMaximized;
static WMPropList *ADontSaveSession;
static WMPropList *AEmulateAppIcon;
static WMPropList *AFullMaximize;
static WMPropList *ACollapseAppIcons;
#ifdef XKB_BUTTON_HINT
static proplist_t ANoLanguageButton;
static WMPropList *ANoLanguageButton;
#endif
static proplist_t AStartWorkspace;
static WMPropList *AStartWorkspace;
static proplist_t AIcon;
static WMPropList *AIcon;
/* application wide options */
static proplist_t AStartHidden;
static WMPropList *AStartHidden;
static proplist_t AnyWindow;
static proplist_t EmptyString;
static proplist_t Yes, No;
static WMPropList *AnyWindow;
static WMPropList *EmptyString;
static WMPropList *Yes, *No;
#define PWIDTH 270
@@ -199,40 +199,40 @@ make_keys()
if (ANoTitlebar!=NULL)
return;
AIcon = PLMakeString("Icon");
ANoTitlebar = PLMakeString("NoTitlebar");
ANoResizebar = PLMakeString("NoResizebar");
ANoMiniaturizeButton = PLMakeString("NoMiniaturizeButton");
ANoCloseButton = PLMakeString("NoCloseButton");
ANoBorder = PLMakeString("NoBorder");
ANoHideOthers = PLMakeString("NoHideOthers");
ANoMouseBindings = PLMakeString("NoMouseBindings");
ANoKeyBindings = PLMakeString("NoKeyBindings");
ANoAppIcon = PLMakeString("NoAppIcon");
AKeepOnTop = PLMakeString("KeepOnTop");
AKeepOnBottom = PLMakeString("KeepOnBottom");
AOmnipresent = PLMakeString("Omnipresent");
ASkipWindowList = PLMakeString("SkipWindowList");
AKeepInsideScreen = PLMakeString("KeepInsideScreen");
AUnfocusable = PLMakeString("Unfocusable");
AAlwaysUserIcon = PLMakeString("AlwaysUserIcon");
AStartMiniaturized = PLMakeString("StartMiniaturized");
AStartMaximized = PLMakeString("StartMaximized");
AStartHidden = PLMakeString("StartHidden");
ADontSaveSession = PLMakeString("DontSaveSession");
AEmulateAppIcon = PLMakeString("EmulateAppIcon");
AFullMaximize = PLMakeString("FullMaximize");
ACollapseAppIcons = PLMakeString("CollapseAppIcons");
AIcon = WMCreatePLString("Icon");
ANoTitlebar = WMCreatePLString("NoTitlebar");
ANoResizebar = WMCreatePLString("NoResizebar");
ANoMiniaturizeButton = WMCreatePLString("NoMiniaturizeButton");
ANoCloseButton = WMCreatePLString("NoCloseButton");
ANoBorder = WMCreatePLString("NoBorder");
ANoHideOthers = WMCreatePLString("NoHideOthers");
ANoMouseBindings = WMCreatePLString("NoMouseBindings");
ANoKeyBindings = WMCreatePLString("NoKeyBindings");
ANoAppIcon = WMCreatePLString("NoAppIcon");
AKeepOnTop = WMCreatePLString("KeepOnTop");
AKeepOnBottom = WMCreatePLString("KeepOnBottom");
AOmnipresent = WMCreatePLString("Omnipresent");
ASkipWindowList = WMCreatePLString("SkipWindowList");
AKeepInsideScreen = WMCreatePLString("KeepInsideScreen");
AUnfocusable = WMCreatePLString("Unfocusable");
AAlwaysUserIcon = WMCreatePLString("AlwaysUserIcon");
AStartMiniaturized = WMCreatePLString("StartMiniaturized");
AStartMaximized = WMCreatePLString("StartMaximized");
AStartHidden = WMCreatePLString("StartHidden");
ADontSaveSession = WMCreatePLString("DontSaveSession");
AEmulateAppIcon = WMCreatePLString("EmulateAppIcon");
AFullMaximize = WMCreatePLString("FullMaximize");
ACollapseAppIcons = WMCreatePLString("CollapseAppIcons");
#ifdef XKB_BUTTON_HINT
ANoLanguageButton = PLMakeString("NoLanguageButton");
ANoLanguageButton = WMCreatePLString("NoLanguageButton");
#endif
AStartWorkspace = PLMakeString("StartWorkspace");
AStartWorkspace = WMCreatePLString("StartWorkspace");
AnyWindow = PLMakeString("*");
EmptyString = PLMakeString("");
Yes = PLMakeString("Yes");
No = PLMakeString("No");
AnyWindow = WMCreatePLString("*");
EmptyString = WMCreatePLString("");
Yes = WMCreatePLString("Yes");
No = WMCreatePLString("No");
}
@@ -428,14 +428,14 @@ updateIcon(WMButton *button, InspectorPanel *panel)
#endif
static int
getBool(proplist_t value)
getBool(WMPropList *value)
{
char *val;
if (!PLIsString(value)) {
if (!WMIsPLString(value)) {
return 0;
}
if (!(val = PLGetString(value))) {
if (!(val = WMGetFromPLString(value))) {
return 0;
}
@@ -472,16 +472,16 @@ getBool(proplist_t value)
static int
insertAttribute(proplist_t dict, proplist_t window, proplist_t attr,
proplist_t value, int flags)
insertAttribute(WMPropList *dict, WMPropList *window, WMPropList *attr,
WMPropList *value, int flags)
{
proplist_t def_win, def_value=NULL;
WMPropList *def_win, *def_value=NULL;
int update = 0;
int modified = 0;
if (!(flags & UPDATE_DEFAULTS) && dict) {
if ((def_win = PLGetDictionaryEntry(dict, AnyWindow)) != NULL) {
def_value = PLGetDictionaryEntry(def_win, attr);
if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL) {
def_value = WMGetFromPLDictionary(def_win, attr);
}
}
@@ -494,11 +494,11 @@ insertAttribute(proplist_t dict, proplist_t window, proplist_t attr,
if ((flags & IS_BOOLEAN))
update = (getBool(value) != getBool(def_value));
else {
update = !PLIsEqual(value, def_value);
update = !WMIsPropListEqualTo(value, def_value);
}
if (update) {
PLInsertDictionaryEntry(window, attr, value);
WMPutInPLDictionary(window, attr, value);
modified = 1;
}
@@ -511,8 +511,8 @@ saveSettings(WMButton *button, InspectorPanel *panel)
{
WWindow *wwin = panel->inspected;
WDDomain *db = WDWindowAttributes;
proplist_t dict = db->dictionary;
proplist_t winDic, value, key;
WMPropList *dict = db->dictionary;
WMPropList *winDic, *value, *key;
char *icon_file;
int flags = 0;
int different = 0;
@@ -521,18 +521,18 @@ saveSettings(WMButton *button, InspectorPanel *panel)
applySettings(panel->applyBtn, panel);
if (WMGetButtonSelected(panel->instRb) != 0)
key = PLMakeString(wwin->wm_instance);
key = WMCreatePLString(wwin->wm_instance);
else if (WMGetButtonSelected(panel->clsRb) != 0)
key = PLMakeString(wwin->wm_class);
key = WMCreatePLString(wwin->wm_class);
else if (WMGetButtonSelected(panel->bothRb) != 0) {
char *buffer;
buffer = wmalloc(strlen(wwin->wm_instance)+strlen(wwin->wm_class)+4);
strcat(strcat(strcpy(buffer, wwin->wm_instance), "."), wwin->wm_class);
key = PLMakeString(buffer);
key = WMCreatePLString(buffer);
wfree(buffer);
} else if (WMGetButtonSelected(panel->defaultRb) != 0) {
key = PLRetain(AnyWindow);
key = WMRetainPropList(AnyWindow);
flags = UPDATE_DEFAULTS;
} else
key = NULL;
@@ -541,15 +541,11 @@ saveSettings(WMButton *button, InspectorPanel *panel)
return;
if (!dict) {
dict = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
dict = WMCreatePLDictionary(NULL, NULL, NULL);
if (dict) {
db->dictionary = dict;
value = PLMakeString(db->path);
PLSetFilename(dict, value);
PLRelease(value);
}
else {
PLRelease(key);
} else {
WMReleasePropList(key);
return;
}
}
@@ -558,17 +554,17 @@ saveSettings(WMButton *button, InspectorPanel *panel)
USE_TEXT_FIELD) < 0)
return;
PLSetStringCmpHook(NULL);
WMPLSetCaseSensitive(True);
winDic = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
winDic = WMCreatePLDictionary(NULL, NULL, NULL);
/* Update icon for window */
icon_file = WMGetTextFieldText(panel->fileText);
if (icon_file) {
if (icon_file[0] != 0) {
value = PLMakeString(icon_file);
value = WMCreatePLString(icon_file);
different |= insertAttribute(dict, winDic, AIcon, value, flags);
PLRelease(value);
WMReleasePropList(value);
}
wfree(icon_file);
}
@@ -579,10 +575,10 @@ saveSettings(WMButton *button, InspectorPanel *panel)
i--;
if (i>=0 && i < panel->frame->screen_ptr->workspace_count) {
value = PLMakeString(panel->frame->screen_ptr->workspaces[i]->name);
value = WMCreatePLString(panel->frame->screen_ptr->workspaces[i]->name);
different |= insertAttribute(dict, winDic, AStartWorkspace, value,
flags);
PLRelease(value);
WMReleasePropList(value);
}
}
@@ -668,13 +664,13 @@ saveSettings(WMButton *button, InspectorPanel *panel)
different |= insertAttribute(dict, winDic, ACollapseAppIcons, value, flags);
}
PLRemoveDictionaryEntry(dict, key);
WMRemoveFromPLDictionary(dict, key);
if (different) {
PLInsertDictionaryEntry(dict, key, winDic);
WMPutInPLDictionary(dict, key, winDic);
}
PLRelease(key);
PLRelease(winDic);
WMReleasePropList(key);
WMReleasePropList(winDic);
different = 0;
@@ -682,14 +678,14 @@ saveSettings(WMButton *button, InspectorPanel *panel)
if (panel->inspected->main_window != panel->inspected->client_win
&& !(flags & UPDATE_DEFAULTS)) {
WApplication *wapp;
proplist_t appDic;
WMPropList *appDic;
wapp = wApplicationOf(panel->inspected->main_window);
if (wapp) {
char *iconFile;
char *buffer;
appDic = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
appDic = WMCreatePLDictionary(NULL, NULL, NULL);
assert(wapp->main_window_desc->wm_instance!=NULL);
assert(wapp->main_window_desc->wm_class!=NULL);
@@ -698,7 +694,7 @@ saveSettings(WMButton *button, InspectorPanel *panel)
+strlen(wapp->main_window_desc->wm_class)+4);
strcat(strcpy(buffer, wapp->main_window_desc->wm_instance), ".");
strcat(buffer, wapp->main_window_desc->wm_class);
key = PLMakeString(buffer);
key = WMCreatePLString(buffer);
wfree(buffer);
iconFile = wDefaultGetIconFile(wwin->screen_ptr,
@@ -707,10 +703,10 @@ saveSettings(WMButton *button, InspectorPanel *panel)
False);
if (iconFile && iconFile[0]!=0) {
value = PLMakeString(iconFile);
value = WMCreatePLString(iconFile);
different |= insertAttribute(dict, appDic, AIcon, value,
flags&~IS_BOOLEAN);
PLRelease(value);
WMReleasePropList(value);
}
value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No;
@@ -725,19 +721,19 @@ saveSettings(WMButton *button, InspectorPanel *panel)
different |= insertAttribute(dict, appDic, ACollapseAppIcons, value,
flags);
PLRemoveDictionaryEntry(dict, key);
WMRemoveFromPLDictionary(dict, key);
if (different) {
PLInsertDictionaryEntry(dict, key, appDic);
WMPutInPLDictionary(dict, key, appDic);
}
PLRelease(key);
PLRelease(appDic);
WMReleasePropList(key);
WMReleasePropList(appDic);
}
}
PLSave(dict, YES);
WMWritePropListToFile(dict, db->path, True);
/* clean up */
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
}

View File

@@ -50,15 +50,15 @@
#include "kwm.h"
#endif
#include <proplist.h>
#include <WINGs/WUtil.h>
extern WPreferences wPreferences;
extern XContext wWinContext;
static proplist_t dWorkspaces=NULL;
static proplist_t dClip, dName;
static WMPropList *dWorkspaces=NULL;
static WMPropList *dClip, *dName;
#ifdef VIRTUAL_DESKTOP
static BOOL initVDesk = False;
@@ -70,9 +70,9 @@ make_keys()
if (dWorkspaces!=NULL)
return;
dWorkspaces = PLMakeString("Workspaces");
dName = PLMakeString("Name");
dClip = PLMakeString("Clip");
dWorkspaces = WMCreatePLString("Workspaces");
dName = WMCreatePLString("Name");
dClip = WMCreatePLString("Clip");
}
@@ -996,72 +996,69 @@ wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu)
void
wWorkspaceSaveState(WScreen *scr, proplist_t old_state)
wWorkspaceSaveState(WScreen *scr, WMPropList *old_state)
{
proplist_t parr, pstr;
proplist_t wks_state, old_wks_state;
proplist_t foo, bar;
WMPropList *parr, *pstr, *wks_state, *old_wks_state, *foo, *bar;
int i;
make_keys();
old_wks_state = PLGetDictionaryEntry(old_state, dWorkspaces);
parr = PLMakeArrayFromElements(NULL);
old_wks_state = WMGetFromPLDictionary(old_state, dWorkspaces);
parr = WMCreatePLArray(NULL);
for (i=0; i < scr->workspace_count; i++) {
pstr = PLMakeString(scr->workspaces[i]->name);
wks_state = PLMakeDictionaryFromEntries(dName, pstr, NULL);
PLRelease(pstr);
pstr = WMCreatePLString(scr->workspaces[i]->name);
wks_state = WMCreatePLDictionary(dName, pstr, NULL);
WMReleasePropList(pstr);
if (!wPreferences.flags.noclip) {
pstr = wClipSaveWorkspaceState(scr, i);
PLInsertDictionaryEntry(wks_state, dClip, pstr);
PLRelease(pstr);
WMPutInPLDictionary(wks_state, dClip, pstr);
WMReleasePropList(pstr);
} else if (old_wks_state!=NULL) {
if ((foo = PLGetArrayElement(old_wks_state, i))!=NULL) {
if ((bar = PLGetDictionaryEntry(foo, dClip))!=NULL) {
PLInsertDictionaryEntry(wks_state, dClip, bar);
if ((foo = WMGetFromPLArray(old_wks_state, i))!=NULL) {
if ((bar = WMGetFromPLDictionary(foo, dClip))!=NULL) {
WMPutInPLDictionary(wks_state, dClip, bar);
}
}
}
PLAppendArrayElement(parr, wks_state);
PLRelease(wks_state);
WMAddToPLArray(parr, wks_state);
WMReleasePropList(wks_state);
}
PLInsertDictionaryEntry(scr->session_state, dWorkspaces, parr);
PLRelease(parr);
WMPutInPLDictionary(scr->session_state, dWorkspaces, parr);
WMReleasePropList(parr);
}
void
wWorkspaceRestoreState(WScreen *scr)
{
proplist_t parr, pstr, wks_state;
proplist_t clip_state;
WMPropList *parr, *pstr, *wks_state, *clip_state;
int i, j, wscount;
make_keys();
parr = PLGetDictionaryEntry(scr->session_state, dWorkspaces);
parr = WMGetFromPLDictionary(scr->session_state, dWorkspaces);
if (!parr)
return;
wscount = scr->workspace_count;
for (i=0; i < WMIN(PLGetNumberOfElements(parr), MAX_WORKSPACES); i++) {
wks_state = PLGetArrayElement(parr, i);
if (PLIsDictionary(wks_state))
pstr = PLGetDictionaryEntry(wks_state, dName);
for (i=0; i < WMIN(WMGetPropListItemCount(parr), MAX_WORKSPACES); i++) {
wks_state = WMGetFromPLArray(parr, i);
if (WMIsPLDictionary(wks_state))
pstr = WMGetFromPLDictionary(wks_state, dName);
else
pstr = wks_state;
if (i >= scr->workspace_count)
wWorkspaceNew(scr);
if (scr->workspace_menu) {
wfree(scr->workspace_menu->entries[i+2]->text);
scr->workspace_menu->entries[i+2]->text = wstrdup(PLGetString(pstr));
scr->workspace_menu->entries[i+2]->text = wstrdup(WMGetFromPLString(pstr));
scr->workspace_menu->flags.realized = 0;
}
wfree(scr->workspaces[i]->name);
scr->workspaces[i]->name = wstrdup(PLGetString(pstr));
scr->workspaces[i]->name = wstrdup(WMGetFromPLString(pstr));
if (!wPreferences.flags.noclip) {
clip_state = PLGetDictionaryEntry(wks_state, dClip);
clip_state = WMGetFromPLDictionary(wks_state, dClip);
if (scr->workspaces[i]->clip)
wDockDestroy(scr->workspaces[i]->clip);
scr->workspaces[i]->clip = wDockRestoreState(scr, clip_state,

View File

@@ -55,7 +55,7 @@ void wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu);
void wWorkspaceMenuEdit(WScreen *scr);
void wWorkspaceSaveState(WScreen *scr, proplist_t old_state);
void wWorkspaceSaveState(WScreen *scr, WMPropList *old_state);
void wWorkspaceRestoreState(WScreen *scr);
void wWorkspaceRename(WScreen *scr, int workspace, char *name);

View File

@@ -13,7 +13,8 @@
#include "workspace.h"
#include "stdlib.h"
#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>
@@ -92,8 +93,7 @@ void wXDNDClearAwareness(Window window) {
Bool
wXDNDProcessSelection(XEvent *event)
{
WScreen *scr = wScreenForWindow(event->xselection.requestor);
char *dropdata;
WScreen *scr = wScreenForWindow(event->xselection.requestor);
char *retain;
Atom ret_type;
int ret_format;
@@ -180,6 +180,8 @@ wXDNDProcessSelection(XEvent *event)
*/
wfree(scr->xdestring); /* this xdestring is not from Xlib (no XFree) */
}
/* why doesn't this function return anything ? -Dan */
}
Bool
@@ -189,7 +191,6 @@ isAwareXDND(Window window)
int format;
unsigned long count, remaining;
unsigned char *data=0;
Atom *types, *t;
if (!window) return False;
XGetWindowProperty (dpy, window, _XA_XdndAware,
@@ -209,8 +210,7 @@ isAwareXDND(Window window)
Bool
acceptXDND(Window window)
{
WScreen *scr = wScreenForWindow(window);
WWindow *wwin = wWindowFor(window);
WScreen *scr = wScreenForWindow(window);
WDock *dock;
int icon_pos,i;