1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-04-23 09:01:25 +02: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
+12
View File
@@ -19,6 +19,18 @@ Changes since version 0.65.1:
- fixed bug in positioning of window list menu when opened by kbd
- internal code clean-up with notifications for window state change and other
stuff
- removed the libPropList dependancy by adding property list handling
code to WINGs. This code is not only better integrated with the other
WINGs data structures, but it's also more robust. Also a backward
compatibility header file is provided which maps old libPropList
function names to the new WINGs based proplist names allowing old code
to be linked to WINGs with minimal changes. For details on how to use
the compat mode, read the comments on the top of WINGs/proplist-compat.h
Say bye, bye libPropList =)
- rewrote all Window Maker code to use the new WINGs based proplist functions.
- fixed a few compilation warnings and a problem caused by an uninitialized
variable.
Changes since version 0.65.0:
.............................
+4 -7
View File
@@ -234,14 +234,11 @@ inside the WindowMaker directory.
Installation:
-=-=-=-=-=-=-
2.1 Where can I get proplist.h?
-------------------------------
You didn't read the INSTALL file, did you? Please read that now.
libPropList is downloaded seperately and you need to install it _before_
attempting to configure Window Maker.
2.1 Where can I get libPropList/proplist.h?
-------------------------------------------
starting with Window Maker 0.70.0, libPropList is no longer needed.
It was obsoleted by adding property list handling code to the WINGs library.
You can find a gzipped tar archive of libPropList at
ftp://ftp.windowmaker.org/pub/libs/
2.2 Why do no icons show up after installing Window Maker >= 0.15.x
+6 -23
View File
@@ -69,11 +69,6 @@ The following is required to build Window Maker:
and the gcc suite. Otherwise you won't be able to build any X
program, including Window Maker.
- libPropList
This library can be found in ftp://ftp.windowmaker.org/pub/libs
or in ftp://ftp.gnome.org/pub/libPropList
Install it before building Window Maker.
- autoconf, automake and libtool
These tools are NOT needed, but IF you have one or
more of them installed, make sure you have ALL of the following
@@ -86,12 +81,6 @@ The following is required to build Window Maker:
system. If you don't develop software you don't need them,
so you can safely uninstall.
- lex (or flex) and yacc (or bison)
These are used by libPropList. lex is actually not needed since
it's output file is included, but either me or automake is stupid,
causing the configure script for libPropList to simply abort for no
convincent reason if lex is not found.
OPTIONAL:
=========
@@ -459,10 +448,10 @@ UPGRADING
If you are upgrading from an older version of Window Maker:
1. Configure and build Window Maker as always
2. Install Window Maker (but do not run wmaker.inst)
3. Read the NEWS file and update your configuration files,
if necessary.
1. Configure and build Window Maker as always
2. Install Window Maker (but do not run wmaker.inst)
3. Read the NEWS file and update your configuration files if necessary.
TROUBLESHOOTING
===============
@@ -482,8 +471,7 @@ ltconfig: unrecognized option `--no-reexec'
Try `ltconfig --help' for more information.
configure: error: libtool configure failed
remove the --no-reexec option from aclocal.m4 and libPropList/aclocal.m4
and reconfigure
remove the --no-reexec option from aclocal.m4 and reconfigure
Also make sure the autoconf and automake versions you have installed are:
autoconf 2.13
automake 1.4
@@ -492,12 +480,6 @@ libtool 1.3
Note that it must not be libtool 1.2b, it must be libtool 1.3,
from the GNU sites.
== Cant find proplist.h or libPropList.something
Download and install libPropList from the places pointed to
somewhere else in this file.
== configure doesn't detect libtiff, or other graphic libraries.
Delete config.cache, then rerun configure adding the following options to
@@ -625,3 +607,4 @@ and WPrefs.app)
The wsetfont script that's supplied will allow you to change the font
settings in a easier way. Take a look in the script for details on usage.
+14 -1
View File
@@ -2,7 +2,10 @@
NEWS for veteran Window Maker users
-----------------------------------
--- 0.66.0
--- 0.70.0
New dock option
---------------
Copy/paste launch in dock. For example, put
netscape %s in the Docked icon for Netscape,
@@ -10,6 +13,16 @@ select an url somewhere and then middle-click the icon.
The command will be launched with the "pasted" string.
Less dependancies
-----------------
starting with 0.70.0 libPropList is no longer required to build Window
Maker. PropList handling code was added to WINGs being now better
integrated with all the rest. For more details check the Changelog
./WINGs/NEWS, ./WINGs/WINGs/WUtil.h and ./WINGs/WINGs/proplist-compat.h
--- 0.65.1
Removed FocusFollowMouse option, only SloppyFocus present now.
+8
View File
@@ -1,6 +1,14 @@
Changes since wmaker 0.65.0:
............................
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
related error when text was selected in a textfiled.
- moved wstrdup(), wstrconcat() and wstrappend() from memory.c to string.c
- added property list handling code making libPropList unnecessary and
obsolete. Backward compatibility is provided through the
WINGs/proplist-compat.h header file which has #defines from old libPropList
function names to new function names with minimal changes.
- Renamed WMGetUDAllKeys() to WMGetUDKeys()
Changes since wmaker 0.64.0:
+3 -5
View File
@@ -6,8 +6,7 @@ AUTOMAKE_OPTIONS = no-dependencies
noinst_PROGRAMS = connect server fontl puzzle
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
@LIBPL@
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la
fontl_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
@@ -17,12 +16,11 @@ puzzle_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
connect_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
connect_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
@NETLIBS@ @LIBPL@
@NETLIBS@
server_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
server_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
@NETLIBS@ @LIBPL@
server_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ @NETLIBS@
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
+13 -5
View File
@@ -290,19 +290,19 @@ showHelp(WMConnection *cPtr) /*FOLD00*/
static void
listUsers(WMConnection *cPtr)
{
proplist_t userList;
WMPropList *userList;
char *id;
int i, time;
userList = WMGetUDAllKeys(timeDB);
userList = WMGetUDKeys(timeDB);
for (i=0; i<PLGetNumberOfElements(userList); i++) {
id = PLGetString(PLGetArrayElement(userList, i));
for (i=0; i<WMGetPropListItemCount(userList); i++) {
id = WMGetFromPLString(WMGetFromPLArray(userList, i));
time = WMGetUDIntegerForKey(timeDB, id);
sendUpdateMessage(cPtr, id, time);
}
PLRelease(userList);
WMReleasePropList(userList);
}
@@ -591,6 +591,12 @@ removeConnection(void *observer, WMNotification *notification)
WMDestroyConnection(cPtr);
}
static void
updatedDomain(void *observer, WMNotification *notification)
{
wmessage("defaults domain file changed on disk. synchronizing.");
}
#if 0
static Bool
@@ -675,6 +681,8 @@ main(int argc, char **argv) /*FOLD00*/
}
timeDB = WMGetDefaultsFromPath("./UserTime.plist");
WMAddNotificationObserver(updatedDomain, NULL,
WMUserDefaultsDidChangeNotification, NULL);
clientConnections = WMCreateArray(4);
+1 -2
View File
@@ -26,8 +26,7 @@ libExtraWINGs_a_SOURCES = \
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
@LIBPL@
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)
+5 -2
View File
@@ -1,6 +1,7 @@
#include <WINGs/WINGs.h>
#include <stdio.h>
#include "wtableview.h"
#include "wtabledelegates.h"
@@ -33,7 +34,7 @@ void *valueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row)
char buf[128];
sprintf(buf, "Test row %i", i);
col1[i] = wstrdup(buf);
col2[i] = 0;
}
@@ -73,7 +74,7 @@ void clickedTable(WMWidget *w, void *self)
int
main(int argc, char **argv)
{
WMScreen *scr;
@@ -128,4 +129,6 @@ main(int argc, char **argv)
WMMapWidget(table);
WMRealizeWidget(win);
WMScreenMainLoop(scr);
return 0;
}
+1 -1
View File
@@ -1,6 +1,6 @@
#include <WINGs/WINGs.h>
#include <WINGs/WINGsP.h>
#include "wtableview.h"
+2 -3
View File
@@ -908,6 +908,7 @@ static void drawRow(WMTableView *table, int row, WMRect clipRect)
}
#if 0
static void drawFullRow(WMTableView *table, int row)
{
int i;
@@ -926,6 +927,7 @@ static void drawFullRow(WMTableView *table, int row)
(*column->delegate->drawCell)(column->delegate, column, row, d);
}
}
#endif
static void setRowSelected(WMTableView *table, unsigned row, Bool flag)
@@ -1054,8 +1056,6 @@ void WMSelectTableViewRow(WMTableView *table, int row)
void WMReloadTableView(WMTableView *table)
{
WMRect rect = getVisibleRect(table);
if (table->editingRow >= 0)
stopRowEdit(table, table->editingRow);
@@ -1163,7 +1163,6 @@ static void handleResize(W_ViewDelegate *self, WMView *view)
int height;
WMTableView *table = view->self;
WMSize size = getTotalSize(table);
WMScreen *scr = WMWidgetScreen(table);
int vw, vh;
width = W_VIEW_WIDTH(view) - 2;
+1 -1
View File
@@ -13,7 +13,7 @@ bin_SCRIPTS = get-wings-flags get-wutil-flags
lib_LIBRARIES = libWINGs.a libWUtil.a
LDADD= libWINGs.a $(top_builddir)/wrlib/libwraster.la @LIBPL@ @INTLIBS@
LDADD= libWINGs.a $(top_builddir)/wrlib/libwraster.la @INTLIBS@
EXTRA_DIST = BUGS
+18
View File
@@ -1,4 +1,22 @@
*** Thu Oct 04 06:00:09 EEST 2001 -Dan
Property lists handling code
----------------------------
Code to handle property lists was added to WINGs. It is more robust
than the libPropList code, mostly because some conflicting concepts
borrowed from UserDefaults (which libPropList uses) are no longer used in
the property lists code.
It is also better integrated with the other data types from WINGs.
Old libPropList based code can still run with the new WINGs proplist
code with minimal changes which are described in detail in the comments
at the top of the WINGs/proplist-compat.h header file (the same file
carries the #defines for mapping old libPropList functions to the new
WINGs proplist functions).
*** Sat Apr 21 09:12:09 EEST 2001 -Dan
API change
+1 -2
View File
@@ -4,8 +4,7 @@ AUTOMAKE_OPTIONS = no-dependencies
noinst_PROGRAMS = wtest wmquery wmfile testmywidget
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
@LIBPL@
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
+28 -17
View File
@@ -10,14 +10,6 @@
#define NULL ((void*)0)
#endif
/*
* Warning: proplist.h #defines BOOL which will clash with the
* typedef BOOL in Xmd.h
* proplist.h should use Bool (which is a #define in Xlib.h) instead.
*
*/
#include <proplist.h>
#ifndef WMAX
# define WMAX(a,b) ((a)>(b) ? (a) : (b))
@@ -231,7 +223,7 @@ char* wfindfile(char *paths, char *file);
char* wfindfileinlist(char **path_list, char *file);
char* wfindfileinarray(proplist_t array, char *file);
char* wfindfileinarray(WMPropList* array, char *file);
char* wexpandpath(char *path);
@@ -761,6 +753,10 @@ WMPropList* WMRetainPropList(WMPropList *plist);
void WMReleasePropList(WMPropList *plist);
/* Objects inserted in arrays and dictionaries will be retained,
* so you can safely release them after insertion.
* For dictionaries both the key and value are retained.
* Objects removed from arrays or dictionaries are released */
void WMInsertInPLArray(WMPropList *plist, int index, WMPropList *item);
void WMAddToPLArray(WMPropList *plist, WMPropList *item);
@@ -773,6 +769,9 @@ void WMPutInPLDictionary(WMPropList *plist, WMPropList *key, WMPropList *value);
void WMRemoveFromPLDictionary(WMPropList *plist, WMPropList *key);
/* It inserts all key/value pairs from source into dest, overwriting
* the values with the same keys from dest, keeping all values with keys
* only present in dest unchanged */
WMPropList* WMMergePLDictionaries(WMPropList *dest, WMPropList *source);
int WMGetPropListItemCount(WMPropList *plist);
@@ -787,26 +786,38 @@ Bool WMIsPLDictionary(WMPropList *plist);
Bool WMIsPropListEqualTo(WMPropList *plist, WMPropList *other);
/* Returns a reference. Do not free it! */
char* WMGetFromPLString(WMPropList *plist);
/* Returns a reference. Do not free it! */
WMData* WMGetFromPLData(WMPropList *plist);
/* Returns a reference. Do not free it! */
const unsigned char* WMGetPLDataBytes(WMPropList *plist);
int WMGetPLDataLength(WMPropList *plist);
/* Returns a reference. */
WMPropList* WMGetFromPLArray(WMPropList *plist, int index);
/* Returns a reference. */
WMPropList* WMGetFromPLDictionary(WMPropList *plist, WMPropList *key);
/* Returns a PropList array with all the dictionary keys. Release it when
* you're done. Keys in array are retained from the original dictionary
* not copied */
WMPropList* WMGetPLDictionaryKeys(WMPropList *plist);
/* Creates only the first level deep object. All the elements inside are
* retained from the original */
WMPropList* WMShallowCopyPropList(WMPropList *plist);
/* Makes a completely separate replica of the original proplist */
WMPropList* WMDeepCopyPropList(WMPropList *plist);
WMPropList* WMCreatePropListFromDescription(char *desc);
/* Free the returned string when you're done */
char* WMGetPropListDescription(WMPropList *plist, Bool indented);
WMPropList* WMReadPropListFromFile(char *file);
@@ -825,14 +836,14 @@ void WMSaveUserDefaults(WMUserDefaults *database);
void WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable);
/* Returns a PLArray with all keys in the user defaults database.
* Free the returned array with PLRelease() when no longer needed,
* but do not free the elements of the array! They're just references. */
proplist_t WMGetUDAllKeys(WMUserDefaults *database);
/* Returns a WMPropList array with all the keys in the user defaults database.
* Free the array with WMReleasePropList() when no longer needed.
* Keys in array are just retained references to the original keys */
WMPropList* WMGetUDKeys(WMUserDefaults *database);
proplist_t WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName);
WMPropList* WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName);
void WMSetUDObjectForKey(WMUserDefaults *database, proplist_t object,
void WMSetUDObjectForKey(WMUserDefaults *database, WMPropList *object,
char *defaultName);
void WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName);
@@ -857,9 +868,9 @@ void WMSetUDFloatForKey(WMUserDefaults *database, float value,
void WMSetUDBoolForKey(WMUserDefaults *database, Bool value,
char *defaultName);
proplist_t WMGetUDSearchList(WMUserDefaults *database);
WMPropList* WMGetUDSearchList(WMUserDefaults *database);
void WMSetUDSearchList(WMUserDefaults *database, proplist_t list);
void WMSetUDSearchList(WMUserDefaults *database, WMPropList *list);
extern char *WMUserDefaultsDidChangeNotification;
+71 -16
View File
@@ -1,3 +1,56 @@
/*
* This header file is provided for old libPropList compatibility.
* DO _NOT_ USE this except for letting your old libPropList-based code to
* work with the new property list code from WINGs, with minimal changes.
*
* All code written with old libPropList functions should work, given
* that the following changes are made:
*
* 1. Replace all
* #include <proplist.h>
* with
* #include <WINGs/proplist-compat.h>
* in your code.
*
* 2. Change all calls to PLSave() to have the extra filename parameter like:
* PLSave(proplist_t proplist, char* filename, Bool atomically)
*
* 3. The PLSetStringCmpHook() function is no longer available. There is a
* similar but simpler function provided which is enough for practical
* purposes:
* PLSetCaseSensitive(Bool caseSensitive)
*
* 4. The following functions do no longer exist. They were removed because
* they were based on concepts borrowed from UserDefaults which conflict
* with the retain/release mechanism:
* PLSynchronize(), PLDeepSynchronize(), PLShallowSynchronize()
* PLSetFilename(), PLGetFilename()
* PLGetContainer()
* You should change your code to not use them anymore.
*
* 5. The following functions are no longer available. They were removed
* because they also used borrowed concepts which have no place in a
* property list as defined in the OpenStep specifications. Also these
* functions were hardly ever used in programs to our knowledge.
* PLGetDomainNames(), PLGetDomain(), PLSetDomain(), PLDeleteDomain()
* PLRegister(), PLUnregister()
* You should also change your code to not use them anymore (in case you
* ever used them anyway ;-) ).
*
* 6. Link your program with libWINGs or libWUtil instead of libPropList.
* (libWINGs should be used for GUI apps, while libWUtil for non-GUI apps)
*
*
* Our recommandation is to rewrite your code to use the new functions and
* link against libWINGs/libWUtil. We do not recommend you to keep using old
* libPropList function names. This file is provided just to allow existing
* libropList based applications to run with minimal changes with the new
* proplist code from WINGs before their authors get the time to rewrite
* them. New proplist code from WINGs provide a better integration with the
* other data types from WINGs, not to mention that the proplist code in WINGs
* is actively maintained while the old libPropList is dead.
*
*/
#ifndef _PROPLIST_COMPAT_H_
@@ -12,8 +65,8 @@ typedef WMPropList* proplist_t;
#define PLMakeString(bytes) WMCreatePLString(bytes)
#define PLMakeData(bytes, length) WMCreatePLDataFromBytes(bytes, length)
#define PLMakeArrayFromElements(pl, ...) WMCreatePLArray(pl, ...)
#define PLMakeDictionaryFromEntries(key, value, ...) WMCreatePLDictionary(key, value, ...)
#define PLMakeArrayFromElements WMCreatePLArray
#define PLMakeDictionaryFromEntries WMCreatePLDictionary
#define PLRetain(pl) WMRetainPropList(pl)
#define PLRelease(pl) WMReleasePropList(pl)
@@ -38,7 +91,7 @@ typedef WMPropList* proplist_t;
#define PLGetString(pl) WMGetFromPLString(pl)
#define PLGetDataBytes(pl) WMGetPLDataBytes(pl)
#define PLGetDataLength(pl) WMGetPLDataLength(pl)
#define PLGetArrayElement(pl, index) WMGetFromArray(pl, index)
#define PLGetArrayElement(pl, index) WMGetFromPLArray(pl, index)
#define PLGetDictionaryEntry(pl, key) WMGetFromPLDictionary(pl, key)
#define PLGetAllDictionaryKeys(pl) WMGetPLDictionaryKeys(pl)
@@ -55,20 +108,22 @@ typedef WMPropList* proplist_t;
#define PLSave(pl, file, atm) WMWritePropListToFile(pl, file, atm)
#if 0
#define PLSetStringCmpHook(fn)
#define PLDeepSynchronize(pl) PLDeepSynchronize_is_not_supported
#define PLSynchronize(pl) PLSynchronize_is_not_supported
#define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
#define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
#define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
#define PLGetContainer(pl)
//#define PLSetStringCmpHook(fn)
//#define PLDeepSynchronize(pl) PLDeepSynchronize_is_not_supported
//#define PLSynchronize(pl) PLSynchronize_is_not_supported
//#define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
//#define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
//#define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
//#define PLGetDomainNames()
//#define PLGetDomain(name)
//#define PLSetDomain(name, value, kickme)
//#define PLDeleteDomain(name, kickme)
//#define PLRegister(name, callback)
//#define PLUnregister(name)
//#define PLGetContainer(pl)
#define PLGetDomainNames()
#define PLGetDomain(name)
#define PLSetDomain(name, value, kickme)
#define PLDeleteDomain(name, kickme)
#define PLRegister(name, callback)
#define PLUnregister(name)
#endif
#endif
-2
View File
@@ -4,8 +4,6 @@
#include <X11/Xlocale.h>
#include <proplist.h>
_WINGsConfiguration WINGsConfiguration;
+5 -5
View File
@@ -286,7 +286,7 @@ wfindfileinlist(char **path_list, char *file)
char*
wfindfileinarray(proplist_t array, char *file)
wfindfileinarray(WMPropList *array, char *file)
{
int i;
char *path;
@@ -314,14 +314,14 @@ wfindfileinarray(proplist_t array, char *file)
}
flen = strlen(file);
for (i=0; i<PLGetNumberOfElements(array); i++) {
proplist_t prop;
for (i=0; i<WMGetPropListItemCount(array); i++) {
WMPropList *prop;
char *p;
prop = PLGetArrayElement(array, i);
prop = WMGetFromPLArray(array, i);
if (!prop)
continue;
p = PLGetString(prop);
p = WMGetFromPLString(prop);
len = strlen(p);
path = wmalloc(len+flen+2);
-2
View File
@@ -435,8 +435,6 @@ Bool
WMNextHashEnumeratorItemAndKey(WMHashEnumerator *enumerator,
void **item, void **key)
{
const void *data = NULL;
/* this assumes the table doesn't change between
* WMEnumerateHashTable() and WMNextHashEnumeratorItemAndKey() calls */
+13
View File
@@ -409,6 +409,17 @@ indentedDescription(WMPropList *plist, int level)
WMHashEnumerator e;
int i;
if (plist->type==WPLArray || plist->type==WPLDictionary) {
retstr = description(plist);
if (retstr && ((2*(level+1) + strlen(retstr)) <= 77)) {
return retstr;
} else if (retstr) {
wfree(retstr);
retstr = NULL;
}
}
switch (plist->type) {
case WPLString:
retstr = stringDescription(plist);
@@ -1175,10 +1186,12 @@ WMPutInPLDictionary(WMPropList *plist, WMPropList *key, WMPropList *value)
{
wassertr(plist->type==WPLDictionary);
/*WMRetainPropList(key);*/
WMRemoveFromPLDictionary(plist, key);
retainPropListByCount(key, plist->retainCount);
retainPropListByCount(value, plist->retainCount);
WMHashInsert(plist->d.dict, key, value);
/*WMReleasePropList(key);*/
}
+125 -110
View File
@@ -9,18 +9,19 @@
#include "../src/config.h"
#include "wconfig.h"
#include "WINGs.h"
#include <proplist.h>
typedef struct W_UserDefaults {
proplist_t defaults;
WMPropList *defaults;
proplist_t appDomain;
WMPropList *appDomain;
proplist_t searchListArray;
proplist_t *searchList; /* cache for searchListArray */
WMPropList *searchListArray;
WMPropList **searchList; /* cache for searchListArray */
char dirty;
@@ -163,7 +164,8 @@ WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable)
void
WMSynchronizeUserDefaults(WMUserDefaults *database)
{
Bool fileIsNewer = False, release = False;
Bool fileIsNewer = False, release = False, notify = False;
WMPropList *plF, *key;
char *path;
struct stat stbuf;
@@ -178,14 +180,45 @@ WMSynchronizeUserDefaults(WMUserDefaults *database)
fileIsNewer = True;
if (database->appDomain && (database->dirty || fileIsNewer)) {
if (database->dirty && fileIsNewer) {
plF = WMReadPropListFromFile(path);
if (plF) {
plF = WMMergePLDictionaries(plF, database->appDomain);
WMReleasePropList(database->appDomain);
database->appDomain = plF;
key = database->searchList[0];
WMPutInPLDictionary(database->defaults, key, plF);
notify = True;
} else {
/* something happened with the file. just overwrite it */
wwarning(_("cannot read domain from file '%s' when syncing"),
path);
WMWritePropListToFile(database->appDomain, path, True);
}
} else if (database->dirty) {
WMWritePropListToFile(database->appDomain, path, True);
} else if (fileIsNewer) {
plF = WMReadPropListFromFile(path);
if (plF) {
WMReleasePropList(database->appDomain);
database->appDomain = plF;
key = database->searchList[0];
WMPutInPLDictionary(database->defaults, key, plF);
notify = True;
} else {
/* something happened with the file. just overwrite it */
wwarning(_("cannot read domain from file '%s' when syncing"),
path);
WMWritePropListToFile(database->appDomain, path, True);
}
}
/*fprintf(stderr, "syncing: %s %d %d\n", path, database->dirty, fileIsNewer);*/
PLShallowSynchronize(database->appDomain);
database->dirty = 0;
if (stat(path, &stbuf) >= 0)
database->timestamp = stbuf.st_mtime;
if (fileIsNewer) {
if (notify) {
WMPostNotificationName(WMUserDefaultsDidChangeNotification,
database, NULL);
}
@@ -205,14 +238,14 @@ WMSaveUserDefaults(WMUserDefaults *database)
char *path;
Bool release = False;
PLSave(database->appDomain, YES);
database->dirty = 0;
if (!database->path) {
path = wdefaultspathfordomain(WMGetApplicationName());
release = True;
} else {
path = database->path;
}
WMWritePropListToFile(database->appDomain, path, True);
database->dirty = 0;
if (stat(path, &stbuf) >= 0)
database->timestamp = stbuf.st_mtime;
if (release)
@@ -225,8 +258,8 @@ WMUserDefaults*
WMGetStandardUserDefaults(void)
{
WMUserDefaults *defaults;
proplist_t domain;
proplist_t key;
WMPropList *domain;
WMPropList *key;
struct stat stbuf;
char *path;
int i;
@@ -245,12 +278,12 @@ WMGetStandardUserDefaults(void)
defaults = wmalloc(sizeof(WMUserDefaults));
memset(defaults, 0, sizeof(WMUserDefaults));
defaults->defaults = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
defaults->defaults = WMCreatePLDictionary(NULL, NULL, NULL);
defaults->searchList = wmalloc(sizeof(proplist_t)*3);
defaults->searchList = wmalloc(sizeof(WMPropList*)*3);
/* application domain */
key = PLMakeString(WMGetApplicationName());
key = WMCreatePLString(WMGetApplicationName());
defaults->searchList[0] = key;
/* temporary kluge */
@@ -258,59 +291,49 @@ WMGetStandardUserDefaults(void)
domain = NULL;
path = NULL;
} else {
path = wdefaultspathfordomain(PLGetString(key));
path = wdefaultspathfordomain(WMGetFromPLString(key));
if (stat(path, &stbuf) >= 0)
defaults->timestamp = stbuf.st_mtime;
domain = PLGetProplistWithPath(path);
domain = WMReadPropListFromFile(path);
}
if (!domain) {
proplist_t p;
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
if (path) {
p = PLMakeString(path);
PLSetFilename(domain, p);
PLRelease(p);
}
}
if (!domain)
domain = WMCreatePLDictionary(NULL, NULL, NULL);
if (path)
wfree(path);
defaults->appDomain = domain;
if (domain)
PLInsertDictionaryEntry(defaults->defaults, key, domain);
PLRelease(key);
WMPutInPLDictionary(defaults->defaults, key, domain);
/* global domain */
key = PLMakeString("WMGLOBAL");
key = WMCreatePLString("WMGLOBAL");
defaults->searchList[1] = key;
path = wdefaultspathfordomain(PLGetString(key));
path = wdefaultspathfordomain(WMGetFromPLString(key));
domain = PLGetProplistWithPath(path);
domain = WMReadPropListFromFile(path);
wfree(path);
if (!domain)
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
domain = WMCreatePLDictionary(NULL, NULL, NULL);
if (domain)
PLInsertDictionaryEntry(defaults->defaults, key, domain);
PLRelease(key);
WMPutInPLDictionary(defaults->defaults, key, domain);
/* terminate list */
defaults->searchList[2] = NULL;
defaults->searchListArray = PLMakeArrayFromElements(NULL,NULL);
defaults->searchListArray = WMCreatePLArray(NULL,NULL);
i = 0;
while (defaults->searchList[i]) {
PLAppendArrayElement(defaults->searchListArray,
WMAddToPLArray(defaults->searchListArray,
defaults->searchList[i]);
i++;
}
@@ -330,8 +353,8 @@ WMUserDefaults*
WMGetDefaultsFromPath(char *path)
{
WMUserDefaults *defaults;
proplist_t domain;
proplist_t key;
WMPropList *domain;
WMPropList *key;
struct stat stbuf;
char *name;
int i;
@@ -351,9 +374,9 @@ WMGetDefaultsFromPath(char *path)
defaults = wmalloc(sizeof(WMUserDefaults));
memset(defaults, 0, sizeof(WMUserDefaults));
defaults->defaults = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
defaults->defaults = WMCreatePLDictionary(NULL, NULL, NULL);
defaults->searchList = wmalloc(sizeof(proplist_t)*2);
defaults->searchList = wmalloc(sizeof(WMPropList*)*2);
/* the domain we want, go in the first position */
name = strrchr(path, '/');
@@ -362,40 +385,32 @@ WMGetDefaultsFromPath(char *path)
else
name++;
key = PLMakeString(name);
key = WMCreatePLString(name);
defaults->searchList[0] = key;
if (stat(path, &stbuf) >= 0)
defaults->timestamp = stbuf.st_mtime;
domain = PLGetProplistWithPath(path);
domain = WMReadPropListFromFile(path);
if (!domain) {
proplist_t p;
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
p = PLMakeString(path);
PLSetFilename(domain, p);
PLRelease(p);
}
if (!domain)
domain = WMCreatePLDictionary(NULL, NULL, NULL);
defaults->path = wstrdup(path);
defaults->appDomain = domain;
if (domain)
PLInsertDictionaryEntry(defaults->defaults, key, domain);
PLRelease(key);
WMPutInPLDictionary(defaults->defaults, key, domain);
/* terminate list */
defaults->searchList[1] = NULL;
defaults->searchListArray = PLMakeArrayFromElements(NULL,NULL);
defaults->searchListArray = WMCreatePLArray(NULL,NULL);
i = 0;
while (defaults->searchList[i]) {
PLAppendArrayElement(defaults->searchListArray,
WMAddToPLArray(defaults->searchListArray,
defaults->searchList[i]);
i++;
}
@@ -411,85 +426,85 @@ WMGetDefaultsFromPath(char *path)
}
/* Returns a PLArray with all keys in the user defaults database.
* Free the returned array with PLRelease() when no longer needed,
/* Returns a WMPropList array with all keys in the user defaults database.
* Free the array with WMReleasePropList() when no longer needed,
* but do not free the elements of the array! They're just references. */
proplist_t
WMGetUDAllKeys(WMUserDefaults *database)
WMPropList*
WMGetUDKeys(WMUserDefaults *database)
{
return PLGetAllDictionaryKeys(database->appDomain);
return WMGetPLDictionaryKeys(database->appDomain);
}
proplist_t
WMPropList*
WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName)
{
proplist_t domainName, domain;
proplist_t object = NULL;
proplist_t key = PLMakeString(defaultName);
WMPropList *domainName, *domain;
WMPropList *object = NULL;
WMPropList *key = WMCreatePLString(defaultName);
int i = 0;
while (database->searchList[i] && !object) {
domainName = database->searchList[i];
domain = PLGetDictionaryEntry(database->defaults, domainName);
domain = WMGetFromPLDictionary(database->defaults, domainName);
if (domain) {
object = PLGetDictionaryEntry(domain, key);
object = WMGetFromPLDictionary(domain, key);
}
i++;
}
PLRelease(key);
WMReleasePropList(key);
return object;
}
void
WMSetUDObjectForKey(WMUserDefaults *database, proplist_t object,
WMSetUDObjectForKey(WMUserDefaults *database, WMPropList *object,
char *defaultName)
{
proplist_t key = PLMakeString(defaultName);
WMPropList *key = WMCreatePLString(defaultName);
database->dirty = 1;
PLInsertDictionaryEntry(database->appDomain, key, object);
PLRelease(key);
WMPutInPLDictionary(database->appDomain, key, object);
WMReleasePropList(key);
}
void
WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName)
{
proplist_t key = PLMakeString(defaultName);
WMPropList *key = WMCreatePLString(defaultName);
database->dirty = 1;
PLRemoveDictionaryEntry(database->appDomain, key);
WMRemoveFromPLDictionary(database->appDomain, key);
PLRelease(key);
WMReleasePropList(key);
}
char*
WMGetUDStringForKey(WMUserDefaults *database, char *defaultName)
{
proplist_t val;
WMPropList *val;
val = WMGetUDObjectForKey(database, defaultName);
if (!val)
return NULL;
if (!PLIsString(val))
if (!WMIsPLString(val))
return NULL;
return PLGetString(val);
return WMGetFromPLString(val);
}
int
WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
{
proplist_t val;
WMPropList *val;
char *str;
int value;
@@ -498,10 +513,10 @@ WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
if (!val)
return 0;
if (!PLIsString(val))
if (!WMIsPLString(val))
return 0;
str = PLGetString(val);
str = WMGetFromPLString(val);
if (!str)
return 0;
@@ -516,16 +531,16 @@ WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
float
WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
{
proplist_t val;
WMPropList *val;
char *str;
float value;
val = WMGetUDObjectForKey(database, defaultName);
if (!val || !PLIsString(val))
if (!val || !WMIsPLString(val))
return 0.0;
if (!(str = PLGetString(val)))
if (!(str = WMGetFromPLString(val)))
return 0.0;
if (sscanf(str, "%f", &value)!=1)
@@ -539,7 +554,7 @@ WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
Bool
WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
{
proplist_t val;
WMPropList *val;
int value;
char *str;
@@ -548,10 +563,10 @@ WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
if (!val)
return False;
if (!PLIsString(val))
if (!WMIsPLString(val))
return False;
str = PLGetString(val);
str = WMGetFromPLString(val);
if (!str)
return False;
@@ -571,14 +586,14 @@ WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
void
WMSetUDIntegerForKey(WMUserDefaults *database, int value, char *defaultName)
{
proplist_t object;
WMPropList *object;
char buffer[128];
sprintf(buffer, "%i", value);
object = PLMakeString(buffer);
object = WMCreatePLString(buffer);
WMSetUDObjectForKey(database, object, defaultName);
PLRelease(object);
WMReleasePropList(object);
}
@@ -587,12 +602,12 @@ WMSetUDIntegerForKey(WMUserDefaults *database, int value, char *defaultName)
void
WMSetUDStringForKey(WMUserDefaults *database, char *value, char *defaultName)
{
proplist_t object;
WMPropList *object;
object = PLMakeString(value);
object = WMCreatePLString(value);
WMSetUDObjectForKey(database, object, defaultName);
PLRelease(object);
WMReleasePropList(object);
}
@@ -600,14 +615,14 @@ WMSetUDStringForKey(WMUserDefaults *database, char *value, char *defaultName)
void
WMSetUDFloatForKey(WMUserDefaults *database, float value, char *defaultName)
{
proplist_t object;
WMPropList *object;
char buffer[128];
sprintf(buffer, "%f", value);
object = PLMakeString(buffer);
object = WMCreatePLString(buffer);
WMSetUDObjectForKey(database, object, defaultName);
PLRelease(object);
WMReleasePropList(object);
}
@@ -615,18 +630,18 @@ WMSetUDFloatForKey(WMUserDefaults *database, float value, char *defaultName)
void
WMSetUDBoolForKey(WMUserDefaults *database, Bool value, char *defaultName)
{
static proplist_t yes = NULL, no = NULL;
static WMPropList *yes = NULL, *no = NULL;
if (!yes) {
yes = PLMakeString("YES");
no = PLMakeString("NO");
yes = WMCreatePLString("YES");
no = WMCreatePLString("NO");
}
WMSetUDObjectForKey(database, value ? yes : no, defaultName);
}
proplist_t
WMPropList*
WMGetUDSearchList(WMUserDefaults *database)
{
return database->searchListArray;
@@ -634,30 +649,30 @@ WMGetUDSearchList(WMUserDefaults *database)
void
WMSetUDSearchList(WMUserDefaults *database, proplist_t list)
WMSetUDSearchList(WMUserDefaults *database, WMPropList *list)
{
int i, c;
if (database->searchList) {
i = 0;
while (database->searchList[i]) {
PLRelease(database->searchList[i]);
WMReleasePropList(database->searchList[i]);
i++;
}
wfree(database->searchList);
}
if (database->searchListArray) {
PLRelease(database->searchListArray);
WMReleasePropList(database->searchListArray);
}
c = PLGetNumberOfElements(list);
database->searchList = wmalloc(sizeof(proplist_t)*(c+1));
c = WMGetPropListItemCount(list);
database->searchList = wmalloc(sizeof(WMPropList*)*(c+1));
for (i=0; i<c; i++) {
database->searchList[i] = PLGetArrayElement(list, i);
database->searchList[i] = WMGetFromPLArray(list, i);
}
database->searchListArray = PLDeepCopy(list);
database->searchListArray = WMDeepCopyPropList(list);
}
-12
View File
@@ -6,20 +6,8 @@
#include <X11/Xutil.h>
/* Xmd.h which is indirectly included by GNUstep.h defines BOOL,
* but libPropList also defines it. So we do this kluge to get rid of BOOL
* temporarily */
#ifdef BOOL
# define WINGS_BOOL
# undef BOOL
#endif
#include "GNUstep.h"
#ifdef WINGS_BOOL
# define BOOL
# undef WINGS_BOOL
#endif
extern struct W_Application WMApplication;
+1 -1
View File
@@ -30,7 +30,7 @@ typedef struct W_FontPanel {
WMButton *revertB;
WMButton *setB;
proplist_t fdb;
WMPropList *fdb;
} FontPanel;
+1 -1
View File
@@ -153,7 +153,7 @@ handleEvents(XEvent *event, void *data)
if (item) {
WMSelectTabViewItem(tPtr, item);
} else if (tPtr->flags.dontFitAll) {
int redraw;
int redraw = 0;
int lastVisible = tPtr->firstVisible+tPtr->visibleTabs-1;
if (event->xbutton.x < BUTTONED_SIDE_OFFSET) {
-1
View File
@@ -1001,7 +1001,6 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
int cancelSelection = 1;
Bool shifted, controled, modified;
Bool relay = True;
WMScreen *scr = tPtr->view->screen;
/*printf("(%d,%d) -> ", tPtr->selection.position, tPtr->selection.count);*/
if (((XKeyEvent *) event)->state & WM_EMACSKEYMASK)
+60 -60
View File
@@ -122,7 +122,7 @@ typedef struct _Panel {
typedef struct {
char *title;
char *texture;
proplist_t prop;
WMPropList *prop;
Pixmap preview;
char *path;
@@ -437,13 +437,13 @@ dumpRImage(char *path, RImage *image)
static int
isPixmap(proplist_t prop)
isPixmap(WMPropList *prop)
{
proplist_t p;
WMPropList *p;
char *s;
p = PLGetArrayElement(prop, 0);
s = PLGetString(p);
p = WMGetFromPLArray(prop, 0);
s = WMGetFromPLString(p);
if (strcasecmp(&s[1], "pixmap")==0)
return 1;
else
@@ -518,7 +518,7 @@ drawMenuBevel(RImage *img)
static Pixmap
renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
renderTexture(WMScreen *scr, WMPropList *texture, int width, int height,
char *path, int border)
{
char *type;
@@ -529,11 +529,11 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
RColor rcolor;
type = PLGetString(PLGetArrayElement(texture, 0));
type = WMGetFromPLString(WMGetFromPLArray(texture, 0));
if (strcasecmp(type, "solid")==0) {
str = PLGetString(PLGetArrayElement(texture, 1));
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
str2rcolor(rc, str, &rcolor);
@@ -543,18 +543,18 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
int t1, t2;
RColor c1[2], c2[2];
str = PLGetString(PLGetArrayElement(texture, 1));
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
str2rcolor(rc, str, &c1[0]);
str = PLGetString(PLGetArrayElement(texture, 2));
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
str2rcolor(rc, str, &c1[1]);
str = PLGetString(PLGetArrayElement(texture, 3));
str = WMGetFromPLString(WMGetFromPLArray(texture, 3));
t1 = atoi(str);
str = PLGetString(PLGetArrayElement(texture, 4));
str = WMGetFromPLString(WMGetFromPLArray(texture, 4));
str2rcolor(rc, str, &c2[0]);
str = PLGetString(PLGetArrayElement(texture, 5));
str = WMGetFromPLString(WMGetFromPLArray(texture, 5));
str2rcolor(rc, str, &c2[1]);
str = PLGetString(PLGetArrayElement(texture, 6));
str = WMGetFromPLString(WMGetFromPLArray(texture, 6));
t2 = atoi(str);
image = RRenderInterwovenGradient(width, height, c1, t1, c2, t2);
@@ -575,9 +575,9 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
break;
}
str = PLGetString(PLGetArrayElement(texture, 1));
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
str2rcolor(rc, str, &rcolor);
str = PLGetString(PLGetArrayElement(texture, 2));
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
str2rcolor(rc, str, &rcolor2);
image = RRenderGradient(width, height, &rcolor, &rcolor2, style);
@@ -601,12 +601,12 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
break;
}
str = PLGetString(PLGetArrayElement(texture, 3));
str = WMGetFromPLString(WMGetFromPLArray(texture, 3));
str2rcolor(rc, str, &rcolor);
str = PLGetString(PLGetArrayElement(texture, 4));
str = WMGetFromPLString(WMGetFromPLArray(texture, 4));
str2rcolor(rc, str, &rcolor2);
str = PLGetString(PLGetArrayElement(texture, 1));
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
if ((path=wfindfileinarray(GetObjectForKey("PixmapPath"), str))!=NULL)
timage = RLoadImage(rc, path, 0);
@@ -620,7 +620,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
image = RMakeTiledImage(timage, width, height);
RReleaseImage(timage);
i = atoi(PLGetString(PLGetArrayElement(texture, 2)));
i = atoi(WMGetFromPLString(WMGetFromPLArray(texture, 2)));
RCombineImagesWithOpaqueness(image, grad, i);
RReleaseImage(grad);
@@ -643,13 +643,13 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
break;
}
j = PLGetNumberOfElements(texture);
j = WMGetPropListItemCount(texture);
if (j > 0) {
colors = wmalloc(j * sizeof(RColor*));
for (i = 2; i < j; i++) {
str = PLGetString(PLGetArrayElement(texture, i));
str = WMGetFromPLString(WMGetFromPLArray(texture, i));
colors[i-2] = wmalloc(sizeof(RColor));
str2rcolor(rc, str, colors[i-2]);
}
@@ -666,7 +666,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
char *path;
RColor color;
str = PLGetString(PLGetArrayElement(texture, 1));
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
if ((path=wfindfileinarray(GetObjectForKey("PixmapPath"), str))!=NULL)
timage = RLoadImage(rc, path, 0);
@@ -675,7 +675,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
wwarning("could not load file '%s': %s", path ? path : str,
RMessageForError(RErrorCode));
} else {
str = PLGetString(PLGetArrayElement(texture, 2));
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
str2rcolor(rc, str, &color);
switch (toupper(type[0])) {
@@ -727,7 +727,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
static Pixmap
renderMenu(_Panel *panel, proplist_t texture, int width, int iheight)
renderMenu(_Panel *panel, WMPropList *texture, int width, int iheight)
{
WMScreen *scr = WMWidgetScreen(panel->parent);
Display *dpy = WMScreenDisplay(scr);
@@ -949,7 +949,7 @@ okNewTexture(void *data)
WMListItem *item;
char *name;
char *str;
proplist_t prop;
WMPropList *prop;
TextureListItem *titem;
WMScreen *scr = WMWidgetScreen(panel->parent);
@@ -962,7 +962,7 @@ okNewTexture(void *data)
prop = GetTexturePanelTexture(panel->texturePanel);
str = PLGetDescription(prop);
str = WMGetPropListDescription(prop, False);
titem->title = name;
titem->prop = prop;
@@ -989,7 +989,7 @@ okEditTexture(void *data)
WMListItem *item;
char *name;
char *str;
proplist_t prop;
WMPropList *prop;
TextureListItem *titem;
item = WMGetListItem(panel->texLs, WMGetListSelectedItemRow(panel->texLs));
@@ -1006,9 +1006,9 @@ okEditTexture(void *data)
prop = GetTexturePanelTexture(panel->texturePanel);
str = PLGetDescription(prop);
str = WMGetPropListDescription(prop, False);
PLRelease(titem->prop);
WMReleasePropList(titem->prop);
titem->prop = prop;
titem->ispixmap = isPixmap(prop);
@@ -1098,7 +1098,7 @@ deleteTexture(WMWidget *w, void *data)
wfree(titem->title);
wfree(titem->texture);
PLRelease(titem->prop);
WMReleasePropList(titem->prop);
if (titem->path) {
if (remove(titem->path) < 0 && errno != ENOENT) {
wsyserror("could not remove file %s", titem->path);
@@ -1373,8 +1373,8 @@ loadRImage(WMScreen *scr, char *path)
static void
fillTextureList(WMList *lPtr)
{
proplist_t textureList;
proplist_t texture;
WMPropList *textureList;
WMPropList *texture;
WMUserDefaults *udb = WMGetStandardUserDefaults();
TextureListItem *titem;
WMScreen *scr = WMWidgetScreen(lPtr);
@@ -1384,19 +1384,19 @@ fillTextureList(WMList *lPtr)
if (!textureList)
return;
for (i = 0; i < PLGetNumberOfElements(textureList); i++) {
for (i = 0; i < WMGetPropListItemCount(textureList); i++) {
WMListItem *item;
texture = PLGetArrayElement(textureList, i);
texture = WMGetFromPLArray(textureList, i);
titem = wmalloc(sizeof(TextureListItem));
memset(titem, 0, sizeof(TextureListItem));
titem->title = wstrdup(PLGetString(PLGetArrayElement(texture, 0)));
titem->prop = PLRetain(PLGetArrayElement(texture, 1));
titem->texture = PLGetDescription(titem->prop);
titem->title = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 0)));
titem->prop = WMRetainPropList(WMGetFromPLArray(texture, 1));
titem->texture = WMGetPropListDescription(titem->prop, False);
titem->selectedFor = 0;
titem->path = wstrdup(PLGetString(PLGetArrayElement(texture, 2)));
titem->path = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 2)));
titem->preview = loadRImage(scr, titem->path);
if (!titem->preview) {
@@ -1413,7 +1413,7 @@ static void
fillColorList(_Panel *panel)
{
WMColor *color;
proplist_t list;
WMPropList *list;
WMUserDefaults *udb = WMGetStandardUserDefaults();
WMScreen *scr = WMWidgetScreen(panel->box);
int i;
@@ -1428,13 +1428,13 @@ fillColorList(_Panel *panel)
WMReleaseColor(color);
}
} else {
proplist_t c;
WMPropList *c;
for (i = 0; i < WMIN(24, PLGetNumberOfElements(list)); i++) {
c = PLGetArrayElement(list, i);
if (!c || !PLIsString(c))
for (i = 0; i < WMIN(24, WMGetPropListItemCount(list)); i++) {
c = WMGetFromPLArray(list, i);
if (!c || !WMIsPLString(c))
continue;
color = WMCreateNamedColor(scr, PLGetString(c), False);
color = WMCreateNamedColor(scr, WMGetFromPLString(c), False);
if (!color)
continue;
WMSetColorWellColor(panel->sampW[i], color);
@@ -2034,13 +2034,13 @@ setupTextureFor(WMList *list, char *key, char *defValue, char *title,
titem->title = wstrdup(title);
titem->prop = GetObjectForKey(key);
if (!titem->prop || !PLIsArray(titem->prop)) {
if (!titem->prop || !WMIsPLArray(titem->prop)) {
/* Maybe also give a error message to stderr that the entry is bad? */
titem->prop = PLGetProplistWithDescription(defValue);
titem->prop = WMCreatePropListFromDescription(defValue);
} else {
PLRetain(titem->prop);
WMRetainPropList(titem->prop);
}
titem->texture = PLGetDescription((proplist_t)titem->prop);
titem->texture = WMGetPropListDescription((WMPropList*)titem->prop, False);
titem->current = 1;
titem->selectedFor = 1<<index;
@@ -2160,33 +2160,33 @@ storeData(_Panel *panel)
static void
prepareForClose(_Panel *panel)
{
proplist_t textureList;
proplist_t texture;
WMPropList *textureList;
WMPropList *texture;
TextureListItem *titem;
WMListItem *item;
WMUserDefaults *udb = WMGetStandardUserDefaults();
int i;
textureList = PLMakeArrayFromElements(NULL, NULL);
textureList = WMCreatePLArray(NULL, NULL);
/* store list of textures */
for (i = 7; i < WMGetListNumberOfRows(panel->texLs); i++) {
item = WMGetListItem(panel->texLs, i);
titem = (TextureListItem*)item->clientData;
texture = PLMakeArrayFromElements(PLMakeString(titem->title),
PLRetain(titem->prop),
PLMakeString(titem->path),
texture = WMCreatePLArray(WMCreatePLString(titem->title),
WMRetainPropList(titem->prop),
WMCreatePLString(titem->path),
NULL);
PLAppendArrayElement(textureList, texture);
WMAddToPLArray(textureList, texture);
}
WMSetUDObjectForKey(udb, textureList, "TextureList");
PLRelease(textureList);
WMReleasePropList(textureList);
/* store list of colors */
textureList = PLMakeArrayFromElements(NULL, NULL);
textureList = WMCreatePLArray(NULL, NULL);
for (i = 0; i < 24; i++) {
WMColor *color;
char *str;
@@ -2194,11 +2194,11 @@ prepareForClose(_Panel *panel)
color = WMGetColorWellColor(panel->sampW[i]);
str = WMGetColorRGBDescription(color);
PLAppendArrayElement(textureList, PLMakeString(str));
WMAddToPLArray(textureList, WMCreatePLString(str));
wfree(str);
}
WMSetUDObjectForKey(udb, textureList, "ColorList");
PLRelease(textureList);
WMReleasePropList(textureList);
WMSynchronizeUserDefaults(udb);
}
-1
View File
@@ -60,7 +60,6 @@ typedef struct _Panel {
#define DELAY_ICON "timer%i"
#define DELAY_ICON_S "timer%is"
static void changeFocusMode(WMWidget *w, void *data);
static void
showData(_Panel *panel)
+33 -33
View File
@@ -23,7 +23,6 @@
#include "WPrefs.h"
#include <proplist.h>
typedef struct _Panel {
WMBox *box;
@@ -76,12 +75,12 @@ typedef struct _Panel {
static proplist_t DefaultWindowTitleFont = NULL;
static proplist_t DefaultMenuTitleFont = NULL;
static proplist_t DefaultMenuTextFont = NULL;
static proplist_t DefaultIconTitleFont = NULL;
static proplist_t DefaultClipTitleFont = NULL;
static proplist_t DefaultDisplayFont = NULL;
static WMPropList *DefaultWindowTitleFont = NULL;
static WMPropList *DefaultMenuTitleFont = NULL;
static WMPropList *DefaultMenuTextFont = NULL;
static WMPropList *DefaultIconTitleFont = NULL;
static WMPropList *DefaultClipTitleFont = NULL;
static WMPropList *DefaultDisplayFont = NULL;
@@ -268,7 +267,7 @@ setLanguageType(Panel *p, Bool multiByte)
static void
readFontEncodings(Panel *panel)
{
proplist_t pl = NULL;
WMPropList *pl = NULL;
char *path;
char *msg;
@@ -278,19 +277,19 @@ readFontEncodings(Panel *panel)
goto error;
}
pl = PLGetProplistWithPath(path);
pl = WMReadPropListFromFile(path);
if (!pl) {
msg = _("Could not read font information file WPrefs.app/font.data");
goto error;
} else {
int i;
proplist_t key = PLMakeString("Encodings");
proplist_t array;
WMPropList *key = WMCreatePLString("Encodings");
WMPropList *array;
WMMenuItem *mi;
array = PLGetDictionaryEntry(pl, key);
PLRelease(key);
if (!array || !PLIsArray(array)) {
array = WMGetFromPLDictionary(pl, key);
WMReleasePropList(key);
if (!array || !WMIsPLArray(array)) {
msg = _("Invalid data in font information file WPrefs.app/font.data.\n"
"Encodings data not found.");
goto error;
@@ -298,46 +297,46 @@ readFontEncodings(Panel *panel)
WMAddPopUpButtonItem(panel->langP, _("- Custom -"));
for (i = 0; i < PLGetNumberOfElements(array); i++) {
proplist_t item, str;
for (i = 0; i < WMGetPropListItemCount(array); i++) {
WMPropList *item, *str;
item = PLGetArrayElement(array, i);
str = PLGetArrayElement(item, 0);
mi = WMAddPopUpButtonItem(panel->langP, PLGetString(str));
WMSetMenuItemRepresentedObject(mi, PLRetain(item));
item = WMGetFromPLArray(array, i);
str = WMGetFromPLArray(item, 0);
mi = WMAddPopUpButtonItem(panel->langP, WMGetFromPLString(str));
WMSetMenuItemRepresentedObject(mi, WMRetainPropList(item));
}
key = PLMakeString("WindowTitleFont");
DefaultWindowTitleFont = PLGetDictionaryEntry(pl, key);
PLRelease(key);
key = WMCreatePLString("WindowTitleFont");
DefaultWindowTitleFont = WMGetFromPLDictionary(pl, key);
WMReleasePropList(key);
key = PLMakeString("MenuTitleFont");
DefaultMenuTitleFont = PLGetDictionaryEntry(pl, key);
PLRelease(key);
key = WMCreatePLString("MenuTitleFont");
DefaultMenuTitleFont = WMGetFromPLDictionary(pl, key);
WMReleasePropList(key);
key = PLMakeString("MenuTextFont");
DefaultMenuTextFont = PLGetDictionaryEntry(pl, key);
PLRelease(key);
key = WMCreatePLString("MenuTextFont");
DefaultMenuTextFont = WMGetFromPLDictionary(pl, key);
WMReleasePropList(key);
}
PLRelease(pl);
WMReleasePropList(pl);
return;
error:
if (pl)
PLRelease(pl);
WMReleasePropList(pl);
WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
_("Error"), msg, _("OK"), NULL, NULL);
}
#if 0
static void
changeLanguageAction(WMWidget *w, void *data)
{
/*Panel *panel = (Panel*)data;*/
WMMenuItem *mi;
proplist_t pl;
WMPropList *pl;
mi = WMGetPopUpButtonMenuItem(w, WMGetPopUpButtonSelectedItem(w));
pl = WMGetMenuItemRepresentedObject(mi);
@@ -348,6 +347,7 @@ changeLanguageAction(WMWidget *w, void *data)
}
}
#endif
static void
-1
View File
@@ -51,6 +51,5 @@ WPrefs_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
WPrefs_LDADD = \
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.la \
@LIBPL@ \
@INTLIBS@
+71 -73
View File
@@ -947,27 +947,27 @@ freeItemData(ItemData *data)
static ItemData*
parseCommand(proplist_t item)
parseCommand(WMPropList *item)
{
ItemData *data = NEW(ItemData);
proplist_t p;
WMPropList *p;
char *command = NULL;
char *parameter = NULL;
char *shortcut = NULL;
int i = 1;
p = PLGetArrayElement(item, i++);
command = PLGetString(p);
p = WMGetFromPLArray(item, i++);
command = WMGetFromPLString(p);
if (strcmp(command, "SHORTCUT") == 0) {
p = PLGetArrayElement(item, i++);
shortcut = PLGetString(p);
p = PLGetArrayElement(item, i++);
command = PLGetString(p);
p = WMGetFromPLArray(item, i++);
shortcut = WMGetFromPLString(p);
p = WMGetFromPLArray(item, i++);
command = WMGetFromPLString(p);
}
p = PLGetArrayElement(item, i++);
p = WMGetFromPLArray(item, i++);
if (p)
parameter = PLGetString(p);
parameter = WMGetFromPLString(p);
if (strcmp(command, "EXEC") == 0 || strcmp(command, "SHEXEC") == 0) {
@@ -1438,31 +1438,31 @@ menuItemSelected(WEditMenuDelegate *delegate, WEditMenu *menu,
static WEditMenu*
buildSubmenu(_Panel *panel, proplist_t pl)
buildSubmenu(_Panel *panel, WMPropList *pl)
{
WMScreen *scr = WMWidgetScreen(panel->parent);
WEditMenu *menu;
WEditMenuItem *item;
char *title;
proplist_t tp, bp;
WMPropList *tp, *bp;
int i;
tp = PLGetArrayElement(pl, 0);
title = PLGetString(tp);
tp = WMGetFromPLArray(pl, 0);
title = WMGetFromPLString(tp);
menu = WCreateEditMenu(scr, title);
for (i = 1; i < PLGetNumberOfElements(pl); i++) {
proplist_t pi;
for (i = 1; i < WMGetPropListItemCount(pl); i++) {
WMPropList *pi;
pi = PLGetArrayElement(pl, i);
pi = WMGetFromPLArray(pl, i);
tp = PLGetArrayElement(pi, 0);
bp = PLGetArrayElement(pi, 1);
tp = WMGetFromPLArray(pi, 0);
bp = WMGetFromPLArray(pi, 1);
title = PLGetString(tp);
title = WMGetFromPLString(tp);
if (!bp || PLIsArray(bp)) { /* it's a submenu */
if (!bp || WMIsPLArray(bp)) { /* it's a submenu */
WEditMenu *submenu;
submenu = buildSubmenu(panel, pi);
@@ -1494,17 +1494,17 @@ buildSubmenu(_Panel *panel, proplist_t pl)
static void
buildMenuFromPL(_Panel *panel, proplist_t pl)
buildMenuFromPL(_Panel *panel, WMPropList *pl)
{
panel->menu = buildSubmenu(panel, pl);
}
static proplist_t
static WMPropList*
getDefaultMenu(_Panel *panel)
{
proplist_t menu, pmenu;
WMPropList *menu, *pmenu;
char *menuPath, *gspath;
gspath = wusergnusteppath();
@@ -1513,7 +1513,7 @@ getDefaultMenu(_Panel *panel)
/* if there is a localized plmenu for the tongue put it's filename here */
sprintf(menuPath, _("%s/Library/WindowMaker/plmenu"), gspath);
menu = PLGetProplistWithPath(menuPath);
menu = WMReadPropListFromFile(menuPath);
if (!menu) {
wwarning("%s:could not read property list menu", menuPath);
@@ -1521,7 +1521,7 @@ getDefaultMenu(_Panel *panel)
_("%s/Library/WindowMaker/plmenu"))!=0) {
sprintf(menuPath, "%s/Library/WindowMaker/plmenu", gspath);
menu = PLGetProplistWithPath(menuPath);
menu = WMReadPropListFromFile(menuPath);
wwarning("%s:could not read property list menu", menuPath);
}
if (!menu) {
@@ -1551,7 +1551,7 @@ showData(_Panel *panel)
{
char *gspath;
char *menuPath;
proplist_t pmenu;
WMPropList *pmenu;
gspath = wusergnusteppath();
@@ -1559,9 +1559,9 @@ showData(_Panel *panel)
strcpy(menuPath, gspath);
strcat(menuPath, "/Defaults/WMRootMenu");
pmenu = PLGetProplistWithPath(menuPath);
pmenu = WMReadPropListFromFile(menuPath);
if (!pmenu || !PLIsArray(pmenu)) {
if (!pmenu || !WMIsPLArray(pmenu)) {
int res;
res = WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
@@ -1576,7 +1576,7 @@ showData(_Panel *panel)
pmenu = getDefaultMenu(panel);
if (!pmenu) {
pmenu = PLMakeArrayFromElements(PLMakeString("Applications"),
pmenu = WMCreatePLArray(WMCreatePLString("Applications"),
NULL);
}
} else {
@@ -1589,7 +1589,7 @@ showData(_Panel *panel)
buildMenuFromPL(panel, pmenu);
PLRelease(pmenu);
WMReleasePropList(pmenu);
}
@@ -1606,21 +1606,21 @@ notblank(char *s)
}
static proplist_t
static WMPropList*
processData(char *title, ItemData *data)
{
proplist_t item;
WMPropList *item;
char *s1;
static char *pscut = NULL;
static char *pomenu = NULL;
static WMPropList *pscut = NULL;
static WMPropList *pomenu = NULL;
int i;
if (!pscut) {
pscut = PLMakeString("SHORTCUT");
pomenu = PLMakeString("OPEN_MENU");
pscut = WMCreatePLString("SHORTCUT");
pomenu = WMCreatePLString("OPEN_MENU");
}
item = PLMakeArrayFromElements(PLMakeString(title), NULL);
item = WMCreatePLArray(WMCreatePLString(title), NULL);
switch (data->type) {
@@ -1638,39 +1638,39 @@ processData(char *title, ItemData *data)
#endif
if (notblank(data->param.exec.shortcut)) {
PLAppendArrayElement(item, pscut);
PLAppendArrayElement(item,
PLMakeString(data->param.exec.shortcut));
WMAddToPLArray(item, pscut);
WMAddToPLArray(item,
WMCreatePLString(data->param.exec.shortcut));
}
PLAppendArrayElement(item, PLMakeString(s1));
PLAppendArrayElement(item, PLMakeString(data->param.exec.command));
WMAddToPLArray(item, WMCreatePLString(s1));
WMAddToPLArray(item, WMCreatePLString(data->param.exec.command));
break;
case CommandInfo:
if (notblank(data->param.command.shortcut)) {
PLAppendArrayElement(item, pscut);
PLAppendArrayElement(item,
PLMakeString(data->param.command.shortcut));
WMAddToPLArray(item, pscut);
WMAddToPLArray(item,
WMCreatePLString(data->param.command.shortcut));
}
i = data->param.command.command;
PLAppendArrayElement(item, PLMakeString(commandNames[i]));
WMAddToPLArray(item, WMCreatePLString(commandNames[i]));
switch (i) {
case 3:
case 4:
if (data->param.command.parameter) {
PLAppendArrayElement(item,
PLMakeString(data->param.command.parameter));
WMAddToPLArray(item,
WMCreatePLString(data->param.command.parameter));
}
break;
case 6: /* restart */
if (data->param.command.parameter) {
PLAppendArrayElement(item,
PLMakeString(data->param.command.parameter));
WMAddToPLArray(item,
WMCreatePLString(data->param.command.parameter));
}
break;
}
@@ -1680,17 +1680,17 @@ processData(char *title, ItemData *data)
case PipeInfo:
if (!data->param.pipe.command)
return NULL;
PLAppendArrayElement(item, pomenu);
WMAddToPLArray(item, pomenu);
s1 = wstrconcat("| ", data->param.pipe.command);
PLAppendArrayElement(item, PLMakeString(s1));
WMAddToPLArray(item, WMCreatePLString(s1));
wfree(s1);
break;
case ExternalInfo:
if (!data->param.external.path)
return NULL;
PLAppendArrayElement(item, pomenu);
PLAppendArrayElement(item, PLMakeString(data->param.external.path));
WMAddToPLArray(item, pomenu);
WMAddToPLArray(item, WMCreatePLString(data->param.external.path));
break;
case DirectoryInfo:
@@ -1705,7 +1705,7 @@ processData(char *title, ItemData *data)
l += strlen(data->param.directory.command);
l += 32;
PLAppendArrayElement(item, pomenu);
WMAddToPLArray(item, pomenu);
tmp = wmalloc(l);
sprintf(tmp, "%s%s WITH %s",
@@ -1713,17 +1713,17 @@ processData(char *title, ItemData *data)
data->param.directory.directory,
data->param.directory.command);
PLAppendArrayElement(item, PLMakeString(tmp));
WMAddToPLArray(item, WMCreatePLString(tmp));
wfree(tmp);
}
break;
case WSMenuInfo:
PLAppendArrayElement(item, PLMakeString("WORKSPACE_MENU"));
WMAddToPLArray(item, WMCreatePLString("WORKSPACE_MENU"));
break;
case WWindowListInfo:
PLAppendArrayElement(item, PLMakeString("WINDOWS_MENU"));
WMAddToPLArray(item, WMCreatePLString("WINDOWS_MENU"));
break;
default:
@@ -1735,20 +1735,20 @@ processData(char *title, ItemData *data)
}
static proplist_t
static WMPropList*
processSubmenu(WEditMenu *menu)
{
WEditMenuItem *item;
proplist_t pmenu;
proplist_t pl;
WMPropList *pmenu;
WMPropList *pl;
char *s;
int i;
s = WGetEditMenuTitle(menu);
pl = PLMakeString(s);
pl = WMCreatePLString(s);
pmenu = PLMakeArrayFromElements(pl, NULL);
pmenu = WMCreatePLArray(pl, NULL);
i = 0;
while ((item = WGetEditMenuItem(menu, i++))) {
@@ -1766,7 +1766,7 @@ processSubmenu(WEditMenu *menu)
if (!pl)
continue;
PLAppendArrayElement(pmenu, pl);
WMAddToPLArray(pmenu, pl);
}
return pmenu;
@@ -1774,10 +1774,10 @@ processSubmenu(WEditMenu *menu)
static proplist_t
static WMPropList*
buildPLFromMenu(_Panel *panel)
{
proplist_t menu;
WMPropList *menu;
menu = processSubmenu(panel->menu);
@@ -1790,18 +1790,16 @@ buildPLFromMenu(_Panel *panel)
static void
storeData(_Panel *panel)
{
proplist_t menu;
WMPropList *menu;
if (panel->dontSave)
return;
menu = buildPLFromMenu(panel);
PLSetFilename(menu, PLMakeString(panel->menuPath));
PLSave(menu, YES);
WMWritePropListToFile(menu, panel->menuPath, True);
PLRelease(menu);
WMReleasePropList(menu);
}
-1
View File
@@ -96,7 +96,6 @@ createPanel(Panel *p)
{
_Panel *panel = (_Panel*)p;
WMScreen *scr = WMWidgetScreen(panel->parent);
WMBox *hbox, *vbox;
WMPixmap *icon;
int i;
char *buf1, *buf2;
+2 -2
View File
@@ -196,8 +196,7 @@ doubleClick(WMWidget *w, void *data)
}
int
static int
getButtonAction(char *str)
{
if (!str)
@@ -217,6 +216,7 @@ getButtonAction(char *str)
}
static int
getWheelAction(char *str)
{
if (!str)
+17 -17
View File
@@ -75,11 +75,11 @@ addPathToList(WMList *list, int index, char *path)
static void
showData(_Panel *panel)
{
proplist_t array, val;
WMPropList *array, *val;
int i;
array = GetObjectForKey("IconPath");
if (!array || !PLIsArray(array)) {
if (!array || !WMIsPLArray(array)) {
if (array)
wwarning(_("bad value in option IconPath. Using default path list"));
addPathToList(panel->icoL, -1, "~/pixmaps");
@@ -89,23 +89,23 @@ showData(_Panel *panel)
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Pixmaps");
addPathToList(panel->icoL, -1, "/usr/share/WindowMaker/Icons");
} else {
for (i=0; i<PLGetNumberOfElements(array); i++) {
val = PLGetArrayElement(array, i);
addPathToList(panel->icoL, -1, PLGetString(val));
for (i=0; i<WMGetPropListItemCount(array); i++) {
val = WMGetFromPLArray(array, i);
addPathToList(panel->icoL, -1, WMGetFromPLString(val));
}
}
array = GetObjectForKey("PixmapPath");
if (!array || !PLIsArray(array)) {
if (!array || !WMIsPLArray(array)) {
if (array)
wwarning(_("bad value in option PixmapPath. Using default path list"));
addPathToList(panel->pixL, -1, "~/pixmaps");
addPathToList(panel->pixL, -1, "~/GNUstep/Library/WindowMaker/Pixmaps");
addPathToList(panel->pixL, -1, "/usr/local/share/WindowMaker/Pixmaps");
} else {
for (i=0; i<PLGetNumberOfElements(array); i++) {
val = PLGetArrayElement(array, i);
addPathToList(panel->pixL, -1, PLGetString(val));
for (i=0; i<WMGetPropListItemCount(array); i++) {
val = WMGetFromPLArray(array, i);
addPathToList(panel->pixL, -1, WMGetFromPLString(val));
}
}
}
@@ -213,24 +213,24 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
static void
storeData(_Panel *panel)
{
proplist_t list;
proplist_t tmp;
WMPropList *list;
WMPropList *tmp;
int i;
char *p;
list = PLMakeArrayFromElements(NULL, NULL);
list = WMCreatePLArray(NULL, NULL);
for (i=0; i<WMGetListNumberOfRows(panel->icoL); i++) {
p = WMGetListItem(panel->icoL, i)->text;
tmp = PLMakeString(p);
PLAppendArrayElement(list, tmp);
tmp = WMCreatePLString(p);
WMAddToPLArray(list, tmp);
}
SetObjectForKey(list, "IconPath");
list = PLMakeArrayFromElements(NULL, NULL);
list = WMCreatePLArray(NULL, NULL);
for (i=0; i<WMGetListNumberOfRows(panel->pixL); i++) {
p = WMGetListItem(panel->pixL, i)->text;
tmp = PLMakeString(p);
PLAppendArrayElement(list, tmp);
tmp = WMCreatePLString(p);
WMAddToPLArray(list, tmp);
}
SetObjectForKey(list, "PixmapPath");
}
+78 -79
View File
@@ -119,7 +119,7 @@ typedef struct _TexturePanel {
int currentType;
proplist_t pathList;
WMPropList *pathList;
} _TexturePanel;
@@ -816,11 +816,11 @@ SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action, void *clien
void
SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
SetTexturePanelTexture(TexturePanel *panel, char *name, WMPropList *texture)
{
WMScreen *scr = WMWidgetScreen(panel->win);
char *str, *type;
proplist_t p;
WMPropList *p;
WMColor *color;
int i;
char buffer[64];
@@ -831,22 +831,22 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
if (!texture)
return;
p = PLGetArrayElement(texture, 0);
p = WMGetFromPLArray(texture, 0);
if (!p) {
goto bad_texture;
}
type = PLGetString(p);
type = WMGetFromPLString(p);
/*...............................................*/
if (strcasecmp(type, "solid")==0) {
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SOLID);
p = PLGetArrayElement(texture, 1);
p = WMGetFromPLArray(texture, 1);
if (!p) {
str = "black";
} else {
str = PLGetString(p);
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
@@ -860,11 +860,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SGRADIENT);
p = PLGetArrayElement(texture, 1);
p = WMGetFromPLArray(texture, 1);
if (!p) {
str = "black";
} else {
str = PLGetString(p);
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
@@ -872,11 +872,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
WMReleaseColor(color);
p = PLGetArrayElement(texture, 2);
p = WMGetFromPLArray(texture, 2);
if (!p) {
str = "black";
} else {
str = PLGetString(p);
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
@@ -896,21 +896,21 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
gradient = type[1];
WMSetTextFieldText(panel->imageT,
PLGetString(PLGetArrayElement(texture, 1)));
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
if (panel->imageFile)
wfree(panel->imageFile);
panel->imageFile = wstrdup(PLGetString(PLGetArrayElement(texture, 1)));
panel->imageFile = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 1)));
i = 180;
sscanf(PLGetString(PLGetArrayElement(texture, 2)), "%i", &i);
sscanf(WMGetFromPLString(WMGetFromPLArray(texture, 2)), "%i", &i);
WMSetSliderValue(panel->topaS, i);
p = PLGetArrayElement(texture, 3);
p = WMGetFromPLArray(texture, 3);
if (!p) {
str = "black";
} else {
str = PLGetString(p);
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
@@ -918,11 +918,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
WMReleaseColor(color);
p = PLGetArrayElement(texture, 4);
p = WMGetFromPLArray(texture, 4);
if (!p) {
str = "black";
} else {
str = PLGetString(p);
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
@@ -931,12 +931,12 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
WMReleaseColor(color);
WMSetTextFieldText(panel->imageT,
PLGetString(PLGetArrayElement(texture, 1)));
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
if (panel->imageFile)
wfree(panel->imageFile);
if ((panel->imageFile = wfindfileinarray(panel->pathList,
PLGetString(PLGetArrayElement(texture, 1)))) != NULL) {
WMGetFromPLString(WMGetFromPLArray(texture, 1)))) != NULL) {
panel->image = RLoadImage(WMScreenRContext(scr), panel->imageFile, 0);
updateTGradImage(panel);
@@ -959,11 +959,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_GRADIENT);
p = PLGetArrayElement(texture, 1);
p = WMGetFromPLArray(texture, 1);
if (!p) {
str = "black";
} else {
str = PLGetString(p);
str = WMGetFromPLString(p);
}
color = WMCreateNamedColor(scr, str, False);
@@ -971,15 +971,15 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
WMReleaseColor(color);
for (i = 2; i < PLGetNumberOfElements(texture); i++) {
for (i = 2; i < WMGetPropListItemCount(texture); i++) {
RColor *rgb;
XColor xcolor;
p = PLGetArrayElement(texture, i);
p = WMGetFromPLArray(texture, i);
if (!p) {
str = "black";
} else {
str = PLGetString(p);
str = WMGetFromPLString(p);
}
XParseColor(WMScreenDisplay(scr), WMScreenRContext(scr)->cmap,
@@ -1023,15 +1023,15 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
}
WMSetTextFieldText(panel->imageT,
PLGetString(PLGetArrayElement(texture, 1)));
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
if (panel->imageFile)
wfree(panel->imageFile);
panel->imageFile = wfindfileinarray(panel->pathList,
PLGetString(PLGetArrayElement(texture, 1)));
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
color = WMCreateNamedColor(scr,
PLGetString(PLGetArrayElement(texture, 2)), False);
WMGetFromPLString(WMGetFromPLArray(texture, 2)), False);
WMSetColorWellColor(panel->defcW, color);
WMReleaseColor(color);
@@ -1060,7 +1060,7 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
return;
bad_texture:
str = PLGetDescription(texture);
str = WMGetPropListDescription(texture, False);
wwarning(_("error creating texture %s"), str);
wfree(str);
@@ -1076,11 +1076,10 @@ GetTexturePanelTextureName(TexturePanel *panel)
}
proplist_t
WMPropList*
GetTexturePanelTexture(TexturePanel *panel)
{
proplist_t prop = NULL;
WMPropList *prop = NULL;
WMColor *color;
char *str, *str2;
char buff[32];
@@ -1092,8 +1091,8 @@ GetTexturePanelTexture(TexturePanel *panel)
case TYPE_SOLID:
color = WMGetColorWellColor(panel->defcW);
str = WMGetColorRGBDescription(color);
prop = PLMakeArrayFromElements(PLMakeString("solid"),
PLMakeString(str), NULL);
prop = WMCreatePLArray(WMCreatePLString("solid"),
WMCreatePLString(str), NULL);
wfree(str);
break;
@@ -1104,24 +1103,24 @@ GetTexturePanelTexture(TexturePanel *panel)
switch (WMGetPopUpButtonSelectedItem(panel->arrP)) {
case PTYPE_SCALE:
prop = PLMakeArrayFromElements(PLMakeString("spixmap"),
PLMakeString(panel->imageFile),
PLMakeString(str), NULL);
prop = WMCreatePLArray(WMCreatePLString("spixmap"),
WMCreatePLString(panel->imageFile),
WMCreatePLString(str), NULL);
break;
case PTYPE_MAXIMIZE:
prop = PLMakeArrayFromElements(PLMakeString("mpixmap"),
PLMakeString(panel->imageFile),
PLMakeString(str), NULL);
prop = WMCreatePLArray(WMCreatePLString("mpixmap"),
WMCreatePLString(panel->imageFile),
WMCreatePLString(str), NULL);
break;
case PTYPE_CENTER:
prop = PLMakeArrayFromElements(PLMakeString("cpixmap"),
PLMakeString(panel->imageFile),
PLMakeString(str), NULL);
prop = WMCreatePLArray(WMCreatePLString("cpixmap"),
WMCreatePLString(panel->imageFile),
WMCreatePLString(str), NULL);
break;
case PTYPE_TILE:
prop = PLMakeArrayFromElements(PLMakeString("tpixmap"),
PLMakeString(panel->imageFile),
PLMakeString(str), NULL);
prop = WMCreatePLArray(WMCreatePLString("tpixmap"),
WMCreatePLString(panel->imageFile),
WMCreatePLString(str), NULL);
break;
}
wfree(str);
@@ -1137,23 +1136,23 @@ GetTexturePanelTexture(TexturePanel *panel)
sprintf(buff, "%i", WMGetSliderValue(panel->topaS));
if (WMGetButtonSelected(panel->dirdB)) {
prop = PLMakeArrayFromElements(PLMakeString("tdgradient"),
PLMakeString(panel->imageFile),
PLMakeString(buff),
PLMakeString(str),
PLMakeString(str2), NULL);
prop = WMCreatePLArray(WMCreatePLString("tdgradient"),
WMCreatePLString(panel->imageFile),
WMCreatePLString(buff),
WMCreatePLString(str),
WMCreatePLString(str2), NULL);
} else if (WMGetButtonSelected(panel->dirvB)) {
prop = PLMakeArrayFromElements(PLMakeString("tvgradient"),
PLMakeString(panel->imageFile),
PLMakeString(buff),
PLMakeString(str),
PLMakeString(str2), NULL);
prop = WMCreatePLArray(WMCreatePLString("tvgradient"),
WMCreatePLString(panel->imageFile),
WMCreatePLString(buff),
WMCreatePLString(str),
WMCreatePLString(str2), NULL);
} else {
prop = PLMakeArrayFromElements(PLMakeString("thgradient"),
PLMakeString(panel->imageFile),
PLMakeString(buff),
PLMakeString(str),
PLMakeString(str2), NULL);
prop = WMCreatePLArray(WMCreatePLString("thgradient"),
WMCreatePLString(panel->imageFile),
WMCreatePLString(buff),
WMCreatePLString(str),
WMCreatePLString(str2), NULL);
}
wfree(str);
wfree(str2);
@@ -1168,17 +1167,17 @@ GetTexturePanelTexture(TexturePanel *panel)
str2 = WMGetColorRGBDescription(color);
if (WMGetButtonSelected(panel->dirdB)) {
prop = PLMakeArrayFromElements(PLMakeString("dgradient"),
PLMakeString(str),
PLMakeString(str2), NULL);
prop = WMCreatePLArray(WMCreatePLString("dgradient"),
WMCreatePLString(str),
WMCreatePLString(str2), NULL);
} else if (WMGetButtonSelected(panel->dirvB)) {
prop = PLMakeArrayFromElements(PLMakeString("vgradient"),
PLMakeString(str),
PLMakeString(str2), NULL);
prop = WMCreatePLArray(WMCreatePLString("vgradient"),
WMCreatePLString(str),
WMCreatePLString(str2), NULL);
} else {
prop = PLMakeArrayFromElements(PLMakeString("hgradient"),
PLMakeString(str),
PLMakeString(str2), NULL);
prop = WMCreatePLArray(WMCreatePLString("hgradient"),
WMCreatePLString(str),
WMCreatePLString(str2), NULL);
}
wfree(str);
wfree(str2);
@@ -1189,14 +1188,14 @@ GetTexturePanelTexture(TexturePanel *panel)
str = WMGetColorRGBDescription(color);
if (WMGetButtonSelected(panel->dirdB)) {
prop = PLMakeArrayFromElements(PLMakeString("mdgradient"),
PLMakeString(str), NULL);
prop = WMCreatePLArray(WMCreatePLString("mdgradient"),
WMCreatePLString(str), NULL);
} else if (WMGetButtonSelected(panel->dirvB)) {
prop = PLMakeArrayFromElements(PLMakeString("mvgradient"),
PLMakeString(str), NULL);
prop = WMCreatePLArray(WMCreatePLString("mvgradient"),
WMCreatePLString(str), NULL);
} else {
prop = PLMakeArrayFromElements(PLMakeString("mhgradient"),
PLMakeString(str), NULL);
prop = WMCreatePLArray(WMCreatePLString("mhgradient"),
WMCreatePLString(str), NULL);
}
wfree(str);
@@ -1210,7 +1209,7 @@ GetTexturePanelTexture(TexturePanel *panel)
sprintf(buff, "#%02x%02x%02x", rgb->red, rgb->green, rgb->blue);
PLAppendArrayElement(prop, PLMakeString(buff));
WMAddToPLArray(prop, WMCreatePLString(buff));
}
break;
}
@@ -1222,7 +1221,7 @@ GetTexturePanelTexture(TexturePanel *panel)
void
SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array)
SetTexturePanelPixmapPath(TexturePanel *panel, WMPropList *array)
{
panel->pathList = array;
}
@@ -1653,7 +1652,7 @@ int main(int argc, char **argv)
SetTexturePanelCancelAction(panel,(WMAction*)testCancelButton,panel);
SetTexturePanelTexture(panel, "pinky",
PLGetProplistWithDescription("(mdgradient, pink, red, blue, yellow)"));
WMCreatePropListFromDescription("(mdgradient, pink, red, blue, yellow)"));
ShowTexturePanel(panel);
+3 -3
View File
@@ -37,12 +37,12 @@ void ShowTexturePanel(TexturePanel *panel);
void HideTexturePanel(TexturePanel *panel);
void SetTexturePanelTexture(TexturePanel *panel, char *name,
proplist_t texture);
WMPropList *texture);
char *GetTexturePanelTextureName(TexturePanel *panel);
proplist_t GetTexturePanelTexture(TexturePanel *panel);
WMPropList *GetTexturePanelTexture(TexturePanel *panel);
RImage *RenderTexturePanelTexture(TexturePanel *panel, unsigned width,
unsigned height);
@@ -53,7 +53,7 @@ void SetTexturePanelOkAction(TexturePanel *panel, WMCallback *action,
void SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action,
void *clientData);
void SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array);
void SetTexturePanelPixmapPath(TexturePanel *panel, WMPropList *array);
#endif
+63 -61
View File
@@ -96,9 +96,10 @@ typedef struct _WPrefs {
static _WPrefs WPrefs;
/* system wide defaults dictionary. Read-only */
static proplist_t GlobalDB = NULL;
static WMPropList *GlobalDB = NULL;
/* user defaults dictionary */
static proplist_t WindowMakerDB = NULL;
static WMPropList *WindowMakerDB = NULL;
static char *WindowMakerDBPath = NULL;
static Bool TIFFOK = False;
@@ -128,9 +129,9 @@ static void
save(WMWidget *w, void *data)
{
int i;
proplist_t p1, p2;
proplist_t keyList;
proplist_t key;
WMPropList *p1, *p2;
WMPropList *keyList;
WMPropList *key;
char *msg = "Reconfigure";
XEvent ev;
@@ -143,30 +144,30 @@ save(WMWidget *w, void *data)
}
/* puts("compressing data");*/
/* compare the user dictionary with the global and remove redundant data */
keyList = PLGetAllDictionaryKeys(GlobalDB);
/* puts(PLGetDescription(WindowMakerDB));*/
for (i=0; i<PLGetNumberOfElements(keyList); i++) {
key = PLGetArrayElement(keyList, i);
keyList = WMGetPLDictionaryKeys(GlobalDB);
/* puts(WMGetPropListDescription(WindowMakerDB, False));*/
for (i=0; i<WMGetPropListItemCount(keyList); i++) {
key = WMGetFromPLArray(keyList, i);
/* We don't have this value anyway, so no problem.
* Probably a new option */
p1 = PLGetDictionaryEntry(WindowMakerDB, key);
p1 = WMGetFromPLDictionary(WindowMakerDB, key);
if (!p1)
continue;
/* The global doesn't have it, so no problem either. */
p2 = PLGetDictionaryEntry(GlobalDB, key);
p2 = WMGetFromPLDictionary(GlobalDB, key);
if (!p2)
continue;
/* If both values are the same, don't save. */
if (PLIsEqual(p1, p2))
PLRemoveDictionaryEntry(WindowMakerDB, key);
if (WMIsPropListEqualTo(p1, p2))
WMRemoveFromPLDictionary(WindowMakerDB, key);
}
/* puts(PLGetDescription(WindowMakerDB));*/
PLRelease(keyList);
/* puts(WMGetPropListDescription(WindowMakerDB, False));*/
WMReleasePropList(keyList);
/* puts("storing data");*/
PLSave(WindowMakerDB, YES);
WMWritePropListToFile(WindowMakerDB, WindowMakerDBPath, True);
memset(&ev, 0, sizeof(XEvent));
@@ -738,7 +739,7 @@ GetWindow(Panel *panel)
static void
loadConfigurations(WMScreen *scr, WMWindow *mainw)
{
proplist_t db, gdb;
WMPropList *db, *gdb;
char *path;
FILE *file;
char buffer[1024];
@@ -746,11 +747,12 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
int v1, v2, v3;
path = wdefaultspathfordomain("WindowMaker");
WindowMakerDBPath = path;
db = PLGetProplistWithPath(path);
db = WMReadPropListFromFile(path);
if (db) {
if (!PLIsDictionary(db)) {
PLRelease(db);
if (!WMIsPLDictionary(db)) {
WMReleasePropList(db);
db = NULL;
sprintf(mbuf, _("Window Maker domain (%s) is corrupted!"), path);
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
@@ -760,7 +762,6 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
path);
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
}
wfree(path);
path = getenv("WMAKER_BIN_NAME");
if (!path)
@@ -827,10 +828,11 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
if (file)
pclose(file);
gdb = PLGetProplistWithPath(buffer);
gdb = WMReadPropListFromFile(buffer);
if (gdb) {
if (!PLIsDictionary(gdb)) {
PLRelease(gdb);
if (!WMIsPLDictionary(gdb)) {
WMReleasePropList(gdb);
gdb = NULL;
sprintf(mbuf, _("Window Maker domain (%s) is corrupted!"), buffer);
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
@@ -842,10 +844,10 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
}
if (!db) {
db = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
db = WMCreatePLDictionary(NULL, NULL, NULL);
}
if (!gdb) {
gdb = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
gdb = WMCreatePLDictionary(NULL, NULL, NULL);
}
GlobalDB = gdb;
@@ -854,89 +856,89 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
}
proplist_t
WMPropList*
GetObjectForKey(char *defaultName)
{
proplist_t object = NULL;
proplist_t key = PLMakeString(defaultName);
WMPropList *object = NULL;
WMPropList *key = WMCreatePLString(defaultName);
object = PLGetDictionaryEntry(WindowMakerDB, key);
object = WMGetFromPLDictionary(WindowMakerDB, key);
if (!object)
object = PLGetDictionaryEntry(GlobalDB, key);
object = WMGetFromPLDictionary(GlobalDB, key);
PLRelease(key);
WMReleasePropList(key);
return object;
}
void
SetObjectForKey(proplist_t object, char *defaultName)
SetObjectForKey(WMPropList *object, char *defaultName)
{
proplist_t key = PLMakeString(defaultName);
WMPropList *key = WMCreatePLString(defaultName);
PLInsertDictionaryEntry(WindowMakerDB, key, object);
PLRelease(key);
WMPutInPLDictionary(WindowMakerDB, key, object);
WMReleasePropList(key);
}
void
RemoveObjectForKey(char *defaultName)
{
proplist_t key = PLMakeString(defaultName);
WMPropList *key = WMCreatePLString(defaultName);
PLRemoveDictionaryEntry(WindowMakerDB, key);
WMRemoveFromPLDictionary(WindowMakerDB, key);
PLRelease(key);
WMReleasePropList(key);
}
char*
GetStringForKey(char *defaultName)
{
proplist_t val;
WMPropList *val;
val = GetObjectForKey(defaultName);
if (!val)
return NULL;
if (!PLIsString(val))
if (!WMIsPLString(val))
return NULL;
return PLGetString(val);
return WMGetFromPLString(val);
}
proplist_t
WMPropList*
GetArrayForKey(char *defaultName)
{
proplist_t val;
WMPropList *val;
val = GetObjectForKey(defaultName);
if (!val)
return NULL;
if (!PLIsArray(val))
if (!WMIsPLArray(val))
return NULL;
return val;
}
proplist_t
WMPropList*
GetDictionaryForKey(char *defaultName)
{
proplist_t val;
WMPropList *val;
val = GetObjectForKey(defaultName);
if (!val)
return NULL;
if (!PLIsDictionary(val))
if (!WMIsPLDictionary(val))
return NULL;
return val;
@@ -946,7 +948,7 @@ GetDictionaryForKey(char *defaultName)
int
GetIntegerForKey(char *defaultName)
{
proplist_t val;
WMPropList *val;
char *str;
int value;
@@ -955,10 +957,10 @@ GetIntegerForKey(char *defaultName)
if (!val)
return 0;
if (!PLIsString(val))
if (!WMIsPLString(val))
return 0;
str = PLGetString(val);
str = WMGetFromPLString(val);
if (!str)
return 0;
@@ -996,14 +998,14 @@ GetBoolForKey(char *defaultName)
void
SetIntegerForKey(int value, char *defaultName)
{
proplist_t object;
WMPropList *object;
char buffer[128];
sprintf(buffer, "%i", value);
object = PLMakeString(buffer);
object = WMCreatePLString(buffer);
SetObjectForKey(object, defaultName);
PLRelease(object);
WMReleasePropList(object);
}
@@ -1011,23 +1013,23 @@ SetIntegerForKey(int value, char *defaultName)
void
SetStringForKey(char *value, char *defaultName)
{
proplist_t object;
WMPropList *object;
object = PLMakeString(value);
object = WMCreatePLString(value);
SetObjectForKey(object, defaultName);
PLRelease(object);
WMReleasePropList(object);
}
void
SetBoolForKey(Bool value, char *defaultName)
{
static proplist_t yes = NULL, no = NULL;
static WMPropList *yes = NULL, *no = NULL;
if (!yes) {
yes = PLMakeString("YES");
no = PLMakeString("NO");
yes = WMCreatePLString("YES");
no = WMCreatePLString("NO");
}
SetObjectForKey(value ? yes : no, defaultName);
+2 -4
View File
@@ -30,8 +30,6 @@
#include <X11/Xlib.h>
#include <proplist.h>
#include <wraster.h>
#include <WINGs/WINGs.h>
@@ -85,9 +83,9 @@ WMWindow *GetWindow(Panel *panel);
/* manipulate the dictionary for the WindowMaker domain */
proplist_t GetObjectForKey(char *defaultName);
WMPropList *GetObjectForKey(char *defaultName);
void SetObjectForKey(proplist_t object, char *defaultName);
void SetObjectForKey(WMPropList *object, char *defaultName);
void RemoveObjectForKey(char *defaultName);
+7 -7
View File
@@ -148,7 +148,7 @@ static void
showData(_Panel *panel)
{
char *str;
proplist_t arr;
WMPropList *arr;
int x, y;
str = GetStringForKey("WindowPlacement");
@@ -159,12 +159,12 @@ showData(_Panel *panel)
x = 0;
y = 0;
if (arr && (!PLIsArray(arr) || PLGetNumberOfElements(arr)!=2)) {
if (arr && (!WMIsPLArray(arr) || WMGetPropListItemCount(arr)!=2)) {
wwarning(_("invalid data in option WindowPlaceOrigin. Using default (0,0)"));
} else {
if (arr) {
x = atoi(PLGetString(PLGetArrayElement(arr, 0)));
y = atoi(PLGetString(PLGetArrayElement(arr, 1)));
x = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 0)));
y = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 1)));
}
}
@@ -195,7 +195,7 @@ showData(_Panel *panel)
static void
storeData(_Panel *panel)
{
proplist_t arr;
WMPropList *arr;
char x[16], y[16];
SetBoolForKey(WMGetButtonSelected(panel->miconB), "NoWindowOverIcons");
@@ -206,11 +206,11 @@ storeData(_Panel *panel)
"WindowPlacement");
sprintf(x, "%i", WMGetSliderValue(panel->hsli));
sprintf(y, "%i", WMGetSliderValue(panel->vsli));
arr = PLMakeArrayFromElements(PLMakeString(x), PLMakeString(y), NULL);
arr = WMCreatePLArray(WMCreatePLString(x), WMCreatePLString(y), NULL);
SetObjectForKey(arr, "WindowPlaceOrigin");
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
SetBoolForKey(WMGetButtonSelected(panel->resrB), "Attraction");
PLRelease(arr);
WMReleasePropList(arr);
}
+1 -16
View File
@@ -53,21 +53,6 @@ wAbort(Bool foo)
}
static 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;
}
static void
print_help(char *progname)
{
@@ -177,7 +162,7 @@ main(int argc, char **argv)
exit(0);
}
PLSetStringCmpHook(stringCompareHook);
WMPLSetCaseSensitive(False);
Initialize(scr);
-34
View File
@@ -24,40 +24,6 @@ CPPFLAGS="$CPPFLAGS_old"
])
dnl
dnl WM_CHECK_PROPLIST_VERSION(MIN_VERSION, [ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]])
dnl
AC_DEFUN(WM_CHECK_PROPLIST_VERSION,
[
CPPFLAGS_old="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $inc_search_path"
lPL_major_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
lPL_minor_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
lPL_micro_version=`echo $1 | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
AC_MSG_CHECKING([whether libPropList is newer than $1])
AC_CACHE_VAL(ac_cv_lib_proplist_version_ok,
[AC_TRY_LINK(
[/* Test version of libPropList we have */
#include <proplist.h>
#if !defined(PROPLIST_VERSION) || PROPLIST_VERSION < $lPL_major_version*10000 + $lPL_minor_version*100 + $lPL_micro_version
#error libPropList on this system is too old. Consider upgrading to at least $1
#endif
], [],
eval "ac_cv_lib_proplist_version_ok=yes",
eval "ac_cv_lib_proplist_version_ok=no")])
if eval "test \"`echo '$ac_cv_lib_proplist_version_ok'`\" = yes"; then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
ifelse([$3], , , [$3
])dnl
fi
CPPFLAGS="$CPPFLAGS_old"
])
dnl
dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
dnl
+3 -56
View File
@@ -15,7 +15,7 @@ AC_INIT(src/WindowMaker.h)
AM_INIT_AUTOMAKE(WindowMaker, 0.66.0)
AM_INIT_AUTOMAKE(WindowMaker, 0.70.0)
AM_PROG_LIBTOOL
@@ -506,59 +506,6 @@ dnl ===================================
#
dnl Check for libPropList
dnl =====================
LIBPL=""
WM_CHECK_LIB(PropList, PLGetString, $X_EXTRA_LIBS)
if test "x$ac_cv_lib_PropList_PLGetString" = xyes; then
WM_CHECK_HEADER(proplist.h)
if test "x$ac_cv_header_proplist_h" = xyes; then
LIBPL="-lPropList"
fi
fi
if test "x$LIBPL" = "x"; then
echo
echo "ERROR!!! libPropList is not installed, or could not be found."
echo " Window Maker requires libPropList to build."
echo " Please read INSTALL to find where you can find libPropList,"
echo " and install it first."
if test x$host_os = xlinux; then
echo " If you're using some prepackaged version of libPropList,"
echo " make sure you install it's \"development\" package as well."
fi
echo " If you already have it installed, try using the"
if test "x$ac_cv_lib_PropList_PLGetString" != xyes; then
echo " --with-libs-from flag to tell configure where the library"
echo " is installed and"
fi
echo " --with-incs-from flag to tell configure where the header"
echo " files are installed"
exit 1
fi
lPLVersion="0.10.1"
WM_CHECK_PROPLIST_VERSION($lPLVersion, goodlPL=yes, goodlPL=no)
if test "$goodlPL" = no; then
echo
echo "ERROR!!! libPropList is an old version. Please consider upgrading"
echo " to at least version ${lPLVersion}. Older versions have bugs that"
echo " may cause Window Maker to crash randomly."
echo " If your libPropList is older than 0.9.2 it will also prevent"
echo " Window Maker from compiling because new functions were"
echo " introduced since that version."
echo " Please read INSTALL to find where you can find libPropList,"
echo " and upgrade it before you proceed."
exit 1
fi
AC_SUBST(LIBPL)
dnl ==============================================
dnl Graphic Format Libraries
dnl ==============================================
@@ -937,7 +884,7 @@ exec_prefix=\$prefix
WCFLAGS="-I\$prefix/include $inc_search_path"
WLFLAGS="-L\$exec_prefix/lib $lib_search_path"
WLIBS="-lWINGs -lwraster $GFXLIBS $XLIBS -lm $NETLIBS -lPropList"
WLIBS="-lWINGs -lwraster $GFXLIBS $XLIBS -lm $NETLIBS"
usage="Usage: get-wings-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
@@ -976,7 +923,7 @@ exec_prefix=\$prefix
WCFLAGS="-I\$prefix/include $inc_search_path"
WLFLAGS="-L\$exec_prefix/lib $lib_search_path"
WLIBS="-lWUtil $NETLIBS -lPropList"
WLIBS="-lWUtil $NETLIBS"
usage="Usage: get-wutil-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
+3 -56
View File
@@ -15,7 +15,7 @@ AC_INIT(src/WindowMaker.h)
AM_INIT_AUTOMAKE(WindowMaker, 0.66.0)
AM_INIT_AUTOMAKE(WindowMaker, 0.70.0)
AM_PROG_LIBTOOL
@@ -506,59 +506,6 @@ dnl ===================================
#
dnl Check for libPropList
dnl =====================
LIBPL=""
WM_CHECK_LIB(PropList, PLGetString, $X_EXTRA_LIBS)
if test "x$ac_cv_lib_PropList_PLGetString" = xyes; then
WM_CHECK_HEADER(proplist.h)
if test "x$ac_cv_header_proplist_h" = xyes; then
LIBPL="-lPropList"
fi
fi
if test "x$LIBPL" = "x"; then
echo
echo "ERROR!!! libPropList is not installed, or could not be found."
echo " Window Maker requires libPropList to build."
echo " Please read INSTALL to find where you can find libPropList,"
echo " and install it first."
if test x$host_os = xlinux; then
echo " If you're using some prepackaged version of libPropList,"
echo " make sure you install it's \"development\" package as well."
fi
echo " If you already have it installed, try using the"
if test "x$ac_cv_lib_PropList_PLGetString" != xyes; then
echo " --with-libs-from flag to tell configure where the library"
echo " is installed and"
fi
echo " --with-incs-from flag to tell configure where the header"
echo " files are installed"
exit 1
fi
lPLVersion="0.10.1"
WM_CHECK_PROPLIST_VERSION($lPLVersion, goodlPL=yes, goodlPL=no)
if test "$goodlPL" = no; then
echo
echo "ERROR!!! libPropList is an old version. Please consider upgrading"
echo " to at least version ${lPLVersion}. Older versions have bugs that"
echo " may cause Window Maker to crash randomly."
echo " If your libPropList is older than 0.9.2 it will also prevent"
echo " Window Maker from compiling because new functions were"
echo " introduced since that version."
echo " Please read INSTALL to find where you can find libPropList,"
echo " and upgrade it before you proceed."
exit 1
fi
AC_SUBST(LIBPL)
dnl ==============================================
dnl Graphic Format Libraries
dnl ==============================================
@@ -937,7 +884,7 @@ exec_prefix=\$prefix
WCFLAGS="-I\$prefix/include $inc_search_path"
WLFLAGS="-L\$exec_prefix/lib $lib_search_path"
WLIBS="-lWINGs -lwraster $GFXLIBS $XLIBS -lm $NETLIBS -lPropList"
WLIBS="-lWINGs -lwraster $GFXLIBS $XLIBS -lm $NETLIBS"
usage="Usage: get-wings-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
@@ -976,7 +923,7 @@ exec_prefix=\$prefix
WCFLAGS="-I\$prefix/include $inc_search_path"
WLFLAGS="-L\$exec_prefix/lib $lib_search_path"
WLIBS="-lWUtil $NETLIBS -lPropList"
WLIBS="-lWUtil $NETLIBS"
usage="Usage: get-wutil-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
+163 -14
View File
@@ -1,7 +1,7 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# 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
@@ -18,11 +18,37 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
-h|--h|--he|--hel|--help)
@@ -35,19 +61,24 @@ error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison touch file \`y.tab.c'
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc touch file \`y.tab.c'"
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing - GNU libit 0.0"
echo "missing 0.3 - GNU automake"
;;
-*)
@@ -59,7 +90,7 @@ Supported PROGRAM values:
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`configure.in'. You might want
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
@@ -68,7 +99,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`configure.in'. You might want to install the
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
@@ -77,21 +108,31 @@ WARNING: \`$1' is missing on your system. You should only need it if
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`configure.in'. You might want
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
touch config.h.in
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print \
| sed 's/^\(.*\).am$/touch \1.in/' \
| sh
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
bison|yacc)
@@ -100,10 +141,79 @@ WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
touch y.tab.c
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
# We have makeinfo, but it failed.
exit 1
fi
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -119,6 +229,45 @@ WARNING: \`$1' is missing on your system. You should only need it if
touch $file
;;
tar)
shift
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
fi
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar ${1+"$@"} && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar ${1+"$@"} && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" ${1+"$@"} && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" ${1+"$@"} && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
-15
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"
-2
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@
-1
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;
+17 -18
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)
+211 -227
View File
File diff suppressed because it is too large Load Diff
+5 -5
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);
+11 -12
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;
+157 -157
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;
}
+4 -4
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);
+1 -3
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);
+1
View File
@@ -48,6 +48,7 @@
#include "funcs.h"
#include "actions.h"
#include "stacking.h"
#include "client.h"
#include "gnome.h"
+3 -3
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];
+48 -48
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
+1 -1
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 */
+11 -11
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;
+3 -20
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;
-491
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;
}
+33 -32
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);
+30 -33
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);
}
+2 -2
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;
+148 -156
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 */
+38 -39
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;
}
+134 -139
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);
}
+100 -104
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);
}
+31 -34
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,
+1 -1
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);
+6 -6
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;
+9 -10
View File
@@ -18,40 +18,39 @@ INCLUDES = $(DFLAGS) -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib \
# X_EXTRA_LIBS is for libproplist in systems that need -lsocket
# remove after we require lPL 0.10.2 which automatically resolves its
# library dependancies using the libPropList.la file
liblist= @LIBRARY_SEARCH_PATH@ @LIBPL@ @X_EXTRA_LIBS@
liblist= @LIBRARY_SEARCH_PATH@ @X_EXTRA_LIBS@
wdwrite_LDADD = $(liblist)
wdwrite_LDADD = $(top_builddir)/WINGs/libWUtil.a $(liblist)
wdread_LDADD = $(liblist)
wdread_LDADD = $(top_builddir)/WINGs/libWUtil.a $(liblist)
wxcopy_LDADD = @XLFLAGS@ @XLIBS@
wxpaste_LDADD = @XLFLAGS@ @XLIBS@
getstyle_LDADD = $(liblist)
getstyle_LDADD = $(top_builddir)/WINGs/libWUtil.a $(liblist)
setstyle_LDADD = @XLFLAGS@ @XLIBS@ $(liblist)
setstyle_LDADD = \
$(top_builddir)/WINGs/libWUtil.a \
@XLFLAGS@ @XLIBS@ $(liblist)
seticons_LDADD= $(liblist)
seticons_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
geticonset_LDADD= $(liblist)
geticonset_LDADD= $(top_builddir)/WINGs/libWUtil.a $(liblist)
wmagnify_LDADD = \
$(top_builddir)/WINGs/libWINGs.a \
$(top_builddir)/wrlib/libwraster.la \
@LIBPL@ \
@DLLIBS@
wmsetup_LDADD = \
$(top_builddir)/WINGs/libWINGs.a \
$(top_builddir)/wrlib/libwraster.la \
@LIBPL@ \
@DLLIBS@
wmsetbg_LDADD = \
$(top_builddir)/WINGs/libWINGs.a \
$(top_builddir)/wrlib/libwraster.la \
@LIBPL@ \
@DLLIBS@
CLEANFILES = wmaker.inst wmchlocale
+19 -22
View File
@@ -25,9 +25,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <proplist.h>
#include <string.h>
#include <WINGs/WUtil.h>
#include "../src/wconfig.h"
@@ -77,9 +78,8 @@ print_help()
int
main(int argc, char **argv)
{
proplist_t window_name, icon_key, window_attrs, icon_value;
proplist_t all_windows, iconset;
proplist_t keylist;
WMPropList *window_name, *icon_key, *window_attrs, *icon_value;
WMPropList *all_windows, *iconset, *keylist;
char *path;
int i;
@@ -99,46 +99,43 @@ main(int argc, char **argv)
path = defaultsPathForDomain("WMWindowAttributes");
all_windows = PLGetProplistWithPath(path);
all_windows = WMReadPropListFromFile(path);
if (!all_windows) {
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
ProgName, path);
exit(1);
}
iconset = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
iconset = WMCreatePLDictionary(NULL, NULL, NULL);
keylist = PLGetAllDictionaryKeys(all_windows);
icon_key = PLMakeString("Icon");
keylist = WMGetPLDictionaryKeys(all_windows);
icon_key = WMCreatePLString("Icon");
for (i=0; i<PLGetNumberOfElements(keylist); i++) {
proplist_t icondic;
for (i=0; i<WMGetPropListItemCount(keylist); i++) {
WMPropList *icondic;
window_name = PLGetArrayElement(keylist, i);
if (!PLIsString(window_name))
window_name = WMGetFromPLArray(keylist, i);
if (!WMIsPLString(window_name))
continue;
window_attrs = PLGetDictionaryEntry(all_windows, window_name);
if (window_attrs && PLIsDictionary(window_attrs)) {
icon_value = PLGetDictionaryEntry(window_attrs, icon_key);
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
if (window_attrs && WMIsPLDictionary(window_attrs)) {
icon_value = WMGetFromPLDictionary(window_attrs, icon_key);
if (icon_value) {
icondic = PLMakeDictionaryFromEntries(icon_key, icon_value,
icondic = WMCreatePLDictionary(icon_key, icon_value,
NULL);
PLInsertDictionaryEntry(iconset, window_name, icondic);
WMPutInPLDictionary(iconset, window_name, icondic);
}
}
}
if (argc==2) {
proplist_t val;
val = PLMakeString(argv[1]);
PLSetFilename(iconset, val);
PLSave(iconset, NO);
WMWritePropListToFile(iconset, argv[1], False);
} else {
puts(PLGetDescriptionIndent(iconset, 0));
puts(WMGetPropListDescription(iconset, True));
}
exit(0);
}
+72 -89
View File
@@ -27,13 +27,13 @@
#include <stdlib.h>
#include <stdio.h>
#include <proplist.h>
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <pwd.h>
#include <limits.h>
#include <assert.h>
#include <WINGs/WUtil.h>
#ifndef PATH_MAX
#define PATH_MAX 1024
@@ -106,7 +106,7 @@ static char *theme_options[] = {
char *ProgName;
proplist_t PixmapPath = NULL;
WMPropList *PixmapPath = NULL;
char *ThemePath = NULL;
@@ -164,21 +164,6 @@ defaultsPathForDomain(char *domain)
}
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;
}
void
abortar(char *reason)
{
@@ -226,7 +211,7 @@ wgethomedir()
void*
wmalloc(int size)
mymalloc(int size)
{
void *tmp;
@@ -240,11 +225,11 @@ wmalloc(int size)
char*
wstrdup(char *str)
mystrdup(char *str)
{
char *tmp;
tmp = wmalloc(strlen(str)+1);
tmp = mymalloc(strlen(str)+1);
strcpy(tmp, str);
@@ -355,13 +340,13 @@ wexpandpath(char *path)
}
}
return wstrdup(buffer);
return mystrdup(buffer);
}
char*
wfindfileinarray(proplist_t paths, char *file)
wfindfileinarray(WMPropList *paths, char *file)
{
int i;
char *path;
@@ -371,8 +356,8 @@ wfindfileinarray(proplist_t paths, char *file)
if (!file)
return NULL;
if (*file=='/' || *file=='~' || !paths || !PLIsArray(paths)
|| PLGetNumberOfElements(paths)==0) {
if (*file=='/' || *file=='~' || !paths || !WMIsPLArray(paths)
|| WMGetPropListItemCount(paths)==0) {
if (access(file, R_OK)<0) {
fullpath = wexpandpath(file);
if (!fullpath)
@@ -385,21 +370,21 @@ wfindfileinarray(proplist_t paths, char *file)
return fullpath;
}
} else {
return wstrdup(file);
return mystrdup(file);
}
}
flen = strlen(file);
for (i=0; i < PLGetNumberOfElements(paths); i++) {
proplist_t tmp;
for (i=0; i < WMGetPropListItemCount(paths); i++) {
WMPropList *tmp;
char *dir;
tmp = PLGetArrayElement(paths, i);
if (!PLIsString(tmp) || !(dir = PLGetString(tmp)))
tmp = WMGetFromPLArray(paths, i);
if (!WMIsPLString(tmp) || !(dir = WMGetFromPLString(tmp)))
continue;
len = strlen(dir);
path = wmalloc(len+flen+2);
path = mymalloc(len+flen+2);
path = memcpy(path, dir, len);
path[len]=0;
strcat(path, "/");
@@ -451,21 +436,21 @@ findCopyFile(char *dir, char *file)
char*
makeThemePack(proplist_t style, char *themeName)
makeThemePack(WMPropList *style, char *themeName)
{
proplist_t keys;
proplist_t key;
proplist_t value;
WMPropList *keys;
WMPropList *key;
WMPropList *value;
int i;
char *themeDir;
themeDir = wmalloc(strlen(themeName)+50);
themeDir = mymalloc(strlen(themeName)+50);
sprintf(themeDir, "%s.themed", themeName);
ThemePath = themeDir;
{
char *tmp;
tmp = wmalloc(strlen(themeDir)+20);
tmp = mymalloc(strlen(themeDir)+20);
sprintf(tmp, "/bin/mkdir \"%s\"", themeDir);
if (system(tmp)!=0) {
printf("%s: could not create directory %s. Probably there's already a theme with that name in this directory.\n", ProgName, themeDir);
@@ -473,18 +458,18 @@ makeThemePack(proplist_t style, char *themeName)
}
free(tmp);
}
keys = PLGetAllDictionaryKeys(style);
keys = WMGetPLDictionaryKeys(style);
for (i = 0; i < PLGetNumberOfElements(keys); i++) {
key = PLGetArrayElement(keys, i);
for (i = 0; i < WMGetPropListItemCount(keys); i++) {
key = WMGetFromPLArray(keys, i);
value = PLGetDictionaryEntry(style, key);
if (value && PLIsArray(value) && PLGetNumberOfElements(value) > 2) {
proplist_t type;
value = WMGetFromPLDictionary(style, key);
if (value && WMIsPLArray(value) && WMGetPropListItemCount(value) > 2) {
WMPropList *type;
char *t;
type = PLGetArrayElement(value, 0);
t = PLGetString(type);
type = WMGetFromPLArray(value, 0);
t = WMGetFromPLString(type);
if (t == NULL)
continue;
@@ -495,55 +480,55 @@ makeThemePack(proplist_t style, char *themeName)
|| strcasecmp(t, "tdgradient")==0
|| strcasecmp(t, "tvgradient")==0
|| strcasecmp(t, "thgradient")==0) {
proplist_t file;
WMPropList *file;
char *p;
char *newPath;
file = PLGetArrayElement(value, 1);
file = WMGetFromPLArray(value, 1);
p = strrchr(PLGetString(file), '/');
p = strrchr(WMGetFromPLString(file), '/');
if (p) {
copyFile(themeDir, PLGetString(file));
copyFile(themeDir, WMGetFromPLString(file));
newPath = wstrdup(p+1);
PLRemoveArrayElement(value, 1);
PLInsertArrayElement(value, PLMakeString(newPath), 1);
newPath = mystrdup(p+1);
WMDeleteFromPLArray(value, 1);
WMInsertInPLArray(value, 1, WMCreatePLString(newPath));
free(newPath);
} else {
findCopyFile(themeDir, PLGetString(file));
findCopyFile(themeDir, WMGetFromPLString(file));
}
} else if (strcasecmp(t, "bitmap")==0) {
proplist_t file;
WMPropList *file;
char *p;
char *newPath;
file = PLGetArrayElement(value, 1);
file = WMGetFromPLArray(value, 1);
p = strrchr(PLGetString(file), '/');
p = strrchr(WMGetFromPLString(file), '/');
if (p) {
copyFile(themeDir, PLGetString(file));
copyFile(themeDir, WMGetFromPLString(file));
newPath = wstrdup(p+1);
PLRemoveArrayElement(value, 1);
PLInsertArrayElement(value, PLMakeString(newPath), 1);
newPath = mystrdup(p+1);
WMDeleteFromPLArray(value, 1);
WMInsertInPLArray(value, 1, WMCreatePLString(newPath));
free(newPath);
} else {
findCopyFile(themeDir, PLGetString(file));
findCopyFile(themeDir, WMGetFromPLString(file));
}
file = PLGetArrayElement(value, 2);
file = WMGetFromPLArray(value, 2);
p = strrchr(PLGetString(file), '/');
p = strrchr(WMGetFromPLString(file), '/');
if (p) {
copyFile(themeDir, PLGetString(file));
copyFile(themeDir, WMGetFromPLString(file));
newPath = wstrdup(p+1);
PLRemoveArrayElement(value, 2);
PLInsertArrayElement(value, PLMakeString(newPath), 2);
newPath = mystrdup(p+1);
WMDeleteFromPLArray(value, 2);
WMInsertInPLArray(value, 2, WMCreatePLString(newPath));
free(newPath);
} else {
findCopyFile(themeDir, PLGetString(file));
findCopyFile(themeDir, WMGetFromPLString(file));
}
}
}
@@ -556,7 +541,7 @@ makeThemePack(proplist_t style, char *themeName)
int
main(int argc, char **argv)
{
proplist_t prop, style, key, val;
WMPropList *prop, *style, *key, *val;
char *path;
int i, theme_too=0;
int make_pack = 0;
@@ -597,11 +582,11 @@ main(int argc, char **argv)
exit(1);
}
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
path = defaultsPathForDomain("WindowMaker");
prop = PLGetProplistWithPath(path);
prop = WMReadPropListFromFile(path);
if (!prop) {
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
ProgName, path);
@@ -610,36 +595,36 @@ main(int argc, char **argv)
/* get global value */
path = globalDefaultsPathForDomain("WindowMaker");
val = PLGetProplistWithPath(path);
val = WMReadPropListFromFile(path);
if (val) {
PLMergeDictionaries(val, prop);
PLRelease(prop);
WMMergePLDictionaries(val, prop);
WMReleasePropList(prop);
prop = val;
}
style = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
style = WMCreatePLDictionary(NULL, NULL, NULL);
for (i=0; options[i]!=NULL; i++) {
key = PLMakeString(options[i]);
key = WMCreatePLString(options[i]);
val = PLGetDictionaryEntry(prop, key);
val = WMGetFromPLDictionary(prop, key);
if (val)
PLInsertDictionaryEntry(style, key, val);
WMPutInPLDictionary(style, key, val);
}
val = PLGetDictionaryEntry(prop, PLMakeString("PixmapPath"));
val = WMGetFromPLDictionary(prop, WMCreatePLString("PixmapPath"));
if (val)
PixmapPath = val;
if (theme_too) {
for (i=0; theme_options[i]!=NULL; i++) {
key = PLMakeString(theme_options[i]);
key = WMCreatePLString(theme_options[i]);
val = PLGetDictionaryEntry(prop, key);
val = WMGetFromPLDictionary(prop, key);
if (val)
PLInsertDictionaryEntry(style, key, val);
}
WMPutInPLDictionary(style, key, val);
}
}
if (make_pack) {
@@ -647,18 +632,16 @@ main(int argc, char **argv)
makeThemePack(style, style_file);
path = wmalloc(strlen(ThemePath)+32);
path = mymalloc(strlen(ThemePath)+32);
strcpy(path, ThemePath);
strcat(path, "/style");
PLSetFilename(style, PLMakeString(path));
PLSave(style, NO);
WMWritePropListToFile(style, path, False);
wfree(path);
} else {
if (style_file) {
val = PLMakeString(style_file);
PLSetFilename(style, val);
PLSave(style, NO);
WMWritePropListToFile(style, style_file, False);
} else {
puts(PLGetDescriptionIndent(style, 0));
puts(WMGetPropListDescription(style, True));
}
}
exit(0);
+17 -19
View File
@@ -25,9 +25,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <proplist.h>
#include <string.h>
#include <WINGs/WUtil.h>
#include "../src/wconfig.h"
@@ -77,9 +76,8 @@ print_help()
int
main(int argc, char **argv)
{
proplist_t window_name, icon_key, window_attrs, icon_value;
proplist_t all_windows, iconset;
proplist_t keylist;
WMPropList *window_name, *icon_key, *window_attrs, *icon_value;
WMPropList *all_windows, *iconset, *keylist;
int i;
char *path = NULL;
@@ -111,43 +109,43 @@ main(int argc, char **argv)
path = defaultsPathForDomain("WMWindowAttributes");
all_windows = PLGetProplistWithPath(path);
all_windows = WMReadPropListFromFile(path);
if (!all_windows) {
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
ProgName, path);
exit(1);
}
iconset = PLGetProplistWithPath(argv[1]);
iconset = WMReadPropListFromFile(argv[1]);
if (!iconset) {
printf("%s:could not load icon set file \"%s\".\n", ProgName, argv[1]);
exit(1);
}
keylist = PLGetAllDictionaryKeys(iconset);
icon_key = PLMakeString("Icon");
keylist = WMGetPLDictionaryKeys(iconset);
icon_key = WMCreatePLString("Icon");
for (i=0; i<PLGetNumberOfElements(keylist); i++) {
window_name = PLGetArrayElement(keylist, i);
if (!PLIsString(window_name))
for (i=0; i<WMGetPropListItemCount(keylist); i++) {
window_name = WMGetFromPLArray(keylist, i);
if (!WMIsPLString(window_name))
continue;
icon_value = PLGetDictionaryEntry(iconset, window_name);
if (!icon_value || !PLIsDictionary(icon_value))
icon_value = WMGetFromPLDictionary(iconset, window_name);
if (!icon_value || !WMIsPLDictionary(icon_value))
continue;
window_attrs = PLGetDictionaryEntry(all_windows, window_name);
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
if (window_attrs) {
if (PLIsDictionary(window_attrs)) {
PLMergeDictionaries(window_attrs, icon_value);
if (WMIsPLDictionary(window_attrs)) {
WMMergePLDictionaries(window_attrs, icon_value);
}
} else {
PLInsertDictionaryEntry(all_windows, window_name, icon_value);
WMPutInPLDictionary(all_windows, window_name, icon_value);
}
}
PLSave(all_windows, YES);
WMWritePropListToFile(all_windows, path, True);
exit(0);
}
+90 -108
View File
@@ -25,13 +25,13 @@
#include <stdlib.h>
#include <stdio.h>
#include <proplist.h>
#include <sys/stat.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <WINGs/WUtil.h>
#include "../src/wconfig.h"
@@ -76,7 +76,7 @@ Display *dpy;
proplist_t readBlackBoxStyle(char *path);
WMPropList *readBlackBoxStyle(char *path);
@@ -112,14 +112,14 @@ defaultsPathForDomain(char *domain)
void
hackPathInTexture(proplist_t texture, char *prefix)
hackPathInTexture(WMPropList *texture, char *prefix)
{
proplist_t type;
WMPropList *type;
char *t;
/* get texture type */
type = PLGetArrayElement(texture, 0);
t = PLGetString(type);
type = WMGetFromPLArray(texture, 0);
t = WMGetFromPLString(type);
if (t == NULL)
return;
if (strcasecmp(t, "tpixmap")==0
@@ -129,64 +129,64 @@ hackPathInTexture(proplist_t texture, char *prefix)
|| strcasecmp(t, "tvgradient")==0
|| strcasecmp(t, "thgradient")==0
|| strcasecmp(t, "tdgradient")==0) {
proplist_t file;
WMPropList *file;
char buffer[4018];
/* get pixmap file path */
file = PLGetArrayElement(texture, 1);
sprintf(buffer, "%s/%s", prefix, PLGetString(file));
file = WMGetFromPLArray(texture, 1);
sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
/* replace path with full path */
PLRemoveArrayElement(texture, 1);
PLInsertArrayElement(texture, PLMakeString(buffer), 1);
WMDeleteFromPLArray(texture, 1);
WMInsertInPLArray(texture, 1, WMCreatePLString(buffer));
} else if (strcasecmp(t, "bitmap") == 0) {
proplist_t file;
WMPropList *file;
char buffer[4018];
/* get bitmap file path */
file = PLGetArrayElement(texture, 1);
sprintf(buffer, "%s/%s", prefix, PLGetString(file));
file = WMGetFromPLArray(texture, 1);
sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
/* replace path with full path */
PLRemoveArrayElement(texture, 1);
PLInsertArrayElement(texture, PLMakeString(buffer), 1);
WMDeleteFromPLArray(texture, 1);
WMInsertInPLArray(texture, 1, WMCreatePLString(buffer));
/* get mask file path */
file = PLGetArrayElement(texture, 2);
sprintf(buffer, "%s/%s", prefix, PLGetString(file));
file = WMGetFromPLArray(texture, 2);
sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
/* replace path with full path */
PLRemoveArrayElement(texture, 2);
PLInsertArrayElement(texture, PLMakeString(buffer), 2);
WMDeleteFromPLArray(texture, 2);
WMInsertInPLArray(texture, 2, WMCreatePLString(buffer));
}
}
void
hackPaths(proplist_t style, char *prefix)
hackPaths(WMPropList *style, char *prefix)
{
proplist_t keys;
proplist_t key;
proplist_t value;
WMPropList *keys;
WMPropList *key;
WMPropList *value;
int i;
keys = PLGetAllDictionaryKeys(style);
keys = WMGetPLDictionaryKeys(style);
for (i = 0; i < PLGetNumberOfElements(keys); i++) {
key = PLGetArrayElement(keys, i);
for (i = 0; i < WMGetPropListItemCount(keys); i++) {
key = WMGetFromPLArray(keys, i);
value = PLGetDictionaryEntry(style, key);
value = WMGetFromPLDictionary(style, key);
if (!value)
continue;
if (strcasecmp(PLGetString(key), "WorkspaceSpecificBack")==0) {
if (PLIsArray(value)) {
if (strcasecmp(WMGetFromPLString(key), "WorkspaceSpecificBack")==0) {
if (WMIsPLArray(value)) {
int j;
proplist_t texture;
WMPropList *texture;
for (j = 0; j < PLGetNumberOfElements(value); j++) {
texture = PLGetArrayElement(value, j);
for (j = 0; j < WMGetPropListItemCount(value); j++) {
texture = WMGetFromPLArray(value, j);
if (texture && PLIsArray(texture)
&& PLGetNumberOfElements(texture) > 2) {
if (texture && WMIsPLArray(texture)
&& WMGetPropListItemCount(texture) > 2) {
hackPathInTexture(texture, prefix);
}
@@ -194,7 +194,7 @@ hackPaths(proplist_t style, char *prefix)
}
} else {
if (PLIsArray(value) && PLGetNumberOfElements(value) > 2) {
if (WMIsPLArray(value) && WMGetPropListItemCount(value) > 2) {
hackPathInTexture(value, prefix);
}
@@ -204,36 +204,36 @@ hackPaths(proplist_t style, char *prefix)
}
static proplist_t
getColor(proplist_t texture)
static WMPropList*
getColor(WMPropList *texture)
{
proplist_t value, type;
WMPropList *value, *type;
char *str;
type = PLGetArrayElement(texture, 0);
type = WMGetFromPLArray(texture, 0);
if (!type)
return NULL;
value = NULL;
str = PLGetString(type);
str = WMGetFromPLString(type);
if (strcasecmp(str, "solid")==0) {
value = PLGetArrayElement(texture, 1);
value = WMGetFromPLArray(texture, 1);
} else if (strcasecmp(str, "dgradient")==0
|| strcasecmp(str, "hgradient")==0
|| strcasecmp(str, "vgradient")==0) {
proplist_t c1, c2;
WMPropList *c1, *c2;
int r1, g1, b1, r2, g2, b2;
char buffer[32];
c1 = PLGetArrayElement(texture, 1);
c2 = PLGetArrayElement(texture, 2);
c1 = WMGetFromPLArray(texture, 1);
c2 = WMGetFromPLArray(texture, 2);
if (!dpy) {
if (sscanf(PLGetString(c1), "#%2x%2x%2x", &r1, &g1, &b1)==3
&& sscanf(PLGetString(c2), "#%2x%2x%2x", &r2, &g2, &b2)==3) {
if (sscanf(WMGetFromPLString(c1), "#%2x%2x%2x", &r1, &g1, &b1)==3
&& sscanf(WMGetFromPLString(c2), "#%2x%2x%2x", &r2, &g2, &b2)==3) {
sprintf(buffer, "#%02x%02x%02x", (r1+r2)/2, (g1+g2)/2,
(b1+b2)/2);
value = PLMakeString(buffer);
value = WMCreatePLString(buffer);
} else {
value = c1;
}
@@ -242,27 +242,27 @@ getColor(proplist_t texture)
XColor color2;
XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
PLGetString(c1), &color1);
WMGetFromPLString(c1), &color1);
XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
PLGetString(c2), &color2);
WMGetFromPLString(c2), &color2);
sprintf(buffer, "#%02x%02x%02x",
(color1.red+color2.red)>>9,
(color1.green+color2.green)>>9,
(color1.blue+color2.blue)>>9);
value = PLMakeString(buffer);
value = WMCreatePLString(buffer);
}
} else if (strcasecmp(str, "mdgradient")==0
|| strcasecmp(str, "mhgradient")==0
|| strcasecmp(str, "mvgradient")==0) {
value = PLGetArrayElement(texture, 1);
value = WMGetFromPLArray(texture, 1);
} else if (strcasecmp(str, "tpixmap")==0
|| strcasecmp(str, "cpixmap")==0
|| strcasecmp(str, "spixmap")==0) {
value = PLGetArrayElement(texture, 2);
value = WMGetFromPLArray(texture, 2);
}
return value;
@@ -277,28 +277,26 @@ getColor(proplist_t texture)
* IconTitleBack
*/
void
hackStyle(proplist_t style)
hackStyle(WMPropList *style)
{
proplist_t keys;
proplist_t tmp;
WMPropList *keys, *tmp;
int foundIconTitle = 0, foundResizebarBack = 0;
int i;
int foundIconTitle = 0;
int foundResizebarBack = 0;
keys = PLGetAllDictionaryKeys(style);
keys = WMGetPLDictionaryKeys(style);
for (i = 0; i < PLGetNumberOfElements(keys); i++) {
for (i = 0; i < WMGetPropListItemCount(keys); i++) {
char *str;
tmp = PLGetArrayElement(keys, i);
str = PLGetString(tmp);
tmp = WMGetFromPLArray(keys, i);
str = WMGetFromPLString(tmp);
if (str) {
int j, found;
if (ignoreFonts) {
for (j = 0, found = 0; FontOptions[j]!=NULL; j++) {
if (strcasecmp(str, FontOptions[j])==0) {
PLRemoveDictionaryEntry(style, tmp);
WMRemoveFromPLDictionary(style, tmp);
found = 1;
break;
}
@@ -309,7 +307,7 @@ hackStyle(proplist_t style)
if (ignoreCursors) {
for (j = 0, found = 0; CursorOptions[j] != NULL; j++) {
if (strcasecmp(str, CursorOptions[j]) == 0) {
PLRemoveDictionaryEntry(style, tmp);
WMRemoveFromPLDictionary(style, tmp);
found = 1;
break;
}
@@ -329,20 +327,20 @@ hackStyle(proplist_t style)
if (!foundIconTitle) {
/* set the default values */
tmp = PLGetDictionaryEntry(style, PLMakeString("FTitleColor"));
tmp = WMGetFromPLDictionary(style, WMCreatePLString("FTitleColor"));
if (tmp) {
PLInsertDictionaryEntry(style, PLMakeString("IconTitleColor"),
WMPutInPLDictionary(style, WMCreatePLString("IconTitleColor"),
tmp);
}
tmp = PLGetDictionaryEntry(style, PLMakeString("FTitleBack"));
tmp = WMGetFromPLDictionary(style, WMCreatePLString("FTitleBack"));
if (tmp) {
proplist_t value;
WMPropList *value;
value = getColor(tmp);
if (value) {
PLInsertDictionaryEntry(style, PLMakeString("IconTitleBack"),
WMPutInPLDictionary(style, WMCreatePLString("IconTitleBack"),
value);
}
}
@@ -350,46 +348,31 @@ hackStyle(proplist_t style)
if (!foundResizebarBack) {
/* set the default values */
tmp = PLGetDictionaryEntry(style, PLMakeString("UTitleBack"));
tmp = WMGetFromPLDictionary(style, WMCreatePLString("UTitleBack"));
if (tmp) {
proplist_t value;
WMPropList *value;
value = getColor(tmp);
if (value) {
proplist_t t;
WMPropList *t;
t = PLMakeArrayFromElements(PLMakeString("solid"), value,
t = WMCreatePLArray(WMCreatePLString("solid"), value,
NULL);
PLInsertDictionaryEntry(style, PLMakeString("ResizebarBack"),
WMPutInPLDictionary(style, WMCreatePLString("ResizebarBack"),
t);
}
}
}
if (!PLGetDictionaryEntry(style, PLMakeString("MenuStyle"))) {
PLInsertDictionaryEntry(style, PLMakeString("MenuStyle"),
PLMakeString("normal"));
if (!WMGetFromPLDictionary(style, WMCreatePLString("MenuStyle"))) {
WMPutInPLDictionary(style, WMCreatePLString("MenuStyle"),
WMCreatePLString("normal"));
}
}
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;
}
void
print_help()
{
@@ -418,7 +401,7 @@ print_help()
int
main(int argc, char **argv)
{
proplist_t prop, style;
WMPropList *prop, *style;
char *path;
char *file = NULL;
struct stat statbuf;
@@ -479,11 +462,11 @@ main(int argc, char **argv)
}
}
PLSetStringCmpHook(StringCompareHook);
WMPLSetCaseSensitive(False);
path = defaultsPathForDomain("WindowMaker");
prop = PLGetProplistWithPath(path);
prop = WMReadPropListFromFile(path);
if (!prop) {
perror(path);
printf("%s:could not load WindowMaker configuration file.\n",
@@ -536,7 +519,7 @@ main(int argc, char **argv)
strcat(buffer, "/style");
style = PLGetProplistWithPath(buffer);
style = WMReadPropListFromFile(buffer);
if (!style) {
perror(buffer);
printf("%s:could not load style file.\n", ProgName);
@@ -548,7 +531,7 @@ main(int argc, char **argv)
} else {
/* normal style file */
style = PLGetProplistWithPath(file);
style = WMReadPropListFromFile(file);
if (!style) {
perror(file);
printf("%s:could not load style file.\n", ProgName);
@@ -557,7 +540,7 @@ main(int argc, char **argv)
}
}
if (!PLIsDictionary(style)) {
if (!WMIsPLDictionary(style)) {
printf("%s: '%s' is not a style file/theme\n", ProgName, file);
exit(1);
}
@@ -566,13 +549,13 @@ main(int argc, char **argv)
if (ignoreCount > 0) {
for (i = 0; i < ignoreCount; i++) {
PLRemoveDictionaryEntry(style, PLMakeString(ignoreList[i]));
WMRemoveFromPLDictionary(style, WMCreatePLString(ignoreList[i]));
}
}
PLMergeDictionaries(prop, style);
WMMergePLDictionaries(prop, style);
PLSave(prop, YES);
WMWritePropListToFile(prop, path, True);
{
XEvent ev;
@@ -609,14 +592,13 @@ getToken(char *str, int i, char *buf)
}
proplist_t
static WMPropList*
readBlackBoxStyle(char *path)
{
FILE *f;
char buffer[128], char token[128];
proplist_t style;
proplist_t p;
WMPropList *style, *p;
f = fopen(path, "r");
if (!f) {
perror(path);
+7 -6
View File
@@ -36,7 +36,8 @@
#include <stdio.h>
#include <unistd.h>
#include <proplist.h>
#include <WINGs/WUtil.h>
#include <pwd.h>
@@ -83,7 +84,7 @@ void help()
int main(int argc, char **argv)
{
char path[256];
proplist_t key, value, dict;
WMPropList *key, *value, *dict;
char *gsdir;
int i;
@@ -105,7 +106,7 @@ int main(int argc, char **argv)
exit(1);
}
key = PLMakeString(argv[2]);
key = WMCreatePLString(argv[2]);
gsdir = getenv("GNUSTEP_USER_ROOT");
if (gsdir) {
@@ -119,12 +120,12 @@ int main(int argc, char **argv)
strcat(path, "/");
strcat(path, argv[1]);
if ((dict = PLGetProplistWithPath(path)) == NULL)
if ((dict = WMReadPropListFromFile(path)) == NULL)
return 1; /* bad domain */
if ((value = PLGetDictionaryEntry(dict, key)) == NULL)
if ((value = WMGetFromPLDictionary(dict, key)) == NULL)
return 2; /* bad key */
printf("%s\n", PLGetString(value));
printf("%s\n", WMGetFromPLString(value));
return 0;
}
+21 -21
View File
@@ -35,7 +35,8 @@
#include <stdio.h>
#include <unistd.h>
#include <proplist.h>
#include <WINGs/WUtil.h>
#include <pwd.h>
@@ -81,8 +82,8 @@ void help()
int main(int argc, char **argv)
{
char path[256];
proplist_t dom, key, value, dict;
char *path;
WMPropList *dom, *key, *value, *dict;
char *gsdir;
int i;
@@ -104,36 +105,35 @@ int main(int argc, char **argv)
exit(1);
}
dom = PLMakeString(argv[1]);
key = PLMakeString(argv[2]);
value = PLGetProplistWithDescription(argv[3]);
dom = WMCreatePLString(argv[1]);
key = WMCreatePLString(argv[2]);
value = WMCreatePropListFromDescription(argv[3]);
if (!value) {
printf("%s:syntax error in value \"%s\"", ProgName, argv[3]);
exit(1);
}
gsdir = getenv("GNUSTEP_USER_ROOT");
if (gsdir) {
strcpy(path, gsdir);
path = wstrdup(gsdir);
} else {
strcpy(path, gethomedir());
strcat(path, "/GNUstep");
path = wstrdup(gethomedir());
path = wstrappend(path, "/GNUstep");
}
strcat(path, "/");
strcat(path, DEFAULTS_DIR);
strcat(path, "/");
strcat(path, argv[1]);
path = wstrappend(path, "/");
path = wstrappend(path, DEFAULTS_DIR);
path = wstrappend(path, "/");
path = wstrappend(path, argv[1]);
dict = PLGetProplistWithPath(path);
dict = WMReadPropListFromFile(path);
if (!dict) {
dict = PLMakeDictionaryFromEntries(key, value, NULL);
PLSetFilename(dict, PLMakeString(path));
dict = WMCreatePLDictionary(key, value, NULL);
} else {
PLRemoveDictionaryEntry(dict, key);
PLInsertDictionaryEntry(dict, key, value);
WMPutInPLDictionary(dict, key, value);
}
PLSave(dict, YES);
WMWritePropListToFile(dict, path, True);
wfree(path);
return 0;
}
+56 -60
View File
@@ -49,7 +49,6 @@
#include <WINGs/WINGs.h>
#include <wraster.h>
#include <proplist.h>
#define PROG_VERSION "wmsetbg (Window Maker) 2.7"
@@ -121,27 +120,27 @@ BackgroundTexture*
parseTexture(RContext *rc, char *text)
{
BackgroundTexture *texture = NULL;
proplist_t texarray;
proplist_t val;
WMPropList *texarray;
WMPropList *val;
int count;
char *tmp;
char *type;
#define GETSTRORGOTO(val, str, i, label) \
val = PLGetArrayElement(texarray, i);\
if (!PLIsString(val)) {\
val = WMGetFromPLArray(texarray, i);\
if (!WMIsPLString(val)) {\
wwarning("could not parse texture %s", text);\
goto label;\
}\
str = PLGetString(val)
str = WMGetFromPLString(val)
texarray = PLGetProplistWithDescription(text);
if (!texarray || !PLIsArray(texarray)
|| (count = PLGetNumberOfElements(texarray)) < 2) {
texarray = WMCreatePropListFromDescription(text);
if (!texarray || !WMIsPLArray(texarray)
|| (count = WMGetPropListItemCount(texarray)) < 2) {
wwarning("could not parse texture %s", text);
if (texarray)
PLRelease(texarray);
WMReleasePropList(texarray);
return NULL;
}
@@ -263,8 +262,8 @@ parseTexture(RContext *rc, char *text)
memset(colors, 0, sizeof(RColor*)*(count-1));
for (i = 2; i < count; i++) {
val = PLGetArrayElement(texarray, i);
if (!PLIsString(val)) {
val = WMGetFromPLArray(texarray, i);
if (!WMIsPLString(val)) {
wwarning("could not parse texture %s", text);
for (j = 0; colors[j]!=NULL; j++)
@@ -272,7 +271,7 @@ parseTexture(RContext *rc, char *text)
wfree(colors);
goto error;
}
tmp = PLGetString(val);
tmp = WMGetFromPLString(val);
if (!XParseColor(dpy, DefaultColormap(dpy, scr), tmp, &color)) {
wwarning("could not parse color %s in texture %s",
@@ -687,7 +686,7 @@ error:
if (texture)
wfree(texture);
if (texarray)
PLRelease(texarray);
WMReleasePropList(texarray);
return NULL;
}
@@ -1032,30 +1031,28 @@ globalDefaultsPathForDomain(char *domain)
}
proplist_t
static WMPropList*
getValueForKey(char *domain, char *keyName)
{
char *path;
proplist_t key;
proplist_t d;
proplist_t val;
WMPropList *key, *val, *d;
key = PLMakeString(keyName);
key = WMCreatePLString(keyName);
/* try to find PixmapPath in user defaults */
path = wdefaultspathfordomain(domain);
d = PLGetProplistWithPath(path);
d = WMReadPropListFromFile(path);
if (!d) {
wwarning("could not open domain file %s", path);
}
wfree(path);
if (d && !PLIsDictionary(d)) {
PLRelease(d);
if (d && !WMIsPLDictionary(d)) {
WMReleasePropList(d);
d = NULL;
}
if (d) {
val = PLGetDictionaryEntry(d, key);
val = WMGetFromPLDictionary(d, key);
} else {
val = NULL;
}
@@ -1066,16 +1063,16 @@ getValueForKey(char *domain, char *keyName)
wwarning("could not locate file for domain %s", domain);
d = NULL;
} else {
d = PLGetProplistWithPath(path);
d = WMReadPropListFromFile(path);
wfree(path);
}
if (d && !PLIsDictionary(d)) {
PLRelease(d);
if (d && !WMIsPLDictionary(d)) {
WMReleasePropList(d);
d = NULL;
}
if (d) {
val = PLGetDictionaryEntry(d, key);
val = WMGetFromPLDictionary(d, key);
} else {
val = NULL;
@@ -1083,11 +1080,11 @@ getValueForKey(char *domain, char *keyName)
}
if (val)
PLRetain(val);
WMRetainPropList(val);
PLRelease(key);
WMReleasePropList(key);
if (d)
PLRelease(d);
WMReleasePropList(d);
return val;
}
@@ -1097,50 +1094,50 @@ getValueForKey(char *domain, char *keyName)
char*
getPixmapPath(char *domain)
{
proplist_t val;
WMPropList *val;
char *ptr, *data;
int len, i, count;
val = getValueForKey(domain, "PixmapPath");
if (!val || !PLIsArray(val)) {
if (!val || !WMIsPLArray(val)) {
if (val)
PLRelease(val);
WMReleasePropList(val);
return wstrdup("");
}
count = PLGetNumberOfElements(val);
count = WMGetPropListItemCount(val);
len = 0;
for (i=0; i<count; i++) {
proplist_t v;
WMPropList *v;
v = PLGetArrayElement(val, i);
if (!v || !PLIsString(v)) {
v = WMGetFromPLArray(val, i);
if (!v || !WMIsPLString(v)) {
continue;
}
len += strlen(PLGetString(v))+1;
len += strlen(WMGetFromPLString(v))+1;
}
ptr = data = wmalloc(len+1);
*ptr = 0;
for (i=0; i<count; i++) {
proplist_t v;
WMPropList *v;
v = PLGetArrayElement(val, i);
if (!v || !PLIsString(v)) {
v = WMGetFromPLArray(val, i);
if (!v || !WMIsPLString(v)) {
continue;
}
strcpy(ptr, PLGetString(v));
strcpy(ptr, WMGetFromPLString(v));
ptr += strlen(PLGetString(v));
ptr += strlen(WMGetFromPLString(v));
*ptr = ':';
ptr++;
}
if (i>0)
ptr--; *(ptr--) = 0;
PLRelease(val);
WMReleasePropList(val);
return data;
}
@@ -1216,12 +1213,11 @@ P(" --help show this help and exit");
void
changeTextureForWorkspace(char *domain, char *texture, int workspace)
{
proplist_t array;
proplist_t val;
WMPropList *array, *val;
char *value;
int j;
val = PLGetProplistWithDescription(texture);
val = WMCreatePropListFromDescription(texture);
if (!val) {
wwarning("could not parse texture %s", texture);
return;
@@ -1230,25 +1226,25 @@ changeTextureForWorkspace(char *domain, char *texture, int workspace)
array = getValueForKey("WindowMaker", "WorkspaceSpecificBack");
if (!array) {
array = PLMakeArrayFromElements(NULL, NULL);
array = WMCreatePLArray(NULL, NULL);
}
j = PLGetNumberOfElements(array);
j = WMGetPropListItemCount(array);
if (workspace >= j) {
proplist_t empty;
WMPropList *empty;
empty = PLMakeArrayFromElements(NULL, NULL);
empty = WMCreatePLArray(NULL, NULL);
while (j++ < workspace-1) {
PLAppendArrayElement(array, empty);
WMAddToPLArray(array, empty);
}
PLAppendArrayElement(array, val);
WMAddToPLArray(array, val);
} else {
PLRemoveArrayElement(array, workspace);
PLInsertArrayElement(array, val, workspace);
WMDeleteFromPLArray(array, workspace);
WMInsertInPLArray(array, workspace, val);
}
value = PLGetDescription(array);
value = WMGetPropListDescription(array, False);
updateDomain(domain, "WorkspaceSpecificBack", value);
}
@@ -1391,15 +1387,15 @@ main(int argc, char **argv)
PixmapPath = getPixmapPath(domain);
if (!smooth) {
proplist_t val;
WMPropList *val;
#if 0 /* some problem with Alpha... TODO: check if its right */
val = PLGetDictionaryEntry(domain,
PLMakeString("SmoothWorkspaceBack"));
val = WMGetFromPLDictionary(domain,
WMCreatePLString("SmoothWorkspaceBack"));
#else
val = getValueForKey(domain, "SmoothWorkspaceBack");
#endif
if (val && PLIsString(val) && strcasecmp(PLGetString(val), "YES")==0)
if (val && WMIsPLString(val) && strcasecmp(WMGetFromPLString(val), "YES")==0)
smooth = True;
}
-2
View File
@@ -24,8 +24,6 @@
/* the definitions in this file can change at any time. WINGs has more
* stable definitions */
#undef BOOL
#include <X11/Xlib.h>
#include <X11/Xmd.h>