mirror of
https://github.com/gryf/wmaker.git
synced 2026-04-25 01:51:26 +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:
@@ -19,6 +19,18 @@ Changes since version 0.65.1:
|
|||||||
- fixed bug in positioning of window list menu when opened by kbd
|
- fixed bug in positioning of window list menu when opened by kbd
|
||||||
- internal code clean-up with notifications for window state change and other
|
- internal code clean-up with notifications for window state change and other
|
||||||
stuff
|
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:
|
Changes since version 0.65.0:
|
||||||
.............................
|
.............................
|
||||||
|
|||||||
@@ -234,14 +234,11 @@ inside the WindowMaker directory.
|
|||||||
Installation:
|
Installation:
|
||||||
-=-=-=-=-=-=-
|
-=-=-=-=-=-=-
|
||||||
|
|
||||||
2.1 Where can I get proplist.h?
|
2.1 Where can I get libPropList/proplist.h?
|
||||||
-------------------------------
|
-------------------------------------------
|
||||||
You didn't read the INSTALL file, did you? Please read that now.
|
starting with Window Maker 0.70.0, libPropList is no longer needed.
|
||||||
libPropList is downloaded seperately and you need to install it _before_
|
It was obsoleted by adding property list handling code to the WINGs library.
|
||||||
attempting to configure Window Maker.
|
|
||||||
|
|
||||||
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
|
2.2 Why do no icons show up after installing Window Maker >= 0.15.x
|
||||||
|
|||||||
@@ -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
|
and the gcc suite. Otherwise you won't be able to build any X
|
||||||
program, including Window Maker.
|
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
|
- autoconf, automake and libtool
|
||||||
These tools are NOT needed, but IF you have one or
|
These tools are NOT needed, but IF you have one or
|
||||||
more of them installed, make sure you have ALL of the following
|
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,
|
system. If you don't develop software you don't need them,
|
||||||
so you can safely uninstall.
|
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:
|
OPTIONAL:
|
||||||
=========
|
=========
|
||||||
@@ -459,10 +448,10 @@ UPGRADING
|
|||||||
|
|
||||||
If you are upgrading from an older version of Window Maker:
|
If you are upgrading from an older version of Window Maker:
|
||||||
|
|
||||||
1. Configure and build Window Maker as always
|
1. Configure and build Window Maker as always
|
||||||
2. Install Window Maker (but do not run wmaker.inst)
|
2. Install Window Maker (but do not run wmaker.inst)
|
||||||
3. Read the NEWS file and update your configuration files,
|
3. Read the NEWS file and update your configuration files if necessary.
|
||||||
if necessary.
|
|
||||||
|
|
||||||
TROUBLESHOOTING
|
TROUBLESHOOTING
|
||||||
===============
|
===============
|
||||||
@@ -482,8 +471,7 @@ ltconfig: unrecognized option `--no-reexec'
|
|||||||
Try `ltconfig --help' for more information.
|
Try `ltconfig --help' for more information.
|
||||||
configure: error: libtool configure failed
|
configure: error: libtool configure failed
|
||||||
|
|
||||||
remove the --no-reexec option from aclocal.m4 and libPropList/aclocal.m4
|
remove the --no-reexec option from aclocal.m4 and reconfigure
|
||||||
and reconfigure
|
|
||||||
Also make sure the autoconf and automake versions you have installed are:
|
Also make sure the autoconf and automake versions you have installed are:
|
||||||
autoconf 2.13
|
autoconf 2.13
|
||||||
automake 1.4
|
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,
|
Note that it must not be libtool 1.2b, it must be libtool 1.3,
|
||||||
from the GNU sites.
|
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.
|
== configure doesn't detect libtiff, or other graphic libraries.
|
||||||
|
|
||||||
Delete config.cache, then rerun configure adding the following options to
|
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
|
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.
|
settings in a easier way. Take a look in the script for details on usage.
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,10 @@
|
|||||||
NEWS for veteran Window Maker users
|
NEWS for veteran Window Maker users
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
--- 0.66.0
|
--- 0.70.0
|
||||||
|
|
||||||
|
New dock option
|
||||||
|
---------------
|
||||||
|
|
||||||
Copy/paste launch in dock. For example, put
|
Copy/paste launch in dock. For example, put
|
||||||
netscape %s in the Docked icon for Netscape,
|
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.
|
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
|
--- 0.65.1
|
||||||
|
|
||||||
Removed FocusFollowMouse option, only SloppyFocus present now.
|
Removed FocusFollowMouse option, only SloppyFocus present now.
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
|
Changes since wmaker 0.65.0:
|
||||||
|
............................
|
||||||
|
|
||||||
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
|
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
|
||||||
related error when text was selected in a textfiled.
|
related error when text was selected in a textfiled.
|
||||||
- moved wstrdup(), wstrconcat() and wstrappend() from memory.c to string.c
|
- 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:
|
Changes since wmaker 0.64.0:
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ AUTOMAKE_OPTIONS = no-dependencies
|
|||||||
noinst_PROGRAMS = connect server fontl puzzle
|
noinst_PROGRAMS = connect server fontl puzzle
|
||||||
|
|
||||||
|
|
||||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la
|
||||||
@LIBPL@
|
|
||||||
|
|
||||||
|
|
||||||
fontl_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
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_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
|
||||||
|
|
||||||
connect_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
|
connect_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
|
||||||
@NETLIBS@ @LIBPL@
|
@NETLIBS@
|
||||||
|
|
||||||
server_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
|
server_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
|
||||||
|
|
||||||
server_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
|
server_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ @NETLIBS@
|
||||||
@NETLIBS@ @LIBPL@
|
|
||||||
|
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||||
|
|||||||
+13
-5
@@ -290,19 +290,19 @@ showHelp(WMConnection *cPtr) /*FOLD00*/
|
|||||||
static void
|
static void
|
||||||
listUsers(WMConnection *cPtr)
|
listUsers(WMConnection *cPtr)
|
||||||
{
|
{
|
||||||
proplist_t userList;
|
WMPropList *userList;
|
||||||
char *id;
|
char *id;
|
||||||
int i, time;
|
int i, time;
|
||||||
|
|
||||||
userList = WMGetUDAllKeys(timeDB);
|
userList = WMGetUDKeys(timeDB);
|
||||||
|
|
||||||
for (i=0; i<PLGetNumberOfElements(userList); i++) {
|
for (i=0; i<WMGetPropListItemCount(userList); i++) {
|
||||||
id = PLGetString(PLGetArrayElement(userList, i));
|
id = WMGetFromPLString(WMGetFromPLArray(userList, i));
|
||||||
time = WMGetUDIntegerForKey(timeDB, id);
|
time = WMGetUDIntegerForKey(timeDB, id);
|
||||||
sendUpdateMessage(cPtr, id, time);
|
sendUpdateMessage(cPtr, id, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLRelease(userList);
|
WMReleasePropList(userList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -591,6 +591,12 @@ removeConnection(void *observer, WMNotification *notification)
|
|||||||
WMDestroyConnection(cPtr);
|
WMDestroyConnection(cPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
updatedDomain(void *observer, WMNotification *notification)
|
||||||
|
{
|
||||||
|
wmessage("defaults domain file changed on disk. synchronizing.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static Bool
|
static Bool
|
||||||
@@ -675,6 +681,8 @@ main(int argc, char **argv) /*FOLD00*/
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeDB = WMGetDefaultsFromPath("./UserTime.plist");
|
timeDB = WMGetDefaultsFromPath("./UserTime.plist");
|
||||||
|
WMAddNotificationObserver(updatedDomain, NULL,
|
||||||
|
WMUserDefaultsDidChangeNotification, NULL);
|
||||||
|
|
||||||
clientConnections = WMCreateArray(4);
|
clientConnections = WMCreateArray(4);
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ libExtraWINGs_a_SOURCES = \
|
|||||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
|
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
|
||||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||||
|
|
||||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la
|
||||||
@LIBPL@
|
|
||||||
|
|
||||||
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)
|
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <WINGs/WINGs.h>
|
#include <WINGs/WINGs.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "wtableview.h"
|
#include "wtableview.h"
|
||||||
#include "wtabledelegates.h"
|
#include "wtabledelegates.h"
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ void clickedTable(WMWidget *w, void *self)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
WMScreen *scr;
|
WMScreen *scr;
|
||||||
@@ -128,4 +129,6 @@ main(int argc, char **argv)
|
|||||||
WMMapWidget(table);
|
WMMapWidget(table);
|
||||||
WMRealizeWidget(win);
|
WMRealizeWidget(win);
|
||||||
WMScreenMainLoop(scr);
|
WMScreenMainLoop(scr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <WINGs/WINGs.h>
|
#include <WINGs/WINGsP.h>
|
||||||
|
|
||||||
#include "wtableview.h"
|
#include "wtableview.h"
|
||||||
|
|
||||||
|
|||||||
@@ -908,6 +908,7 @@ static void drawRow(WMTableView *table, int row, WMRect clipRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void drawFullRow(WMTableView *table, int row)
|
static void drawFullRow(WMTableView *table, int row)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -926,6 +927,7 @@ static void drawFullRow(WMTableView *table, int row)
|
|||||||
(*column->delegate->drawCell)(column->delegate, column, row, d);
|
(*column->delegate->drawCell)(column->delegate, column, row, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void setRowSelected(WMTableView *table, unsigned row, Bool flag)
|
static void setRowSelected(WMTableView *table, unsigned row, Bool flag)
|
||||||
@@ -1054,8 +1056,6 @@ void WMSelectTableViewRow(WMTableView *table, int row)
|
|||||||
|
|
||||||
void WMReloadTableView(WMTableView *table)
|
void WMReloadTableView(WMTableView *table)
|
||||||
{
|
{
|
||||||
WMRect rect = getVisibleRect(table);
|
|
||||||
|
|
||||||
if (table->editingRow >= 0)
|
if (table->editingRow >= 0)
|
||||||
stopRowEdit(table, table->editingRow);
|
stopRowEdit(table, table->editingRow);
|
||||||
|
|
||||||
@@ -1163,7 +1163,6 @@ static void handleResize(W_ViewDelegate *self, WMView *view)
|
|||||||
int height;
|
int height;
|
||||||
WMTableView *table = view->self;
|
WMTableView *table = view->self;
|
||||||
WMSize size = getTotalSize(table);
|
WMSize size = getTotalSize(table);
|
||||||
WMScreen *scr = WMWidgetScreen(table);
|
|
||||||
int vw, vh;
|
int vw, vh;
|
||||||
|
|
||||||
width = W_VIEW_WIDTH(view) - 2;
|
width = W_VIEW_WIDTH(view) - 2;
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ bin_SCRIPTS = get-wings-flags get-wutil-flags
|
|||||||
lib_LIBRARIES = libWINGs.a libWUtil.a
|
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
|
EXTRA_DIST = BUGS
|
||||||
|
|||||||
+18
@@ -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
|
*** Sat Apr 21 09:12:09 EEST 2001 -Dan
|
||||||
|
|
||||||
API change
|
API change
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ AUTOMAKE_OPTIONS = no-dependencies
|
|||||||
|
|
||||||
noinst_PROGRAMS = wtest wmquery wmfile testmywidget
|
noinst_PROGRAMS = wtest wmquery wmfile testmywidget
|
||||||
|
|
||||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la
|
||||||
@LIBPL@
|
|
||||||
|
|
||||||
|
|
||||||
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
|
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
|
||||||
|
|||||||
+28
-17
@@ -10,14 +10,6 @@
|
|||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
#endif
|
#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
|
#ifndef WMAX
|
||||||
# define WMAX(a,b) ((a)>(b) ? (a) : (b))
|
# 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* wfindfileinlist(char **path_list, char *file);
|
||||||
|
|
||||||
char* wfindfileinarray(proplist_t array, char *file);
|
char* wfindfileinarray(WMPropList* array, char *file);
|
||||||
|
|
||||||
char* wexpandpath(char *path);
|
char* wexpandpath(char *path);
|
||||||
|
|
||||||
@@ -761,6 +753,10 @@ WMPropList* WMRetainPropList(WMPropList *plist);
|
|||||||
|
|
||||||
void WMReleasePropList(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 WMInsertInPLArray(WMPropList *plist, int index, WMPropList *item);
|
||||||
|
|
||||||
void WMAddToPLArray(WMPropList *plist, 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);
|
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);
|
WMPropList* WMMergePLDictionaries(WMPropList *dest, WMPropList *source);
|
||||||
|
|
||||||
int WMGetPropListItemCount(WMPropList *plist);
|
int WMGetPropListItemCount(WMPropList *plist);
|
||||||
@@ -787,26 +786,38 @@ Bool WMIsPLDictionary(WMPropList *plist);
|
|||||||
|
|
||||||
Bool WMIsPropListEqualTo(WMPropList *plist, WMPropList *other);
|
Bool WMIsPropListEqualTo(WMPropList *plist, WMPropList *other);
|
||||||
|
|
||||||
|
/* Returns a reference. Do not free it! */
|
||||||
char* WMGetFromPLString(WMPropList *plist);
|
char* WMGetFromPLString(WMPropList *plist);
|
||||||
|
|
||||||
|
/* Returns a reference. Do not free it! */
|
||||||
WMData* WMGetFromPLData(WMPropList *plist);
|
WMData* WMGetFromPLData(WMPropList *plist);
|
||||||
|
|
||||||
|
/* Returns a reference. Do not free it! */
|
||||||
const unsigned char* WMGetPLDataBytes(WMPropList *plist);
|
const unsigned char* WMGetPLDataBytes(WMPropList *plist);
|
||||||
|
|
||||||
int WMGetPLDataLength(WMPropList *plist);
|
int WMGetPLDataLength(WMPropList *plist);
|
||||||
|
|
||||||
|
/* Returns a reference. */
|
||||||
WMPropList* WMGetFromPLArray(WMPropList *plist, int index);
|
WMPropList* WMGetFromPLArray(WMPropList *plist, int index);
|
||||||
|
|
||||||
|
/* Returns a reference. */
|
||||||
WMPropList* WMGetFromPLDictionary(WMPropList *plist, WMPropList *key);
|
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);
|
WMPropList* WMGetPLDictionaryKeys(WMPropList *plist);
|
||||||
|
|
||||||
|
/* Creates only the first level deep object. All the elements inside are
|
||||||
|
* retained from the original */
|
||||||
WMPropList* WMShallowCopyPropList(WMPropList *plist);
|
WMPropList* WMShallowCopyPropList(WMPropList *plist);
|
||||||
|
|
||||||
|
/* Makes a completely separate replica of the original proplist */
|
||||||
WMPropList* WMDeepCopyPropList(WMPropList *plist);
|
WMPropList* WMDeepCopyPropList(WMPropList *plist);
|
||||||
|
|
||||||
WMPropList* WMCreatePropListFromDescription(char *desc);
|
WMPropList* WMCreatePropListFromDescription(char *desc);
|
||||||
|
|
||||||
|
/* Free the returned string when you're done */
|
||||||
char* WMGetPropListDescription(WMPropList *plist, Bool indented);
|
char* WMGetPropListDescription(WMPropList *plist, Bool indented);
|
||||||
|
|
||||||
WMPropList* WMReadPropListFromFile(char *file);
|
WMPropList* WMReadPropListFromFile(char *file);
|
||||||
@@ -825,14 +836,14 @@ void WMSaveUserDefaults(WMUserDefaults *database);
|
|||||||
|
|
||||||
void WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable);
|
void WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable);
|
||||||
|
|
||||||
/* Returns a PLArray with all keys in the user defaults database.
|
/* Returns a WMPropList array with all the keys in the user defaults database.
|
||||||
* Free the returned array with PLRelease() when no longer needed,
|
* Free the array with WMReleasePropList() when no longer needed.
|
||||||
* but do not free the elements of the array! They're just references. */
|
* Keys in array are just retained references to the original keys */
|
||||||
proplist_t WMGetUDAllKeys(WMUserDefaults *database);
|
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);
|
char *defaultName);
|
||||||
|
|
||||||
void WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
void WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||||
@@ -857,9 +868,9 @@ void WMSetUDFloatForKey(WMUserDefaults *database, float value,
|
|||||||
void WMSetUDBoolForKey(WMUserDefaults *database, Bool value,
|
void WMSetUDBoolForKey(WMUserDefaults *database, Bool value,
|
||||||
char *defaultName);
|
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;
|
extern char *WMUserDefaultsDidChangeNotification;
|
||||||
|
|
||||||
|
|||||||
@@ -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_
|
#ifndef _PROPLIST_COMPAT_H_
|
||||||
@@ -12,8 +65,8 @@ typedef WMPropList* proplist_t;
|
|||||||
|
|
||||||
#define PLMakeString(bytes) WMCreatePLString(bytes)
|
#define PLMakeString(bytes) WMCreatePLString(bytes)
|
||||||
#define PLMakeData(bytes, length) WMCreatePLDataFromBytes(bytes, length)
|
#define PLMakeData(bytes, length) WMCreatePLDataFromBytes(bytes, length)
|
||||||
#define PLMakeArrayFromElements(pl, ...) WMCreatePLArray(pl, ...)
|
#define PLMakeArrayFromElements WMCreatePLArray
|
||||||
#define PLMakeDictionaryFromEntries(key, value, ...) WMCreatePLDictionary(key, value, ...)
|
#define PLMakeDictionaryFromEntries WMCreatePLDictionary
|
||||||
|
|
||||||
#define PLRetain(pl) WMRetainPropList(pl)
|
#define PLRetain(pl) WMRetainPropList(pl)
|
||||||
#define PLRelease(pl) WMReleasePropList(pl)
|
#define PLRelease(pl) WMReleasePropList(pl)
|
||||||
@@ -38,7 +91,7 @@ typedef WMPropList* proplist_t;
|
|||||||
#define PLGetString(pl) WMGetFromPLString(pl)
|
#define PLGetString(pl) WMGetFromPLString(pl)
|
||||||
#define PLGetDataBytes(pl) WMGetPLDataBytes(pl)
|
#define PLGetDataBytes(pl) WMGetPLDataBytes(pl)
|
||||||
#define PLGetDataLength(pl) WMGetPLDataLength(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 PLGetDictionaryEntry(pl, key) WMGetFromPLDictionary(pl, key)
|
||||||
#define PLGetAllDictionaryKeys(pl) WMGetPLDictionaryKeys(pl)
|
#define PLGetAllDictionaryKeys(pl) WMGetPLDictionaryKeys(pl)
|
||||||
|
|
||||||
@@ -55,20 +108,22 @@ typedef WMPropList* proplist_t;
|
|||||||
#define PLSave(pl, file, atm) WMWritePropListToFile(pl, file, atm)
|
#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 PLGetDomainNames()
|
||||||
//#define PLDeepSynchronize(pl) PLDeepSynchronize_is_not_supported
|
#define PLGetDomain(name)
|
||||||
//#define PLSynchronize(pl) PLSynchronize_is_not_supported
|
#define PLSetDomain(name, value, kickme)
|
||||||
//#define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
|
#define PLDeleteDomain(name, kickme)
|
||||||
//#define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
|
#define PLRegister(name, callback)
|
||||||
//#define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
|
#define PLUnregister(name)
|
||||||
//#define PLGetDomainNames()
|
#endif
|
||||||
//#define PLGetDomain(name)
|
|
||||||
//#define PLSetDomain(name, value, kickme)
|
|
||||||
//#define PLDeleteDomain(name, kickme)
|
|
||||||
//#define PLRegister(name, callback)
|
|
||||||
//#define PLUnregister(name)
|
|
||||||
//#define PLGetContainer(pl)
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
#include <X11/Xlocale.h>
|
#include <X11/Xlocale.h>
|
||||||
|
|
||||||
#include <proplist.h>
|
|
||||||
|
|
||||||
|
|
||||||
_WINGsConfiguration WINGsConfiguration;
|
_WINGsConfiguration WINGsConfiguration;
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -286,7 +286,7 @@ wfindfileinlist(char **path_list, char *file)
|
|||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
wfindfileinarray(proplist_t array, char *file)
|
wfindfileinarray(WMPropList *array, char *file)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *path;
|
char *path;
|
||||||
@@ -314,14 +314,14 @@ wfindfileinarray(proplist_t array, char *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
flen = strlen(file);
|
flen = strlen(file);
|
||||||
for (i=0; i<PLGetNumberOfElements(array); i++) {
|
for (i=0; i<WMGetPropListItemCount(array); i++) {
|
||||||
proplist_t prop;
|
WMPropList *prop;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
prop = PLGetArrayElement(array, i);
|
prop = WMGetFromPLArray(array, i);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
continue;
|
continue;
|
||||||
p = PLGetString(prop);
|
p = WMGetFromPLString(prop);
|
||||||
|
|
||||||
len = strlen(p);
|
len = strlen(p);
|
||||||
path = wmalloc(len+flen+2);
|
path = wmalloc(len+flen+2);
|
||||||
|
|||||||
@@ -435,8 +435,6 @@ Bool
|
|||||||
WMNextHashEnumeratorItemAndKey(WMHashEnumerator *enumerator,
|
WMNextHashEnumeratorItemAndKey(WMHashEnumerator *enumerator,
|
||||||
void **item, void **key)
|
void **item, void **key)
|
||||||
{
|
{
|
||||||
const void *data = NULL;
|
|
||||||
|
|
||||||
/* this assumes the table doesn't change between
|
/* this assumes the table doesn't change between
|
||||||
* WMEnumerateHashTable() and WMNextHashEnumeratorItemAndKey() calls */
|
* WMEnumerateHashTable() and WMNextHashEnumeratorItemAndKey() calls */
|
||||||
|
|
||||||
|
|||||||
@@ -409,6 +409,17 @@ indentedDescription(WMPropList *plist, int level)
|
|||||||
WMHashEnumerator e;
|
WMHashEnumerator e;
|
||||||
int i;
|
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) {
|
switch (plist->type) {
|
||||||
case WPLString:
|
case WPLString:
|
||||||
retstr = stringDescription(plist);
|
retstr = stringDescription(plist);
|
||||||
@@ -1175,10 +1186,12 @@ WMPutInPLDictionary(WMPropList *plist, WMPropList *key, WMPropList *value)
|
|||||||
{
|
{
|
||||||
wassertr(plist->type==WPLDictionary);
|
wassertr(plist->type==WPLDictionary);
|
||||||
|
|
||||||
|
/*WMRetainPropList(key);*/
|
||||||
WMRemoveFromPLDictionary(plist, key);
|
WMRemoveFromPLDictionary(plist, key);
|
||||||
retainPropListByCount(key, plist->retainCount);
|
retainPropListByCount(key, plist->retainCount);
|
||||||
retainPropListByCount(value, plist->retainCount);
|
retainPropListByCount(value, plist->retainCount);
|
||||||
WMHashInsert(plist->d.dict, key, value);
|
WMHashInsert(plist->d.dict, key, value);
|
||||||
|
/*WMReleasePropList(key);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+125
-110
@@ -9,18 +9,19 @@
|
|||||||
|
|
||||||
#include "../src/config.h"
|
#include "../src/config.h"
|
||||||
|
|
||||||
|
#include "wconfig.h"
|
||||||
|
|
||||||
#include "WINGs.h"
|
#include "WINGs.h"
|
||||||
|
|
||||||
#include <proplist.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct W_UserDefaults {
|
typedef struct W_UserDefaults {
|
||||||
proplist_t defaults;
|
WMPropList *defaults;
|
||||||
|
|
||||||
proplist_t appDomain;
|
WMPropList *appDomain;
|
||||||
|
|
||||||
proplist_t searchListArray;
|
WMPropList *searchListArray;
|
||||||
proplist_t *searchList; /* cache for searchListArray */
|
WMPropList **searchList; /* cache for searchListArray */
|
||||||
|
|
||||||
char dirty;
|
char dirty;
|
||||||
|
|
||||||
@@ -163,7 +164,8 @@ WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable)
|
|||||||
void
|
void
|
||||||
WMSynchronizeUserDefaults(WMUserDefaults *database)
|
WMSynchronizeUserDefaults(WMUserDefaults *database)
|
||||||
{
|
{
|
||||||
Bool fileIsNewer = False, release = False;
|
Bool fileIsNewer = False, release = False, notify = False;
|
||||||
|
WMPropList *plF, *key;
|
||||||
char *path;
|
char *path;
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
|
|
||||||
@@ -178,14 +180,45 @@ WMSynchronizeUserDefaults(WMUserDefaults *database)
|
|||||||
fileIsNewer = True;
|
fileIsNewer = True;
|
||||||
|
|
||||||
if (database->appDomain && (database->dirty || fileIsNewer)) {
|
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;
|
database->dirty = 0;
|
||||||
|
|
||||||
if (stat(path, &stbuf) >= 0)
|
if (stat(path, &stbuf) >= 0)
|
||||||
database->timestamp = stbuf.st_mtime;
|
database->timestamp = stbuf.st_mtime;
|
||||||
if (fileIsNewer) {
|
|
||||||
|
if (notify) {
|
||||||
WMPostNotificationName(WMUserDefaultsDidChangeNotification,
|
WMPostNotificationName(WMUserDefaultsDidChangeNotification,
|
||||||
database, NULL);
|
database, NULL);
|
||||||
}
|
}
|
||||||
@@ -205,14 +238,14 @@ WMSaveUserDefaults(WMUserDefaults *database)
|
|||||||
char *path;
|
char *path;
|
||||||
Bool release = False;
|
Bool release = False;
|
||||||
|
|
||||||
PLSave(database->appDomain, YES);
|
|
||||||
database->dirty = 0;
|
|
||||||
if (!database->path) {
|
if (!database->path) {
|
||||||
path = wdefaultspathfordomain(WMGetApplicationName());
|
path = wdefaultspathfordomain(WMGetApplicationName());
|
||||||
release = True;
|
release = True;
|
||||||
} else {
|
} else {
|
||||||
path = database->path;
|
path = database->path;
|
||||||
}
|
}
|
||||||
|
WMWritePropListToFile(database->appDomain, path, True);
|
||||||
|
database->dirty = 0;
|
||||||
if (stat(path, &stbuf) >= 0)
|
if (stat(path, &stbuf) >= 0)
|
||||||
database->timestamp = stbuf.st_mtime;
|
database->timestamp = stbuf.st_mtime;
|
||||||
if (release)
|
if (release)
|
||||||
@@ -225,8 +258,8 @@ WMUserDefaults*
|
|||||||
WMGetStandardUserDefaults(void)
|
WMGetStandardUserDefaults(void)
|
||||||
{
|
{
|
||||||
WMUserDefaults *defaults;
|
WMUserDefaults *defaults;
|
||||||
proplist_t domain;
|
WMPropList *domain;
|
||||||
proplist_t key;
|
WMPropList *key;
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
char *path;
|
char *path;
|
||||||
int i;
|
int i;
|
||||||
@@ -245,12 +278,12 @@ WMGetStandardUserDefaults(void)
|
|||||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||||
memset(defaults, 0, 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 */
|
/* application domain */
|
||||||
key = PLMakeString(WMGetApplicationName());
|
key = WMCreatePLString(WMGetApplicationName());
|
||||||
defaults->searchList[0] = key;
|
defaults->searchList[0] = key;
|
||||||
|
|
||||||
/* temporary kluge */
|
/* temporary kluge */
|
||||||
@@ -258,59 +291,49 @@ WMGetStandardUserDefaults(void)
|
|||||||
domain = NULL;
|
domain = NULL;
|
||||||
path = NULL;
|
path = NULL;
|
||||||
} else {
|
} else {
|
||||||
path = wdefaultspathfordomain(PLGetString(key));
|
path = wdefaultspathfordomain(WMGetFromPLString(key));
|
||||||
|
|
||||||
if (stat(path, &stbuf) >= 0)
|
if (stat(path, &stbuf) >= 0)
|
||||||
defaults->timestamp = stbuf.st_mtime;
|
defaults->timestamp = stbuf.st_mtime;
|
||||||
|
|
||||||
domain = PLGetProplistWithPath(path);
|
domain = WMReadPropListFromFile(path);
|
||||||
}
|
}
|
||||||
if (!domain) {
|
|
||||||
proplist_t p;
|
|
||||||
|
|
||||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
if (!domain)
|
||||||
if (path) {
|
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
p = PLMakeString(path);
|
|
||||||
PLSetFilename(domain, p);
|
|
||||||
PLRelease(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (path)
|
if (path)
|
||||||
wfree(path);
|
wfree(path);
|
||||||
|
|
||||||
defaults->appDomain = domain;
|
defaults->appDomain = domain;
|
||||||
|
|
||||||
if (domain)
|
if (domain)
|
||||||
PLInsertDictionaryEntry(defaults->defaults, key, domain);
|
WMPutInPLDictionary(defaults->defaults, key, domain);
|
||||||
|
|
||||||
PLRelease(key);
|
|
||||||
|
|
||||||
/* global domain */
|
/* global domain */
|
||||||
key = PLMakeString("WMGLOBAL");
|
key = WMCreatePLString("WMGLOBAL");
|
||||||
defaults->searchList[1] = key;
|
defaults->searchList[1] = key;
|
||||||
|
|
||||||
path = wdefaultspathfordomain(PLGetString(key));
|
path = wdefaultspathfordomain(WMGetFromPLString(key));
|
||||||
|
|
||||||
domain = PLGetProplistWithPath(path);
|
domain = WMReadPropListFromFile(path);
|
||||||
|
|
||||||
wfree(path);
|
wfree(path);
|
||||||
|
|
||||||
if (!domain)
|
if (!domain)
|
||||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
|
|
||||||
if (domain)
|
if (domain)
|
||||||
PLInsertDictionaryEntry(defaults->defaults, key, domain);
|
WMPutInPLDictionary(defaults->defaults, key, domain);
|
||||||
|
|
||||||
PLRelease(key);
|
|
||||||
|
|
||||||
/* terminate list */
|
/* terminate list */
|
||||||
defaults->searchList[2] = NULL;
|
defaults->searchList[2] = NULL;
|
||||||
|
|
||||||
defaults->searchListArray = PLMakeArrayFromElements(NULL,NULL);
|
defaults->searchListArray = WMCreatePLArray(NULL,NULL);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (defaults->searchList[i]) {
|
while (defaults->searchList[i]) {
|
||||||
PLAppendArrayElement(defaults->searchListArray,
|
WMAddToPLArray(defaults->searchListArray,
|
||||||
defaults->searchList[i]);
|
defaults->searchList[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -330,8 +353,8 @@ WMUserDefaults*
|
|||||||
WMGetDefaultsFromPath(char *path)
|
WMGetDefaultsFromPath(char *path)
|
||||||
{
|
{
|
||||||
WMUserDefaults *defaults;
|
WMUserDefaults *defaults;
|
||||||
proplist_t domain;
|
WMPropList *domain;
|
||||||
proplist_t key;
|
WMPropList *key;
|
||||||
struct stat stbuf;
|
struct stat stbuf;
|
||||||
char *name;
|
char *name;
|
||||||
int i;
|
int i;
|
||||||
@@ -351,9 +374,9 @@ WMGetDefaultsFromPath(char *path)
|
|||||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||||
memset(defaults, 0, 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 */
|
/* the domain we want, go in the first position */
|
||||||
name = strrchr(path, '/');
|
name = strrchr(path, '/');
|
||||||
@@ -362,40 +385,32 @@ WMGetDefaultsFromPath(char *path)
|
|||||||
else
|
else
|
||||||
name++;
|
name++;
|
||||||
|
|
||||||
key = PLMakeString(name);
|
key = WMCreatePLString(name);
|
||||||
defaults->searchList[0] = key;
|
defaults->searchList[0] = key;
|
||||||
|
|
||||||
if (stat(path, &stbuf) >= 0)
|
if (stat(path, &stbuf) >= 0)
|
||||||
defaults->timestamp = stbuf.st_mtime;
|
defaults->timestamp = stbuf.st_mtime;
|
||||||
|
|
||||||
domain = PLGetProplistWithPath(path);
|
domain = WMReadPropListFromFile(path);
|
||||||
|
|
||||||
if (!domain) {
|
if (!domain)
|
||||||
proplist_t p;
|
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
|
|
||||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
|
||||||
p = PLMakeString(path);
|
|
||||||
PLSetFilename(domain, p);
|
|
||||||
PLRelease(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
defaults->path = wstrdup(path);
|
defaults->path = wstrdup(path);
|
||||||
|
|
||||||
defaults->appDomain = domain;
|
defaults->appDomain = domain;
|
||||||
|
|
||||||
if (domain)
|
if (domain)
|
||||||
PLInsertDictionaryEntry(defaults->defaults, key, domain);
|
WMPutInPLDictionary(defaults->defaults, key, domain);
|
||||||
|
|
||||||
PLRelease(key);
|
|
||||||
|
|
||||||
/* terminate list */
|
/* terminate list */
|
||||||
defaults->searchList[1] = NULL;
|
defaults->searchList[1] = NULL;
|
||||||
|
|
||||||
defaults->searchListArray = PLMakeArrayFromElements(NULL,NULL);
|
defaults->searchListArray = WMCreatePLArray(NULL,NULL);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (defaults->searchList[i]) {
|
while (defaults->searchList[i]) {
|
||||||
PLAppendArrayElement(defaults->searchListArray,
|
WMAddToPLArray(defaults->searchListArray,
|
||||||
defaults->searchList[i]);
|
defaults->searchList[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -411,85 +426,85 @@ WMGetDefaultsFromPath(char *path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Returns a PLArray with all keys in the user defaults database.
|
/* Returns a WMPropList array with all keys in the user defaults database.
|
||||||
* Free the returned array with PLRelease() when no longer needed,
|
* Free the array with WMReleasePropList() when no longer needed,
|
||||||
* but do not free the elements of the array! They're just references. */
|
* but do not free the elements of the array! They're just references. */
|
||||||
proplist_t
|
WMPropList*
|
||||||
WMGetUDAllKeys(WMUserDefaults *database)
|
WMGetUDKeys(WMUserDefaults *database)
|
||||||
{
|
{
|
||||||
return PLGetAllDictionaryKeys(database->appDomain);
|
return WMGetPLDictionaryKeys(database->appDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
proplist_t
|
WMPropList*
|
||||||
WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName)
|
WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t domainName, domain;
|
WMPropList *domainName, *domain;
|
||||||
proplist_t object = NULL;
|
WMPropList *object = NULL;
|
||||||
proplist_t key = PLMakeString(defaultName);
|
WMPropList *key = WMCreatePLString(defaultName);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (database->searchList[i] && !object) {
|
while (database->searchList[i] && !object) {
|
||||||
domainName = database->searchList[i];
|
domainName = database->searchList[i];
|
||||||
domain = PLGetDictionaryEntry(database->defaults, domainName);
|
domain = WMGetFromPLDictionary(database->defaults, domainName);
|
||||||
if (domain) {
|
if (domain) {
|
||||||
object = PLGetDictionaryEntry(domain, key);
|
object = WMGetFromPLDictionary(domain, key);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetUDObjectForKey(WMUserDefaults *database, proplist_t object,
|
WMSetUDObjectForKey(WMUserDefaults *database, WMPropList *object,
|
||||||
char *defaultName)
|
char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t key = PLMakeString(defaultName);
|
WMPropList *key = WMCreatePLString(defaultName);
|
||||||
|
|
||||||
database->dirty = 1;
|
database->dirty = 1;
|
||||||
|
|
||||||
PLInsertDictionaryEntry(database->appDomain, key, object);
|
WMPutInPLDictionary(database->appDomain, key, object);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName)
|
WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t key = PLMakeString(defaultName);
|
WMPropList *key = WMCreatePLString(defaultName);
|
||||||
|
|
||||||
database->dirty = 1;
|
database->dirty = 1;
|
||||||
|
|
||||||
PLRemoveDictionaryEntry(database->appDomain, key);
|
WMRemoveFromPLDictionary(database->appDomain, key);
|
||||||
|
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
WMGetUDStringForKey(WMUserDefaults *database, char *defaultName)
|
WMGetUDStringForKey(WMUserDefaults *database, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
|
|
||||||
val = WMGetUDObjectForKey(database, defaultName);
|
val = WMGetUDObjectForKey(database, defaultName);
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!PLIsString(val))
|
if (!WMIsPLString(val))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PLGetString(val);
|
return WMGetFromPLString(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
|
WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
char *str;
|
char *str;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
@@ -498,10 +513,10 @@ WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
|
|||||||
if (!val)
|
if (!val)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!PLIsString(val))
|
if (!WMIsPLString(val))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
str = PLGetString(val);
|
str = WMGetFromPLString(val);
|
||||||
if (!str)
|
if (!str)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -516,16 +531,16 @@ WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
|
|||||||
float
|
float
|
||||||
WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
|
WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
char *str;
|
char *str;
|
||||||
float value;
|
float value;
|
||||||
|
|
||||||
val = WMGetUDObjectForKey(database, defaultName);
|
val = WMGetUDObjectForKey(database, defaultName);
|
||||||
|
|
||||||
if (!val || !PLIsString(val))
|
if (!val || !WMIsPLString(val))
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
if (!(str = PLGetString(val)))
|
if (!(str = WMGetFromPLString(val)))
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
||||||
if (sscanf(str, "%f", &value)!=1)
|
if (sscanf(str, "%f", &value)!=1)
|
||||||
@@ -539,7 +554,7 @@ WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
|
|||||||
Bool
|
Bool
|
||||||
WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
|
WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
int value;
|
int value;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
@@ -548,10 +563,10 @@ WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
|
|||||||
if (!val)
|
if (!val)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
if (!PLIsString(val))
|
if (!WMIsPLString(val))
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
str = PLGetString(val);
|
str = WMGetFromPLString(val);
|
||||||
if (!str)
|
if (!str)
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
@@ -571,14 +586,14 @@ WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
|
|||||||
void
|
void
|
||||||
WMSetUDIntegerForKey(WMUserDefaults *database, int value, char *defaultName)
|
WMSetUDIntegerForKey(WMUserDefaults *database, int value, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t object;
|
WMPropList *object;
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
|
|
||||||
sprintf(buffer, "%i", value);
|
sprintf(buffer, "%i", value);
|
||||||
object = PLMakeString(buffer);
|
object = WMCreatePLString(buffer);
|
||||||
|
|
||||||
WMSetUDObjectForKey(database, object, defaultName);
|
WMSetUDObjectForKey(database, object, defaultName);
|
||||||
PLRelease(object);
|
WMReleasePropList(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -587,12 +602,12 @@ WMSetUDIntegerForKey(WMUserDefaults *database, int value, char *defaultName)
|
|||||||
void
|
void
|
||||||
WMSetUDStringForKey(WMUserDefaults *database, char *value, char *defaultName)
|
WMSetUDStringForKey(WMUserDefaults *database, char *value, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t object;
|
WMPropList *object;
|
||||||
|
|
||||||
object = PLMakeString(value);
|
object = WMCreatePLString(value);
|
||||||
|
|
||||||
WMSetUDObjectForKey(database, object, defaultName);
|
WMSetUDObjectForKey(database, object, defaultName);
|
||||||
PLRelease(object);
|
WMReleasePropList(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -600,14 +615,14 @@ WMSetUDStringForKey(WMUserDefaults *database, char *value, char *defaultName)
|
|||||||
void
|
void
|
||||||
WMSetUDFloatForKey(WMUserDefaults *database, float value, char *defaultName)
|
WMSetUDFloatForKey(WMUserDefaults *database, float value, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t object;
|
WMPropList *object;
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
|
|
||||||
sprintf(buffer, "%f", value);
|
sprintf(buffer, "%f", value);
|
||||||
object = PLMakeString(buffer);
|
object = WMCreatePLString(buffer);
|
||||||
|
|
||||||
WMSetUDObjectForKey(database, object, defaultName);
|
WMSetUDObjectForKey(database, object, defaultName);
|
||||||
PLRelease(object);
|
WMReleasePropList(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -615,18 +630,18 @@ WMSetUDFloatForKey(WMUserDefaults *database, float value, char *defaultName)
|
|||||||
void
|
void
|
||||||
WMSetUDBoolForKey(WMUserDefaults *database, Bool value, char *defaultName)
|
WMSetUDBoolForKey(WMUserDefaults *database, Bool value, char *defaultName)
|
||||||
{
|
{
|
||||||
static proplist_t yes = NULL, no = NULL;
|
static WMPropList *yes = NULL, *no = NULL;
|
||||||
|
|
||||||
if (!yes) {
|
if (!yes) {
|
||||||
yes = PLMakeString("YES");
|
yes = WMCreatePLString("YES");
|
||||||
no = PLMakeString("NO");
|
no = WMCreatePLString("NO");
|
||||||
}
|
}
|
||||||
|
|
||||||
WMSetUDObjectForKey(database, value ? yes : no, defaultName);
|
WMSetUDObjectForKey(database, value ? yes : no, defaultName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
proplist_t
|
WMPropList*
|
||||||
WMGetUDSearchList(WMUserDefaults *database)
|
WMGetUDSearchList(WMUserDefaults *database)
|
||||||
{
|
{
|
||||||
return database->searchListArray;
|
return database->searchListArray;
|
||||||
@@ -634,30 +649,30 @@ WMGetUDSearchList(WMUserDefaults *database)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
WMSetUDSearchList(WMUserDefaults *database, proplist_t list)
|
WMSetUDSearchList(WMUserDefaults *database, WMPropList *list)
|
||||||
{
|
{
|
||||||
int i, c;
|
int i, c;
|
||||||
|
|
||||||
if (database->searchList) {
|
if (database->searchList) {
|
||||||
i = 0;
|
i = 0;
|
||||||
while (database->searchList[i]) {
|
while (database->searchList[i]) {
|
||||||
PLRelease(database->searchList[i]);
|
WMReleasePropList(database->searchList[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
wfree(database->searchList);
|
wfree(database->searchList);
|
||||||
}
|
}
|
||||||
if (database->searchListArray) {
|
if (database->searchListArray) {
|
||||||
PLRelease(database->searchListArray);
|
WMReleasePropList(database->searchListArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
c = PLGetNumberOfElements(list);
|
c = WMGetPropListItemCount(list);
|
||||||
database->searchList = wmalloc(sizeof(proplist_t)*(c+1));
|
database->searchList = wmalloc(sizeof(WMPropList*)*(c+1));
|
||||||
|
|
||||||
for (i=0; i<c; i++) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,20 +6,8 @@
|
|||||||
|
|
||||||
#include <X11/Xutil.h>
|
#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"
|
#include "GNUstep.h"
|
||||||
|
|
||||||
#ifdef WINGS_BOOL
|
|
||||||
# define BOOL
|
|
||||||
# undef WINGS_BOOL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
extern struct W_Application WMApplication;
|
extern struct W_Application WMApplication;
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ typedef struct W_FontPanel {
|
|||||||
WMButton *revertB;
|
WMButton *revertB;
|
||||||
WMButton *setB;
|
WMButton *setB;
|
||||||
|
|
||||||
proplist_t fdb;
|
WMPropList *fdb;
|
||||||
} FontPanel;
|
} FontPanel;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -153,7 +153,7 @@ handleEvents(XEvent *event, void *data)
|
|||||||
if (item) {
|
if (item) {
|
||||||
WMSelectTabViewItem(tPtr, item);
|
WMSelectTabViewItem(tPtr, item);
|
||||||
} else if (tPtr->flags.dontFitAll) {
|
} else if (tPtr->flags.dontFitAll) {
|
||||||
int redraw;
|
int redraw = 0;
|
||||||
int lastVisible = tPtr->firstVisible+tPtr->visibleTabs-1;
|
int lastVisible = tPtr->firstVisible+tPtr->visibleTabs-1;
|
||||||
|
|
||||||
if (event->xbutton.x < BUTTONED_SIDE_OFFSET) {
|
if (event->xbutton.x < BUTTONED_SIDE_OFFSET) {
|
||||||
|
|||||||
@@ -1001,7 +1001,6 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event)
|
|||||||
int cancelSelection = 1;
|
int cancelSelection = 1;
|
||||||
Bool shifted, controled, modified;
|
Bool shifted, controled, modified;
|
||||||
Bool relay = True;
|
Bool relay = True;
|
||||||
WMScreen *scr = tPtr->view->screen;
|
|
||||||
|
|
||||||
/*printf("(%d,%d) -> ", tPtr->selection.position, tPtr->selection.count);*/
|
/*printf("(%d,%d) -> ", tPtr->selection.position, tPtr->selection.count);*/
|
||||||
if (((XKeyEvent *) event)->state & WM_EMACSKEYMASK)
|
if (((XKeyEvent *) event)->state & WM_EMACSKEYMASK)
|
||||||
|
|||||||
+60
-60
@@ -122,7 +122,7 @@ typedef struct _Panel {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
char *title;
|
char *title;
|
||||||
char *texture;
|
char *texture;
|
||||||
proplist_t prop;
|
WMPropList *prop;
|
||||||
Pixmap preview;
|
Pixmap preview;
|
||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
@@ -437,13 +437,13 @@ dumpRImage(char *path, RImage *image)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
isPixmap(proplist_t prop)
|
isPixmap(WMPropList *prop)
|
||||||
{
|
{
|
||||||
proplist_t p;
|
WMPropList *p;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
p = PLGetArrayElement(prop, 0);
|
p = WMGetFromPLArray(prop, 0);
|
||||||
s = PLGetString(p);
|
s = WMGetFromPLString(p);
|
||||||
if (strcasecmp(&s[1], "pixmap")==0)
|
if (strcasecmp(&s[1], "pixmap")==0)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
@@ -518,7 +518,7 @@ drawMenuBevel(RImage *img)
|
|||||||
|
|
||||||
|
|
||||||
static Pixmap
|
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 *path, int border)
|
||||||
{
|
{
|
||||||
char *type;
|
char *type;
|
||||||
@@ -529,11 +529,11 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
RColor rcolor;
|
RColor rcolor;
|
||||||
|
|
||||||
|
|
||||||
type = PLGetString(PLGetArrayElement(texture, 0));
|
type = WMGetFromPLString(WMGetFromPLArray(texture, 0));
|
||||||
|
|
||||||
if (strcasecmp(type, "solid")==0) {
|
if (strcasecmp(type, "solid")==0) {
|
||||||
|
|
||||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||||
|
|
||||||
str2rcolor(rc, str, &rcolor);
|
str2rcolor(rc, str, &rcolor);
|
||||||
|
|
||||||
@@ -543,18 +543,18 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
int t1, t2;
|
int t1, t2;
|
||||||
RColor c1[2], c2[2];
|
RColor c1[2], c2[2];
|
||||||
|
|
||||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||||
str2rcolor(rc, str, &c1[0]);
|
str2rcolor(rc, str, &c1[0]);
|
||||||
str = PLGetString(PLGetArrayElement(texture, 2));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
|
||||||
str2rcolor(rc, str, &c1[1]);
|
str2rcolor(rc, str, &c1[1]);
|
||||||
str = PLGetString(PLGetArrayElement(texture, 3));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 3));
|
||||||
t1 = atoi(str);
|
t1 = atoi(str);
|
||||||
|
|
||||||
str = PLGetString(PLGetArrayElement(texture, 4));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 4));
|
||||||
str2rcolor(rc, str, &c2[0]);
|
str2rcolor(rc, str, &c2[0]);
|
||||||
str = PLGetString(PLGetArrayElement(texture, 5));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 5));
|
||||||
str2rcolor(rc, str, &c2[1]);
|
str2rcolor(rc, str, &c2[1]);
|
||||||
str = PLGetString(PLGetArrayElement(texture, 6));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 6));
|
||||||
t2 = atoi(str);
|
t2 = atoi(str);
|
||||||
|
|
||||||
image = RRenderInterwovenGradient(width, height, c1, t1, c2, t2);
|
image = RRenderInterwovenGradient(width, height, c1, t1, c2, t2);
|
||||||
@@ -575,9 +575,9 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||||
str2rcolor(rc, str, &rcolor);
|
str2rcolor(rc, str, &rcolor);
|
||||||
str = PLGetString(PLGetArrayElement(texture, 2));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
|
||||||
str2rcolor(rc, str, &rcolor2);
|
str2rcolor(rc, str, &rcolor2);
|
||||||
|
|
||||||
image = RRenderGradient(width, height, &rcolor, &rcolor2, style);
|
image = RRenderGradient(width, height, &rcolor, &rcolor2, style);
|
||||||
@@ -601,12 +601,12 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = PLGetString(PLGetArrayElement(texture, 3));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 3));
|
||||||
str2rcolor(rc, str, &rcolor);
|
str2rcolor(rc, str, &rcolor);
|
||||||
str = PLGetString(PLGetArrayElement(texture, 4));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 4));
|
||||||
str2rcolor(rc, str, &rcolor2);
|
str2rcolor(rc, str, &rcolor2);
|
||||||
|
|
||||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||||
|
|
||||||
if ((path=wfindfileinarray(GetObjectForKey("PixmapPath"), str))!=NULL)
|
if ((path=wfindfileinarray(GetObjectForKey("PixmapPath"), str))!=NULL)
|
||||||
timage = RLoadImage(rc, path, 0);
|
timage = RLoadImage(rc, path, 0);
|
||||||
@@ -620,7 +620,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
image = RMakeTiledImage(timage, width, height);
|
image = RMakeTiledImage(timage, width, height);
|
||||||
RReleaseImage(timage);
|
RReleaseImage(timage);
|
||||||
|
|
||||||
i = atoi(PLGetString(PLGetArrayElement(texture, 2)));
|
i = atoi(WMGetFromPLString(WMGetFromPLArray(texture, 2)));
|
||||||
|
|
||||||
RCombineImagesWithOpaqueness(image, grad, i);
|
RCombineImagesWithOpaqueness(image, grad, i);
|
||||||
RReleaseImage(grad);
|
RReleaseImage(grad);
|
||||||
@@ -643,13 +643,13 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
j = PLGetNumberOfElements(texture);
|
j = WMGetPropListItemCount(texture);
|
||||||
|
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
colors = wmalloc(j * sizeof(RColor*));
|
colors = wmalloc(j * sizeof(RColor*));
|
||||||
|
|
||||||
for (i = 2; i < j; i++) {
|
for (i = 2; i < j; i++) {
|
||||||
str = PLGetString(PLGetArrayElement(texture, i));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, i));
|
||||||
colors[i-2] = wmalloc(sizeof(RColor));
|
colors[i-2] = wmalloc(sizeof(RColor));
|
||||||
str2rcolor(rc, str, colors[i-2]);
|
str2rcolor(rc, str, colors[i-2]);
|
||||||
}
|
}
|
||||||
@@ -666,7 +666,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
char *path;
|
char *path;
|
||||||
RColor color;
|
RColor color;
|
||||||
|
|
||||||
str = PLGetString(PLGetArrayElement(texture, 1));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 1));
|
||||||
|
|
||||||
if ((path=wfindfileinarray(GetObjectForKey("PixmapPath"), str))!=NULL)
|
if ((path=wfindfileinarray(GetObjectForKey("PixmapPath"), str))!=NULL)
|
||||||
timage = RLoadImage(rc, path, 0);
|
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,
|
wwarning("could not load file '%s': %s", path ? path : str,
|
||||||
RMessageForError(RErrorCode));
|
RMessageForError(RErrorCode));
|
||||||
} else {
|
} else {
|
||||||
str = PLGetString(PLGetArrayElement(texture, 2));
|
str = WMGetFromPLString(WMGetFromPLArray(texture, 2));
|
||||||
str2rcolor(rc, str, &color);
|
str2rcolor(rc, str, &color);
|
||||||
|
|
||||||
switch (toupper(type[0])) {
|
switch (toupper(type[0])) {
|
||||||
@@ -727,7 +727,7 @@ renderTexture(WMScreen *scr, proplist_t texture, int width, int height,
|
|||||||
|
|
||||||
|
|
||||||
static Pixmap
|
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);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
Display *dpy = WMScreenDisplay(scr);
|
Display *dpy = WMScreenDisplay(scr);
|
||||||
@@ -949,7 +949,7 @@ okNewTexture(void *data)
|
|||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
char *name;
|
char *name;
|
||||||
char *str;
|
char *str;
|
||||||
proplist_t prop;
|
WMPropList *prop;
|
||||||
TextureListItem *titem;
|
TextureListItem *titem;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
|
|
||||||
@@ -962,7 +962,7 @@ okNewTexture(void *data)
|
|||||||
|
|
||||||
prop = GetTexturePanelTexture(panel->texturePanel);
|
prop = GetTexturePanelTexture(panel->texturePanel);
|
||||||
|
|
||||||
str = PLGetDescription(prop);
|
str = WMGetPropListDescription(prop, False);
|
||||||
|
|
||||||
titem->title = name;
|
titem->title = name;
|
||||||
titem->prop = prop;
|
titem->prop = prop;
|
||||||
@@ -989,7 +989,7 @@ okEditTexture(void *data)
|
|||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
char *name;
|
char *name;
|
||||||
char *str;
|
char *str;
|
||||||
proplist_t prop;
|
WMPropList *prop;
|
||||||
TextureListItem *titem;
|
TextureListItem *titem;
|
||||||
|
|
||||||
item = WMGetListItem(panel->texLs, WMGetListSelectedItemRow(panel->texLs));
|
item = WMGetListItem(panel->texLs, WMGetListSelectedItemRow(panel->texLs));
|
||||||
@@ -1006,9 +1006,9 @@ okEditTexture(void *data)
|
|||||||
|
|
||||||
prop = GetTexturePanelTexture(panel->texturePanel);
|
prop = GetTexturePanelTexture(panel->texturePanel);
|
||||||
|
|
||||||
str = PLGetDescription(prop);
|
str = WMGetPropListDescription(prop, False);
|
||||||
|
|
||||||
PLRelease(titem->prop);
|
WMReleasePropList(titem->prop);
|
||||||
titem->prop = prop;
|
titem->prop = prop;
|
||||||
|
|
||||||
titem->ispixmap = isPixmap(prop);
|
titem->ispixmap = isPixmap(prop);
|
||||||
@@ -1098,7 +1098,7 @@ deleteTexture(WMWidget *w, void *data)
|
|||||||
|
|
||||||
wfree(titem->title);
|
wfree(titem->title);
|
||||||
wfree(titem->texture);
|
wfree(titem->texture);
|
||||||
PLRelease(titem->prop);
|
WMReleasePropList(titem->prop);
|
||||||
if (titem->path) {
|
if (titem->path) {
|
||||||
if (remove(titem->path) < 0 && errno != ENOENT) {
|
if (remove(titem->path) < 0 && errno != ENOENT) {
|
||||||
wsyserror("could not remove file %s", titem->path);
|
wsyserror("could not remove file %s", titem->path);
|
||||||
@@ -1373,8 +1373,8 @@ loadRImage(WMScreen *scr, char *path)
|
|||||||
static void
|
static void
|
||||||
fillTextureList(WMList *lPtr)
|
fillTextureList(WMList *lPtr)
|
||||||
{
|
{
|
||||||
proplist_t textureList;
|
WMPropList *textureList;
|
||||||
proplist_t texture;
|
WMPropList *texture;
|
||||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||||
TextureListItem *titem;
|
TextureListItem *titem;
|
||||||
WMScreen *scr = WMWidgetScreen(lPtr);
|
WMScreen *scr = WMWidgetScreen(lPtr);
|
||||||
@@ -1384,19 +1384,19 @@ fillTextureList(WMList *lPtr)
|
|||||||
if (!textureList)
|
if (!textureList)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < PLGetNumberOfElements(textureList); i++) {
|
for (i = 0; i < WMGetPropListItemCount(textureList); i++) {
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
|
|
||||||
texture = PLGetArrayElement(textureList, i);
|
texture = WMGetFromPLArray(textureList, i);
|
||||||
|
|
||||||
titem = wmalloc(sizeof(TextureListItem));
|
titem = wmalloc(sizeof(TextureListItem));
|
||||||
memset(titem, 0, sizeof(TextureListItem));
|
memset(titem, 0, sizeof(TextureListItem));
|
||||||
|
|
||||||
titem->title = wstrdup(PLGetString(PLGetArrayElement(texture, 0)));
|
titem->title = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 0)));
|
||||||
titem->prop = PLRetain(PLGetArrayElement(texture, 1));
|
titem->prop = WMRetainPropList(WMGetFromPLArray(texture, 1));
|
||||||
titem->texture = PLGetDescription(titem->prop);
|
titem->texture = WMGetPropListDescription(titem->prop, False);
|
||||||
titem->selectedFor = 0;
|
titem->selectedFor = 0;
|
||||||
titem->path = wstrdup(PLGetString(PLGetArrayElement(texture, 2)));
|
titem->path = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 2)));
|
||||||
|
|
||||||
titem->preview = loadRImage(scr, titem->path);
|
titem->preview = loadRImage(scr, titem->path);
|
||||||
if (!titem->preview) {
|
if (!titem->preview) {
|
||||||
@@ -1413,7 +1413,7 @@ static void
|
|||||||
fillColorList(_Panel *panel)
|
fillColorList(_Panel *panel)
|
||||||
{
|
{
|
||||||
WMColor *color;
|
WMColor *color;
|
||||||
proplist_t list;
|
WMPropList *list;
|
||||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||||
WMScreen *scr = WMWidgetScreen(panel->box);
|
WMScreen *scr = WMWidgetScreen(panel->box);
|
||||||
int i;
|
int i;
|
||||||
@@ -1428,13 +1428,13 @@ fillColorList(_Panel *panel)
|
|||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
proplist_t c;
|
WMPropList *c;
|
||||||
|
|
||||||
for (i = 0; i < WMIN(24, PLGetNumberOfElements(list)); i++) {
|
for (i = 0; i < WMIN(24, WMGetPropListItemCount(list)); i++) {
|
||||||
c = PLGetArrayElement(list, i);
|
c = WMGetFromPLArray(list, i);
|
||||||
if (!c || !PLIsString(c))
|
if (!c || !WMIsPLString(c))
|
||||||
continue;
|
continue;
|
||||||
color = WMCreateNamedColor(scr, PLGetString(c), False);
|
color = WMCreateNamedColor(scr, WMGetFromPLString(c), False);
|
||||||
if (!color)
|
if (!color)
|
||||||
continue;
|
continue;
|
||||||
WMSetColorWellColor(panel->sampW[i], color);
|
WMSetColorWellColor(panel->sampW[i], color);
|
||||||
@@ -2034,13 +2034,13 @@ setupTextureFor(WMList *list, char *key, char *defValue, char *title,
|
|||||||
|
|
||||||
titem->title = wstrdup(title);
|
titem->title = wstrdup(title);
|
||||||
titem->prop = GetObjectForKey(key);
|
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? */
|
/* Maybe also give a error message to stderr that the entry is bad? */
|
||||||
titem->prop = PLGetProplistWithDescription(defValue);
|
titem->prop = WMCreatePropListFromDescription(defValue);
|
||||||
} else {
|
} 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->current = 1;
|
||||||
titem->selectedFor = 1<<index;
|
titem->selectedFor = 1<<index;
|
||||||
|
|
||||||
@@ -2160,33 +2160,33 @@ storeData(_Panel *panel)
|
|||||||
static void
|
static void
|
||||||
prepareForClose(_Panel *panel)
|
prepareForClose(_Panel *panel)
|
||||||
{
|
{
|
||||||
proplist_t textureList;
|
WMPropList *textureList;
|
||||||
proplist_t texture;
|
WMPropList *texture;
|
||||||
TextureListItem *titem;
|
TextureListItem *titem;
|
||||||
WMListItem *item;
|
WMListItem *item;
|
||||||
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
WMUserDefaults *udb = WMGetStandardUserDefaults();
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
textureList = PLMakeArrayFromElements(NULL, NULL);
|
textureList = WMCreatePLArray(NULL, NULL);
|
||||||
|
|
||||||
/* store list of textures */
|
/* store list of textures */
|
||||||
for (i = 7; i < WMGetListNumberOfRows(panel->texLs); i++) {
|
for (i = 7; i < WMGetListNumberOfRows(panel->texLs); i++) {
|
||||||
item = WMGetListItem(panel->texLs, i);
|
item = WMGetListItem(panel->texLs, i);
|
||||||
titem = (TextureListItem*)item->clientData;
|
titem = (TextureListItem*)item->clientData;
|
||||||
|
|
||||||
texture = PLMakeArrayFromElements(PLMakeString(titem->title),
|
texture = WMCreatePLArray(WMCreatePLString(titem->title),
|
||||||
PLRetain(titem->prop),
|
WMRetainPropList(titem->prop),
|
||||||
PLMakeString(titem->path),
|
WMCreatePLString(titem->path),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
PLAppendArrayElement(textureList, texture);
|
WMAddToPLArray(textureList, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
WMSetUDObjectForKey(udb, textureList, "TextureList");
|
WMSetUDObjectForKey(udb, textureList, "TextureList");
|
||||||
PLRelease(textureList);
|
WMReleasePropList(textureList);
|
||||||
|
|
||||||
/* store list of colors */
|
/* store list of colors */
|
||||||
textureList = PLMakeArrayFromElements(NULL, NULL);
|
textureList = WMCreatePLArray(NULL, NULL);
|
||||||
for (i = 0; i < 24; i++) {
|
for (i = 0; i < 24; i++) {
|
||||||
WMColor *color;
|
WMColor *color;
|
||||||
char *str;
|
char *str;
|
||||||
@@ -2194,11 +2194,11 @@ prepareForClose(_Panel *panel)
|
|||||||
color = WMGetColorWellColor(panel->sampW[i]);
|
color = WMGetColorWellColor(panel->sampW[i]);
|
||||||
|
|
||||||
str = WMGetColorRGBDescription(color);
|
str = WMGetColorRGBDescription(color);
|
||||||
PLAppendArrayElement(textureList, PLMakeString(str));
|
WMAddToPLArray(textureList, WMCreatePLString(str));
|
||||||
wfree(str);
|
wfree(str);
|
||||||
}
|
}
|
||||||
WMSetUDObjectForKey(udb, textureList, "ColorList");
|
WMSetUDObjectForKey(udb, textureList, "ColorList");
|
||||||
PLRelease(textureList);
|
WMReleasePropList(textureList);
|
||||||
|
|
||||||
WMSynchronizeUserDefaults(udb);
|
WMSynchronizeUserDefaults(udb);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ typedef struct _Panel {
|
|||||||
#define DELAY_ICON "timer%i"
|
#define DELAY_ICON "timer%i"
|
||||||
#define DELAY_ICON_S "timer%is"
|
#define DELAY_ICON_S "timer%is"
|
||||||
|
|
||||||
static void changeFocusMode(WMWidget *w, void *data);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
showData(_Panel *panel)
|
showData(_Panel *panel)
|
||||||
|
|||||||
+33
-33
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "WPrefs.h"
|
#include "WPrefs.h"
|
||||||
|
|
||||||
#include <proplist.h>
|
|
||||||
|
|
||||||
typedef struct _Panel {
|
typedef struct _Panel {
|
||||||
WMBox *box;
|
WMBox *box;
|
||||||
@@ -76,12 +75,12 @@ typedef struct _Panel {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static proplist_t DefaultWindowTitleFont = NULL;
|
static WMPropList *DefaultWindowTitleFont = NULL;
|
||||||
static proplist_t DefaultMenuTitleFont = NULL;
|
static WMPropList *DefaultMenuTitleFont = NULL;
|
||||||
static proplist_t DefaultMenuTextFont = NULL;
|
static WMPropList *DefaultMenuTextFont = NULL;
|
||||||
static proplist_t DefaultIconTitleFont = NULL;
|
static WMPropList *DefaultIconTitleFont = NULL;
|
||||||
static proplist_t DefaultClipTitleFont = NULL;
|
static WMPropList *DefaultClipTitleFont = NULL;
|
||||||
static proplist_t DefaultDisplayFont = NULL;
|
static WMPropList *DefaultDisplayFont = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -268,7 +267,7 @@ setLanguageType(Panel *p, Bool multiByte)
|
|||||||
static void
|
static void
|
||||||
readFontEncodings(Panel *panel)
|
readFontEncodings(Panel *panel)
|
||||||
{
|
{
|
||||||
proplist_t pl = NULL;
|
WMPropList *pl = NULL;
|
||||||
char *path;
|
char *path;
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
@@ -278,19 +277,19 @@ readFontEncodings(Panel *panel)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
pl = PLGetProplistWithPath(path);
|
pl = WMReadPropListFromFile(path);
|
||||||
if (!pl) {
|
if (!pl) {
|
||||||
msg = _("Could not read font information file WPrefs.app/font.data");
|
msg = _("Could not read font information file WPrefs.app/font.data");
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
proplist_t key = PLMakeString("Encodings");
|
WMPropList *key = WMCreatePLString("Encodings");
|
||||||
proplist_t array;
|
WMPropList *array;
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
|
|
||||||
array = PLGetDictionaryEntry(pl, key);
|
array = WMGetFromPLDictionary(pl, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
if (!array || !PLIsArray(array)) {
|
if (!array || !WMIsPLArray(array)) {
|
||||||
msg = _("Invalid data in font information file WPrefs.app/font.data.\n"
|
msg = _("Invalid data in font information file WPrefs.app/font.data.\n"
|
||||||
"Encodings data not found.");
|
"Encodings data not found.");
|
||||||
goto error;
|
goto error;
|
||||||
@@ -298,46 +297,46 @@ readFontEncodings(Panel *panel)
|
|||||||
|
|
||||||
WMAddPopUpButtonItem(panel->langP, _("- Custom -"));
|
WMAddPopUpButtonItem(panel->langP, _("- Custom -"));
|
||||||
|
|
||||||
for (i = 0; i < PLGetNumberOfElements(array); i++) {
|
for (i = 0; i < WMGetPropListItemCount(array); i++) {
|
||||||
proplist_t item, str;
|
WMPropList *item, *str;
|
||||||
|
|
||||||
item = PLGetArrayElement(array, i);
|
item = WMGetFromPLArray(array, i);
|
||||||
str = PLGetArrayElement(item, 0);
|
str = WMGetFromPLArray(item, 0);
|
||||||
mi = WMAddPopUpButtonItem(panel->langP, PLGetString(str));
|
mi = WMAddPopUpButtonItem(panel->langP, WMGetFromPLString(str));
|
||||||
WMSetMenuItemRepresentedObject(mi, PLRetain(item));
|
WMSetMenuItemRepresentedObject(mi, WMRetainPropList(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
key = PLMakeString("WindowTitleFont");
|
key = WMCreatePLString("WindowTitleFont");
|
||||||
DefaultWindowTitleFont = PLGetDictionaryEntry(pl, key);
|
DefaultWindowTitleFont = WMGetFromPLDictionary(pl, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
|
|
||||||
key = PLMakeString("MenuTitleFont");
|
key = WMCreatePLString("MenuTitleFont");
|
||||||
DefaultMenuTitleFont = PLGetDictionaryEntry(pl, key);
|
DefaultMenuTitleFont = WMGetFromPLDictionary(pl, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
|
|
||||||
key = PLMakeString("MenuTextFont");
|
key = WMCreatePLString("MenuTextFont");
|
||||||
DefaultMenuTextFont = PLGetDictionaryEntry(pl, key);
|
DefaultMenuTextFont = WMGetFromPLDictionary(pl, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLRelease(pl);
|
WMReleasePropList(pl);
|
||||||
return;
|
return;
|
||||||
error:
|
error:
|
||||||
if (pl)
|
if (pl)
|
||||||
PLRelease(pl);
|
WMReleasePropList(pl);
|
||||||
|
|
||||||
WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
|
WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
|
||||||
_("Error"), msg, _("OK"), NULL, NULL);
|
_("Error"), msg, _("OK"), NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
changeLanguageAction(WMWidget *w, void *data)
|
changeLanguageAction(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
/*Panel *panel = (Panel*)data;*/
|
/*Panel *panel = (Panel*)data;*/
|
||||||
WMMenuItem *mi;
|
WMMenuItem *mi;
|
||||||
proplist_t pl;
|
WMPropList *pl;
|
||||||
|
|
||||||
mi = WMGetPopUpButtonMenuItem(w, WMGetPopUpButtonSelectedItem(w));
|
mi = WMGetPopUpButtonMenuItem(w, WMGetPopUpButtonSelectedItem(w));
|
||||||
pl = WMGetMenuItemRepresentedObject(mi);
|
pl = WMGetMenuItemRepresentedObject(mi);
|
||||||
@@ -348,6 +347,7 @@ changeLanguageAction(WMWidget *w, void *data)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@@ -51,6 +51,5 @@ WPrefs_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
|||||||
WPrefs_LDADD = \
|
WPrefs_LDADD = \
|
||||||
$(top_builddir)/WINGs/libWINGs.a\
|
$(top_builddir)/WINGs/libWINGs.a\
|
||||||
$(top_builddir)/wrlib/libwraster.la \
|
$(top_builddir)/wrlib/libwraster.la \
|
||||||
@LIBPL@ \
|
|
||||||
@INTLIBS@
|
@INTLIBS@
|
||||||
|
|
||||||
|
|||||||
+70
-72
@@ -947,27 +947,27 @@ freeItemData(ItemData *data)
|
|||||||
|
|
||||||
|
|
||||||
static ItemData*
|
static ItemData*
|
||||||
parseCommand(proplist_t item)
|
parseCommand(WMPropList *item)
|
||||||
{
|
{
|
||||||
ItemData *data = NEW(ItemData);
|
ItemData *data = NEW(ItemData);
|
||||||
proplist_t p;
|
WMPropList *p;
|
||||||
char *command = NULL;
|
char *command = NULL;
|
||||||
char *parameter = NULL;
|
char *parameter = NULL;
|
||||||
char *shortcut = NULL;
|
char *shortcut = NULL;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
|
|
||||||
p = PLGetArrayElement(item, i++);
|
p = WMGetFromPLArray(item, i++);
|
||||||
command = PLGetString(p);
|
command = WMGetFromPLString(p);
|
||||||
if (strcmp(command, "SHORTCUT") == 0) {
|
if (strcmp(command, "SHORTCUT") == 0) {
|
||||||
p = PLGetArrayElement(item, i++);
|
p = WMGetFromPLArray(item, i++);
|
||||||
shortcut = PLGetString(p);
|
shortcut = WMGetFromPLString(p);
|
||||||
p = PLGetArrayElement(item, i++);
|
p = WMGetFromPLArray(item, i++);
|
||||||
command = PLGetString(p);
|
command = WMGetFromPLString(p);
|
||||||
}
|
}
|
||||||
p = PLGetArrayElement(item, i++);
|
p = WMGetFromPLArray(item, i++);
|
||||||
if (p)
|
if (p)
|
||||||
parameter = PLGetString(p);
|
parameter = WMGetFromPLString(p);
|
||||||
|
|
||||||
if (strcmp(command, "EXEC") == 0 || strcmp(command, "SHEXEC") == 0) {
|
if (strcmp(command, "EXEC") == 0 || strcmp(command, "SHEXEC") == 0) {
|
||||||
|
|
||||||
@@ -1438,31 +1438,31 @@ menuItemSelected(WEditMenuDelegate *delegate, WEditMenu *menu,
|
|||||||
|
|
||||||
|
|
||||||
static WEditMenu*
|
static WEditMenu*
|
||||||
buildSubmenu(_Panel *panel, proplist_t pl)
|
buildSubmenu(_Panel *panel, WMPropList *pl)
|
||||||
{
|
{
|
||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
WEditMenu *menu;
|
WEditMenu *menu;
|
||||||
WEditMenuItem *item;
|
WEditMenuItem *item;
|
||||||
char *title;
|
char *title;
|
||||||
proplist_t tp, bp;
|
WMPropList *tp, *bp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
tp = PLGetArrayElement(pl, 0);
|
tp = WMGetFromPLArray(pl, 0);
|
||||||
title = PLGetString(tp);
|
title = WMGetFromPLString(tp);
|
||||||
|
|
||||||
menu = WCreateEditMenu(scr, title);
|
menu = WCreateEditMenu(scr, title);
|
||||||
|
|
||||||
for (i = 1; i < PLGetNumberOfElements(pl); i++) {
|
for (i = 1; i < WMGetPropListItemCount(pl); i++) {
|
||||||
proplist_t pi;
|
WMPropList *pi;
|
||||||
|
|
||||||
pi = PLGetArrayElement(pl, i);
|
pi = WMGetFromPLArray(pl, i);
|
||||||
|
|
||||||
tp = PLGetArrayElement(pi, 0);
|
tp = WMGetFromPLArray(pi, 0);
|
||||||
bp = PLGetArrayElement(pi, 1);
|
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;
|
WEditMenu *submenu;
|
||||||
|
|
||||||
submenu = buildSubmenu(panel, pi);
|
submenu = buildSubmenu(panel, pi);
|
||||||
@@ -1494,17 +1494,17 @@ buildSubmenu(_Panel *panel, proplist_t pl)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
buildMenuFromPL(_Panel *panel, proplist_t pl)
|
buildMenuFromPL(_Panel *panel, WMPropList *pl)
|
||||||
{
|
{
|
||||||
panel->menu = buildSubmenu(panel, pl);
|
panel->menu = buildSubmenu(panel, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
getDefaultMenu(_Panel *panel)
|
getDefaultMenu(_Panel *panel)
|
||||||
{
|
{
|
||||||
proplist_t menu, pmenu;
|
WMPropList *menu, *pmenu;
|
||||||
char *menuPath, *gspath;
|
char *menuPath, *gspath;
|
||||||
|
|
||||||
gspath = wusergnusteppath();
|
gspath = wusergnusteppath();
|
||||||
@@ -1513,7 +1513,7 @@ getDefaultMenu(_Panel *panel)
|
|||||||
/* if there is a localized plmenu for the tongue put it's filename here */
|
/* if there is a localized plmenu for the tongue put it's filename here */
|
||||||
sprintf(menuPath, _("%s/Library/WindowMaker/plmenu"), gspath);
|
sprintf(menuPath, _("%s/Library/WindowMaker/plmenu"), gspath);
|
||||||
|
|
||||||
menu = PLGetProplistWithPath(menuPath);
|
menu = WMReadPropListFromFile(menuPath);
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
wwarning("%s:could not read property list menu", menuPath);
|
wwarning("%s:could not read property list menu", menuPath);
|
||||||
|
|
||||||
@@ -1521,7 +1521,7 @@ getDefaultMenu(_Panel *panel)
|
|||||||
_("%s/Library/WindowMaker/plmenu"))!=0) {
|
_("%s/Library/WindowMaker/plmenu"))!=0) {
|
||||||
|
|
||||||
sprintf(menuPath, "%s/Library/WindowMaker/plmenu", gspath);
|
sprintf(menuPath, "%s/Library/WindowMaker/plmenu", gspath);
|
||||||
menu = PLGetProplistWithPath(menuPath);
|
menu = WMReadPropListFromFile(menuPath);
|
||||||
wwarning("%s:could not read property list menu", menuPath);
|
wwarning("%s:could not read property list menu", menuPath);
|
||||||
}
|
}
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
@@ -1551,7 +1551,7 @@ showData(_Panel *panel)
|
|||||||
{
|
{
|
||||||
char *gspath;
|
char *gspath;
|
||||||
char *menuPath;
|
char *menuPath;
|
||||||
proplist_t pmenu;
|
WMPropList *pmenu;
|
||||||
|
|
||||||
gspath = wusergnusteppath();
|
gspath = wusergnusteppath();
|
||||||
|
|
||||||
@@ -1559,9 +1559,9 @@ showData(_Panel *panel)
|
|||||||
strcpy(menuPath, gspath);
|
strcpy(menuPath, gspath);
|
||||||
strcat(menuPath, "/Defaults/WMRootMenu");
|
strcat(menuPath, "/Defaults/WMRootMenu");
|
||||||
|
|
||||||
pmenu = PLGetProplistWithPath(menuPath);
|
pmenu = WMReadPropListFromFile(menuPath);
|
||||||
|
|
||||||
if (!pmenu || !PLIsArray(pmenu)) {
|
if (!pmenu || !WMIsPLArray(pmenu)) {
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
|
res = WMRunAlertPanel(WMWidgetScreen(panel->parent), panel->parent,
|
||||||
@@ -1576,7 +1576,7 @@ showData(_Panel *panel)
|
|||||||
pmenu = getDefaultMenu(panel);
|
pmenu = getDefaultMenu(panel);
|
||||||
|
|
||||||
if (!pmenu) {
|
if (!pmenu) {
|
||||||
pmenu = PLMakeArrayFromElements(PLMakeString("Applications"),
|
pmenu = WMCreatePLArray(WMCreatePLString("Applications"),
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1589,7 +1589,7 @@ showData(_Panel *panel)
|
|||||||
|
|
||||||
buildMenuFromPL(panel, pmenu);
|
buildMenuFromPL(panel, pmenu);
|
||||||
|
|
||||||
PLRelease(pmenu);
|
WMReleasePropList(pmenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1606,21 +1606,21 @@ notblank(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
processData(char *title, ItemData *data)
|
processData(char *title, ItemData *data)
|
||||||
{
|
{
|
||||||
proplist_t item;
|
WMPropList *item;
|
||||||
char *s1;
|
char *s1;
|
||||||
static char *pscut = NULL;
|
static WMPropList *pscut = NULL;
|
||||||
static char *pomenu = NULL;
|
static WMPropList *pomenu = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!pscut) {
|
if (!pscut) {
|
||||||
pscut = PLMakeString("SHORTCUT");
|
pscut = WMCreatePLString("SHORTCUT");
|
||||||
pomenu = PLMakeString("OPEN_MENU");
|
pomenu = WMCreatePLString("OPEN_MENU");
|
||||||
}
|
}
|
||||||
|
|
||||||
item = PLMakeArrayFromElements(PLMakeString(title), NULL);
|
item = WMCreatePLArray(WMCreatePLString(title), NULL);
|
||||||
|
|
||||||
|
|
||||||
switch (data->type) {
|
switch (data->type) {
|
||||||
@@ -1638,39 +1638,39 @@ processData(char *title, ItemData *data)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (notblank(data->param.exec.shortcut)) {
|
if (notblank(data->param.exec.shortcut)) {
|
||||||
PLAppendArrayElement(item, pscut);
|
WMAddToPLArray(item, pscut);
|
||||||
PLAppendArrayElement(item,
|
WMAddToPLArray(item,
|
||||||
PLMakeString(data->param.exec.shortcut));
|
WMCreatePLString(data->param.exec.shortcut));
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAppendArrayElement(item, PLMakeString(s1));
|
WMAddToPLArray(item, WMCreatePLString(s1));
|
||||||
PLAppendArrayElement(item, PLMakeString(data->param.exec.command));
|
WMAddToPLArray(item, WMCreatePLString(data->param.exec.command));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CommandInfo:
|
case CommandInfo:
|
||||||
if (notblank(data->param.command.shortcut)) {
|
if (notblank(data->param.command.shortcut)) {
|
||||||
PLAppendArrayElement(item, pscut);
|
WMAddToPLArray(item, pscut);
|
||||||
PLAppendArrayElement(item,
|
WMAddToPLArray(item,
|
||||||
PLMakeString(data->param.command.shortcut));
|
WMCreatePLString(data->param.command.shortcut));
|
||||||
}
|
}
|
||||||
|
|
||||||
i = data->param.command.command;
|
i = data->param.command.command;
|
||||||
|
|
||||||
PLAppendArrayElement(item, PLMakeString(commandNames[i]));
|
WMAddToPLArray(item, WMCreatePLString(commandNames[i]));
|
||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
if (data->param.command.parameter) {
|
if (data->param.command.parameter) {
|
||||||
PLAppendArrayElement(item,
|
WMAddToPLArray(item,
|
||||||
PLMakeString(data->param.command.parameter));
|
WMCreatePLString(data->param.command.parameter));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: /* restart */
|
case 6: /* restart */
|
||||||
if (data->param.command.parameter) {
|
if (data->param.command.parameter) {
|
||||||
PLAppendArrayElement(item,
|
WMAddToPLArray(item,
|
||||||
PLMakeString(data->param.command.parameter));
|
WMCreatePLString(data->param.command.parameter));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1680,17 +1680,17 @@ processData(char *title, ItemData *data)
|
|||||||
case PipeInfo:
|
case PipeInfo:
|
||||||
if (!data->param.pipe.command)
|
if (!data->param.pipe.command)
|
||||||
return NULL;
|
return NULL;
|
||||||
PLAppendArrayElement(item, pomenu);
|
WMAddToPLArray(item, pomenu);
|
||||||
s1 = wstrconcat("| ", data->param.pipe.command);
|
s1 = wstrconcat("| ", data->param.pipe.command);
|
||||||
PLAppendArrayElement(item, PLMakeString(s1));
|
WMAddToPLArray(item, WMCreatePLString(s1));
|
||||||
wfree(s1);
|
wfree(s1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ExternalInfo:
|
case ExternalInfo:
|
||||||
if (!data->param.external.path)
|
if (!data->param.external.path)
|
||||||
return NULL;
|
return NULL;
|
||||||
PLAppendArrayElement(item, pomenu);
|
WMAddToPLArray(item, pomenu);
|
||||||
PLAppendArrayElement(item, PLMakeString(data->param.external.path));
|
WMAddToPLArray(item, WMCreatePLString(data->param.external.path));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DirectoryInfo:
|
case DirectoryInfo:
|
||||||
@@ -1705,7 +1705,7 @@ processData(char *title, ItemData *data)
|
|||||||
l += strlen(data->param.directory.command);
|
l += strlen(data->param.directory.command);
|
||||||
l += 32;
|
l += 32;
|
||||||
|
|
||||||
PLAppendArrayElement(item, pomenu);
|
WMAddToPLArray(item, pomenu);
|
||||||
|
|
||||||
tmp = wmalloc(l);
|
tmp = wmalloc(l);
|
||||||
sprintf(tmp, "%s%s WITH %s",
|
sprintf(tmp, "%s%s WITH %s",
|
||||||
@@ -1713,17 +1713,17 @@ processData(char *title, ItemData *data)
|
|||||||
data->param.directory.directory,
|
data->param.directory.directory,
|
||||||
data->param.directory.command);
|
data->param.directory.command);
|
||||||
|
|
||||||
PLAppendArrayElement(item, PLMakeString(tmp));
|
WMAddToPLArray(item, WMCreatePLString(tmp));
|
||||||
wfree(tmp);
|
wfree(tmp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WSMenuInfo:
|
case WSMenuInfo:
|
||||||
PLAppendArrayElement(item, PLMakeString("WORKSPACE_MENU"));
|
WMAddToPLArray(item, WMCreatePLString("WORKSPACE_MENU"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WWindowListInfo:
|
case WWindowListInfo:
|
||||||
PLAppendArrayElement(item, PLMakeString("WINDOWS_MENU"));
|
WMAddToPLArray(item, WMCreatePLString("WINDOWS_MENU"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -1735,20 +1735,20 @@ processData(char *title, ItemData *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
processSubmenu(WEditMenu *menu)
|
processSubmenu(WEditMenu *menu)
|
||||||
{
|
{
|
||||||
WEditMenuItem *item;
|
WEditMenuItem *item;
|
||||||
proplist_t pmenu;
|
WMPropList *pmenu;
|
||||||
proplist_t pl;
|
WMPropList *pl;
|
||||||
char *s;
|
char *s;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
s = WGetEditMenuTitle(menu);
|
s = WGetEditMenuTitle(menu);
|
||||||
pl = PLMakeString(s);
|
pl = WMCreatePLString(s);
|
||||||
|
|
||||||
pmenu = PLMakeArrayFromElements(pl, NULL);
|
pmenu = WMCreatePLArray(pl, NULL);
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((item = WGetEditMenuItem(menu, i++))) {
|
while ((item = WGetEditMenuItem(menu, i++))) {
|
||||||
@@ -1766,7 +1766,7 @@ processSubmenu(WEditMenu *menu)
|
|||||||
if (!pl)
|
if (!pl)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PLAppendArrayElement(pmenu, pl);
|
WMAddToPLArray(pmenu, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pmenu;
|
return pmenu;
|
||||||
@@ -1774,10 +1774,10 @@ processSubmenu(WEditMenu *menu)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
buildPLFromMenu(_Panel *panel)
|
buildPLFromMenu(_Panel *panel)
|
||||||
{
|
{
|
||||||
proplist_t menu;
|
WMPropList *menu;
|
||||||
|
|
||||||
menu = processSubmenu(panel->menu);
|
menu = processSubmenu(panel->menu);
|
||||||
|
|
||||||
@@ -1790,18 +1790,16 @@ buildPLFromMenu(_Panel *panel)
|
|||||||
static void
|
static void
|
||||||
storeData(_Panel *panel)
|
storeData(_Panel *panel)
|
||||||
{
|
{
|
||||||
proplist_t menu;
|
WMPropList *menu;
|
||||||
|
|
||||||
if (panel->dontSave)
|
if (panel->dontSave)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
menu = buildPLFromMenu(panel);
|
menu = buildPLFromMenu(panel);
|
||||||
|
|
||||||
PLSetFilename(menu, PLMakeString(panel->menuPath));
|
WMWritePropListToFile(menu, panel->menuPath, True);
|
||||||
|
|
||||||
PLSave(menu, YES);
|
WMReleasePropList(menu);
|
||||||
|
|
||||||
PLRelease(menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ createPanel(Panel *p)
|
|||||||
{
|
{
|
||||||
_Panel *panel = (_Panel*)p;
|
_Panel *panel = (_Panel*)p;
|
||||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||||
WMBox *hbox, *vbox;
|
|
||||||
WMPixmap *icon;
|
WMPixmap *icon;
|
||||||
int i;
|
int i;
|
||||||
char *buf1, *buf2;
|
char *buf1, *buf2;
|
||||||
|
|||||||
@@ -196,8 +196,7 @@ doubleClick(WMWidget *w, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
int
|
|
||||||
getButtonAction(char *str)
|
getButtonAction(char *str)
|
||||||
{
|
{
|
||||||
if (!str)
|
if (!str)
|
||||||
@@ -217,6 +216,7 @@ getButtonAction(char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
getWheelAction(char *str)
|
getWheelAction(char *str)
|
||||||
{
|
{
|
||||||
if (!str)
|
if (!str)
|
||||||
|
|||||||
+17
-17
@@ -75,11 +75,11 @@ addPathToList(WMList *list, int index, char *path)
|
|||||||
static void
|
static void
|
||||||
showData(_Panel *panel)
|
showData(_Panel *panel)
|
||||||
{
|
{
|
||||||
proplist_t array, val;
|
WMPropList *array, *val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
array = GetObjectForKey("IconPath");
|
array = GetObjectForKey("IconPath");
|
||||||
if (!array || !PLIsArray(array)) {
|
if (!array || !WMIsPLArray(array)) {
|
||||||
if (array)
|
if (array)
|
||||||
wwarning(_("bad value in option IconPath. Using default path list"));
|
wwarning(_("bad value in option IconPath. Using default path list"));
|
||||||
addPathToList(panel->icoL, -1, "~/pixmaps");
|
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/local/share/WindowMaker/Pixmaps");
|
||||||
addPathToList(panel->icoL, -1, "/usr/share/WindowMaker/Icons");
|
addPathToList(panel->icoL, -1, "/usr/share/WindowMaker/Icons");
|
||||||
} else {
|
} else {
|
||||||
for (i=0; i<PLGetNumberOfElements(array); i++) {
|
for (i=0; i<WMGetPropListItemCount(array); i++) {
|
||||||
val = PLGetArrayElement(array, i);
|
val = WMGetFromPLArray(array, i);
|
||||||
addPathToList(panel->icoL, -1, PLGetString(val));
|
addPathToList(panel->icoL, -1, WMGetFromPLString(val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
array = GetObjectForKey("PixmapPath");
|
array = GetObjectForKey("PixmapPath");
|
||||||
if (!array || !PLIsArray(array)) {
|
if (!array || !WMIsPLArray(array)) {
|
||||||
if (array)
|
if (array)
|
||||||
wwarning(_("bad value in option PixmapPath. Using default path list"));
|
wwarning(_("bad value in option PixmapPath. Using default path list"));
|
||||||
addPathToList(panel->pixL, -1, "~/pixmaps");
|
addPathToList(panel->pixL, -1, "~/pixmaps");
|
||||||
addPathToList(panel->pixL, -1, "~/GNUstep/Library/WindowMaker/Pixmaps");
|
addPathToList(panel->pixL, -1, "~/GNUstep/Library/WindowMaker/Pixmaps");
|
||||||
addPathToList(panel->pixL, -1, "/usr/local/share/WindowMaker/Pixmaps");
|
addPathToList(panel->pixL, -1, "/usr/local/share/WindowMaker/Pixmaps");
|
||||||
} else {
|
} else {
|
||||||
for (i=0; i<PLGetNumberOfElements(array); i++) {
|
for (i=0; i<WMGetPropListItemCount(array); i++) {
|
||||||
val = PLGetArrayElement(array, i);
|
val = WMGetFromPLArray(array, i);
|
||||||
addPathToList(panel->pixL, -1, PLGetString(val));
|
addPathToList(panel->pixL, -1, WMGetFromPLString(val));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,24 +213,24 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
|
|||||||
static void
|
static void
|
||||||
storeData(_Panel *panel)
|
storeData(_Panel *panel)
|
||||||
{
|
{
|
||||||
proplist_t list;
|
WMPropList *list;
|
||||||
proplist_t tmp;
|
WMPropList *tmp;
|
||||||
int i;
|
int i;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
list = PLMakeArrayFromElements(NULL, NULL);
|
list = WMCreatePLArray(NULL, NULL);
|
||||||
for (i=0; i<WMGetListNumberOfRows(panel->icoL); i++) {
|
for (i=0; i<WMGetListNumberOfRows(panel->icoL); i++) {
|
||||||
p = WMGetListItem(panel->icoL, i)->text;
|
p = WMGetListItem(panel->icoL, i)->text;
|
||||||
tmp = PLMakeString(p);
|
tmp = WMCreatePLString(p);
|
||||||
PLAppendArrayElement(list, tmp);
|
WMAddToPLArray(list, tmp);
|
||||||
}
|
}
|
||||||
SetObjectForKey(list, "IconPath");
|
SetObjectForKey(list, "IconPath");
|
||||||
|
|
||||||
list = PLMakeArrayFromElements(NULL, NULL);
|
list = WMCreatePLArray(NULL, NULL);
|
||||||
for (i=0; i<WMGetListNumberOfRows(panel->pixL); i++) {
|
for (i=0; i<WMGetListNumberOfRows(panel->pixL); i++) {
|
||||||
p = WMGetListItem(panel->pixL, i)->text;
|
p = WMGetListItem(panel->pixL, i)->text;
|
||||||
tmp = PLMakeString(p);
|
tmp = WMCreatePLString(p);
|
||||||
PLAppendArrayElement(list, tmp);
|
WMAddToPLArray(list, tmp);
|
||||||
}
|
}
|
||||||
SetObjectForKey(list, "PixmapPath");
|
SetObjectForKey(list, "PixmapPath");
|
||||||
}
|
}
|
||||||
|
|||||||
+78
-79
@@ -119,7 +119,7 @@ typedef struct _TexturePanel {
|
|||||||
int currentType;
|
int currentType;
|
||||||
|
|
||||||
|
|
||||||
proplist_t pathList;
|
WMPropList *pathList;
|
||||||
|
|
||||||
} _TexturePanel;
|
} _TexturePanel;
|
||||||
|
|
||||||
@@ -816,11 +816,11 @@ SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action, void *clien
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
SetTexturePanelTexture(TexturePanel *panel, char *name, WMPropList *texture)
|
||||||
{
|
{
|
||||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||||
char *str, *type;
|
char *str, *type;
|
||||||
proplist_t p;
|
WMPropList *p;
|
||||||
WMColor *color;
|
WMColor *color;
|
||||||
int i;
|
int i;
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
@@ -831,22 +831,22 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
if (!texture)
|
if (!texture)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p = PLGetArrayElement(texture, 0);
|
p = WMGetFromPLArray(texture, 0);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
goto bad_texture;
|
goto bad_texture;
|
||||||
}
|
}
|
||||||
type = PLGetString(p);
|
type = WMGetFromPLString(p);
|
||||||
|
|
||||||
/*...............................................*/
|
/*...............................................*/
|
||||||
if (strcasecmp(type, "solid")==0) {
|
if (strcasecmp(type, "solid")==0) {
|
||||||
|
|
||||||
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SOLID);
|
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SOLID);
|
||||||
|
|
||||||
p = PLGetArrayElement(texture, 1);
|
p = WMGetFromPLArray(texture, 1);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
str = "black";
|
str = "black";
|
||||||
} else {
|
} else {
|
||||||
str = PLGetString(p);
|
str = WMGetFromPLString(p);
|
||||||
}
|
}
|
||||||
color = WMCreateNamedColor(scr, str, False);
|
color = WMCreateNamedColor(scr, str, False);
|
||||||
|
|
||||||
@@ -860,11 +860,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
|
|
||||||
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SGRADIENT);
|
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_SGRADIENT);
|
||||||
|
|
||||||
p = PLGetArrayElement(texture, 1);
|
p = WMGetFromPLArray(texture, 1);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
str = "black";
|
str = "black";
|
||||||
} else {
|
} else {
|
||||||
str = PLGetString(p);
|
str = WMGetFromPLString(p);
|
||||||
}
|
}
|
||||||
color = WMCreateNamedColor(scr, str, False);
|
color = WMCreateNamedColor(scr, str, False);
|
||||||
|
|
||||||
@@ -872,11 +872,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
|
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
|
|
||||||
p = PLGetArrayElement(texture, 2);
|
p = WMGetFromPLArray(texture, 2);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
str = "black";
|
str = "black";
|
||||||
} else {
|
} else {
|
||||||
str = PLGetString(p);
|
str = WMGetFromPLString(p);
|
||||||
}
|
}
|
||||||
color = WMCreateNamedColor(scr, str, False);
|
color = WMCreateNamedColor(scr, str, False);
|
||||||
|
|
||||||
@@ -896,21 +896,21 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
gradient = type[1];
|
gradient = type[1];
|
||||||
|
|
||||||
WMSetTextFieldText(panel->imageT,
|
WMSetTextFieldText(panel->imageT,
|
||||||
PLGetString(PLGetArrayElement(texture, 1)));
|
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||||
if (panel->imageFile)
|
if (panel->imageFile)
|
||||||
wfree(panel->imageFile);
|
wfree(panel->imageFile);
|
||||||
panel->imageFile = wstrdup(PLGetString(PLGetArrayElement(texture, 1)));
|
panel->imageFile = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||||
|
|
||||||
|
|
||||||
i = 180;
|
i = 180;
|
||||||
sscanf(PLGetString(PLGetArrayElement(texture, 2)), "%i", &i);
|
sscanf(WMGetFromPLString(WMGetFromPLArray(texture, 2)), "%i", &i);
|
||||||
WMSetSliderValue(panel->topaS, i);
|
WMSetSliderValue(panel->topaS, i);
|
||||||
|
|
||||||
p = PLGetArrayElement(texture, 3);
|
p = WMGetFromPLArray(texture, 3);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
str = "black";
|
str = "black";
|
||||||
} else {
|
} else {
|
||||||
str = PLGetString(p);
|
str = WMGetFromPLString(p);
|
||||||
}
|
}
|
||||||
color = WMCreateNamedColor(scr, str, False);
|
color = WMCreateNamedColor(scr, str, False);
|
||||||
|
|
||||||
@@ -918,11 +918,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
|
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
|
|
||||||
p = PLGetArrayElement(texture, 4);
|
p = WMGetFromPLArray(texture, 4);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
str = "black";
|
str = "black";
|
||||||
} else {
|
} else {
|
||||||
str = PLGetString(p);
|
str = WMGetFromPLString(p);
|
||||||
}
|
}
|
||||||
color = WMCreateNamedColor(scr, str, False);
|
color = WMCreateNamedColor(scr, str, False);
|
||||||
|
|
||||||
@@ -931,12 +931,12 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
|
|
||||||
WMSetTextFieldText(panel->imageT,
|
WMSetTextFieldText(panel->imageT,
|
||||||
PLGetString(PLGetArrayElement(texture, 1)));
|
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||||
|
|
||||||
if (panel->imageFile)
|
if (panel->imageFile)
|
||||||
wfree(panel->imageFile);
|
wfree(panel->imageFile);
|
||||||
if ((panel->imageFile = wfindfileinarray(panel->pathList,
|
if ((panel->imageFile = wfindfileinarray(panel->pathList,
|
||||||
PLGetString(PLGetArrayElement(texture, 1)))) != NULL) {
|
WMGetFromPLString(WMGetFromPLArray(texture, 1)))) != NULL) {
|
||||||
|
|
||||||
panel->image = RLoadImage(WMScreenRContext(scr), panel->imageFile, 0);
|
panel->image = RLoadImage(WMScreenRContext(scr), panel->imageFile, 0);
|
||||||
updateTGradImage(panel);
|
updateTGradImage(panel);
|
||||||
@@ -959,11 +959,11 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
|
|
||||||
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_GRADIENT);
|
WMSetPopUpButtonSelectedItem(panel->typeP, TYPE_GRADIENT);
|
||||||
|
|
||||||
p = PLGetArrayElement(texture, 1);
|
p = WMGetFromPLArray(texture, 1);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
str = "black";
|
str = "black";
|
||||||
} else {
|
} else {
|
||||||
str = PLGetString(p);
|
str = WMGetFromPLString(p);
|
||||||
}
|
}
|
||||||
color = WMCreateNamedColor(scr, str, False);
|
color = WMCreateNamedColor(scr, str, False);
|
||||||
|
|
||||||
@@ -971,15 +971,15 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
|
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
|
|
||||||
for (i = 2; i < PLGetNumberOfElements(texture); i++) {
|
for (i = 2; i < WMGetPropListItemCount(texture); i++) {
|
||||||
RColor *rgb;
|
RColor *rgb;
|
||||||
XColor xcolor;
|
XColor xcolor;
|
||||||
|
|
||||||
p = PLGetArrayElement(texture, i);
|
p = WMGetFromPLArray(texture, i);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
str = "black";
|
str = "black";
|
||||||
} else {
|
} else {
|
||||||
str = PLGetString(p);
|
str = WMGetFromPLString(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
XParseColor(WMScreenDisplay(scr), WMScreenRContext(scr)->cmap,
|
XParseColor(WMScreenDisplay(scr), WMScreenRContext(scr)->cmap,
|
||||||
@@ -1023,15 +1023,15 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WMSetTextFieldText(panel->imageT,
|
WMSetTextFieldText(panel->imageT,
|
||||||
PLGetString(PLGetArrayElement(texture, 1)));
|
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||||
|
|
||||||
if (panel->imageFile)
|
if (panel->imageFile)
|
||||||
wfree(panel->imageFile);
|
wfree(panel->imageFile);
|
||||||
panel->imageFile = wfindfileinarray(panel->pathList,
|
panel->imageFile = wfindfileinarray(panel->pathList,
|
||||||
PLGetString(PLGetArrayElement(texture, 1)));
|
WMGetFromPLString(WMGetFromPLArray(texture, 1)));
|
||||||
|
|
||||||
color = WMCreateNamedColor(scr,
|
color = WMCreateNamedColor(scr,
|
||||||
PLGetString(PLGetArrayElement(texture, 2)), False);
|
WMGetFromPLString(WMGetFromPLArray(texture, 2)), False);
|
||||||
WMSetColorWellColor(panel->defcW, color);
|
WMSetColorWellColor(panel->defcW, color);
|
||||||
WMReleaseColor(color);
|
WMReleaseColor(color);
|
||||||
|
|
||||||
@@ -1060,7 +1060,7 @@ SetTexturePanelTexture(TexturePanel *panel, char *name, proplist_t texture)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
bad_texture:
|
bad_texture:
|
||||||
str = PLGetDescription(texture);
|
str = WMGetPropListDescription(texture, False);
|
||||||
wwarning(_("error creating texture %s"), str);
|
wwarning(_("error creating texture %s"), str);
|
||||||
wfree(str);
|
wfree(str);
|
||||||
|
|
||||||
@@ -1076,11 +1076,10 @@ GetTexturePanelTextureName(TexturePanel *panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
WMPropList*
|
||||||
proplist_t
|
|
||||||
GetTexturePanelTexture(TexturePanel *panel)
|
GetTexturePanelTexture(TexturePanel *panel)
|
||||||
{
|
{
|
||||||
proplist_t prop = NULL;
|
WMPropList *prop = NULL;
|
||||||
WMColor *color;
|
WMColor *color;
|
||||||
char *str, *str2;
|
char *str, *str2;
|
||||||
char buff[32];
|
char buff[32];
|
||||||
@@ -1092,8 +1091,8 @@ GetTexturePanelTexture(TexturePanel *panel)
|
|||||||
case TYPE_SOLID:
|
case TYPE_SOLID:
|
||||||
color = WMGetColorWellColor(panel->defcW);
|
color = WMGetColorWellColor(panel->defcW);
|
||||||
str = WMGetColorRGBDescription(color);
|
str = WMGetColorRGBDescription(color);
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("solid"),
|
prop = WMCreatePLArray(WMCreatePLString("solid"),
|
||||||
PLMakeString(str), NULL);
|
WMCreatePLString(str), NULL);
|
||||||
wfree(str);
|
wfree(str);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -1104,24 +1103,24 @@ GetTexturePanelTexture(TexturePanel *panel)
|
|||||||
|
|
||||||
switch (WMGetPopUpButtonSelectedItem(panel->arrP)) {
|
switch (WMGetPopUpButtonSelectedItem(panel->arrP)) {
|
||||||
case PTYPE_SCALE:
|
case PTYPE_SCALE:
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("spixmap"),
|
prop = WMCreatePLArray(WMCreatePLString("spixmap"),
|
||||||
PLMakeString(panel->imageFile),
|
WMCreatePLString(panel->imageFile),
|
||||||
PLMakeString(str), NULL);
|
WMCreatePLString(str), NULL);
|
||||||
break;
|
break;
|
||||||
case PTYPE_MAXIMIZE:
|
case PTYPE_MAXIMIZE:
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("mpixmap"),
|
prop = WMCreatePLArray(WMCreatePLString("mpixmap"),
|
||||||
PLMakeString(panel->imageFile),
|
WMCreatePLString(panel->imageFile),
|
||||||
PLMakeString(str), NULL);
|
WMCreatePLString(str), NULL);
|
||||||
break;
|
break;
|
||||||
case PTYPE_CENTER:
|
case PTYPE_CENTER:
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("cpixmap"),
|
prop = WMCreatePLArray(WMCreatePLString("cpixmap"),
|
||||||
PLMakeString(panel->imageFile),
|
WMCreatePLString(panel->imageFile),
|
||||||
PLMakeString(str), NULL);
|
WMCreatePLString(str), NULL);
|
||||||
break;
|
break;
|
||||||
case PTYPE_TILE:
|
case PTYPE_TILE:
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("tpixmap"),
|
prop = WMCreatePLArray(WMCreatePLString("tpixmap"),
|
||||||
PLMakeString(panel->imageFile),
|
WMCreatePLString(panel->imageFile),
|
||||||
PLMakeString(str), NULL);
|
WMCreatePLString(str), NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
wfree(str);
|
wfree(str);
|
||||||
@@ -1137,23 +1136,23 @@ GetTexturePanelTexture(TexturePanel *panel)
|
|||||||
sprintf(buff, "%i", WMGetSliderValue(panel->topaS));
|
sprintf(buff, "%i", WMGetSliderValue(panel->topaS));
|
||||||
|
|
||||||
if (WMGetButtonSelected(panel->dirdB)) {
|
if (WMGetButtonSelected(panel->dirdB)) {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("tdgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("tdgradient"),
|
||||||
PLMakeString(panel->imageFile),
|
WMCreatePLString(panel->imageFile),
|
||||||
PLMakeString(buff),
|
WMCreatePLString(buff),
|
||||||
PLMakeString(str),
|
WMCreatePLString(str),
|
||||||
PLMakeString(str2), NULL);
|
WMCreatePLString(str2), NULL);
|
||||||
} else if (WMGetButtonSelected(panel->dirvB)) {
|
} else if (WMGetButtonSelected(panel->dirvB)) {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("tvgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("tvgradient"),
|
||||||
PLMakeString(panel->imageFile),
|
WMCreatePLString(panel->imageFile),
|
||||||
PLMakeString(buff),
|
WMCreatePLString(buff),
|
||||||
PLMakeString(str),
|
WMCreatePLString(str),
|
||||||
PLMakeString(str2), NULL);
|
WMCreatePLString(str2), NULL);
|
||||||
} else {
|
} else {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("thgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("thgradient"),
|
||||||
PLMakeString(panel->imageFile),
|
WMCreatePLString(panel->imageFile),
|
||||||
PLMakeString(buff),
|
WMCreatePLString(buff),
|
||||||
PLMakeString(str),
|
WMCreatePLString(str),
|
||||||
PLMakeString(str2), NULL);
|
WMCreatePLString(str2), NULL);
|
||||||
}
|
}
|
||||||
wfree(str);
|
wfree(str);
|
||||||
wfree(str2);
|
wfree(str2);
|
||||||
@@ -1168,17 +1167,17 @@ GetTexturePanelTexture(TexturePanel *panel)
|
|||||||
str2 = WMGetColorRGBDescription(color);
|
str2 = WMGetColorRGBDescription(color);
|
||||||
|
|
||||||
if (WMGetButtonSelected(panel->dirdB)) {
|
if (WMGetButtonSelected(panel->dirdB)) {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("dgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("dgradient"),
|
||||||
PLMakeString(str),
|
WMCreatePLString(str),
|
||||||
PLMakeString(str2), NULL);
|
WMCreatePLString(str2), NULL);
|
||||||
} else if (WMGetButtonSelected(panel->dirvB)) {
|
} else if (WMGetButtonSelected(panel->dirvB)) {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("vgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("vgradient"),
|
||||||
PLMakeString(str),
|
WMCreatePLString(str),
|
||||||
PLMakeString(str2), NULL);
|
WMCreatePLString(str2), NULL);
|
||||||
} else {
|
} else {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("hgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("hgradient"),
|
||||||
PLMakeString(str),
|
WMCreatePLString(str),
|
||||||
PLMakeString(str2), NULL);
|
WMCreatePLString(str2), NULL);
|
||||||
}
|
}
|
||||||
wfree(str);
|
wfree(str);
|
||||||
wfree(str2);
|
wfree(str2);
|
||||||
@@ -1189,14 +1188,14 @@ GetTexturePanelTexture(TexturePanel *panel)
|
|||||||
str = WMGetColorRGBDescription(color);
|
str = WMGetColorRGBDescription(color);
|
||||||
|
|
||||||
if (WMGetButtonSelected(panel->dirdB)) {
|
if (WMGetButtonSelected(panel->dirdB)) {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("mdgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("mdgradient"),
|
||||||
PLMakeString(str), NULL);
|
WMCreatePLString(str), NULL);
|
||||||
} else if (WMGetButtonSelected(panel->dirvB)) {
|
} else if (WMGetButtonSelected(panel->dirvB)) {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("mvgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("mvgradient"),
|
||||||
PLMakeString(str), NULL);
|
WMCreatePLString(str), NULL);
|
||||||
} else {
|
} else {
|
||||||
prop = PLMakeArrayFromElements(PLMakeString("mhgradient"),
|
prop = WMCreatePLArray(WMCreatePLString("mhgradient"),
|
||||||
PLMakeString(str), NULL);
|
WMCreatePLString(str), NULL);
|
||||||
}
|
}
|
||||||
wfree(str);
|
wfree(str);
|
||||||
|
|
||||||
@@ -1210,7 +1209,7 @@ GetTexturePanelTexture(TexturePanel *panel)
|
|||||||
|
|
||||||
sprintf(buff, "#%02x%02x%02x", rgb->red, rgb->green, rgb->blue);
|
sprintf(buff, "#%02x%02x%02x", rgb->red, rgb->green, rgb->blue);
|
||||||
|
|
||||||
PLAppendArrayElement(prop, PLMakeString(buff));
|
WMAddToPLArray(prop, WMCreatePLString(buff));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1221,7 @@ GetTexturePanelTexture(TexturePanel *panel)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array)
|
SetTexturePanelPixmapPath(TexturePanel *panel, WMPropList *array)
|
||||||
{
|
{
|
||||||
panel->pathList = array;
|
panel->pathList = array;
|
||||||
}
|
}
|
||||||
@@ -1653,7 +1652,7 @@ int main(int argc, char **argv)
|
|||||||
SetTexturePanelCancelAction(panel,(WMAction*)testCancelButton,panel);
|
SetTexturePanelCancelAction(panel,(WMAction*)testCancelButton,panel);
|
||||||
|
|
||||||
SetTexturePanelTexture(panel, "pinky",
|
SetTexturePanelTexture(panel, "pinky",
|
||||||
PLGetProplistWithDescription("(mdgradient, pink, red, blue, yellow)"));
|
WMCreatePropListFromDescription("(mdgradient, pink, red, blue, yellow)"));
|
||||||
|
|
||||||
ShowTexturePanel(panel);
|
ShowTexturePanel(panel);
|
||||||
|
|
||||||
|
|||||||
@@ -37,12 +37,12 @@ void ShowTexturePanel(TexturePanel *panel);
|
|||||||
void HideTexturePanel(TexturePanel *panel);
|
void HideTexturePanel(TexturePanel *panel);
|
||||||
|
|
||||||
void SetTexturePanelTexture(TexturePanel *panel, char *name,
|
void SetTexturePanelTexture(TexturePanel *panel, char *name,
|
||||||
proplist_t texture);
|
WMPropList *texture);
|
||||||
|
|
||||||
|
|
||||||
char *GetTexturePanelTextureName(TexturePanel *panel);
|
char *GetTexturePanelTextureName(TexturePanel *panel);
|
||||||
|
|
||||||
proplist_t GetTexturePanelTexture(TexturePanel *panel);
|
WMPropList *GetTexturePanelTexture(TexturePanel *panel);
|
||||||
|
|
||||||
RImage *RenderTexturePanelTexture(TexturePanel *panel, unsigned width,
|
RImage *RenderTexturePanelTexture(TexturePanel *panel, unsigned width,
|
||||||
unsigned height);
|
unsigned height);
|
||||||
@@ -53,7 +53,7 @@ void SetTexturePanelOkAction(TexturePanel *panel, WMCallback *action,
|
|||||||
void SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action,
|
void SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action,
|
||||||
void *clientData);
|
void *clientData);
|
||||||
|
|
||||||
void SetTexturePanelPixmapPath(TexturePanel *panel, proplist_t array);
|
void SetTexturePanelPixmapPath(TexturePanel *panel, WMPropList *array);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+62
-60
@@ -96,9 +96,10 @@ typedef struct _WPrefs {
|
|||||||
static _WPrefs WPrefs;
|
static _WPrefs WPrefs;
|
||||||
|
|
||||||
/* system wide defaults dictionary. Read-only */
|
/* system wide defaults dictionary. Read-only */
|
||||||
static proplist_t GlobalDB = NULL;
|
static WMPropList *GlobalDB = NULL;
|
||||||
/* user defaults dictionary */
|
/* user defaults dictionary */
|
||||||
static proplist_t WindowMakerDB = NULL;
|
static WMPropList *WindowMakerDB = NULL;
|
||||||
|
static char *WindowMakerDBPath = NULL;
|
||||||
|
|
||||||
|
|
||||||
static Bool TIFFOK = False;
|
static Bool TIFFOK = False;
|
||||||
@@ -128,9 +129,9 @@ static void
|
|||||||
save(WMWidget *w, void *data)
|
save(WMWidget *w, void *data)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
proplist_t p1, p2;
|
WMPropList *p1, *p2;
|
||||||
proplist_t keyList;
|
WMPropList *keyList;
|
||||||
proplist_t key;
|
WMPropList *key;
|
||||||
char *msg = "Reconfigure";
|
char *msg = "Reconfigure";
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
@@ -143,29 +144,29 @@ save(WMWidget *w, void *data)
|
|||||||
}
|
}
|
||||||
/* puts("compressing data");*/
|
/* puts("compressing data");*/
|
||||||
/* compare the user dictionary with the global and remove redundant data */
|
/* compare the user dictionary with the global and remove redundant data */
|
||||||
keyList = PLGetAllDictionaryKeys(GlobalDB);
|
keyList = WMGetPLDictionaryKeys(GlobalDB);
|
||||||
/* puts(PLGetDescription(WindowMakerDB));*/
|
/* puts(WMGetPropListDescription(WindowMakerDB, False));*/
|
||||||
for (i=0; i<PLGetNumberOfElements(keyList); i++) {
|
for (i=0; i<WMGetPropListItemCount(keyList); i++) {
|
||||||
key = PLGetArrayElement(keyList, i);
|
key = WMGetFromPLArray(keyList, i);
|
||||||
|
|
||||||
/* We don't have this value anyway, so no problem.
|
/* We don't have this value anyway, so no problem.
|
||||||
* Probably a new option */
|
* Probably a new option */
|
||||||
p1 = PLGetDictionaryEntry(WindowMakerDB, key);
|
p1 = WMGetFromPLDictionary(WindowMakerDB, key);
|
||||||
if (!p1)
|
if (!p1)
|
||||||
continue;
|
continue;
|
||||||
/* The global doesn't have it, so no problem either. */
|
/* The global doesn't have it, so no problem either. */
|
||||||
p2 = PLGetDictionaryEntry(GlobalDB, key);
|
p2 = WMGetFromPLDictionary(GlobalDB, key);
|
||||||
if (!p2)
|
if (!p2)
|
||||||
continue;
|
continue;
|
||||||
/* If both values are the same, don't save. */
|
/* If both values are the same, don't save. */
|
||||||
if (PLIsEqual(p1, p2))
|
if (WMIsPropListEqualTo(p1, p2))
|
||||||
PLRemoveDictionaryEntry(WindowMakerDB, key);
|
WMRemoveFromPLDictionary(WindowMakerDB, key);
|
||||||
}
|
}
|
||||||
/* puts(PLGetDescription(WindowMakerDB));*/
|
/* puts(WMGetPropListDescription(WindowMakerDB, False));*/
|
||||||
PLRelease(keyList);
|
WMReleasePropList(keyList);
|
||||||
/* puts("storing data");*/
|
/* puts("storing data");*/
|
||||||
|
|
||||||
PLSave(WindowMakerDB, YES);
|
WMWritePropListToFile(WindowMakerDB, WindowMakerDBPath, True);
|
||||||
|
|
||||||
|
|
||||||
memset(&ev, 0, sizeof(XEvent));
|
memset(&ev, 0, sizeof(XEvent));
|
||||||
@@ -738,7 +739,7 @@ GetWindow(Panel *panel)
|
|||||||
static void
|
static void
|
||||||
loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
||||||
{
|
{
|
||||||
proplist_t db, gdb;
|
WMPropList *db, *gdb;
|
||||||
char *path;
|
char *path;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
@@ -746,11 +747,12 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
|||||||
int v1, v2, v3;
|
int v1, v2, v3;
|
||||||
|
|
||||||
path = wdefaultspathfordomain("WindowMaker");
|
path = wdefaultspathfordomain("WindowMaker");
|
||||||
|
WindowMakerDBPath = path;
|
||||||
|
|
||||||
db = PLGetProplistWithPath(path);
|
db = WMReadPropListFromFile(path);
|
||||||
if (db) {
|
if (db) {
|
||||||
if (!PLIsDictionary(db)) {
|
if (!WMIsPLDictionary(db)) {
|
||||||
PLRelease(db);
|
WMReleasePropList(db);
|
||||||
db = NULL;
|
db = NULL;
|
||||||
sprintf(mbuf, _("Window Maker domain (%s) is corrupted!"), path);
|
sprintf(mbuf, _("Window Maker domain (%s) is corrupted!"), path);
|
||||||
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
||||||
@@ -760,7 +762,6 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
|||||||
path);
|
path);
|
||||||
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
||||||
}
|
}
|
||||||
wfree(path);
|
|
||||||
|
|
||||||
path = getenv("WMAKER_BIN_NAME");
|
path = getenv("WMAKER_BIN_NAME");
|
||||||
if (!path)
|
if (!path)
|
||||||
@@ -827,10 +828,11 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
|||||||
if (file)
|
if (file)
|
||||||
pclose(file);
|
pclose(file);
|
||||||
|
|
||||||
gdb = PLGetProplistWithPath(buffer);
|
gdb = WMReadPropListFromFile(buffer);
|
||||||
|
|
||||||
if (gdb) {
|
if (gdb) {
|
||||||
if (!PLIsDictionary(gdb)) {
|
if (!WMIsPLDictionary(gdb)) {
|
||||||
PLRelease(gdb);
|
WMReleasePropList(gdb);
|
||||||
gdb = NULL;
|
gdb = NULL;
|
||||||
sprintf(mbuf, _("Window Maker domain (%s) is corrupted!"), buffer);
|
sprintf(mbuf, _("Window Maker domain (%s) is corrupted!"), buffer);
|
||||||
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
WMRunAlertPanel(scr, mainw, _("Error"), mbuf, _("OK"), NULL, NULL);
|
||||||
@@ -842,10 +844,10 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!db) {
|
if (!db) {
|
||||||
db = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
db = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
if (!gdb) {
|
if (!gdb) {
|
||||||
gdb = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
gdb = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalDB = gdb;
|
GlobalDB = gdb;
|
||||||
@@ -854,89 +856,89 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
proplist_t
|
WMPropList*
|
||||||
GetObjectForKey(char *defaultName)
|
GetObjectForKey(char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t object = NULL;
|
WMPropList *object = NULL;
|
||||||
proplist_t key = PLMakeString(defaultName);
|
WMPropList *key = WMCreatePLString(defaultName);
|
||||||
|
|
||||||
object = PLGetDictionaryEntry(WindowMakerDB, key);
|
object = WMGetFromPLDictionary(WindowMakerDB, key);
|
||||||
if (!object)
|
if (!object)
|
||||||
object = PLGetDictionaryEntry(GlobalDB, key);
|
object = WMGetFromPLDictionary(GlobalDB, key);
|
||||||
|
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
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);
|
WMPutInPLDictionary(WindowMakerDB, key, object);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
RemoveObjectForKey(char *defaultName)
|
RemoveObjectForKey(char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t key = PLMakeString(defaultName);
|
WMPropList *key = WMCreatePLString(defaultName);
|
||||||
|
|
||||||
PLRemoveDictionaryEntry(WindowMakerDB, key);
|
WMRemoveFromPLDictionary(WindowMakerDB, key);
|
||||||
|
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
GetStringForKey(char *defaultName)
|
GetStringForKey(char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
|
|
||||||
val = GetObjectForKey(defaultName);
|
val = GetObjectForKey(defaultName);
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!PLIsString(val))
|
if (!WMIsPLString(val))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return PLGetString(val);
|
return WMGetFromPLString(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
proplist_t
|
WMPropList*
|
||||||
GetArrayForKey(char *defaultName)
|
GetArrayForKey(char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
|
|
||||||
val = GetObjectForKey(defaultName);
|
val = GetObjectForKey(defaultName);
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!PLIsArray(val))
|
if (!WMIsPLArray(val))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
proplist_t
|
WMPropList*
|
||||||
GetDictionaryForKey(char *defaultName)
|
GetDictionaryForKey(char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
|
|
||||||
val = GetObjectForKey(defaultName);
|
val = GetObjectForKey(defaultName);
|
||||||
|
|
||||||
if (!val)
|
if (!val)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!PLIsDictionary(val))
|
if (!WMIsPLDictionary(val))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
@@ -946,7 +948,7 @@ GetDictionaryForKey(char *defaultName)
|
|||||||
int
|
int
|
||||||
GetIntegerForKey(char *defaultName)
|
GetIntegerForKey(char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
char *str;
|
char *str;
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
@@ -955,10 +957,10 @@ GetIntegerForKey(char *defaultName)
|
|||||||
if (!val)
|
if (!val)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!PLIsString(val))
|
if (!WMIsPLString(val))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
str = PLGetString(val);
|
str = WMGetFromPLString(val);
|
||||||
if (!str)
|
if (!str)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -996,14 +998,14 @@ GetBoolForKey(char *defaultName)
|
|||||||
void
|
void
|
||||||
SetIntegerForKey(int value, char *defaultName)
|
SetIntegerForKey(int value, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t object;
|
WMPropList *object;
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
|
|
||||||
sprintf(buffer, "%i", value);
|
sprintf(buffer, "%i", value);
|
||||||
object = PLMakeString(buffer);
|
object = WMCreatePLString(buffer);
|
||||||
|
|
||||||
SetObjectForKey(object, defaultName);
|
SetObjectForKey(object, defaultName);
|
||||||
PLRelease(object);
|
WMReleasePropList(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1011,23 +1013,23 @@ SetIntegerForKey(int value, char *defaultName)
|
|||||||
void
|
void
|
||||||
SetStringForKey(char *value, char *defaultName)
|
SetStringForKey(char *value, char *defaultName)
|
||||||
{
|
{
|
||||||
proplist_t object;
|
WMPropList *object;
|
||||||
|
|
||||||
object = PLMakeString(value);
|
object = WMCreatePLString(value);
|
||||||
|
|
||||||
SetObjectForKey(object, defaultName);
|
SetObjectForKey(object, defaultName);
|
||||||
PLRelease(object);
|
WMReleasePropList(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SetBoolForKey(Bool value, char *defaultName)
|
SetBoolForKey(Bool value, char *defaultName)
|
||||||
{
|
{
|
||||||
static proplist_t yes = NULL, no = NULL;
|
static WMPropList *yes = NULL, *no = NULL;
|
||||||
|
|
||||||
if (!yes) {
|
if (!yes) {
|
||||||
yes = PLMakeString("YES");
|
yes = WMCreatePLString("YES");
|
||||||
no = PLMakeString("NO");
|
no = WMCreatePLString("NO");
|
||||||
}
|
}
|
||||||
|
|
||||||
SetObjectForKey(value ? yes : no, defaultName);
|
SetObjectForKey(value ? yes : no, defaultName);
|
||||||
|
|||||||
+2
-4
@@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#include <proplist.h>
|
|
||||||
|
|
||||||
#include <wraster.h>
|
#include <wraster.h>
|
||||||
|
|
||||||
#include <WINGs/WINGs.h>
|
#include <WINGs/WINGs.h>
|
||||||
@@ -85,9 +83,9 @@ WMWindow *GetWindow(Panel *panel);
|
|||||||
|
|
||||||
/* manipulate the dictionary for the WindowMaker domain */
|
/* 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);
|
void RemoveObjectForKey(char *defaultName);
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ static void
|
|||||||
showData(_Panel *panel)
|
showData(_Panel *panel)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
proplist_t arr;
|
WMPropList *arr;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
str = GetStringForKey("WindowPlacement");
|
str = GetStringForKey("WindowPlacement");
|
||||||
@@ -159,12 +159,12 @@ showData(_Panel *panel)
|
|||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 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)"));
|
wwarning(_("invalid data in option WindowPlaceOrigin. Using default (0,0)"));
|
||||||
} else {
|
} else {
|
||||||
if (arr) {
|
if (arr) {
|
||||||
x = atoi(PLGetString(PLGetArrayElement(arr, 0)));
|
x = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 0)));
|
||||||
y = atoi(PLGetString(PLGetArrayElement(arr, 1)));
|
y = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ showData(_Panel *panel)
|
|||||||
static void
|
static void
|
||||||
storeData(_Panel *panel)
|
storeData(_Panel *panel)
|
||||||
{
|
{
|
||||||
proplist_t arr;
|
WMPropList *arr;
|
||||||
char x[16], y[16];
|
char x[16], y[16];
|
||||||
|
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->miconB), "NoWindowOverIcons");
|
SetBoolForKey(WMGetButtonSelected(panel->miconB), "NoWindowOverIcons");
|
||||||
@@ -206,11 +206,11 @@ storeData(_Panel *panel)
|
|||||||
"WindowPlacement");
|
"WindowPlacement");
|
||||||
sprintf(x, "%i", WMGetSliderValue(panel->hsli));
|
sprintf(x, "%i", WMGetSliderValue(panel->hsli));
|
||||||
sprintf(y, "%i", WMGetSliderValue(panel->vsli));
|
sprintf(y, "%i", WMGetSliderValue(panel->vsli));
|
||||||
arr = PLMakeArrayFromElements(PLMakeString(x), PLMakeString(y), NULL);
|
arr = WMCreatePLArray(WMCreatePLString(x), WMCreatePLString(y), NULL);
|
||||||
SetObjectForKey(arr, "WindowPlaceOrigin");
|
SetObjectForKey(arr, "WindowPlaceOrigin");
|
||||||
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
|
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");
|
||||||
SetBoolForKey(WMGetButtonSelected(panel->resrB), "Attraction");
|
SetBoolForKey(WMGetButtonSelected(panel->resrB), "Attraction");
|
||||||
PLRelease(arr);
|
WMReleasePropList(arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-16
@@ -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
|
static void
|
||||||
print_help(char *progname)
|
print_help(char *progname)
|
||||||
{
|
{
|
||||||
@@ -177,7 +162,7 @@ main(int argc, char **argv)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLSetStringCmpHook(stringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
Initialize(scr);
|
Initialize(scr);
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
|
dnl WM_CHECK_REDCRAP_BUGS(prefix,bindir,libdir)
|
||||||
dnl
|
dnl
|
||||||
|
|||||||
+3
-56
@@ -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
|
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 ==============================================
|
||||||
dnl Graphic Format Libraries
|
dnl Graphic Format Libraries
|
||||||
dnl ==============================================
|
dnl ==============================================
|
||||||
@@ -937,7 +884,7 @@ exec_prefix=\$prefix
|
|||||||
|
|
||||||
WCFLAGS="-I\$prefix/include $inc_search_path"
|
WCFLAGS="-I\$prefix/include $inc_search_path"
|
||||||
WLFLAGS="-L\$exec_prefix/lib $lib_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#"
|
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"
|
WCFLAGS="-I\$prefix/include $inc_search_path"
|
||||||
WLFLAGS="-L\$exec_prefix/lib $lib_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#"
|
usage="Usage: get-wutil-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
|
||||||
|
|
||||||
|
|||||||
+3
-56
@@ -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
|
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 ==============================================
|
||||||
dnl Graphic Format Libraries
|
dnl Graphic Format Libraries
|
||||||
dnl ==============================================
|
dnl ==============================================
|
||||||
@@ -937,7 +884,7 @@ exec_prefix=\$prefix
|
|||||||
|
|
||||||
WCFLAGS="-I\$prefix/include $inc_search_path"
|
WCFLAGS="-I\$prefix/include $inc_search_path"
|
||||||
WLFLAGS="-L\$exec_prefix/lib $lib_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#"
|
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"
|
WCFLAGS="-I\$prefix/include $inc_search_path"
|
||||||
WLFLAGS="-L\$exec_prefix/lib $lib_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#"
|
usage="Usage: get-wutil-flags #lp#--cflags#rp# #lp#--ldflags#rp# #lp#--libs#rp#"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Common stub for a few missing GNU programs while installing.
|
# Common stub for a few missing GNU programs while installing.
|
||||||
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
||||||
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
|
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# 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
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
# 02111-1307, USA.
|
# 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
|
if test $# -eq 0; then
|
||||||
echo 1>&2 "Try \`$0 --help' for more information"
|
echo 1>&2 "Try \`$0 --help' for more information"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
case "$1" in
|
||||||
|
|
||||||
-h|--h|--he|--hel|--help)
|
-h|--h|--he|--hel|--help)
|
||||||
@@ -35,19 +61,24 @@ error status if there is no known handling for PROGRAM.
|
|||||||
Options:
|
Options:
|
||||||
-h, --help display this help and exit
|
-h, --help display this help and exit
|
||||||
-v, --version output version information 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:
|
Supported PROGRAM values:
|
||||||
aclocal touch file \`aclocal.m4'
|
aclocal touch file \`aclocal.m4'
|
||||||
autoconf touch file \`configure'
|
autoconf touch file \`configure'
|
||||||
autoheader touch file \`config.h.in'
|
autoheader touch file \`config.h.in'
|
||||||
automake touch all \`Makefile.in' files
|
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
|
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)
|
-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)
|
aclocal)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is missing on your system. You should only need it if
|
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
|
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||||
any GNU archive site."
|
any GNU archive site."
|
||||||
touch aclocal.m4
|
touch aclocal.m4
|
||||||
@@ -68,7 +99,7 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
|||||||
autoconf)
|
autoconf)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is missing on your system. You should only need it if
|
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
|
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||||
archive site."
|
archive site."
|
||||||
touch configure
|
touch configure
|
||||||
@@ -77,21 +108,31 @@ WARNING: \`$1' is missing on your system. You should only need it if
|
|||||||
autoheader)
|
autoheader)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is missing on your system. You should only need it if
|
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
|
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||||
from any GNU archive site."
|
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)
|
automake)
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is missing on your system. You should only need it if
|
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.
|
You might want to install the \`Automake' and \`Perl' packages.
|
||||||
Grab them from any GNU archive site."
|
Grab them from any GNU archive site."
|
||||||
find . -type f -name Makefile.am -print \
|
find . -type f -name Makefile.am -print |
|
||||||
| sed 's/^\(.*\).am$/touch \1.in/' \
|
sed 's/\.am$/.in/' |
|
||||||
| sh
|
while read f; do touch "$f"; done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
bison|yacc)
|
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
|
you modified a \`.y' file. You may need the \`Bison' package
|
||||||
in order for those modifications to take effect. You can get
|
in order for those modifications to take effect. You can get
|
||||||
\`Bison' from any GNU archive site."
|
\`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)
|
makeinfo)
|
||||||
|
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||||
|
# We have makeinfo, but it failed.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo 1>&2 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is missing on your system. You should only need it if
|
WARNING: \`$1' is missing on your system. You should only need it if
|
||||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
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
|
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 "\
|
echo 1>&2 "\
|
||||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||||
|
|||||||
@@ -24,23 +24,8 @@
|
|||||||
#ifndef WMGNUSTEP_H_
|
#ifndef WMGNUSTEP_H_
|
||||||
#define 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>
|
#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"
|
#define GNUSTEP_WM_MINIATURIZE_WINDOW "_GNUSTEP_WM_MINIATURIZE_WINDOW"
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ wmaker_SOURCES = \
|
|||||||
placement.c \
|
placement.c \
|
||||||
properties.c \
|
properties.c \
|
||||||
properties.h \
|
properties.h \
|
||||||
proplist.c \
|
|
||||||
resources.c \
|
resources.c \
|
||||||
resources.h \
|
resources.h \
|
||||||
rootmenu.c \
|
rootmenu.c \
|
||||||
@@ -114,7 +113,6 @@ INCLUDES = \
|
|||||||
wmaker_LDADD = \
|
wmaker_LDADD = \
|
||||||
$(top_builddir)/WINGs/libWINGs.a\
|
$(top_builddir)/WINGs/libWINGs.a\
|
||||||
$(top_builddir)/wrlib/libwraster.la\
|
$(top_builddir)/wrlib/libwraster.la\
|
||||||
@LIBPL@ \
|
|
||||||
@XLIBS@ \
|
@XLIBS@ \
|
||||||
@INTLIBS@ \
|
@INTLIBS@ \
|
||||||
@DLLIBS@
|
@DLLIBS@
|
||||||
|
|||||||
@@ -382,7 +382,6 @@ Bool
|
|||||||
wAppIconIsFirstInstance(WAppIcon *icon)
|
wAppIconIsFirstInstance(WAppIcon *icon)
|
||||||
{
|
{
|
||||||
WAppIcon *list = icon->icon->core->screen_ptr->app_icon_list;
|
WAppIcon *list = icon->icon->core->screen_ptr->app_icon_list;
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
if (!WFLAGP(icon->icon->owner, collapse_appicons))
|
if (!WFLAGP(icon->icon->owner, collapse_appicons))
|
||||||
return True;
|
return True;
|
||||||
|
|||||||
+16
-17
@@ -139,9 +139,9 @@ extractIcon(WWindow *wwin)
|
|||||||
static void
|
static void
|
||||||
saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
|
saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
|
||||||
{
|
{
|
||||||
proplist_t dict = WDWindowAttributes->dictionary;
|
WMPropList *dict = WDWindowAttributes->dictionary;
|
||||||
proplist_t adict, key, iconk;
|
WMPropList *adict, *key, *iconk;
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -162,31 +162,31 @@ saveIconNameFor(char *iconPath, char *wm_instance, char *wm_class)
|
|||||||
strcat(tmp, wm_class);
|
strcat(tmp, wm_class);
|
||||||
}
|
}
|
||||||
|
|
||||||
key = PLMakeString(tmp);
|
key = WMCreatePLString(tmp);
|
||||||
wfree(tmp);
|
wfree(tmp);
|
||||||
adict = PLGetDictionaryEntry(dict, key);
|
adict = WMGetFromPLDictionary(dict, key);
|
||||||
|
|
||||||
iconk = PLMakeString("Icon");
|
iconk = WMCreatePLString("Icon");
|
||||||
|
|
||||||
if (adict) {
|
if (adict) {
|
||||||
val = PLGetDictionaryEntry(adict, iconk);
|
val = WMGetFromPLDictionary(adict, iconk);
|
||||||
} else {
|
} else {
|
||||||
/* no dictionary for app, so create one */
|
/* no dictionary for app, so create one */
|
||||||
adict = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
adict = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
PLInsertDictionaryEntry(dict, key, adict);
|
WMPutInPLDictionary(dict, key, adict);
|
||||||
PLRelease(adict);
|
WMReleasePropList(adict);
|
||||||
val = NULL;
|
val = NULL;
|
||||||
}
|
}
|
||||||
if (!val) {
|
if (!val) {
|
||||||
val = PLMakeString(iconPath);
|
val = WMCreatePLString(iconPath);
|
||||||
PLInsertDictionaryEntry(adict, iconk, val);
|
WMPutInPLDictionary(adict, iconk, val);
|
||||||
PLRelease(val);
|
WMReleasePropList(val);
|
||||||
}
|
}
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
PLRelease(iconk);
|
WMReleasePropList(iconk);
|
||||||
|
|
||||||
if (val && !wPreferences.flags.noupdates)
|
if (val && !wPreferences.flags.noupdates)
|
||||||
PLSave(dict, YES);
|
WMWritePropListToFile(dict, WDWindowAttributes->path, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -549,7 +549,6 @@ void
|
|||||||
wApplicationSetCollapse(WApplication *app, Bool flag)
|
wApplicationSetCollapse(WApplication *app, Bool flag)
|
||||||
{
|
{
|
||||||
WApplication *list = app->main_window_desc->screen_ptr->wapp_list;
|
WApplication *list = app->main_window_desc->screen_ptr->wapp_list;
|
||||||
int index = 0;
|
|
||||||
WWindow *wwin = app->main_window_desc;
|
WWindow *wwin = app->main_window_desc;
|
||||||
|
|
||||||
if (WFLAGP(app->main_window_desc, collapse_appicons) == flag)
|
if (WFLAGP(app->main_window_desc, collapse_appicons) == flag)
|
||||||
|
|||||||
+211
-227
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -24,25 +24,25 @@
|
|||||||
|
|
||||||
typedef struct WDDomain {
|
typedef struct WDDomain {
|
||||||
char *domain_name;
|
char *domain_name;
|
||||||
proplist_t dictionary;
|
WMPropList *dictionary;
|
||||||
char *path;
|
char *path;
|
||||||
time_t timestamp;
|
time_t timestamp;
|
||||||
} WDDomain;
|
} WDDomain;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
proplist_t wDefaultsInit(int screen_number);
|
WMPropList* wDefaultsInit(int screen_number);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
WDDomain*wDefaultsInitDomain(char *domain, Bool requireDictionary);
|
WDDomain* wDefaultsInitDomain(char *domain, Bool requireDictionary);
|
||||||
|
|
||||||
void wDefaultsDestroyDomain(WDDomain *domain);
|
void wDefaultsDestroyDomain(WDDomain *domain);
|
||||||
|
|
||||||
void wReadDefaults(WScreen *scr, proplist_t new_dict);
|
void wReadDefaults(WScreen *scr, WMPropList *new_dict);
|
||||||
|
|
||||||
void wDefaultUpdateIcons(WScreen *scr);
|
void wDefaultUpdateIcons(WScreen *scr);
|
||||||
|
|
||||||
void wReadStaticDefaults(proplist_t dict);
|
void wReadStaticDefaults(WMPropList *dict);
|
||||||
|
|
||||||
void wDefaultsCheckDomains(void *screen);
|
void wDefaultsCheckDomains(void *screen);
|
||||||
|
|
||||||
|
|||||||
+11
-12
@@ -503,7 +503,6 @@ static void
|
|||||||
keyPressHandler(XEvent *event, void *data)
|
keyPressHandler(XEvent *event, void *data)
|
||||||
{
|
{
|
||||||
IconPanel *panel = (IconPanel*)data;
|
IconPanel *panel = (IconPanel*)data;
|
||||||
Display *dpy = event->xany.display;
|
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
int count;
|
int count;
|
||||||
KeySym ksym;
|
KeySym ksym;
|
||||||
@@ -1592,28 +1591,28 @@ setCrashAction(void *self, void *clientData)
|
|||||||
static WMPixmap*
|
static WMPixmap*
|
||||||
getWindowMakerIconImage(WMScreen *scr)
|
getWindowMakerIconImage(WMScreen *scr)
|
||||||
{
|
{
|
||||||
proplist_t dict, key, option, value=NULL;
|
WMPropList *dict, *key, *option, *value=NULL;
|
||||||
WMPixmap *pix=NULL;
|
WMPixmap *pix=NULL;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
PLSetStringCmpHook(NULL);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
key = PLMakeString("Logo.WMPanel");
|
key = WMCreatePLString("Logo.WMPanel");
|
||||||
option = PLMakeString("Icon");
|
option = WMCreatePLString("Icon");
|
||||||
|
|
||||||
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
|
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
|
||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
value = PLGetDictionaryEntry(dict, option);
|
value = WMGetFromPLDictionary(dict, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
PLRelease(option);
|
WMReleasePropList(option);
|
||||||
|
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
if (value && PLIsString(value)) {
|
if (value && WMIsPLString(value)) {
|
||||||
path = FindImage(wPreferences.icon_path, PLGetString(value));
|
path = FindImage(wPreferences.icon_path, WMGetFromPLString(value));
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
RColor gray;
|
RColor gray;
|
||||||
|
|||||||
+157
-157
@@ -56,7 +56,7 @@
|
|||||||
#include "wsound.h"
|
#include "wsound.h"
|
||||||
|
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -97,19 +97,19 @@ extern void appIconMouseDown(WObjDescriptor *desc, XEvent *event);
|
|||||||
|
|
||||||
/***** Local variables ****/
|
/***** Local variables ****/
|
||||||
|
|
||||||
static proplist_t dCommand=NULL;
|
static WMPropList *dCommand=NULL;
|
||||||
static proplist_t dPasteCommand=NULL;
|
static WMPropList *dPasteCommand=NULL;
|
||||||
#ifdef OFFIX_DND
|
#ifdef OFFIX_DND
|
||||||
static proplist_t dDropCommand=NULL;
|
static WMPropList *dDropCommand=NULL;
|
||||||
#endif
|
#endif
|
||||||
static proplist_t dAutoLaunch, dLock;
|
static WMPropList *dAutoLaunch, *dLock;
|
||||||
static proplist_t dName, dForced, dBuggyApplication, dYes, dNo;
|
static WMPropList *dName, *dForced, *dBuggyApplication, *dYes, *dNo;
|
||||||
static proplist_t dHost, dDock, dClip;
|
static WMPropList *dHost, *dDock, *dClip;
|
||||||
static proplist_t dAutoAttractIcons;
|
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);
|
static void dockIconPaint(WAppIcon *btn);
|
||||||
|
|
||||||
@@ -168,30 +168,30 @@ make_keys()
|
|||||||
if (dCommand!=NULL)
|
if (dCommand!=NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dCommand = PLRetain(PLMakeString("Command"));
|
dCommand = WMRetainPropList(WMCreatePLString("Command"));
|
||||||
dPasteCommand = PLRetain(PLMakeString("PasteCommand"));
|
dPasteCommand = WMRetainPropList(WMCreatePLString("PasteCommand"));
|
||||||
dDropCommand = PLRetain(PLMakeString("DropCommand"));
|
dDropCommand = WMRetainPropList(WMCreatePLString("DropCommand"));
|
||||||
dLock = PLRetain(PLMakeString("Lock"));
|
dLock = WMRetainPropList(WMCreatePLString("Lock"));
|
||||||
dAutoLaunch = PLRetain(PLMakeString("AutoLaunch"));
|
dAutoLaunch = WMRetainPropList(WMCreatePLString("AutoLaunch"));
|
||||||
dName = PLRetain(PLMakeString("Name"));
|
dName = WMRetainPropList(WMCreatePLString("Name"));
|
||||||
dForced = PLRetain(PLMakeString("Forced"));
|
dForced = WMRetainPropList(WMCreatePLString("Forced"));
|
||||||
dBuggyApplication = PLRetain(PLMakeString("BuggyApplication"));
|
dBuggyApplication = WMRetainPropList(WMCreatePLString("BuggyApplication"));
|
||||||
dYes = PLRetain(PLMakeString("Yes"));
|
dYes = WMRetainPropList(WMCreatePLString("Yes"));
|
||||||
dNo = PLRetain(PLMakeString("No"));
|
dNo = WMRetainPropList(WMCreatePLString("No"));
|
||||||
dHost = PLRetain(PLMakeString("Host"));
|
dHost = WMRetainPropList(WMCreatePLString("Host"));
|
||||||
|
|
||||||
dPosition = PLMakeString("Position");
|
dPosition = WMCreatePLString("Position");
|
||||||
dApplications = PLMakeString("Applications");
|
dApplications = WMCreatePLString("Applications");
|
||||||
dLowered = PLMakeString("Lowered");
|
dLowered = WMCreatePLString("Lowered");
|
||||||
dCollapsed = PLMakeString("Collapsed");
|
dCollapsed = WMCreatePLString("Collapsed");
|
||||||
dAutoCollapse = PLMakeString("AutoCollapse");
|
dAutoCollapse = WMCreatePLString("AutoCollapse");
|
||||||
dAutoRaiseLower = PLMakeString("AutoRaiseLower");
|
dAutoRaiseLower = WMCreatePLString("AutoRaiseLower");
|
||||||
dAutoAttractIcons = PLMakeString("AutoAttractIcons");
|
dAutoAttractIcons = WMCreatePLString("AutoAttractIcons");
|
||||||
|
|
||||||
dOmnipresent = PLMakeString("Omnipresent");
|
dOmnipresent = WMCreatePLString("Omnipresent");
|
||||||
|
|
||||||
dDock = PLMakeString("Dock");
|
dDock = WMCreatePLString("Dock");
|
||||||
dClip = PLMakeString("Clip");
|
dClip = WMCreatePLString("Clip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1307,20 +1307,20 @@ dockIconPaint(WAppIcon *btn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
make_icon_state(WAppIcon *btn)
|
make_icon_state(WAppIcon *btn)
|
||||||
{
|
{
|
||||||
proplist_t node = NULL;
|
WMPropList *node = NULL;
|
||||||
proplist_t command, autolaunch, lock, name, forced, host, position, buggy;
|
WMPropList *command, *autolaunch, *lock, *name, *forced, *host;
|
||||||
proplist_t omnipresent;
|
WMPropList *position, *buggy, *omnipresent;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
|
|
||||||
if (btn) {
|
if (btn) {
|
||||||
if (!btn->command)
|
if (!btn->command)
|
||||||
command = PLMakeString("-");
|
command = WMCreatePLString("-");
|
||||||
else
|
else
|
||||||
command = PLMakeString(btn->command);
|
command = WMCreatePLString(btn->command);
|
||||||
|
|
||||||
autolaunch = btn->auto_launch ? dYes : dNo;
|
autolaunch = btn->auto_launch ? dYes : dNo;
|
||||||
|
|
||||||
@@ -1328,7 +1328,7 @@ make_icon_state(WAppIcon *btn)
|
|||||||
|
|
||||||
tmp = EscapeWM_CLASS(btn->wm_instance, btn->wm_class);
|
tmp = EscapeWM_CLASS(btn->wm_instance, btn->wm_class);
|
||||||
|
|
||||||
name = PLMakeString(tmp);
|
name = WMCreatePLString(tmp);
|
||||||
|
|
||||||
wfree(tmp);
|
wfree(tmp);
|
||||||
|
|
||||||
@@ -1340,9 +1340,9 @@ make_icon_state(WAppIcon *btn)
|
|||||||
snprintf(buffer, sizeof(buffer), "%i,%i", btn->x_pos, btn->y_pos);
|
snprintf(buffer, sizeof(buffer), "%i,%i", btn->x_pos, btn->y_pos);
|
||||||
else
|
else
|
||||||
snprintf(buffer, sizeof(buffer), "%hi,%hi", btn->xindex, btn->yindex);
|
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,
|
dName, name,
|
||||||
dAutoLaunch, autolaunch,
|
dAutoLaunch, autolaunch,
|
||||||
dLock, lock,
|
dLock, lock,
|
||||||
@@ -1350,33 +1350,33 @@ make_icon_state(WAppIcon *btn)
|
|||||||
dBuggyApplication, buggy,
|
dBuggyApplication, buggy,
|
||||||
dPosition, position,
|
dPosition, position,
|
||||||
NULL);
|
NULL);
|
||||||
PLRelease(command);
|
WMReleasePropList(command);
|
||||||
PLRelease(name);
|
WMReleasePropList(name);
|
||||||
PLRelease(position);
|
WMReleasePropList(position);
|
||||||
|
|
||||||
omnipresent = btn->omnipresent ? dYes : dNo;
|
omnipresent = btn->omnipresent ? dYes : dNo;
|
||||||
if (btn->dock != btn->icon->core->screen_ptr->dock &&
|
if (btn->dock != btn->icon->core->screen_ptr->dock &&
|
||||||
(btn->xindex != 0 || btn->yindex != 0))
|
(btn->xindex != 0 || btn->yindex != 0))
|
||||||
PLInsertDictionaryEntry(node, dOmnipresent, omnipresent);
|
WMPutInPLDictionary(node, dOmnipresent, omnipresent);
|
||||||
|
|
||||||
#ifdef OFFIX_DND
|
#ifdef OFFIX_DND
|
||||||
if (btn->dnd_command) {
|
if (btn->dnd_command) {
|
||||||
command = PLMakeString(btn->dnd_command);
|
command = WMCreatePLString(btn->dnd_command);
|
||||||
PLInsertDictionaryEntry(node, dDropCommand, command);
|
WMPutInPLDictionary(node, dDropCommand, command);
|
||||||
PLRelease(command);
|
WMReleasePropList(command);
|
||||||
}
|
}
|
||||||
#endif /* OFFIX_DND */
|
#endif /* OFFIX_DND */
|
||||||
|
|
||||||
if (btn->paste_command) {
|
if (btn->paste_command) {
|
||||||
command = PLMakeString(btn->paste_command);
|
command = WMCreatePLString(btn->paste_command);
|
||||||
PLInsertDictionaryEntry(node, dPasteCommand, command);
|
WMPutInPLDictionary(node, dPasteCommand, command);
|
||||||
PLRelease(command);
|
WMReleasePropList(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btn->client_machine && btn->remote_start) {
|
if (btn->client_machine && btn->remote_start) {
|
||||||
host = PLMakeString(btn->client_machine);
|
host = WMCreatePLString(btn->client_machine);
|
||||||
PLInsertDictionaryEntry(node, dHost, host);
|
WMPutInPLDictionary(node, dHost, host);
|
||||||
PLRelease(host);
|
WMReleasePropList(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1384,16 +1384,16 @@ make_icon_state(WAppIcon *btn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
dockSaveState(WDock *dock)
|
dockSaveState(WDock *dock)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
proplist_t icon_info;
|
WMPropList *icon_info;
|
||||||
proplist_t list=NULL, dock_state=NULL;
|
WMPropList *list=NULL, *dock_state=NULL;
|
||||||
proplist_t value, key;
|
WMPropList *value, *key;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
||||||
list = PLMakeArrayFromElements(NULL);
|
list = WMCreatePLArray(NULL);
|
||||||
|
|
||||||
for (i=(dock->type==WM_DOCK ? 0 : 1); i<dock->max_icons; i++) {
|
for (i=(dock->type==WM_DOCK ? 0 : 1); i<dock->max_icons; i++) {
|
||||||
WAppIcon *btn = dock->icon_array[i];
|
WAppIcon *btn = dock->icon_array[i];
|
||||||
@@ -1402,45 +1402,45 @@ dockSaveState(WDock *dock)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((icon_info = make_icon_state(dock->icon_array[i]))) {
|
if ((icon_info = make_icon_state(dock->icon_array[i]))) {
|
||||||
list = PLAppendArrayElement(list, icon_info);
|
WMAddToPLArray(list, icon_info);
|
||||||
PLRelease(icon_info);
|
WMReleasePropList(icon_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dock_state = PLMakeDictionaryFromEntries(dApplications, list,
|
dock_state = WMCreatePLDictionary(dApplications, list,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (dock->type == WM_DOCK) {
|
if (dock->type == WM_DOCK) {
|
||||||
snprintf(buffer, sizeof(buffer), "Applications%i", dock->screen_ptr->scr_height);
|
snprintf(buffer, sizeof(buffer), "Applications%i", dock->screen_ptr->scr_height);
|
||||||
key = PLMakeString(buffer);
|
key = WMCreatePLString(buffer);
|
||||||
PLInsertDictionaryEntry(dock_state, key, list);
|
WMPutInPLDictionary(dock_state, key, list);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
|
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%i,%i", (dock->on_right_side ? -ICON_SIZE : 0),
|
snprintf(buffer, sizeof(buffer), "%i,%i", (dock->on_right_side ? -ICON_SIZE : 0),
|
||||||
dock->y_pos);
|
dock->y_pos);
|
||||||
value = PLMakeString(buffer);
|
value = WMCreatePLString(buffer);
|
||||||
PLInsertDictionaryEntry(dock_state, dPosition, value);
|
WMPutInPLDictionary(dock_state, dPosition, value);
|
||||||
PLRelease(value);
|
WMReleasePropList(value);
|
||||||
}
|
}
|
||||||
PLRelease(list);
|
WMReleasePropList(list);
|
||||||
|
|
||||||
|
|
||||||
value = (dock->lowered ? dYes : dNo);
|
value = (dock->lowered ? dYes : dNo);
|
||||||
PLInsertDictionaryEntry(dock_state, dLowered, value);
|
WMPutInPLDictionary(dock_state, dLowered, value);
|
||||||
|
|
||||||
if (dock->type == WM_CLIP) {
|
if (dock->type == WM_CLIP) {
|
||||||
value = (dock->collapsed ? dYes : dNo);
|
value = (dock->collapsed ? dYes : dNo);
|
||||||
PLInsertDictionaryEntry(dock_state, dCollapsed, value);
|
WMPutInPLDictionary(dock_state, dCollapsed, value);
|
||||||
|
|
||||||
value = (dock->auto_collapse ? dYes : dNo);
|
value = (dock->auto_collapse ? dYes : dNo);
|
||||||
PLInsertDictionaryEntry(dock_state, dAutoCollapse, value);
|
WMPutInPLDictionary(dock_state, dAutoCollapse, value);
|
||||||
|
|
||||||
value = (dock->auto_raise_lower ? dYes : dNo);
|
value = (dock->auto_raise_lower ? dYes : dNo);
|
||||||
PLInsertDictionaryEntry(dock_state, dAutoRaiseLower, value);
|
WMPutInPLDictionary(dock_state, dAutoRaiseLower, value);
|
||||||
|
|
||||||
value = (dock->attract_icons ? dYes : dNo);
|
value = (dock->attract_icons ? dYes : dNo);
|
||||||
PLInsertDictionaryEntry(dock_state, dAutoAttractIcons, value);
|
WMPutInPLDictionary(dock_state, dAutoAttractIcons, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dock_state;
|
return dock_state;
|
||||||
@@ -1448,10 +1448,10 @@ dockSaveState(WDock *dock)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wDockSaveState(WScreen *scr, proplist_t old_state)
|
wDockSaveState(WScreen *scr, WMPropList *old_state)
|
||||||
{
|
{
|
||||||
proplist_t dock_state;
|
WMPropList *dock_state;
|
||||||
proplist_t keys;
|
WMPropList *keys;
|
||||||
|
|
||||||
dock_state = dockSaveState(scr->dock);
|
dock_state = dockSaveState(scr->dock);
|
||||||
|
|
||||||
@@ -1460,44 +1460,44 @@ wDockSaveState(WScreen *scr, proplist_t old_state)
|
|||||||
*/
|
*/
|
||||||
if (old_state) {
|
if (old_state) {
|
||||||
int i;
|
int i;
|
||||||
proplist_t tmp;
|
WMPropList *tmp;
|
||||||
|
|
||||||
keys = PLGetAllDictionaryKeys(old_state);
|
keys = WMGetPLDictionaryKeys(old_state);
|
||||||
for (i = 0; i < PLGetNumberOfElements(keys); i++) {
|
for (i = 0; i < WMGetPropListItemCount(keys); i++) {
|
||||||
tmp = PLGetArrayElement(keys, i);
|
tmp = WMGetFromPLArray(keys, i);
|
||||||
|
|
||||||
if (strncasecmp(PLGetString(tmp), "applications", 12) == 0
|
if (strncasecmp(WMGetFromPLString(tmp), "applications", 12) == 0
|
||||||
&& !PLGetDictionaryEntry(dock_state, tmp)) {
|
&& !WMGetFromPLDictionary(dock_state, tmp)) {
|
||||||
|
|
||||||
PLInsertDictionaryEntry(dock_state,
|
WMPutInPLDictionary(dock_state,
|
||||||
tmp,
|
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
|
void
|
||||||
wClipSaveState(WScreen *scr)
|
wClipSaveState(WScreen *scr)
|
||||||
{
|
{
|
||||||
proplist_t clip_state;
|
WMPropList *clip_state;
|
||||||
|
|
||||||
clip_state = make_icon_state(scr->clip_icon);
|
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)
|
wClipSaveWorkspaceState(WScreen *scr, int workspace)
|
||||||
{
|
{
|
||||||
return dockSaveState(scr->workspaces[workspace]->clip);
|
return dockSaveState(scr->workspaces[workspace]->clip);
|
||||||
@@ -1505,15 +1505,15 @@ wClipSaveWorkspaceState(WScreen *scr, int workspace)
|
|||||||
|
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
getBooleanDockValue(proplist_t value, proplist_t key)
|
getBooleanDockValue(WMPropList *value, WMPropList *key)
|
||||||
{
|
{
|
||||||
if (value) {
|
if (value) {
|
||||||
if (PLIsString(value)) {
|
if (WMIsPLString(value)) {
|
||||||
if (strcasecmp(PLGetString(value), "YES")==0)
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
|
||||||
return True;
|
return True;
|
||||||
} else {
|
} else {
|
||||||
wwarning(_("bad value in docked icon state info %s"),
|
wwarning(_("bad value in docked icon state info %s"),
|
||||||
PLGetString(key));
|
WMGetFromPLString(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return False;
|
return False;
|
||||||
@@ -1521,19 +1521,19 @@ getBooleanDockValue(proplist_t value, proplist_t key)
|
|||||||
|
|
||||||
|
|
||||||
static WAppIcon*
|
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;
|
WAppIcon *aicon;
|
||||||
proplist_t cmd, value;
|
WMPropList *cmd, *value;
|
||||||
|
|
||||||
|
|
||||||
cmd = PLGetDictionaryEntry(info, dCommand);
|
cmd = WMGetFromPLDictionary(info, dCommand);
|
||||||
if (!cmd || !PLIsString(cmd)) {
|
if (!cmd || !WMIsPLString(cmd)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse window name */
|
/* parse window name */
|
||||||
value = PLGetDictionaryEntry(info, dName);
|
value = WMGetFromPLDictionary(info, dName);
|
||||||
if (!value)
|
if (!value)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -1550,7 +1550,7 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
|
|||||||
/* get commands */
|
/* get commands */
|
||||||
|
|
||||||
if (cmd)
|
if (cmd)
|
||||||
command = wstrdup(PLGetString(cmd));
|
command = wstrdup(WMGetFromPLString(cmd));
|
||||||
else
|
else
|
||||||
command = NULL;
|
command = NULL;
|
||||||
|
|
||||||
@@ -1585,42 +1585,42 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef OFFIX_DND
|
#ifdef OFFIX_DND
|
||||||
cmd = PLGetDictionaryEntry(info, dDropCommand);
|
cmd = WMGetFromPLDictionary(info, dDropCommand);
|
||||||
if (cmd)
|
if (cmd)
|
||||||
aicon->dnd_command = wstrdup(PLGetString(cmd));
|
aicon->dnd_command = wstrdup(WMGetFromPLString(cmd));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmd = PLGetDictionaryEntry(info, dPasteCommand);
|
cmd = WMGetFromPLDictionary(info, dPasteCommand);
|
||||||
if (cmd)
|
if (cmd)
|
||||||
aicon->paste_command = wstrdup(PLGetString(cmd));
|
aicon->paste_command = wstrdup(WMGetFromPLString(cmd));
|
||||||
|
|
||||||
/* check auto launch */
|
/* check auto launch */
|
||||||
value = PLGetDictionaryEntry(info, dAutoLaunch);
|
value = WMGetFromPLDictionary(info, dAutoLaunch);
|
||||||
|
|
||||||
aicon->auto_launch = getBooleanDockValue(value, dAutoLaunch);
|
aicon->auto_launch = getBooleanDockValue(value, dAutoLaunch);
|
||||||
|
|
||||||
/* check lock */
|
/* check lock */
|
||||||
value = PLGetDictionaryEntry(info, dLock);
|
value = WMGetFromPLDictionary(info, dLock);
|
||||||
|
|
||||||
aicon->lock = getBooleanDockValue(value, dLock);
|
aicon->lock = getBooleanDockValue(value, dLock);
|
||||||
|
|
||||||
/* check if it wasn't normally docked */
|
/* check if it wasn't normally docked */
|
||||||
value = PLGetDictionaryEntry(info, dForced);
|
value = WMGetFromPLDictionary(info, dForced);
|
||||||
|
|
||||||
aicon->forced_dock = getBooleanDockValue(value, dForced);
|
aicon->forced_dock = getBooleanDockValue(value, dForced);
|
||||||
|
|
||||||
/* check if we can rely on the stuff in the app */
|
/* 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);
|
aicon->buggy_app = getBooleanDockValue(value, dBuggyApplication);
|
||||||
|
|
||||||
/* get position in the dock */
|
/* get position in the dock */
|
||||||
value = PLGetDictionaryEntry(info, dPosition);
|
value = WMGetFromPLDictionary(info, dPosition);
|
||||||
if (value && PLIsString(value)) {
|
if (value && WMIsPLString(value)) {
|
||||||
if (sscanf(PLGetString(value), "%hi,%hi", &aicon->xindex,
|
if (sscanf(WMGetFromPLString(value), "%hi,%hi", &aicon->xindex,
|
||||||
&aicon->yindex)!=2)
|
&aicon->yindex)!=2)
|
||||||
wwarning(_("bad value in docked icon state info %s"),
|
wwarning(_("bad value in docked icon state info %s"),
|
||||||
PLGetString(dPosition));
|
WMGetFromPLString(dPosition));
|
||||||
|
|
||||||
/* check position sanity */
|
/* check position sanity */
|
||||||
/* incomplete section! */
|
/* incomplete section! */
|
||||||
@@ -1636,7 +1636,7 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if icon is omnipresent */
|
/* check if icon is omnipresent */
|
||||||
value = PLGetDictionaryEntry(info, dOmnipresent);
|
value = WMGetFromPLDictionary(info, dOmnipresent);
|
||||||
|
|
||||||
aicon->omnipresent = getBooleanDockValue(value, dOmnipresent);
|
aicon->omnipresent = getBooleanDockValue(value, dOmnipresent);
|
||||||
|
|
||||||
@@ -1651,10 +1651,10 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
|
|||||||
|
|
||||||
|
|
||||||
WAppIcon*
|
WAppIcon*
|
||||||
wClipRestoreState(WScreen *scr, proplist_t clip_state)
|
wClipRestoreState(WScreen *scr, WMPropList *clip_state)
|
||||||
{
|
{
|
||||||
WAppIcon *icon;
|
WAppIcon *icon;
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
|
|
||||||
|
|
||||||
icon = mainIconCreate(scr, WM_CLIP);
|
icon = mainIconCreate(scr, WM_CLIP);
|
||||||
@@ -1662,17 +1662,17 @@ wClipRestoreState(WScreen *scr, proplist_t clip_state)
|
|||||||
if (!clip_state)
|
if (!clip_state)
|
||||||
return icon;
|
return icon;
|
||||||
else
|
else
|
||||||
PLRetain(clip_state);
|
WMRetainPropList(clip_state);
|
||||||
|
|
||||||
/* restore position */
|
/* restore position */
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(clip_state, dPosition);
|
value = WMGetFromPLDictionary(clip_state, dPosition);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!PLIsString(value))
|
if (!WMIsPLString(value))
|
||||||
COMPLAIN("Position");
|
COMPLAIN("Position");
|
||||||
else {
|
else {
|
||||||
if (sscanf(PLGetString(value), "%i,%i", &icon->x_pos,
|
if (sscanf(WMGetFromPLString(value), "%i,%i", &icon->x_pos,
|
||||||
&icon->y_pos)!=2)
|
&icon->y_pos)!=2)
|
||||||
COMPLAIN("Position");
|
COMPLAIN("Position");
|
||||||
|
|
||||||
@@ -1690,27 +1690,27 @@ wClipRestoreState(WScreen *scr, proplist_t clip_state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OFFIX_DND
|
#ifdef OFFIX_DND
|
||||||
value = PLGetDictionaryEntry(clip_state, dDropCommand);
|
value = WMGetFromPLDictionary(clip_state, dDropCommand);
|
||||||
if (value && PLIsString(value))
|
if (value && WMIsPLString(value))
|
||||||
icon->dnd_command = wstrdup(PLGetString(value));
|
icon->dnd_command = wstrdup(WMGetFromPLString(value));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(clip_state, dPasteCommand);
|
value = WMGetFromPLDictionary(clip_state, dPasteCommand);
|
||||||
if (value && PLIsString(value))
|
if (value && WMIsPLString(value))
|
||||||
icon->paste_command = wstrdup(PLGetString(value));
|
icon->paste_command = wstrdup(WMGetFromPLString(value));
|
||||||
|
|
||||||
PLRelease(clip_state);
|
WMReleasePropList(clip_state);
|
||||||
|
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WDock*
|
WDock*
|
||||||
wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
wDockRestoreState(WScreen *scr, WMPropList *dock_state, int type)
|
||||||
{
|
{
|
||||||
WDock *dock;
|
WDock *dock;
|
||||||
proplist_t apps;
|
WMPropList *apps;
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
WAppIcon *aicon, *old_top;
|
WAppIcon *aicon, *old_top;
|
||||||
int count, i;
|
int count, i;
|
||||||
|
|
||||||
@@ -1721,18 +1721,18 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
return dock;
|
return dock;
|
||||||
|
|
||||||
if (dock_state)
|
if (dock_state)
|
||||||
PLRetain(dock_state);
|
WMRetainPropList(dock_state);
|
||||||
|
|
||||||
|
|
||||||
/* restore position */
|
/* restore position */
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(dock_state, dPosition);
|
value = WMGetFromPLDictionary(dock_state, dPosition);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!PLIsString(value))
|
if (!WMIsPLString(value))
|
||||||
COMPLAIN("Position");
|
COMPLAIN("Position");
|
||||||
else {
|
else {
|
||||||
if (sscanf(PLGetString(value), "%i,%i", &dock->x_pos,
|
if (sscanf(WMGetFromPLString(value), "%i,%i", &dock->x_pos,
|
||||||
&dock->y_pos)!=2)
|
&dock->y_pos)!=2)
|
||||||
COMPLAIN("Position");
|
COMPLAIN("Position");
|
||||||
|
|
||||||
@@ -1764,13 +1764,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
|
|
||||||
dock->lowered = 0;
|
dock->lowered = 0;
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(dock_state, dLowered);
|
value = WMGetFromPLDictionary(dock_state, dLowered);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!PLIsString(value))
|
if (!WMIsPLString(value))
|
||||||
COMPLAIN("Lowered");
|
COMPLAIN("Lowered");
|
||||||
else {
|
else {
|
||||||
if (strcasecmp(PLGetString(value), "YES")==0)
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
|
||||||
dock->lowered = 1;
|
dock->lowered = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1780,13 +1780,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
|
|
||||||
dock->collapsed = 0;
|
dock->collapsed = 0;
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(dock_state, dCollapsed);
|
value = WMGetFromPLDictionary(dock_state, dCollapsed);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!PLIsString(value))
|
if (!WMIsPLString(value))
|
||||||
COMPLAIN("Collapsed");
|
COMPLAIN("Collapsed");
|
||||||
else {
|
else {
|
||||||
if (strcasecmp(PLGetString(value), "YES")==0)
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
|
||||||
dock->collapsed = 1;
|
dock->collapsed = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1794,13 +1794,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
|
|
||||||
/* restore auto-collapsed state */
|
/* restore auto-collapsed state */
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(dock_state, dAutoCollapse);
|
value = WMGetFromPLDictionary(dock_state, dAutoCollapse);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!PLIsString(value))
|
if (!WMIsPLString(value))
|
||||||
COMPLAIN("AutoCollapse");
|
COMPLAIN("AutoCollapse");
|
||||||
else {
|
else {
|
||||||
if (strcasecmp(PLGetString(value), "YES")==0) {
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
||||||
dock->auto_collapse = 1;
|
dock->auto_collapse = 1;
|
||||||
dock->collapsed = 1;
|
dock->collapsed = 1;
|
||||||
}
|
}
|
||||||
@@ -1810,13 +1810,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
|
|
||||||
/* restore auto-raise/lower state */
|
/* restore auto-raise/lower state */
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(dock_state, dAutoRaiseLower);
|
value = WMGetFromPLDictionary(dock_state, dAutoRaiseLower);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!PLIsString(value))
|
if (!WMIsPLString(value))
|
||||||
COMPLAIN("AutoRaiseLower");
|
COMPLAIN("AutoRaiseLower");
|
||||||
else {
|
else {
|
||||||
if (strcasecmp(PLGetString(value), "YES")==0) {
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0) {
|
||||||
dock->auto_raise_lower = 1;
|
dock->auto_raise_lower = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1826,13 +1826,13 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
|
|
||||||
dock->attract_icons = 0;
|
dock->attract_icons = 0;
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(dock_state, dAutoAttractIcons);
|
value = WMGetFromPLDictionary(dock_state, dAutoAttractIcons);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (!PLIsString(value))
|
if (!WMIsPLString(value))
|
||||||
COMPLAIN("AutoAttractIcons");
|
COMPLAIN("AutoAttractIcons");
|
||||||
else {
|
else {
|
||||||
if (strcasecmp(PLGetString(value), "YES")==0)
|
if (strcasecmp(WMGetFromPLString(value), "YES")==0)
|
||||||
dock->attract_icons = 1;
|
dock->attract_icons = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1841,7 +1841,7 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
/* application list */
|
/* application list */
|
||||||
|
|
||||||
{
|
{
|
||||||
proplist_t tmp;
|
WMPropList *tmp;
|
||||||
char buffer[64];
|
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);
|
snprintf(buffer, sizeof(buffer), "Applications%i", scr->scr_height);
|
||||||
|
|
||||||
tmp = PLMakeString(buffer);
|
tmp = WMCreatePLString(buffer);
|
||||||
apps = PLGetDictionaryEntry(dock_state, tmp);
|
apps = WMGetFromPLDictionary(dock_state, tmp);
|
||||||
PLRelease(tmp);
|
WMReleasePropList(tmp);
|
||||||
|
|
||||||
if (!apps) {
|
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;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = PLGetNumberOfElements(apps);
|
count = WMGetPropListItemCount(apps);
|
||||||
|
|
||||||
if (count==0)
|
if (count==0)
|
||||||
goto finish;
|
goto finish;
|
||||||
@@ -1887,7 +1887,7 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = PLGetArrayElement(apps, i);
|
value = WMGetFromPLArray(apps, i);
|
||||||
aicon = restore_icon_state(scr, value, type, dock->icon_count);
|
aicon = restore_icon_state(scr, value, type, dock->icon_count);
|
||||||
|
|
||||||
dock->icon_array[dock->icon_count] = aicon;
|
dock->icon_array[dock->icon_count] = aicon;
|
||||||
@@ -1936,7 +1936,7 @@ wDockRestoreState(WScreen *scr, proplist_t dock_state, int type)
|
|||||||
|
|
||||||
finish:
|
finish:
|
||||||
if (dock_state)
|
if (dock_state)
|
||||||
PLRelease(dock_state);
|
WMReleasePropList(dock_state);
|
||||||
|
|
||||||
return dock;
|
return dock;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -70,7 +70,7 @@ typedef struct WDock {
|
|||||||
|
|
||||||
|
|
||||||
WDock *wDockCreate(WScreen *scr, int type);
|
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 wDockDestroy(WDock *dock);
|
||||||
void wDockHideIcons(WDock *dock);
|
void wDockHideIcons(WDock *dock);
|
||||||
@@ -78,7 +78,7 @@ void wDockShowIcons(WDock *dock);
|
|||||||
void wDockLower(WDock *dock);
|
void wDockLower(WDock *dock);
|
||||||
void wDockRaise(WDock *dock);
|
void wDockRaise(WDock *dock);
|
||||||
void wDockRaiseLower(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 wDockAttachIcon(WDock *dock, WAppIcon *icon, int x, int y);
|
||||||
Bool wDockSnapIcon(WDock *dock, WAppIcon *icon, int req_x, int req_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 wClipIconPaint(WAppIcon *aicon);
|
||||||
void wClipSaveState(WScreen *scr);
|
void wClipSaveState(WScreen *scr);
|
||||||
proplist_t wClipSaveWorkspaceState(WScreen *scr, int workspace);
|
WMPropList *wClipSaveWorkspaceState(WScreen *scr, int workspace);
|
||||||
WAppIcon* wClipRestoreState(WScreen *scr, proplist_t clip_state);
|
WAppIcon *wClipRestoreState(WScreen *scr, WMPropList *clip_state);
|
||||||
|
|
||||||
void wClipUpdateForWorkspaceChange(WScreen *scr, int workspace);
|
void wClipUpdateForWorkspaceChange(WScreen *scr, int workspace);
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -111,11 +111,9 @@ char *FindImage(char *paths, char *file);
|
|||||||
|
|
||||||
RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
|
RImage*wGetImageForWindowName(WScreen *scr, char *winstance, char *wclass);
|
||||||
|
|
||||||
BOOL StringCompareHook(proplist_t pl1, proplist_t pl2);
|
|
||||||
|
|
||||||
int IsEof(FILE * stream); /* feof that stats pipes */
|
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);
|
char *where);
|
||||||
|
|
||||||
void SendHelperMessage(WScreen *scr, char type, int workspace, char *msg);
|
void SendHelperMessage(WScreen *scr, char type, int workspace, char *msg);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
#include "stacking.h"
|
#include "stacking.h"
|
||||||
|
#include "client.h"
|
||||||
|
|
||||||
#include "gnome.h"
|
#include "gnome.h"
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -51,7 +51,7 @@
|
|||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
/****** Global Variables ******/
|
/****** Global Variables ******/
|
||||||
|
|
||||||
@@ -71,8 +71,8 @@ int wScreenCount=0;
|
|||||||
WPreferences wPreferences;
|
WPreferences wPreferences;
|
||||||
|
|
||||||
|
|
||||||
proplist_t wDomainName;
|
WMPropList *wDomainName;
|
||||||
proplist_t wAttributeDomainName;
|
WMPropList *wAttributeDomainName;
|
||||||
|
|
||||||
WShortKey wKeyBindings[WKBD_LAST];
|
WShortKey wKeyBindings[WKBD_LAST];
|
||||||
|
|
||||||
|
|||||||
+48
-48
@@ -87,8 +87,8 @@ static void menuCloseClick(WCoreWindow *sender, void *data, XEvent *event);
|
|||||||
static void updateTexture(WMenu *menu);
|
static void updateTexture(WMenu *menu);
|
||||||
|
|
||||||
#ifndef LITE
|
#ifndef LITE
|
||||||
static int saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu);
|
static int saveMenuRecurs(WMPropList *menus, WScreen *scr, WMenu *menu);
|
||||||
static int restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path);
|
static int restoreMenuRecurs(WScreen *scr, WMPropList *menus, WMenu *menu, char *path);
|
||||||
#endif /* !LITE */
|
#endif /* !LITE */
|
||||||
|
|
||||||
static void selectEntry(WMenu *menu, int entry_no);
|
static void selectEntry(WMenu *menu, int entry_no);
|
||||||
@@ -632,7 +632,7 @@ wMenuDestroy(WMenu *menu, int recurse)
|
|||||||
#ifdef USER_MENU
|
#ifdef USER_MENU
|
||||||
|
|
||||||
if (menu->entries[i]->instances){
|
if (menu->entries[i]->instances){
|
||||||
PLRelease(menu->entries[i]->instances);
|
WMReleasePropList(menu->entries[i]->instances);
|
||||||
}
|
}
|
||||||
#endif /* USER_MENU */
|
#endif /* USER_MENU */
|
||||||
|
|
||||||
@@ -2450,35 +2450,35 @@ menuCloseClick(WCoreWindow *sender, void *data, XEvent *event)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
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];
|
char buffer[256];
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%i,%i", menu->frame_x, menu->frame_y);
|
snprintf(buffer, sizeof(buffer), "%i,%i", menu->frame_x, menu->frame_y);
|
||||||
value = PLMakeString(buffer);
|
value = WMCreatePLString(buffer);
|
||||||
list = PLMakeArrayFromElements(value, NULL);
|
list = WMCreatePLArray(value, NULL);
|
||||||
if (menu->flags.lowered)
|
if (menu->flags.lowered)
|
||||||
PLAppendArrayElement(list, PLMakeString("lowered"));
|
WMAddToPLArray(list, WMCreatePLString("lowered"));
|
||||||
PLInsertDictionaryEntry(dict, key, list);
|
WMPutInPLDictionary(dict, key, list);
|
||||||
PLRelease(value);
|
WMReleasePropList(value);
|
||||||
PLRelease(list);
|
WMReleasePropList(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wMenuSaveState(WScreen *scr)
|
wMenuSaveState(WScreen *scr)
|
||||||
{
|
{
|
||||||
proplist_t menus, key;
|
WMPropList *menus, *key;
|
||||||
int save_menus = 0;
|
int save_menus = 0;
|
||||||
|
|
||||||
menus = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
menus = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
|
|
||||||
#ifndef LITE
|
#ifndef LITE
|
||||||
if (scr->switch_menu && scr->switch_menu->flags.buttoned) {
|
if (scr->switch_menu && scr->switch_menu->flags.buttoned) {
|
||||||
key = PLMakeString("SwitchMenu");
|
key = WMCreatePLString("SwitchMenu");
|
||||||
saveMenuInfo(menus, scr->switch_menu, key);
|
saveMenuInfo(menus, scr->switch_menu, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
save_menus = 1;
|
save_menus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2487,18 +2487,18 @@ wMenuSaveState(WScreen *scr)
|
|||||||
|
|
||||||
#endif /* !LITE */
|
#endif /* !LITE */
|
||||||
if (scr->workspace_menu && scr->workspace_menu->flags.buttoned) {
|
if (scr->workspace_menu && scr->workspace_menu->flags.buttoned) {
|
||||||
key = PLMakeString("WorkspaceMenu");
|
key = WMCreatePLString("WorkspaceMenu");
|
||||||
saveMenuInfo(menus, scr->workspace_menu, key);
|
saveMenuInfo(menus, scr->workspace_menu, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
save_menus = 1;
|
save_menus = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save_menus) {
|
if (save_menus) {
|
||||||
key = PLMakeString("Menus");
|
key = WMCreatePLString("Menus");
|
||||||
PLInsertDictionaryEntry(scr->session_state, key, menus);
|
WMPutInPLDictionary(scr->session_state, key, menus);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
}
|
}
|
||||||
PLRelease(menus);
|
WMReleasePropList(menus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2531,9 +2531,9 @@ getMenuPath(WMenu *menu, char *buffer, int bufSize)
|
|||||||
|
|
||||||
|
|
||||||
static Bool
|
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;
|
int save_menus = 0, i;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
Bool ok = True;
|
Bool ok = True;
|
||||||
@@ -2548,9 +2548,9 @@ saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu)
|
|||||||
ok = getMenuPath(menu, buffer, 510);
|
ok = getMenuPath(menu, buffer, 510);
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
key = PLMakeString(buffer);
|
key = WMCreatePLString(buffer);
|
||||||
saveMenuInfo(menus, menu, key);
|
saveMenuInfo(menus, menu, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
save_menus = 1;
|
save_menus = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2570,26 +2570,26 @@ saveMenuRecurs(proplist_t menus, WScreen *scr, WMenu *menu)
|
|||||||
|
|
||||||
|
|
||||||
static Bool
|
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;
|
*lowered = False;
|
||||||
|
|
||||||
if (PLIsArray(info)) {
|
if (WMIsPLArray(info)) {
|
||||||
proplist_t flags;
|
WMPropList *flags;
|
||||||
pos = PLGetArrayElement(info, 0);
|
pos = WMGetFromPLArray(info, 0);
|
||||||
flags = PLGetArrayElement(info, 1);
|
flags = WMGetFromPLArray(info, 1);
|
||||||
if (flags != NULL && PLIsString(flags) && PLGetString(flags) != NULL
|
if (flags != NULL && WMIsPLString(flags) && WMGetFromPLString(flags) != NULL
|
||||||
&& strcmp(PLGetString(flags), "lowered") == 0) {
|
&& strcmp(WMGetFromPLString(flags), "lowered") == 0) {
|
||||||
*lowered = True;
|
*lowered = True;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pos = info;
|
pos = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos != NULL && PLIsString(pos)) {
|
if (pos != NULL && WMIsPLString(pos)) {
|
||||||
if (sscanf(PLGetString(pos), "%i,%i", x, y)!=2)
|
if (sscanf(WMGetFromPLString(pos), "%i,%i", x, y)!=2)
|
||||||
COMPLAIN("Position");
|
COMPLAIN("Position");
|
||||||
} else {
|
} else {
|
||||||
COMPLAIN("(position, flags...)");
|
COMPLAIN("(position, flags...)");
|
||||||
@@ -2601,7 +2601,7 @@ getMenuInfo(proplist_t info, int *x, int *y, Bool *lowered)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
restoreMenu(WScreen *scr, proplist_t menu, int which)
|
restoreMenu(WScreen *scr, WMPropList *menu, int which)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
Bool lowered = False;
|
Bool lowered = False;
|
||||||
@@ -2644,9 +2644,9 @@ restoreMenu(WScreen *scr, proplist_t menu, int which)
|
|||||||
|
|
||||||
#ifndef LITE
|
#ifndef LITE
|
||||||
static int
|
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];
|
char buffer[512];
|
||||||
int i, x, y, res;
|
int i, x, y, res;
|
||||||
Bool lowered;
|
Bool lowered;
|
||||||
@@ -2655,8 +2655,8 @@ restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path)
|
|||||||
return False;
|
return False;
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%s\\%s", path, menu->frame->title);
|
snprintf(buffer, sizeof(buffer), "%s\\%s", path, menu->frame->title);
|
||||||
key = PLMakeString(buffer);
|
key = WMCreatePLString(buffer);
|
||||||
entry = PLGetDictionaryEntry(menus, key);
|
entry = WMGetFromPLDictionary(menus, key);
|
||||||
res = False;
|
res = False;
|
||||||
|
|
||||||
if (entry && getMenuInfo(entry, &x, &y, &lowered)) {
|
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++) {
|
for (i=0; i<menu->cascade_no; i++) {
|
||||||
if (restoreMenuRecurs(scr, menus, menu->cascades[i], buffer) != False)
|
if (restoreMenuRecurs(scr, menus, menu->cascades[i], buffer) != False)
|
||||||
@@ -2705,20 +2705,20 @@ restoreMenuRecurs(WScreen *scr, proplist_t menus, WMenu *menu, char *path)
|
|||||||
void
|
void
|
||||||
wMenuRestoreState(WScreen *scr)
|
wMenuRestoreState(WScreen *scr)
|
||||||
{
|
{
|
||||||
proplist_t menus, menu, key, skey;
|
WMPropList *menus, *menu, *key, *skey;
|
||||||
|
|
||||||
key = PLMakeString("Menus");
|
key = WMCreatePLString("Menus");
|
||||||
menus = PLGetDictionaryEntry(scr->session_state, key);
|
menus = WMGetFromPLDictionary(scr->session_state, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
|
|
||||||
if (!menus)
|
if (!menus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* restore menus */
|
/* restore menus */
|
||||||
|
|
||||||
skey = PLMakeString("SwitchMenu");
|
skey = WMCreatePLString("SwitchMenu");
|
||||||
menu = PLGetDictionaryEntry(menus, skey);
|
menu = WMGetFromPLDictionary(menus, skey);
|
||||||
PLRelease(skey);
|
WMReleasePropList(skey);
|
||||||
restoreMenu(scr, menu, WSS_SWITCHMENU);
|
restoreMenu(scr, menu, WSS_SWITCHMENU);
|
||||||
|
|
||||||
#ifndef LITE
|
#ifndef LITE
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ typedef struct WMenuEntry {
|
|||||||
void *clientdata; /* data to pass to callback */
|
void *clientdata; /* data to pass to callback */
|
||||||
int cascade; /* cascade menu index */
|
int cascade; /* cascade menu index */
|
||||||
#ifdef USER_MENU
|
#ifdef USER_MENU
|
||||||
proplist_t instances; /* allowed instances */
|
WMPropList *instances; /* allowed instances */
|
||||||
#endif /* USER_MENU */
|
#endif /* USER_MENU */
|
||||||
struct {
|
struct {
|
||||||
unsigned int enabled:1; /* entry is selectable */
|
unsigned int enabled:1; /* entry is selectable */
|
||||||
|
|||||||
+11
-11
@@ -37,10 +37,10 @@
|
|||||||
typedef struct PLMenuReaderData {
|
typedef struct PLMenuReaderData {
|
||||||
WRootMenuReader *reader;
|
WRootMenuReader *reader;
|
||||||
|
|
||||||
proplist_t pl;
|
WMPropList *pl;
|
||||||
int curIndex;
|
int curIndex;
|
||||||
|
|
||||||
proplist_t *submenu;
|
WMPropList **submenu;
|
||||||
int *curSubIndex;
|
int *curSubIndex;
|
||||||
int submenuDepth;
|
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_hasMoreData(WRootMenuData *data);
|
||||||
static Bool pl_nextCommand(WRootMenuData *data,
|
static Bool pl_nextCommand(WRootMenuData *data,
|
||||||
char **title,
|
char **title,
|
||||||
@@ -148,7 +148,7 @@ static char linebuf[LINESIZE];
|
|||||||
/* ---------- proplist ---------- */
|
/* ---------- proplist ---------- */
|
||||||
|
|
||||||
|
|
||||||
static WRootMenuData *pl_openMenuFile(proplist_t pl)
|
static WRootMenuData *pl_openMenuFile(WMPropList *pl)
|
||||||
{
|
{
|
||||||
PLRootMenuData *data = wmalloc(sizeof(PLRootMenuData));
|
PLRootMenuData *data = wmalloc(sizeof(PLRootMenuData));
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ static void pl_closeMenuFile(WRootMenuData *data)
|
|||||||
if (data->curSubIndex)
|
if (data->curSubIndex)
|
||||||
wfree(data->curSubIndex);
|
wfree(data->curSubIndex);
|
||||||
|
|
||||||
PLRelease(data->pl);
|
WMReleasePropList(data->pl);
|
||||||
|
|
||||||
wfree(data);
|
wfree(data);
|
||||||
}
|
}
|
||||||
@@ -354,8 +354,8 @@ WRootMenuData *OpenMenu(char *path, time_t *menuTime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* then check whether it's a proplist menu */
|
/* then check whether it's a proplist menu */
|
||||||
pl = ReadProplistFromFile(path);
|
pl = WMReadPropListFromFile(path);
|
||||||
if (pl && PLIsArray(pl)) {
|
if (pl && WMIsPLArray(pl)) {
|
||||||
*menuTime = stat_buf.st_mtime;
|
*menuTime = stat_buf.st_mtime;
|
||||||
return pl_openMenu(pl);
|
return pl_openMenu(pl);
|
||||||
}
|
}
|
||||||
@@ -392,19 +392,19 @@ WRootMenuData *ReopenRootMenu(time_t *checkTime,
|
|||||||
|
|
||||||
*checkTime = stat_buf.st_mtime;
|
*checkTime = stat_buf.st_mtime;
|
||||||
|
|
||||||
pl = ReadProplistFromFile(path);
|
pl = WMReadPropListFromFile(path);
|
||||||
if (!pl) {
|
if (!pl) {
|
||||||
wwarning(_("could not load domain %s from user defaults database"),
|
wwarning(_("could not load domain %s from user defaults database"),
|
||||||
"WMRootMenu");
|
"WMRootMenu");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PLIsString(pl)) {
|
if (WMIsPLString(pl)) {
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *path;
|
char *path;
|
||||||
Bool menu_is_default = False;
|
Bool menu_is_default = False;
|
||||||
|
|
||||||
tmp = wexpandpath(PLGetString(pl));
|
tmp = wexpandpath(WMGetFromPLString(pl));
|
||||||
|
|
||||||
path = getLocalizedMenuFile(tmp);
|
path = getLocalizedMenuFile(tmp);
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ WRootMenuData *ReopenRootMenu(time_t *checkTime,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return OpenMenu(*menuPath, menuTimestamp);
|
return OpenMenu(*menuPath, menuTimestamp);
|
||||||
} else if (PLIsArray(pl)) {
|
} else if (WMIsPLArray(pl)) {
|
||||||
|
|
||||||
*menuTimestamp = stat_buf.st_mtime;
|
*menuTimestamp = stat_buf.st_mtime;
|
||||||
|
|
||||||
|
|||||||
+3
-20
@@ -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 */
|
/* feof doesn't seem to work on pipes */
|
||||||
int
|
int
|
||||||
IsEof(FILE * stream)
|
IsEof(FILE * stream)
|
||||||
@@ -977,18 +960,18 @@ IsEof(FILE * stream)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ParseWindowName(proplist_t value, char **winstance, char **wclass, char *where)
|
ParseWindowName(WMPropList *value, char **winstance, char **wclass, char *where)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
*winstance = *wclass = NULL;
|
*winstance = *wclass = NULL;
|
||||||
|
|
||||||
if (!PLIsString(value)) {
|
if (!WMIsPLString(value)) {
|
||||||
wwarning(_("bad window name value in %s state info"), where);
|
wwarning(_("bad window name value in %s state info"), where);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
name = PLGetString(value);
|
name = WMGetFromPLString(value);
|
||||||
if (!name || strlen(name)==0) {
|
if (!name || strlen(name)==0) {
|
||||||
wwarning(_("bad window name value in %s state info"), where);
|
wwarning(_("bad window name value in %s state info"), where);
|
||||||
return;
|
return;
|
||||||
|
|||||||
-491
@@ -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
@@ -52,7 +52,8 @@
|
|||||||
#include "framewin.h"
|
#include "framewin.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "xmodifier.h"
|
#include "xmodifier.h"
|
||||||
#include <proplist.h>
|
|
||||||
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1579,23 +1580,23 @@ makeDefaultMenu(WScreen *scr)
|
|||||||
*----------------------------------------------------------------------
|
*----------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static WMenu*
|
static WMenu*
|
||||||
configureMenu(WScreen *scr, proplist_t definition)
|
configureMenu(WScreen *scr, WMPropList *definition)
|
||||||
{
|
{
|
||||||
WMenu *menu = NULL;
|
WMenu *menu = NULL;
|
||||||
proplist_t elem;
|
WMPropList *elem;
|
||||||
int i, count;
|
int i, count;
|
||||||
proplist_t title, command, params;
|
WMPropList *title, *command, *params;
|
||||||
char *tmp, *mtitle;
|
char *tmp, *mtitle;
|
||||||
|
|
||||||
|
|
||||||
if (PLIsString(definition)) {
|
if (WMIsPLString(definition)) {
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
Bool menu_is_default = False;
|
Bool menu_is_default = False;
|
||||||
|
|
||||||
/* menu definition is a string. Probably a path, so parse the file */
|
/* menu definition is a string. Probably a path, so parse the file */
|
||||||
|
|
||||||
tmp = wexpandpath(PLGetString(definition));
|
tmp = wexpandpath(WMGetFromPLString(definition));
|
||||||
|
|
||||||
path = getLocalizedMenuFile(tmp);
|
path = getLocalizedMenuFile(tmp);
|
||||||
|
|
||||||
@@ -1642,19 +1643,19 @@ configureMenu(WScreen *scr, proplist_t definition)
|
|||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = PLGetNumberOfElements(definition);
|
count = WMGetPropListItemCount(definition);
|
||||||
if (count==0)
|
if (count==0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
elem = PLGetArrayElement(definition, 0);
|
elem = WMGetFromPLArray(definition, 0);
|
||||||
if (!PLIsString(elem)) {
|
if (!WMIsPLString(elem)) {
|
||||||
tmp = PLGetDescription(elem);
|
tmp = WMGetPropListDescription(elem, False);
|
||||||
wwarning(_("%s:format error in root menu configuration \"%s\""),
|
wwarning(_("%s:format error in root menu configuration \"%s\""),
|
||||||
"WMRootMenu", tmp);
|
"WMRootMenu", tmp);
|
||||||
wfree(tmp);
|
wfree(tmp);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
mtitle = PLGetString(elem);
|
mtitle = WMGetFromPLString(elem);
|
||||||
|
|
||||||
menu = wMenuCreate(scr, mtitle, False);
|
menu = wMenuCreate(scr, mtitle, False);
|
||||||
menu->on_destroy = removeShortcutsForMenu;
|
menu->on_destroy = removeShortcutsForMenu;
|
||||||
@@ -1674,19 +1675,19 @@ configureMenu(WScreen *scr, proplist_t definition)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i=1; i<count; i++) {
|
for (i=1; i<count; i++) {
|
||||||
elem = PLGetArrayElement(definition, i);
|
elem = WMGetFromPLArray(definition, i);
|
||||||
#if 0
|
#if 0
|
||||||
if (PLIsString(elem)) {
|
if (WMIsPLString(elem)) {
|
||||||
char *file;
|
char *file;
|
||||||
|
|
||||||
file = PLGetString(elem);
|
file = WMGetFromPLString(elem);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!PLIsArray(elem) || PLGetNumberOfElements(elem) < 2)
|
if (!WMIsPLArray(elem) || WMGetPropListItemCount(elem) < 2)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (PLIsArray(PLGetArrayElement(elem,1))) {
|
if (WMIsPLArray(WMGetFromPLArray(elem,1))) {
|
||||||
WMenu *submenu;
|
WMenu *submenu;
|
||||||
WMenuEntry *mentry;
|
WMenuEntry *mentry;
|
||||||
|
|
||||||
@@ -1699,32 +1700,32 @@ configureMenu(WScreen *scr, proplist_t definition)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
char *shortcut;
|
WMPropList *shortcut;
|
||||||
/* normal entry */
|
/* normal entry */
|
||||||
|
|
||||||
title = PLGetArrayElement(elem, idx++);
|
title = WMGetFromPLArray(elem, idx++);
|
||||||
shortcut = PLGetArrayElement(elem, idx++);
|
shortcut = WMGetFromPLArray(elem, idx++);
|
||||||
if (strcmp(PLGetString(shortcut), "SHORTCUT")==0) {
|
if (strcmp(WMGetFromPLString(shortcut), "SHORTCUT")==0) {
|
||||||
shortcut = PLGetArrayElement(elem, idx++);
|
shortcut = WMGetFromPLArray(elem, idx++);
|
||||||
command = PLGetArrayElement(elem, idx++);
|
command = WMGetFromPLArray(elem, idx++);
|
||||||
} else {
|
} else {
|
||||||
command = shortcut;
|
command = shortcut;
|
||||||
shortcut = NULL;
|
shortcut = NULL;
|
||||||
}
|
}
|
||||||
params = PLGetArrayElement(elem, idx++);
|
params = WMGetFromPLArray(elem, idx++);
|
||||||
|
|
||||||
if (!title || !command)
|
if (!title || !command)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
addMenuEntry(menu, PLGetString(title),
|
addMenuEntry(menu, WMGetFromPLString(title),
|
||||||
shortcut ? PLGetString(shortcut) : NULL,
|
shortcut ? WMGetFromPLString(shortcut) : NULL,
|
||||||
PLGetString(command),
|
WMGetFromPLString(command),
|
||||||
params ? PLGetString(params) : NULL, "WMRootMenu");
|
params ? WMGetFromPLString(params) : NULL, "WMRootMenu");
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
tmp = PLGetDescription(elem);
|
tmp = WMGetPropListDescription(elem, False);
|
||||||
wwarning(_("%s:format error in root menu configuration \"%s\""),
|
wwarning(_("%s:format error in root menu configuration \"%s\""),
|
||||||
"WMRootMenu", tmp);
|
"WMRootMenu", tmp);
|
||||||
wfree(tmp);
|
wfree(tmp);
|
||||||
@@ -1760,12 +1761,12 @@ void
|
|||||||
OpenRootMenu(WScreen *scr, int x, int y, int keyboard)
|
OpenRootMenu(WScreen *scr, int x, int y, int keyboard)
|
||||||
{
|
{
|
||||||
WMenu *menu=NULL;
|
WMenu *menu=NULL;
|
||||||
proplist_t definition;
|
WMPropList *definition;
|
||||||
/*
|
/*
|
||||||
static proplist_t domain=NULL;
|
static WMPropList *domain=NULL;
|
||||||
|
|
||||||
if (!domain) {
|
if (!domain) {
|
||||||
domain = PLMakeString("WMRootMenu");
|
domain = WMCreatePLString("WMRootMenu");
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1795,7 +1796,7 @@ OpenRootMenu(WScreen *scr, int x, int y, int keyboard)
|
|||||||
definition = PLGetDomain(domain);
|
definition = PLGetDomain(domain);
|
||||||
*/
|
*/
|
||||||
if (definition) {
|
if (definition) {
|
||||||
if (PLIsArray(definition)) {
|
if (WMIsPLArray(definition)) {
|
||||||
if (!scr->root_menu
|
if (!scr->root_menu
|
||||||
|| WDRootMenu->timestamp > scr->root_menu->timestamp) {
|
|| WDRootMenu->timestamp > scr->root_menu->timestamp) {
|
||||||
menu = configureMenu(scr, definition);
|
menu = configureMenu(scr, definition);
|
||||||
|
|||||||
+30
-33
@@ -63,7 +63,7 @@
|
|||||||
# include "openlook.h"
|
# include "openlook.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
#include "defaults.h"
|
#include "defaults.h"
|
||||||
|
|
||||||
@@ -104,10 +104,10 @@ static char STIPPLE_DATA[] = {0x02, 0x01};
|
|||||||
|
|
||||||
static int CantManageScreen = 0;
|
static int CantManageScreen = 0;
|
||||||
|
|
||||||
static proplist_t dApplications = NULL;
|
static WMPropList *dApplications = NULL;
|
||||||
static proplist_t dWorkspace;
|
static WMPropList *dWorkspace;
|
||||||
static proplist_t dDock;
|
static WMPropList *dDock;
|
||||||
static proplist_t dClip;
|
static WMPropList *dClip;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -116,10 +116,10 @@ make_keys()
|
|||||||
if (dApplications!=NULL)
|
if (dApplications!=NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dApplications = PLMakeString("Applications");
|
dApplications = WMCreatePLString("Applications");
|
||||||
dWorkspace = PLMakeString("Workspace");
|
dWorkspace = WMCreatePLString("Workspace");
|
||||||
dDock = PLMakeString("Dock");
|
dDock = WMCreatePLString("Dock");
|
||||||
dClip = PLMakeString("Clip");
|
dClip = WMCreatePLString("Clip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1007,7 +1007,7 @@ wScreenUpdateUsableArea(WScreen *scr)
|
|||||||
void
|
void
|
||||||
wScreenRestoreState(WScreen *scr)
|
wScreenRestoreState(WScreen *scr)
|
||||||
{
|
{
|
||||||
proplist_t state;
|
WMPropList *state;
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
|
|
||||||
@@ -1025,18 +1025,18 @@ wScreenRestoreState(WScreen *scr)
|
|||||||
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
||||||
path = wdefaultspathfordomain(buf);
|
path = wdefaultspathfordomain(buf);
|
||||||
}
|
}
|
||||||
scr->session_state = PLGetProplistWithPath(path);
|
scr->session_state = WMReadPropListFromFile(path);
|
||||||
wfree(path);
|
wfree(path);
|
||||||
if (!scr->session_state && wScreenCount>1) {
|
if (!scr->session_state && wScreenCount>1) {
|
||||||
char buf[16];
|
char buf[16];
|
||||||
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
||||||
path = wdefaultspathfordomain(buf);
|
path = wdefaultspathfordomain(buf);
|
||||||
scr->session_state = PLGetProplistWithPath(path);
|
scr->session_state = WMReadPropListFromFile(path);
|
||||||
wfree(path);
|
wfree(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wPreferences.flags.noclip) {
|
if (!wPreferences.flags.noclip) {
|
||||||
state = PLGetDictionaryEntry(scr->session_state, dClip);
|
state = WMGetFromPLDictionary(scr->session_state, dClip);
|
||||||
scr->clip_icon = wClipRestoreState(scr, state);
|
scr->clip_icon = wClipRestoreState(scr, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,7 +1050,7 @@ wScreenRestoreState(WScreen *scr)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!wPreferences.flags.nodock) {
|
if (!wPreferences.flags.nodock) {
|
||||||
state = PLGetDictionaryEntry(scr->session_state, dDock);
|
state = WMGetFromPLDictionary(scr->session_state, dDock);
|
||||||
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
|
scr->dock = wDockRestoreState(scr, state, WM_DOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1063,7 +1063,7 @@ wScreenSaveState(WScreen *scr)
|
|||||||
{
|
{
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
char *str;
|
char *str;
|
||||||
proplist_t path, old_state, foo;
|
WMPropList *old_state, *foo;
|
||||||
CARD32 data[2];
|
CARD32 data[2];
|
||||||
|
|
||||||
|
|
||||||
@@ -1090,23 +1090,23 @@ wScreenSaveState(WScreen *scr)
|
|||||||
|
|
||||||
|
|
||||||
old_state = scr->session_state;
|
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 */
|
/* save dock state to file */
|
||||||
if (!wPreferences.flags.nodock) {
|
if (!wPreferences.flags.nodock) {
|
||||||
wDockSaveState(scr, old_state);
|
wDockSaveState(scr, old_state);
|
||||||
} else {
|
} else {
|
||||||
if ((foo = PLGetDictionaryEntry(old_state, dDock))!=NULL) {
|
if ((foo = WMGetFromPLDictionary(old_state, dDock))!=NULL) {
|
||||||
PLInsertDictionaryEntry(scr->session_state, dDock, foo);
|
WMPutInPLDictionary(scr->session_state, dDock, foo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!wPreferences.flags.noclip) {
|
if (!wPreferences.flags.noclip) {
|
||||||
wClipSaveState(scr);
|
wClipSaveState(scr);
|
||||||
} else {
|
} else {
|
||||||
if ((foo = PLGetDictionaryEntry(old_state, dClip))!=NULL) {
|
if ((foo = WMGetFromPLDictionary(old_state, dClip))!=NULL) {
|
||||||
PLInsertDictionaryEntry(scr->session_state, dClip, foo);
|
WMPutInPLDictionary(scr->session_state, dClip, foo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1115,16 +1115,16 @@ wScreenSaveState(WScreen *scr)
|
|||||||
if (wPreferences.save_session_on_exit) {
|
if (wPreferences.save_session_on_exit) {
|
||||||
wSessionSaveState(scr);
|
wSessionSaveState(scr);
|
||||||
} else {
|
} else {
|
||||||
if ((foo = PLGetDictionaryEntry(old_state, dApplications))!=NULL) {
|
if ((foo = WMGetFromPLDictionary(old_state, dApplications))!=NULL) {
|
||||||
PLInsertDictionaryEntry(scr->session_state, dApplications, foo);
|
WMPutInPLDictionary(scr->session_state, dApplications, foo);
|
||||||
}
|
}
|
||||||
if ((foo = PLGetDictionaryEntry(old_state, dWorkspace))!=NULL) {
|
if ((foo = WMGetFromPLDictionary(old_state, dWorkspace))!=NULL) {
|
||||||
PLInsertDictionaryEntry(scr->session_state, dWorkspace, foo);
|
WMPutInPLDictionary(scr->session_state, dWorkspace, foo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
wMenuSaveState(scr);
|
wMenuSaveState(scr);
|
||||||
|
|
||||||
@@ -1135,14 +1135,11 @@ wScreenSaveState(WScreen *scr)
|
|||||||
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
snprintf(buf, sizeof(buf), "WMState.%i", scr->screen);
|
||||||
str = wdefaultspathfordomain(buf);
|
str = wdefaultspathfordomain(buf);
|
||||||
}
|
}
|
||||||
path = PLMakeString(str);
|
if (!WMWritePropListToFile(scr->session_state, str, True)) {
|
||||||
wfree(str);
|
wsyserror(_("could not save session state in %s"), str);
|
||||||
PLSetFilename(scr->session_state, path);
|
|
||||||
if (!PLSave(scr->session_state, YES)) {
|
|
||||||
wsyserror(_("could not save session state in %s"), PLGetString(path));
|
|
||||||
}
|
}
|
||||||
PLRelease(path);
|
wfree(str);
|
||||||
PLRelease(old_state);
|
WMReleasePropList(old_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -26,7 +26,7 @@
|
|||||||
#include "WindowMaker.h"
|
#include "WindowMaker.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
#include <X11/Xinerama.h>
|
#include <X11/Xinerama.h>
|
||||||
@@ -264,7 +264,7 @@ typedef struct _WScreen {
|
|||||||
/* state and other informations */
|
/* state and other informations */
|
||||||
short cascade_index; /* for cascade window placement */
|
short cascade_index; /* for cascade window placement */
|
||||||
|
|
||||||
proplist_t session_state;
|
WMPropList *session_state;
|
||||||
|
|
||||||
/* for double-click detection */
|
/* for double-click detection */
|
||||||
Time last_click_time;
|
Time last_click_time;
|
||||||
|
|||||||
+147
-155
@@ -92,7 +92,7 @@
|
|||||||
#include "dock.h"
|
#include "dock.h"
|
||||||
|
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
/** Global **/
|
/** Global **/
|
||||||
|
|
||||||
@@ -116,20 +116,20 @@ static char *sClientID = NULL;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static proplist_t sApplications = NULL;
|
static WMPropList *sApplications = NULL;
|
||||||
static proplist_t sCommand;
|
static WMPropList *sCommand;
|
||||||
static proplist_t sName;
|
static WMPropList *sName;
|
||||||
static proplist_t sHost;
|
static WMPropList *sHost;
|
||||||
static proplist_t sWorkspace;
|
static WMPropList *sWorkspace;
|
||||||
static proplist_t sShaded;
|
static WMPropList *sShaded;
|
||||||
static proplist_t sMiniaturized;
|
static WMPropList *sMiniaturized;
|
||||||
static proplist_t sHidden;
|
static WMPropList *sHidden;
|
||||||
static proplist_t sGeometry;
|
static WMPropList *sGeometry;
|
||||||
static proplist_t sShortcutMask;
|
static WMPropList *sShortcutMask;
|
||||||
|
|
||||||
static proplist_t sDock;
|
static WMPropList *sDock;
|
||||||
|
|
||||||
static proplist_t sYes, sNo;
|
static WMPropList *sYes, *sNo;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -138,33 +138,33 @@ make_keys()
|
|||||||
if (sApplications!=NULL)
|
if (sApplications!=NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sApplications = PLMakeString("Applications");
|
sApplications = WMCreatePLString("Applications");
|
||||||
sCommand = PLMakeString("Command");
|
sCommand = WMCreatePLString("Command");
|
||||||
sName = PLMakeString("Name");
|
sName = WMCreatePLString("Name");
|
||||||
sHost = PLMakeString("Host");
|
sHost = WMCreatePLString("Host");
|
||||||
sWorkspace = PLMakeString("Workspace");
|
sWorkspace = WMCreatePLString("Workspace");
|
||||||
sShaded = PLMakeString("Shaded");
|
sShaded = WMCreatePLString("Shaded");
|
||||||
sMiniaturized = PLMakeString("Miniaturized");
|
sMiniaturized = WMCreatePLString("Miniaturized");
|
||||||
sHidden = PLMakeString("Hidden");
|
sHidden = WMCreatePLString("Hidden");
|
||||||
sGeometry = PLMakeString("Geometry");
|
sGeometry = WMCreatePLString("Geometry");
|
||||||
sDock = PLMakeString("Dock");
|
sDock = WMCreatePLString("Dock");
|
||||||
sShortcutMask = PLMakeString("ShortcutMask");
|
sShortcutMask = WMCreatePLString("ShortcutMask");
|
||||||
|
|
||||||
sYes = PLMakeString("Yes");
|
sYes = WMCreatePLString("Yes");
|
||||||
sNo = PLMakeString("No");
|
sNo = WMCreatePLString("No");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getBool(proplist_t value)
|
getBool(WMPropList *value)
|
||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
if (!PLIsString(value)) {
|
if (!WMIsPLString(value)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(val = PLGetString(value))) {
|
if (!(val = WMGetFromPLString(value))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,14 +188,14 @@ getBool(proplist_t value)
|
|||||||
|
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
getInt(proplist_t value)
|
getInt(WMPropList *value)
|
||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
if (!PLIsString(value))
|
if (!WMIsPLString(value))
|
||||||
return 0;
|
return 0;
|
||||||
val = PLGetString(value);
|
val = WMGetFromPLString(value);
|
||||||
if (!val)
|
if (!val)
|
||||||
return 0;
|
return 0;
|
||||||
if (sscanf(val, "%u", &n) != 1)
|
if (sscanf(val, "%u", &n) != 1)
|
||||||
@@ -206,7 +206,7 @@ getInt(proplist_t value)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
makeWindowState(WWindow *wwin, WApplication *wapp)
|
makeWindowState(WWindow *wwin, WApplication *wapp)
|
||||||
{
|
{
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
@@ -216,9 +216,9 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
|
|||||||
int i;
|
int i;
|
||||||
unsigned mask;
|
unsigned mask;
|
||||||
char *class, *instance, *command=NULL, buffer[512];
|
char *class, *instance, *command=NULL, buffer[512];
|
||||||
proplist_t win_state, cmd, name, workspace;
|
WMPropList *win_state, *cmd, *name, *workspace;
|
||||||
proplist_t shaded, miniaturized, hidden, geometry;
|
WMPropList *shaded, *miniaturized, *hidden, *geometry;
|
||||||
proplist_t dock, shortcut;
|
WMPropList *dock, *shortcut;
|
||||||
|
|
||||||
if (wwin->main_window!=None && wwin->main_window!=wwin->client_win)
|
if (wwin->main_window!=None && wwin->main_window!=wwin->client_win)
|
||||||
win = wwin->main_window;
|
win = wwin->main_window;
|
||||||
@@ -242,18 +242,18 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
|
|||||||
else
|
else
|
||||||
snprintf(buffer, sizeof(buffer), ".");
|
snprintf(buffer, sizeof(buffer), ".");
|
||||||
|
|
||||||
name = PLMakeString(buffer);
|
name = WMCreatePLString(buffer);
|
||||||
cmd = PLMakeString(command);
|
cmd = WMCreatePLString(command);
|
||||||
/*sprintf(buffer, "%d", wwin->frame->workspace+1);
|
/*sprintf(buffer, "%d", wwin->frame->workspace+1);
|
||||||
workspace = PLMakeString(buffer);*/
|
workspace = WMCreatePLString(buffer);*/
|
||||||
workspace = PLMakeString(scr->workspaces[wwin->frame->workspace]->name);
|
workspace = WMCreatePLString(scr->workspaces[wwin->frame->workspace]->name);
|
||||||
shaded = wwin->flags.shaded ? sYes : sNo;
|
shaded = wwin->flags.shaded ? sYes : sNo;
|
||||||
miniaturized = wwin->flags.miniaturized ? sYes : sNo;
|
miniaturized = wwin->flags.miniaturized ? sYes : sNo;
|
||||||
hidden = wwin->flags.hidden ? sYes : sNo;
|
hidden = wwin->flags.hidden ? sYes : sNo;
|
||||||
snprintf(buffer, sizeof(buffer), "%ix%i+%i+%i",
|
snprintf(buffer, sizeof(buffer), "%ix%i+%i+%i",
|
||||||
wwin->client.width, wwin->client.height,
|
wwin->client.width, wwin->client.height,
|
||||||
wwin->frame_x, wwin->frame_y);
|
wwin->frame_x, wwin->frame_y);
|
||||||
geometry = PLMakeString(buffer);
|
geometry = WMCreatePLString(buffer);
|
||||||
|
|
||||||
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
for (mask = 0, i = 0; i < MAX_WINDOW_SHORTCUTS; i++) {
|
||||||
if (scr->shortcutWindows[i] != NULL &&
|
if (scr->shortcutWindows[i] != NULL &&
|
||||||
@@ -263,9 +263,9 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
snprintf(buffer, sizeof(buffer), "%u", mask);
|
snprintf(buffer, sizeof(buffer), "%u", mask);
|
||||||
shortcut = PLMakeString(buffer);
|
shortcut = WMCreatePLString(buffer);
|
||||||
|
|
||||||
win_state = PLMakeDictionaryFromEntries(sName, name,
|
win_state = WMCreatePLDictionary(sName, name,
|
||||||
sCommand, cmd,
|
sCommand, cmd,
|
||||||
sWorkspace, workspace,
|
sWorkspace, workspace,
|
||||||
sShaded, shaded,
|
sShaded, shaded,
|
||||||
@@ -275,11 +275,11 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
|
|||||||
sGeometry, geometry,
|
sGeometry, geometry,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
PLRelease(name);
|
WMReleasePropList(name);
|
||||||
PLRelease(cmd);
|
WMReleasePropList(cmd);
|
||||||
PLRelease(workspace);
|
WMReleasePropList(workspace);
|
||||||
PLRelease(geometry);
|
WMReleasePropList(geometry);
|
||||||
PLRelease(shortcut);
|
WMReleasePropList(shortcut);
|
||||||
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
|
if (wapp && wapp->app_icon && wapp->app_icon->dock) {
|
||||||
int i;
|
int i;
|
||||||
char *name;
|
char *name;
|
||||||
@@ -293,9 +293,9 @@ makeWindowState(WWindow *wwin, WApplication *wapp)
|
|||||||
/*n = i+1;*/
|
/*n = i+1;*/
|
||||||
name = scr->workspaces[i]->name;
|
name = scr->workspaces[i]->name;
|
||||||
}
|
}
|
||||||
dock = PLMakeString(name);
|
dock = WMCreatePLString(name);
|
||||||
PLInsertDictionaryEntry(win_state, sDock, dock);
|
WMPutInPLDictionary(win_state, sDock, dock);
|
||||||
PLRelease(dock);
|
WMReleasePropList(dock);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
win_state = NULL;
|
win_state = NULL;
|
||||||
@@ -313,20 +313,20 @@ void
|
|||||||
wSessionSaveState(WScreen *scr)
|
wSessionSaveState(WScreen *scr)
|
||||||
{
|
{
|
||||||
WWindow *wwin = scr->focused_window;
|
WWindow *wwin = scr->focused_window;
|
||||||
proplist_t win_info, wks;
|
WMPropList *win_info, *wks;
|
||||||
proplist_t list=NULL;
|
WMPropList *list=NULL;
|
||||||
WMArray *wapp_list=NULL;
|
WMArray *wapp_list=NULL;
|
||||||
|
|
||||||
|
|
||||||
make_keys();
|
make_keys();
|
||||||
|
|
||||||
if (!scr->session_state) {
|
if (!scr->session_state) {
|
||||||
scr->session_state = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
scr->session_state = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
if (!scr->session_state)
|
if (!scr->session_state)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
list = PLMakeArrayFromElements(NULL);
|
list = WMCreatePLArray(NULL);
|
||||||
|
|
||||||
wapp_list = WMCreateArray(16);
|
wapp_list = WMCreateArray(16);
|
||||||
|
|
||||||
@@ -338,8 +338,8 @@ wSessionSaveState(WScreen *scr)
|
|||||||
&& !WFLAGP(wwin, dont_save_session)) {
|
&& !WFLAGP(wwin, dont_save_session)) {
|
||||||
/* A entry for this application was not yet saved. Save one. */
|
/* A entry for this application was not yet saved. Save one. */
|
||||||
if ((win_info = makeWindowState(wwin, wapp))!=NULL) {
|
if ((win_info = makeWindowState(wwin, wapp))!=NULL) {
|
||||||
list = PLAppendArrayElement(list, win_info);
|
WMAddToPLArray(list, win_info);
|
||||||
PLRelease(win_info);
|
WMReleasePropList(win_info);
|
||||||
/* If we were succesful in saving the info for this window
|
/* If we were succesful in saving the info for this window
|
||||||
* add the application the window belongs to, to the
|
* add the application the window belongs to, to the
|
||||||
* application list, so no multiple entries for the same
|
* application list, so no multiple entries for the same
|
||||||
@@ -350,13 +350,13 @@ wSessionSaveState(WScreen *scr)
|
|||||||
}
|
}
|
||||||
wwin = wwin->prev;
|
wwin = wwin->prev;
|
||||||
}
|
}
|
||||||
PLRemoveDictionaryEntry(scr->session_state, sApplications);
|
WMRemoveFromPLDictionary(scr->session_state, sApplications);
|
||||||
PLInsertDictionaryEntry(scr->session_state, sApplications, list);
|
WMPutInPLDictionary(scr->session_state, sApplications, list);
|
||||||
PLRelease(list);
|
WMReleasePropList(list);
|
||||||
|
|
||||||
wks = PLMakeString(scr->workspaces[scr->current_workspace]->name);
|
wks = WMCreatePLString(scr->workspaces[scr->current_workspace]->name);
|
||||||
PLInsertDictionaryEntry(scr->session_state, sWorkspace, wks);
|
WMPutInPLDictionary(scr->session_state, sWorkspace, wks);
|
||||||
PLRelease(wks);
|
WMReleasePropList(wks);
|
||||||
|
|
||||||
WMFreeArray(wapp_list);
|
WMFreeArray(wapp_list);
|
||||||
}
|
}
|
||||||
@@ -370,8 +370,8 @@ wSessionClearState(WScreen *scr)
|
|||||||
if (!scr->session_state)
|
if (!scr->session_state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PLRemoveDictionaryEntry(scr->session_state, sApplications);
|
WMRemoveFromPLDictionary(scr->session_state, sApplications);
|
||||||
PLRemoveDictionaryEntry(scr->session_state, sWorkspace);
|
WMRemoveFromPLDictionary(scr->session_state, sWorkspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -412,19 +412,19 @@ execCommand(WScreen *scr, char *command, char *host)
|
|||||||
|
|
||||||
|
|
||||||
static WSavedState*
|
static WSavedState*
|
||||||
getWindowState(WScreen *scr, proplist_t win_state)
|
getWindowState(WScreen *scr, WMPropList *win_state)
|
||||||
{
|
{
|
||||||
WSavedState *state = wmalloc(sizeof(WSavedState));
|
WSavedState *state = wmalloc(sizeof(WSavedState));
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
unsigned mask;
|
unsigned mask;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset(state, 0, sizeof(WSavedState));
|
memset(state, 0, sizeof(WSavedState));
|
||||||
state->workspace = -1;
|
state->workspace = -1;
|
||||||
value = PLGetDictionaryEntry(win_state, sWorkspace);
|
value = WMGetFromPLDictionary(win_state, sWorkspace);
|
||||||
if (value && PLIsString(value)) {
|
if (value && WMIsPLString(value)) {
|
||||||
tmp = PLGetString(value);
|
tmp = WMGetFromPLString(value);
|
||||||
if (sscanf(tmp, "%i", &state->workspace)!=1) {
|
if (sscanf(tmp, "%i", &state->workspace)!=1) {
|
||||||
state->workspace = -1;
|
state->workspace = -1;
|
||||||
for (i=0; i < scr->workspace_count; i++) {
|
for (i=0; i < scr->workspace_count; i++) {
|
||||||
@@ -437,20 +437,20 @@ getWindowState(WScreen *scr, proplist_t win_state)
|
|||||||
state->workspace--;
|
state->workspace--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((value = PLGetDictionaryEntry(win_state, sShaded))!=NULL)
|
if ((value = WMGetFromPLDictionary(win_state, sShaded))!=NULL)
|
||||||
state->shaded = getBool(value);
|
state->shaded = getBool(value);
|
||||||
if ((value = PLGetDictionaryEntry(win_state, sMiniaturized))!=NULL)
|
if ((value = WMGetFromPLDictionary(win_state, sMiniaturized))!=NULL)
|
||||||
state->miniaturized = getBool(value);
|
state->miniaturized = getBool(value);
|
||||||
if ((value = PLGetDictionaryEntry(win_state, sHidden))!=NULL)
|
if ((value = WMGetFromPLDictionary(win_state, sHidden))!=NULL)
|
||||||
state->hidden = getBool(value);
|
state->hidden = getBool(value);
|
||||||
if ((value = PLGetDictionaryEntry(win_state, sShortcutMask))!=NULL) {
|
if ((value = WMGetFromPLDictionary(win_state, sShortcutMask))!=NULL) {
|
||||||
mask = getInt(value);
|
mask = getInt(value);
|
||||||
state->window_shortcuts = mask;
|
state->window_shortcuts = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(win_state, sGeometry);
|
value = WMGetFromPLDictionary(win_state, sGeometry);
|
||||||
if (value && PLIsString(value)) {
|
if (value && WMIsPLString(value)) {
|
||||||
if (!(sscanf(PLGetString(value), "%ix%i+%i+%i",
|
if (!(sscanf(WMGetFromPLString(value), "%ix%i+%i+%i",
|
||||||
&state->w, &state->h, &state->x, &state->y)==4 &&
|
&state->w, &state->h, &state->x, &state->y)==4 &&
|
||||||
(state->w>0 && state->h>0))) {
|
(state->w>0 && state->h>0))) {
|
||||||
state->w = 0;
|
state->w = 0;
|
||||||
@@ -469,7 +469,7 @@ wSessionRestoreState(WScreen *scr)
|
|||||||
{
|
{
|
||||||
WSavedState *state;
|
WSavedState *state;
|
||||||
char *instance, *class, *command, *host;
|
char *instance, *class, *command, *host;
|
||||||
proplist_t win_info, apps, cmd, value;
|
WMPropList *win_info, *apps, *cmd, *value;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int i, count;
|
int i, count;
|
||||||
WDock *dock;
|
WDock *dock;
|
||||||
@@ -482,25 +482,25 @@ wSessionRestoreState(WScreen *scr)
|
|||||||
if (!scr->session_state)
|
if (!scr->session_state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PLSetStringCmpHook(NULL);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
apps = PLGetDictionaryEntry(scr->session_state, sApplications);
|
apps = WMGetFromPLDictionary(scr->session_state, sApplications);
|
||||||
if (!apps)
|
if (!apps)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
count = PLGetNumberOfElements(apps);
|
count = WMGetPropListItemCount(apps);
|
||||||
if (count==0)
|
if (count==0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i=0; i<count; i++) {
|
for (i=0; i<count; i++) {
|
||||||
win_info = PLGetArrayElement(apps, i);
|
win_info = WMGetFromPLArray(apps, i);
|
||||||
|
|
||||||
cmd = PLGetDictionaryEntry(win_info, sCommand);
|
cmd = WMGetFromPLDictionary(win_info, sCommand);
|
||||||
if (!cmd || !PLIsString(cmd) || !(command = PLGetString(cmd))) {
|
if (!cmd || !WMIsPLString(cmd) || !(command = WMGetFromPLString(cmd))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(win_info, sName);
|
value = WMGetFromPLDictionary(win_info, sName);
|
||||||
if (!value)
|
if (!value)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -508,17 +508,17 @@ wSessionRestoreState(WScreen *scr)
|
|||||||
if (!instance && !class)
|
if (!instance && !class)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(win_info, sHost);
|
value = WMGetFromPLDictionary(win_info, sHost);
|
||||||
if (value && PLIsString(value))
|
if (value && WMIsPLString(value))
|
||||||
host = PLGetString(value);
|
host = WMGetFromPLString(value);
|
||||||
else
|
else
|
||||||
host = NULL;
|
host = NULL;
|
||||||
|
|
||||||
state = getWindowState(scr, win_info);
|
state = getWindowState(scr, win_info);
|
||||||
|
|
||||||
dock = NULL;
|
dock = NULL;
|
||||||
value = PLGetDictionaryEntry(win_info, sDock);
|
value = WMGetFromPLDictionary(win_info, sDock);
|
||||||
if (value && PLIsString(value) && (tmp = PLGetString(value))!=NULL) {
|
if (value && WMIsPLString(value) && (tmp = WMGetFromPLString(value))!=NULL) {
|
||||||
if (sscanf(tmp, "%i", &n)!=1) {
|
if (sscanf(tmp, "%i", &n)!=1) {
|
||||||
if (!strcasecmp(tmp, "DOCK")) {
|
if (!strcasecmp(tmp, "DOCK")) {
|
||||||
dock = scr->dock;
|
dock = scr->dock;
|
||||||
@@ -565,14 +565,14 @@ wSessionRestoreState(WScreen *scr)
|
|||||||
if (class) wfree(class);
|
if (class) wfree(class);
|
||||||
}
|
}
|
||||||
/* clean up */
|
/* clean up */
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wSessionRestoreLastWorkspace(WScreen *scr)
|
wSessionRestoreLastWorkspace(WScreen *scr)
|
||||||
{
|
{
|
||||||
proplist_t wks;
|
WMPropList *wks;
|
||||||
int w, i;
|
int w, i;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
@@ -581,16 +581,16 @@ wSessionRestoreLastWorkspace(WScreen *scr)
|
|||||||
if (!scr->session_state)
|
if (!scr->session_state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PLSetStringCmpHook(NULL);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
wks = PLGetDictionaryEntry(scr->session_state, sWorkspace);
|
wks = WMGetFromPLDictionary(scr->session_state, sWorkspace);
|
||||||
if (!wks || !PLIsString(wks))
|
if (!wks || !WMIsPLString(wks))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tmp = PLGetString(wks);
|
tmp = WMGetFromPLString(wks);
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
if (sscanf(tmp, "%i", &w)!=1) {
|
if (sscanf(tmp, "%i", &w)!=1) {
|
||||||
w = -1;
|
w = -1;
|
||||||
@@ -757,14 +757,14 @@ getWindowRole(Window window)
|
|||||||
* window shortcut #
|
* window shortcut #
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
makeAppState(WWindow *wwin)
|
makeAppState(WWindow *wwin)
|
||||||
{
|
{
|
||||||
WApplication *wapp;
|
WApplication *wapp;
|
||||||
proplist_t state;
|
WMPropList *state;
|
||||||
WScreen *scr = wwin->screen_ptr;
|
WScreen *scr = wwin->screen_ptr;
|
||||||
|
|
||||||
state = PLMakeArrayWithElements(NULL, NULL);
|
state = WMCreatePLArray(NULL, NULL);
|
||||||
|
|
||||||
wapp = wApplicationOf(wwin->main_window);
|
wapp = wApplicationOf(wwin->main_window);
|
||||||
|
|
||||||
@@ -772,7 +772,7 @@ makeAppState(WWindow *wwin)
|
|||||||
if (wapp->app_icon && wapp->app_icon->dock) {
|
if (wapp->app_icon && wapp->app_icon->dock) {
|
||||||
|
|
||||||
if (wapp->app_icon->dock == scr->dock) {
|
if (wapp->app_icon->dock == scr->dock) {
|
||||||
PLAppendArrayElement(state, PLMakeString("Dock"));
|
WMAddToPLArray(state, WMCreatePLString("Dock"));
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -782,12 +782,12 @@ makeAppState(WWindow *wwin)
|
|||||||
|
|
||||||
assert(i < scr->workspace_count);
|
assert(i < scr->workspace_count);
|
||||||
|
|
||||||
PLAppendArrayElement(state,
|
WMAddToPLArray(state,
|
||||||
PLMakeString(scr->workspaces[i]->name));
|
WMCreatePLString(scr->workspaces[i]->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAppendArrayElement(state, PLMakeString(wapp->hidden ? "1" : "0"));
|
WMAddToPLArray(state, WMCreatePLString(wapp->hidden ? "1" : "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
@@ -799,16 +799,16 @@ Bool
|
|||||||
wSessionGetStateFor(WWindow *wwin, WSessionData *state)
|
wSessionGetStateFor(WWindow *wwin, WSessionData *state)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
proplist_t slist;
|
WMPropList *slist;
|
||||||
proplist_t elem;
|
WMPropList *elem;
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
index = 3;
|
index = 3;
|
||||||
|
|
||||||
/* geometry */
|
/* geometry */
|
||||||
value = PLGetArrayElement(slist, index++);
|
value = WMGetFromPLArray(slist, index++);
|
||||||
str = PLGetString(value);
|
str = WMGetFromPLString(value);
|
||||||
|
|
||||||
sscanf(str, "%i %i %i %i %i %i", &state->x, &state->y,
|
sscanf(str, "%i %i %i %i %i %i", &state->x, &state->y,
|
||||||
&state->width, &state->height,
|
&state->width, &state->height,
|
||||||
@@ -816,43 +816,43 @@ wSessionGetStateFor(WWindow *wwin, WSessionData *state)
|
|||||||
|
|
||||||
|
|
||||||
/* state */
|
/* state */
|
||||||
value = PLGetArrayElement(slist, index++);
|
value = WMGetFromPLArray(slist, index++);
|
||||||
str = PLGetString(value);
|
str = WMGetFromPLString(value);
|
||||||
|
|
||||||
sscanf(str, "%i %i %i", &state->miniaturized, &state->shaded,
|
sscanf(str, "%i %i %i", &state->miniaturized, &state->shaded,
|
||||||
&state->maximized);
|
&state->maximized);
|
||||||
|
|
||||||
|
|
||||||
/* attributes */
|
/* attributes */
|
||||||
value = PLGetArrayElement(slist, index++);
|
value = WMGetFromPLArray(slist, index++);
|
||||||
str = PLGetString(value);
|
str = WMGetFromPLString(value);
|
||||||
|
|
||||||
getAttributeState(str, &state->mflags, &state->flags);
|
getAttributeState(str, &state->mflags, &state->flags);
|
||||||
|
|
||||||
|
|
||||||
/* workspace */
|
/* workspace */
|
||||||
value = PLGetArrayElement(slist, index++);
|
value = WMGetFromPLArray(slist, index++);
|
||||||
str = PLGetString(value);
|
str = WMGetFromPLString(value);
|
||||||
|
|
||||||
sscanf(str, "%i", &state->workspace);
|
sscanf(str, "%i", &state->workspace);
|
||||||
|
|
||||||
|
|
||||||
/* app state (repeated for all windows of the app) */
|
/* app state (repeated for all windows of the app) */
|
||||||
value = PLGetArrayElement(slist, index++);
|
value = WMGetFromPLArray(slist, index++);
|
||||||
str = PLGetString(value);
|
str = WMGetFromPLString(value);
|
||||||
|
|
||||||
/* ???? */
|
/* ???? */
|
||||||
|
|
||||||
/* shortcuts */
|
/* shortcuts */
|
||||||
value = PLGetArrayElement(slist, index++);
|
value = WMGetFromPLArray(slist, index++);
|
||||||
str = PLGetString(value);
|
str = WMGetFromPLString(value);
|
||||||
|
|
||||||
sscanf(str, "%i", &state->shortcuts);
|
sscanf(str, "%i", &state->shortcuts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
makeAttributeState(WWindow *wwin)
|
makeAttributeState(WWindow *wwin)
|
||||||
{
|
{
|
||||||
unsigned int data1, data2;
|
unsigned int data1, data2;
|
||||||
@@ -892,32 +892,32 @@ makeAttributeState(WWindow *wwin)
|
|||||||
W_FLAG(dont_save_session),
|
W_FLAG(dont_save_session),
|
||||||
W_FLAG(emulate_appicon));
|
W_FLAG(emulate_appicon));
|
||||||
|
|
||||||
return PLMakeString(buffer);
|
return WMCreatePLString(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
appendStringInArray(proplist_t array, char *str)
|
appendStringInArray(WMPropList *array, char *str)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
|
|
||||||
val = PLMakeString(str);
|
val = WMCreatePLString(str);
|
||||||
PLAppendArrayElement(array, val);
|
WMAddToPLArray(array, val);
|
||||||
PLRelease(val);
|
WMReleasePropList(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
makeClientState(WWindow *wwin)
|
makeClientState(WWindow *wwin)
|
||||||
{
|
{
|
||||||
proplist_t state;
|
WMPropList *state;
|
||||||
proplist_t tmp;
|
WMPropList *tmp;
|
||||||
char *str;
|
char *str;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
int i;
|
int i;
|
||||||
unsigned shortcuts;
|
unsigned shortcuts;
|
||||||
|
|
||||||
state = PLMakeArrayWithElements(NULL, NULL);
|
state = WMCreatePLArray(NULL, NULL);
|
||||||
|
|
||||||
/* WM_WINDOW_ROLE */
|
/* WM_WINDOW_ROLE */
|
||||||
str = getWindowRole(wwin->client_win);
|
str = getWindowRole(wwin->client_win);
|
||||||
@@ -953,8 +953,8 @@ makeClientState(WWindow *wwin)
|
|||||||
|
|
||||||
/* attributes */
|
/* attributes */
|
||||||
tmp = makeAttributeState(wwin);
|
tmp = makeAttributeState(wwin);
|
||||||
PLAppendArrayElement(state, tmp);
|
WMAddToPLArray(state, tmp);
|
||||||
PLRelease(tmp);
|
WMReleasePropList(tmp);
|
||||||
|
|
||||||
/* workspace */
|
/* workspace */
|
||||||
snprintf(buffer, sizeof(buffer), "%i", wwin->frame->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) */
|
/* app state (repeated for all windows of the app) */
|
||||||
tmp = makeAppState(wwin);
|
tmp = makeAppState(wwin);
|
||||||
PLAppendArrayElement(state, tmp);
|
WMAddToPLArray(state, tmp);
|
||||||
PLRelease(tmp);
|
WMReleasePropList(tmp);
|
||||||
|
|
||||||
/* shortcuts */
|
/* shortcuts */
|
||||||
shortcuts = 0;
|
shortcuts = 0;
|
||||||
@@ -993,7 +993,7 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
|
|||||||
Bool gsPrefix = False;
|
Bool gsPrefix = False;
|
||||||
char *discardCmd = NULL;
|
char *discardCmd = NULL;
|
||||||
time_t t;
|
time_t t;
|
||||||
proplist_t state;
|
WMPropList *state, *plState;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
#ifdef DEBUG1
|
#ifdef DEBUG1
|
||||||
@@ -1034,7 +1034,7 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
|
|||||||
} while (access(F_OK, statefile)!=-1);
|
} while (access(F_OK, statefile)!=-1);
|
||||||
|
|
||||||
/* save the states of all windows we're managing */
|
/* save the states of all windows we're managing */
|
||||||
state = PLMakeArrayFromElements(NULL, NULL);
|
state = WMCreatePLArray(NULL, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Format:
|
* Format:
|
||||||
@@ -1049,42 +1049,34 @@ smSaveYourselfPhase2Proc(SmcConn smc_conn, SmPointer client_data)
|
|||||||
WScreen *scr;
|
WScreen *scr;
|
||||||
WWindow *wwin;
|
WWindow *wwin;
|
||||||
char buf[32];
|
char buf[32];
|
||||||
proplist_t pscreen;
|
WMPropList *pscreen;
|
||||||
|
|
||||||
scr = wScreenWithNumber(i);
|
scr = wScreenWithNumber(i);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%i", scr->screen);
|
snprintf(buf, sizeof(buf), "%i", scr->screen);
|
||||||
pscreen = PLMakeArrayFromElements(PLMakeString(buf), NULL);
|
pscreen = WMCreatePLArray(WMCreatePLString(buf), NULL);
|
||||||
|
|
||||||
wwin = scr->focused_window;
|
wwin = scr->focused_window;
|
||||||
while (wwin) {
|
while (wwin) {
|
||||||
proplist_t pwindow;
|
WMPropList *pwindow;
|
||||||
|
|
||||||
pwindow = makeClientState(wwin);
|
pwindow = makeClientState(wwin);
|
||||||
PLAppendArrayElement(pscreen, pwindow);
|
WMAddToPLArray(pscreen, pwindow);
|
||||||
|
|
||||||
wwin = wwin->prev;
|
wwin = wwin->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLAppendArrayElement(state, pscreen);
|
WMAddToPLArray(state, pscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
plState = WMCreatePLDictionary(WMCreatePLString("Version"),
|
||||||
proplist_t statefile;
|
WMCreatePLString("1.0"),
|
||||||
|
WMCreatePLString("Screens"),
|
||||||
|
state, NULL);
|
||||||
|
|
||||||
statefile = PLMakeDictionaryFromEntries(PLMakeString("Version"),
|
WMWritePropListToFile(plState, statefile, False);
|
||||||
PLMakeString("1.0"),
|
|
||||||
|
|
||||||
PLMakeString("Screens"),
|
WMReleasePropList(plState);
|
||||||
state,
|
|
||||||
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
PLSetFilename(statefile, PLMakeString(statefile));
|
|
||||||
PLSave(statefile, NO);
|
|
||||||
|
|
||||||
PLRelease(statefile);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set the remaining properties that we didn't set at
|
/* set the remaining properties that we didn't set at
|
||||||
* startup time */
|
* startup time */
|
||||||
|
|||||||
+38
-39
@@ -80,7 +80,6 @@
|
|||||||
#include "framewin.h"
|
#include "framewin.h"
|
||||||
|
|
||||||
|
|
||||||
extern proplist_t ReadProplistFromFile(char *file);
|
|
||||||
/*** var ***/
|
/*** var ***/
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
|
|
||||||
@@ -134,7 +133,7 @@ removeUserMenudata(void *menudata)
|
|||||||
|
|
||||||
|
|
||||||
static WUserMenuData*
|
static WUserMenuData*
|
||||||
convertShortcuts(WScreen *scr, proplist_t shortcut)
|
convertShortcuts(WScreen *scr, WMPropList *shortcut)
|
||||||
{
|
{
|
||||||
WUserMenuData *data;
|
WUserMenuData *data;
|
||||||
KeySym ksym;
|
KeySym ksym;
|
||||||
@@ -143,11 +142,11 @@ convertShortcuts(WScreen *scr, proplist_t shortcut)
|
|||||||
char buf[128], *b;
|
char buf[128], *b;
|
||||||
int keycount,i,j,mod;
|
int keycount,i,j,mod;
|
||||||
|
|
||||||
if (PLIsString(shortcut)) {
|
if (WMIsPLString(shortcut)) {
|
||||||
keycount = 1;
|
keycount = 1;
|
||||||
}
|
}
|
||||||
else if (PLIsArray(shortcut)) {
|
else if (WMIsPLArray(shortcut)) {
|
||||||
keycount = PLGetNumberOfElements(shortcut);
|
keycount = WMGetPropListItemCount(shortcut);
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return NULL;
|
||||||
/*for (i=0;i<keycount;i++){*/
|
/*for (i=0;i<keycount;i++){*/
|
||||||
@@ -163,10 +162,10 @@ convertShortcuts(WScreen *scr, proplist_t shortcut)
|
|||||||
|
|
||||||
for (i=0,j=0;i<keycount;i++) {
|
for (i=0,j=0;i<keycount;i++) {
|
||||||
data->key[j].modifier = 0;
|
data->key[j].modifier = 0;
|
||||||
if (PLIsArray(shortcut)) {
|
if (WMIsPLArray(shortcut)) {
|
||||||
strcpy(buf, PLGetString(PLGetArrayElement(shortcut, i)));
|
strcpy(buf, WMGetFromPLString(WMGetFromPLArray(shortcut, i)));
|
||||||
} else {
|
} else {
|
||||||
strcpy(buf, PLGetString(shortcut));
|
strcpy(buf, WMGetFromPLString(shortcut));
|
||||||
}
|
}
|
||||||
b = (char*)buf;
|
b = (char*)buf;
|
||||||
|
|
||||||
@@ -207,34 +206,34 @@ keyover:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static WMenu*
|
static WMenu*
|
||||||
configureUserMenu(WScreen *scr, proplist_t plum)
|
configureUserMenu(WScreen *scr, WMPropList *plum)
|
||||||
{
|
{
|
||||||
char *mtitle;
|
char *mtitle;
|
||||||
WMenu *menu=NULL;
|
WMenu *menu=NULL;
|
||||||
proplist_t elem, title, command, params;
|
WMPropList *elem, *title, *command, *params;
|
||||||
int count,i;
|
int count,i;
|
||||||
WUserMenuData *data;
|
WUserMenuData *data;
|
||||||
|
|
||||||
if (!plum) return NULL;
|
if (!plum) return NULL;
|
||||||
if (!PLIsArray(plum)) {
|
if (!WMIsPLArray(plum)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = PLGetNumberOfElements(plum);
|
count = WMGetPropListItemCount(plum);
|
||||||
if (!count) return NULL;
|
if (!count) return NULL;
|
||||||
|
|
||||||
elem = PLGetArrayElement(plum, 0);
|
elem = WMGetFromPLArray(plum, 0);
|
||||||
if (!PLIsString(elem)) {
|
if (!WMIsPLString(elem)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtitle = PLGetString(elem);
|
mtitle = WMGetFromPLString(elem);
|
||||||
|
|
||||||
menu=wMenuCreateForApp(scr, mtitle, True);
|
menu=wMenuCreateForApp(scr, mtitle, True);
|
||||||
|
|
||||||
for(i=1; i<count; i++) {
|
for(i=1; i<count; i++) {
|
||||||
elem = PLGetArrayElement(plum,i);
|
elem = WMGetFromPLArray(plum,i);
|
||||||
if(PLIsArray(PLGetArrayElement(elem,1))) {
|
if(WMIsPLArray(WMGetFromPLArray(elem,1))) {
|
||||||
WMenu *submenu;
|
WMenu *submenu;
|
||||||
WMenuEntry *mentry;
|
WMenuEntry *mentry;
|
||||||
|
|
||||||
@@ -246,36 +245,36 @@ configureUserMenu(WScreen *scr, proplist_t plum)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
proplist_t instances=0;
|
WMPropList *instances=0;
|
||||||
|
|
||||||
title = PLGetArrayElement(elem,idx++);
|
title = WMGetFromPLArray(elem,idx++);
|
||||||
command = PLGetArrayElement(elem,idx++);
|
command = WMGetFromPLArray(elem,idx++);
|
||||||
if (PLGetNumberOfElements(elem) >= 3)
|
if (WMGetPropListItemCount(elem) >= 3)
|
||||||
params = PLGetArrayElement(elem,idx++);
|
params = WMGetFromPLArray(elem,idx++);
|
||||||
|
|
||||||
if (!title || !command)
|
if (!title || !command)
|
||||||
return menu;
|
return menu;
|
||||||
|
|
||||||
if (!strcmp("SHORTCUT",PLGetString(command))) {
|
if (!strcmp("SHORTCUT",WMGetFromPLString(command))) {
|
||||||
WMenuEntry *entry;
|
WMenuEntry *entry;
|
||||||
|
|
||||||
data = convertShortcuts(scr, params);
|
data = convertShortcuts(scr, params);
|
||||||
if (data){
|
if (data){
|
||||||
entry = wMenuAddCallback(menu, PLGetString(title),
|
entry = wMenuAddCallback(menu, WMGetFromPLString(title),
|
||||||
notifyClient, data);
|
notifyClient, data);
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
if (PLIsString(params)) {
|
if (WMIsPLString(params)) {
|
||||||
entry->rtext = GetShortcutString(PLGetString(params));
|
entry->rtext = GetShortcutString(WMGetFromPLString(params));
|
||||||
}
|
}
|
||||||
entry->free_cdata = removeUserMenudata;
|
entry->free_cdata = removeUserMenudata;
|
||||||
|
|
||||||
if (PLGetNumberOfElements(elem) >= 4) {
|
if (WMGetPropListItemCount(elem) >= 4) {
|
||||||
instances = PLGetArrayElement(elem,idx++);
|
instances = WMGetFromPLArray(elem,idx++);
|
||||||
if(PLIsArray(instances))
|
if(WMIsPLArray(instances))
|
||||||
if (instances && PLGetNumberOfElements(instances)
|
if (instances && WMGetPropListItemCount(instances)
|
||||||
&& PLIsArray(instances)){
|
&& WMIsPLArray(instances)){
|
||||||
entry->instances = PLRetain(instances);
|
entry->instances = WMRetainPropList(instances);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,15 +299,15 @@ wUserMenuRefreshInstances(WMenu *menu, WWindow *wwin)
|
|||||||
|
|
||||||
for (i=0; i<menu->entry_no; i++) {
|
for (i=0; i<menu->entry_no; i++) {
|
||||||
if (menu->entries[i]->instances){
|
if (menu->entries[i]->instances){
|
||||||
proplist_t ins;
|
WMPropList *ins;
|
||||||
int oldflag;
|
int oldflag;
|
||||||
count = PLGetNumberOfElements(menu->entries[i]->instances);
|
count = WMGetPropListItemCount(menu->entries[i]->instances);
|
||||||
|
|
||||||
oldflag = menu->entries[i]->flags.enabled;
|
oldflag = menu->entries[i]->flags.enabled;
|
||||||
menu->entries[i]->flags.enabled = 0;
|
menu->entries[i]->flags.enabled = 0;
|
||||||
for (j=0; j<count;j++) {
|
for (j=0; j<count;j++) {
|
||||||
ins = PLGetArrayElement(menu->entries[i]->instances,j);
|
ins = WMGetFromPLArray(menu->entries[i]->instances,j);
|
||||||
if (!strcmp(wwin->wm_instance,PLGetString(ins))) {
|
if (!strcmp(wwin->wm_instance,WMGetFromPLString(ins))) {
|
||||||
menu->entries[i]->flags.enabled = 1;
|
menu->entries[i]->flags.enabled = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -334,16 +333,16 @@ readUserMenuFile(WScreen *scr, char *file_name)
|
|||||||
{
|
{
|
||||||
WMenu *menu;
|
WMenu *menu;
|
||||||
char *mtitle;
|
char *mtitle;
|
||||||
proplist_t plum, elem, title, command, params;
|
WMPropList *plum, *elem, *title, *command, *params;
|
||||||
int count,i;
|
int count,i;
|
||||||
|
|
||||||
menu=NULL;
|
menu=NULL;
|
||||||
plum = ReadProplistFromFile(file_name);
|
plum = WMReadPropListFromFile(file_name);
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
if(plum){
|
if(plum){
|
||||||
menu = configureUserMenu(scr, plum);
|
menu = configureUserMenu(scr, plum);
|
||||||
PLRelease(plum);
|
WMReleasePropList(plum);
|
||||||
}
|
}
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|||||||
+134
-139
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
|
|
||||||
extern proplist_t wAttributeDomainName;
|
extern WMPropList *wAttributeDomainName;
|
||||||
|
|
||||||
extern WDDomain *WDWindowAttributes;
|
extern WDDomain *WDWindowAttributes;
|
||||||
|
|
||||||
@@ -57,83 +57,83 @@ extern WDDomain *WDWindowAttributes;
|
|||||||
|
|
||||||
|
|
||||||
/* type converters */
|
/* 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 WMPropList *ANoTitlebar = NULL;
|
||||||
static proplist_t ANoResizebar;
|
static WMPropList *ANoResizebar;
|
||||||
static proplist_t ANoMiniaturizeButton;
|
static WMPropList *ANoMiniaturizeButton;
|
||||||
static proplist_t ANoCloseButton;
|
static WMPropList *ANoCloseButton;
|
||||||
static proplist_t ANoBorder;
|
static WMPropList *ANoBorder;
|
||||||
static proplist_t ANoHideOthers;
|
static WMPropList *ANoHideOthers;
|
||||||
static proplist_t ANoMouseBindings;
|
static WMPropList *ANoMouseBindings;
|
||||||
static proplist_t ANoKeyBindings;
|
static WMPropList *ANoKeyBindings;
|
||||||
static proplist_t ANoAppIcon; /* app */
|
static WMPropList *ANoAppIcon; /* app */
|
||||||
static proplist_t AKeepOnTop;
|
static WMPropList *AKeepOnTop;
|
||||||
static proplist_t AKeepOnBottom;
|
static WMPropList *AKeepOnBottom;
|
||||||
static proplist_t AOmnipresent;
|
static WMPropList *AOmnipresent;
|
||||||
static proplist_t ASkipWindowList;
|
static WMPropList *ASkipWindowList;
|
||||||
static proplist_t AKeepInsideScreen;
|
static WMPropList *AKeepInsideScreen;
|
||||||
static proplist_t AUnfocusable;
|
static WMPropList *AUnfocusable;
|
||||||
static proplist_t AAlwaysUserIcon;
|
static WMPropList *AAlwaysUserIcon;
|
||||||
static proplist_t AStartMiniaturized;
|
static WMPropList *AStartMiniaturized;
|
||||||
static proplist_t AStartMaximized;
|
static WMPropList *AStartMaximized;
|
||||||
static proplist_t AStartHidden; /* app */
|
static WMPropList *AStartHidden; /* app */
|
||||||
static proplist_t ADontSaveSession; /* app */
|
static WMPropList *ADontSaveSession; /* app */
|
||||||
static proplist_t AEmulateAppIcon;
|
static WMPropList *AEmulateAppIcon;
|
||||||
static proplist_t AFullMaximize;
|
static WMPropList *AFullMaximize;
|
||||||
static proplist_t ACollapseAppIcons; /* app */
|
static WMPropList *ACollapseAppIcons; /* app */
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
static proplist_t ANoLanguageButton;
|
static WMPropList *ANoLanguageButton;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static proplist_t AStartWorkspace;
|
static WMPropList *AStartWorkspace;
|
||||||
|
|
||||||
static proplist_t AIcon;
|
static WMPropList *AIcon;
|
||||||
|
|
||||||
|
|
||||||
static proplist_t AnyWindow;
|
static WMPropList *AnyWindow;
|
||||||
static proplist_t No;
|
static WMPropList *No;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_wdefaults(WScreen *scr)
|
init_wdefaults(WScreen *scr)
|
||||||
{
|
{
|
||||||
AIcon = PLMakeString("Icon");
|
AIcon = WMCreatePLString("Icon");
|
||||||
|
|
||||||
ANoTitlebar = PLMakeString("NoTitlebar");
|
ANoTitlebar = WMCreatePLString("NoTitlebar");
|
||||||
ANoResizebar = PLMakeString("NoResizebar");
|
ANoResizebar = WMCreatePLString("NoResizebar");
|
||||||
ANoMiniaturizeButton = PLMakeString("NoMiniaturizeButton");
|
ANoMiniaturizeButton = WMCreatePLString("NoMiniaturizeButton");
|
||||||
ANoCloseButton = PLMakeString("NoCloseButton");
|
ANoCloseButton = WMCreatePLString("NoCloseButton");
|
||||||
ANoBorder = PLMakeString("NoBorder");
|
ANoBorder = WMCreatePLString("NoBorder");
|
||||||
ANoHideOthers = PLMakeString("NoHideOthers");
|
ANoHideOthers = WMCreatePLString("NoHideOthers");
|
||||||
ANoMouseBindings = PLMakeString("NoMouseBindings");
|
ANoMouseBindings = WMCreatePLString("NoMouseBindings");
|
||||||
ANoKeyBindings = PLMakeString("NoKeyBindings");
|
ANoKeyBindings = WMCreatePLString("NoKeyBindings");
|
||||||
ANoAppIcon = PLMakeString("NoAppIcon");
|
ANoAppIcon = WMCreatePLString("NoAppIcon");
|
||||||
AKeepOnTop = PLMakeString("KeepOnTop");
|
AKeepOnTop = WMCreatePLString("KeepOnTop");
|
||||||
AKeepOnBottom = PLMakeString("KeepOnBottom");
|
AKeepOnBottom = WMCreatePLString("KeepOnBottom");
|
||||||
AOmnipresent = PLMakeString("Omnipresent");
|
AOmnipresent = WMCreatePLString("Omnipresent");
|
||||||
ASkipWindowList = PLMakeString("SkipWindowList");
|
ASkipWindowList = WMCreatePLString("SkipWindowList");
|
||||||
AKeepInsideScreen = PLMakeString("KeepInsideScreen");
|
AKeepInsideScreen = WMCreatePLString("KeepInsideScreen");
|
||||||
AUnfocusable = PLMakeString("Unfocusable");
|
AUnfocusable = WMCreatePLString("Unfocusable");
|
||||||
AAlwaysUserIcon = PLMakeString("AlwaysUserIcon");
|
AAlwaysUserIcon = WMCreatePLString("AlwaysUserIcon");
|
||||||
AStartMiniaturized = PLMakeString("StartMiniaturized");
|
AStartMiniaturized = WMCreatePLString("StartMiniaturized");
|
||||||
AStartHidden = PLMakeString("StartHidden");
|
AStartHidden = WMCreatePLString("StartHidden");
|
||||||
AStartMaximized = PLMakeString("StartMaximized");
|
AStartMaximized = WMCreatePLString("StartMaximized");
|
||||||
ADontSaveSession = PLMakeString("DontSaveSession");
|
ADontSaveSession = WMCreatePLString("DontSaveSession");
|
||||||
AEmulateAppIcon = PLMakeString("EmulateAppIcon");
|
AEmulateAppIcon = WMCreatePLString("EmulateAppIcon");
|
||||||
AFullMaximize = PLMakeString("FullMaximize");
|
AFullMaximize = WMCreatePLString("FullMaximize");
|
||||||
ACollapseAppIcons = PLMakeString("CollapseAppIcons");
|
ACollapseAppIcons = WMCreatePLString("CollapseAppIcons");
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
ANoLanguageButton = PLMakeString("NoLanguageButton");
|
ANoLanguageButton = WMCreatePLString("NoLanguageButton");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AStartWorkspace = PLMakeString("StartWorkspace");
|
AStartWorkspace = WMCreatePLString("StartWorkspace");
|
||||||
|
|
||||||
AnyWindow = PLMakeString("*");
|
AnyWindow = WMCreatePLString("*");
|
||||||
No = PLMakeString("No");
|
No = WMCreatePLString("No");
|
||||||
/*
|
/*
|
||||||
if (!scr->wattribs) {
|
if (!scr->wattribs) {
|
||||||
scr->wattribs = PLGetDomain(wAttributeDomainName);
|
scr->wattribs = PLGetDomain(wAttributeDomainName);
|
||||||
@@ -142,28 +142,28 @@ init_wdefaults(WScreen *scr)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
get_value(proplist_t dict_win, proplist_t dict_class, proplist_t dict_name,
|
get_value(WMPropList *dict_win, WMPropList *dict_class, WMPropList *dict_name,
|
||||||
proplist_t dict_any, proplist_t option, proplist_t default_value,
|
WMPropList *dict_any, WMPropList *option, WMPropList *default_value,
|
||||||
Bool useGlobalDefault)
|
Bool useGlobalDefault)
|
||||||
{
|
{
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
|
|
||||||
|
|
||||||
if (dict_win) {
|
if (dict_win) {
|
||||||
value = PLGetDictionaryEntry(dict_win, option);
|
value = WMGetFromPLDictionary(dict_win, option);
|
||||||
if (value)
|
if (value)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict_name) {
|
if (dict_name) {
|
||||||
value = PLGetDictionaryEntry(dict_name, option);
|
value = WMGetFromPLDictionary(dict_name, option);
|
||||||
if (value)
|
if (value)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict_class) {
|
if (dict_class) {
|
||||||
value = PLGetDictionaryEntry(dict_class, option);
|
value = WMGetFromPLDictionary(dict_class, option);
|
||||||
if (value)
|
if (value)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ get_value(proplist_t dict_win, proplist_t dict_class, proplist_t dict_name,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (dict_any) {
|
if (dict_any) {
|
||||||
value = PLGetDictionaryEntry(dict_any, option);
|
value = WMGetFromPLDictionary(dict_any, option);
|
||||||
if (value)
|
if (value)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -198,26 +198,24 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
|
|||||||
WWindowAttributes *mask,
|
WWindowAttributes *mask,
|
||||||
Bool useGlobalDefault)
|
Bool useGlobalDefault)
|
||||||
{
|
{
|
||||||
proplist_t value;
|
WMPropList *value, *key1, *key2, *key3, *dw, *dc, *dn, *da;
|
||||||
proplist_t key1, key2, key3;
|
|
||||||
proplist_t dw, dc, dn, da;
|
|
||||||
|
|
||||||
|
|
||||||
if (class && instance) {
|
if (class && instance) {
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
buffer = wmalloc(strlen(class)+strlen(instance)+4);
|
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);
|
wfree(buffer);
|
||||||
} else
|
} else
|
||||||
key1 = NULL;
|
key1 = NULL;
|
||||||
|
|
||||||
if (instance)
|
if (instance)
|
||||||
key2 = PLMakeString(instance);
|
key2 = WMCreatePLString(instance);
|
||||||
else
|
else
|
||||||
key2 = NULL;
|
key2 = NULL;
|
||||||
|
|
||||||
if (class)
|
if (class)
|
||||||
key3 = PLMakeString(class);
|
key3 = WMCreatePLString(class);
|
||||||
else
|
else
|
||||||
key3 = NULL;
|
key3 = NULL;
|
||||||
|
|
||||||
@@ -225,14 +223,14 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
|
|||||||
init_wdefaults(scr);
|
init_wdefaults(scr);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLSetStringCmpHook(NULL);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
if (WDWindowAttributes->dictionary) {
|
if (WDWindowAttributes->dictionary) {
|
||||||
dw = key1 ? PLGetDictionaryEntry(WDWindowAttributes->dictionary, key1) : NULL;
|
dw = key1 ? WMGetFromPLDictionary(WDWindowAttributes->dictionary, key1) : NULL;
|
||||||
dn = key2 ? PLGetDictionaryEntry(WDWindowAttributes->dictionary, key2) : NULL;
|
dn = key2 ? WMGetFromPLDictionary(WDWindowAttributes->dictionary, key2) : NULL;
|
||||||
dc = key3 ? PLGetDictionaryEntry(WDWindowAttributes->dictionary, key3) : NULL;
|
dc = key3 ? WMGetFromPLDictionary(WDWindowAttributes->dictionary, key3) : NULL;
|
||||||
if (useGlobalDefault)
|
if (useGlobalDefault)
|
||||||
da = PLGetDictionaryEntry(WDWindowAttributes->dictionary, AnyWindow);
|
da = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow);
|
||||||
else
|
else
|
||||||
da = NULL;
|
da = NULL;
|
||||||
} else {
|
} else {
|
||||||
@@ -242,11 +240,11 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
|
|||||||
da = NULL;
|
da = NULL;
|
||||||
}
|
}
|
||||||
if (key1)
|
if (key1)
|
||||||
PLRelease(key1);
|
WMReleasePropList(key1);
|
||||||
if (key2)
|
if (key2)
|
||||||
PLRelease(key2);
|
WMReleasePropList(key2);
|
||||||
if (key3)
|
if (key3)
|
||||||
PLRelease(key3);
|
WMReleasePropList(key3);
|
||||||
|
|
||||||
#define APPLY_VAL(value, flag, attrib) \
|
#define APPLY_VAL(value, flag, attrib) \
|
||||||
if (value) {attr->flag = getBool(attrib, value); \
|
if (value) {attr->flag = getBool(attrib, value); \
|
||||||
@@ -328,65 +326,65 @@ wDefaultFillAttributes(WScreen *scr, char *instance, char *class,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
proplist_t
|
WMPropList*
|
||||||
get_generic_value(WScreen *scr, char *instance, char *class, proplist_t option,
|
get_generic_value(WScreen *scr, char *instance, char *class, WMPropList *option,
|
||||||
Bool noDefault)
|
Bool noDefault)
|
||||||
{
|
{
|
||||||
proplist_t value, key, dict;
|
WMPropList *value, *key, *dict;
|
||||||
|
|
||||||
value = NULL;
|
value = NULL;
|
||||||
|
|
||||||
PLSetStringCmpHook(NULL);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
if (class && instance) {
|
if (class && instance) {
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
buffer = wmalloc(strlen(class)+strlen(instance)+4);
|
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);
|
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
wfree(buffer);
|
wfree(buffer);
|
||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
value = PLGetDictionaryEntry(dict, option);
|
value = WMGetFromPLDictionary(dict, option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value && instance) {
|
if (!value && instance) {
|
||||||
key = PLMakeString(instance);
|
key = WMCreatePLString(instance);
|
||||||
|
|
||||||
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
|
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
if (dict) {
|
if (dict) {
|
||||||
value = PLGetDictionaryEntry(dict, option);
|
value = WMGetFromPLDictionary(dict, option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value && class) {
|
if (!value && class) {
|
||||||
key = PLMakeString(class);
|
key = WMCreatePLString(class);
|
||||||
|
|
||||||
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, key);
|
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, key);
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
value = PLGetDictionaryEntry(dict, option);
|
value = WMGetFromPLDictionary(dict, option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!value && !noDefault) {
|
if (!value && !noDefault) {
|
||||||
dict = PLGetDictionaryEntry(WDWindowAttributes->dictionary, AnyWindow);
|
dict = WMGetFromPLDictionary(WDWindowAttributes->dictionary, AnyWindow);
|
||||||
|
|
||||||
if (dict) {
|
if (dict) {
|
||||||
value = PLGetDictionaryEntry(dict, option);
|
value = WMGetFromPLDictionary(dict, option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -396,7 +394,7 @@ char*
|
|||||||
wDefaultGetIconFile(WScreen *scr, char *instance, char *class,
|
wDefaultGetIconFile(WScreen *scr, char *instance, char *class,
|
||||||
Bool noDefault)
|
Bool noDefault)
|
||||||
{
|
{
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (!ANoTitlebar) {
|
if (!ANoTitlebar) {
|
||||||
@@ -450,7 +448,7 @@ wDefaultGetImage(WScreen *scr, char *winstance, char *wclass)
|
|||||||
int
|
int
|
||||||
wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class)
|
wDefaultGetStartWorkspace(WScreen *scr, char *instance, char *class)
|
||||||
{
|
{
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
int w, i;
|
int w, i;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
@@ -492,69 +490,66 @@ void
|
|||||||
wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
|
wDefaultChangeIcon(WScreen *scr, char *instance, char* class, char *file)
|
||||||
{
|
{
|
||||||
WDDomain *db = WDWindowAttributes;
|
WDDomain *db = WDWindowAttributes;
|
||||||
proplist_t icon_value=NULL, value, attr, key, def_win, def_icon=NULL;
|
WMPropList *icon_value=NULL, *value, *attr, *key, *def_win, *def_icon=NULL;
|
||||||
proplist_t dict = db->dictionary;
|
WMPropList *dict = db->dictionary;
|
||||||
int same = 0;
|
int same = 0;
|
||||||
|
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
dict = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
dict = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
if (dict) {
|
if (dict) {
|
||||||
db->dictionary = dict;
|
db->dictionary = dict;
|
||||||
value = PLMakeString(db->path);
|
} else {
|
||||||
PLSetFilename(dict, value);
|
|
||||||
PLRelease(value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PLSetStringCmpHook(NULL);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
if (instance && class) {
|
if (instance && class) {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
buffer = wmalloc(strlen(instance) + strlen(class) + 2);
|
buffer = wmalloc(strlen(instance) + strlen(class) + 2);
|
||||||
strcat(strcat(strcpy(buffer, instance), "."), class);
|
strcat(strcat(strcpy(buffer, instance), "."), class);
|
||||||
key = PLMakeString(buffer);
|
key = WMCreatePLString(buffer);
|
||||||
wfree(buffer);
|
wfree(buffer);
|
||||||
} else if (instance) {
|
} else if (instance) {
|
||||||
key = PLMakeString(instance);
|
key = WMCreatePLString(instance);
|
||||||
} else if (class) {
|
} else if (class) {
|
||||||
key = PLMakeString(class);
|
key = WMCreatePLString(class);
|
||||||
} else {
|
} else {
|
||||||
key = PLRetain(AnyWindow);
|
key = WMRetainPropList(AnyWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
value = PLMakeString(file);
|
value = WMCreatePLString(file);
|
||||||
icon_value = PLMakeDictionaryFromEntries(AIcon, value, NULL);
|
icon_value = WMCreatePLDictionary(AIcon, value, NULL);
|
||||||
PLRelease(value);
|
WMReleasePropList(value);
|
||||||
|
|
||||||
if ((def_win = PLGetDictionaryEntry(dict, AnyWindow)) != NULL) {
|
if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL) {
|
||||||
def_icon = PLGetDictionaryEntry(def_win, AIcon);
|
def_icon = WMGetFromPLDictionary(def_win, AIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def_icon && !strcmp(PLGetString(def_icon), file))
|
if (def_icon && !strcmp(WMGetFromPLString(def_icon), file))
|
||||||
same = 1;
|
same = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((attr = PLGetDictionaryEntry(dict, key)) != NULL) {
|
if ((attr = WMGetFromPLDictionary(dict, key)) != NULL) {
|
||||||
if (PLIsDictionary(attr)) {
|
if (WMIsPLDictionary(attr)) {
|
||||||
if (icon_value!=NULL && !same)
|
if (icon_value!=NULL && !same)
|
||||||
PLMergeDictionaries(attr, icon_value);
|
WMMergePLDictionaries(attr, icon_value);
|
||||||
else
|
else
|
||||||
PLRemoveDictionaryEntry(attr, AIcon);
|
WMRemoveFromPLDictionary(attr, AIcon);
|
||||||
}
|
}
|
||||||
} else if (icon_value!=NULL && !same) {
|
} else if (icon_value!=NULL && !same) {
|
||||||
PLInsertDictionaryEntry(dict, key, icon_value);
|
WMPutInPLDictionary(dict, key, icon_value);
|
||||||
}
|
}
|
||||||
if (!wPreferences.flags.noupdates)
|
if (!wPreferences.flags.noupdates)
|
||||||
PLSave(dict, YES);
|
WMWritePropListToFile(dict, db->path, True);
|
||||||
|
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
if(icon_value)
|
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 ----------------------- */
|
/* --------------------------- Local ----------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getBool(proplist_t key, proplist_t value)
|
getBool(WMPropList *key, WMPropList *value)
|
||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
if (!PLIsString(value)) {
|
if (!WMIsPLString(value)) {
|
||||||
wwarning(_("Wrong option format for key \"%s\". Should be %s."),
|
wwarning(_("Wrong option format for key \"%s\". Should be %s."),
|
||||||
PLGetString(key), "Boolean");
|
WMGetFromPLString(key), "Boolean");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
val = PLGetString(value);
|
val = WMGetFromPLString(value);
|
||||||
|
|
||||||
if ((val[1]=='\0' && (val[0]=='y' || val[0]=='Y' || val[0]=='T'
|
if ((val[1]=='\0' && (val[0]=='y' || val[0]=='Y' || val[0]=='T'
|
||||||
|| val[0]=='t' || val[0]=='1'))
|
|| 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!!
|
* WARNING: Do not free value returned by this!!
|
||||||
*/
|
*/
|
||||||
static char*
|
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."),
|
wwarning(_("Wrong option format for key \"%s\". Should be %s."),
|
||||||
PLGetString(key), "String");
|
WMGetFromPLString(key), "String");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLGetString(value);
|
return WMGetFromPLString(value);
|
||||||
}
|
}
|
||||||
|
|||||||
+100
-104
@@ -48,7 +48,7 @@
|
|||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -133,43 +133,43 @@ static InspectorPanel *panelList=NULL;
|
|||||||
|
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
|
|
||||||
static proplist_t ANoTitlebar = NULL;
|
static WMPropList *ANoTitlebar = NULL;
|
||||||
static proplist_t ANoResizebar;
|
static WMPropList *ANoResizebar;
|
||||||
static proplist_t ANoMiniaturizeButton;
|
static WMPropList *ANoMiniaturizeButton;
|
||||||
static proplist_t ANoCloseButton;
|
static WMPropList *ANoCloseButton;
|
||||||
static proplist_t ANoBorder;
|
static WMPropList *ANoBorder;
|
||||||
static proplist_t ANoHideOthers;
|
static WMPropList *ANoHideOthers;
|
||||||
static proplist_t ANoMouseBindings;
|
static WMPropList *ANoMouseBindings;
|
||||||
static proplist_t ANoKeyBindings;
|
static WMPropList *ANoKeyBindings;
|
||||||
static proplist_t ANoAppIcon;
|
static WMPropList *ANoAppIcon;
|
||||||
static proplist_t AKeepOnTop;
|
static WMPropList *AKeepOnTop;
|
||||||
static proplist_t AKeepOnBottom;
|
static WMPropList *AKeepOnBottom;
|
||||||
static proplist_t AOmnipresent;
|
static WMPropList *AOmnipresent;
|
||||||
static proplist_t ASkipWindowList;
|
static WMPropList *ASkipWindowList;
|
||||||
static proplist_t AKeepInsideScreen;
|
static WMPropList *AKeepInsideScreen;
|
||||||
static proplist_t AUnfocusable;
|
static WMPropList *AUnfocusable;
|
||||||
static proplist_t AAlwaysUserIcon;
|
static WMPropList *AAlwaysUserIcon;
|
||||||
static proplist_t AStartMiniaturized;
|
static WMPropList *AStartMiniaturized;
|
||||||
static proplist_t AStartMaximized;
|
static WMPropList *AStartMaximized;
|
||||||
static proplist_t ADontSaveSession;
|
static WMPropList *ADontSaveSession;
|
||||||
static proplist_t AEmulateAppIcon;
|
static WMPropList *AEmulateAppIcon;
|
||||||
static proplist_t AFullMaximize;
|
static WMPropList *AFullMaximize;
|
||||||
static proplist_t ACollapseAppIcons;
|
static WMPropList *ACollapseAppIcons;
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
static proplist_t ANoLanguageButton;
|
static WMPropList *ANoLanguageButton;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static proplist_t AStartWorkspace;
|
static WMPropList *AStartWorkspace;
|
||||||
|
|
||||||
static proplist_t AIcon;
|
static WMPropList *AIcon;
|
||||||
|
|
||||||
/* application wide options */
|
/* application wide options */
|
||||||
static proplist_t AStartHidden;
|
static WMPropList *AStartHidden;
|
||||||
|
|
||||||
|
|
||||||
static proplist_t AnyWindow;
|
static WMPropList *AnyWindow;
|
||||||
static proplist_t EmptyString;
|
static WMPropList *EmptyString;
|
||||||
static proplist_t Yes, No;
|
static WMPropList *Yes, *No;
|
||||||
|
|
||||||
|
|
||||||
#define PWIDTH 270
|
#define PWIDTH 270
|
||||||
@@ -199,40 +199,40 @@ make_keys()
|
|||||||
if (ANoTitlebar!=NULL)
|
if (ANoTitlebar!=NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AIcon = PLMakeString("Icon");
|
AIcon = WMCreatePLString("Icon");
|
||||||
ANoTitlebar = PLMakeString("NoTitlebar");
|
ANoTitlebar = WMCreatePLString("NoTitlebar");
|
||||||
ANoResizebar = PLMakeString("NoResizebar");
|
ANoResizebar = WMCreatePLString("NoResizebar");
|
||||||
ANoMiniaturizeButton = PLMakeString("NoMiniaturizeButton");
|
ANoMiniaturizeButton = WMCreatePLString("NoMiniaturizeButton");
|
||||||
ANoCloseButton = PLMakeString("NoCloseButton");
|
ANoCloseButton = WMCreatePLString("NoCloseButton");
|
||||||
ANoBorder = PLMakeString("NoBorder");
|
ANoBorder = WMCreatePLString("NoBorder");
|
||||||
ANoHideOthers = PLMakeString("NoHideOthers");
|
ANoHideOthers = WMCreatePLString("NoHideOthers");
|
||||||
ANoMouseBindings = PLMakeString("NoMouseBindings");
|
ANoMouseBindings = WMCreatePLString("NoMouseBindings");
|
||||||
ANoKeyBindings = PLMakeString("NoKeyBindings");
|
ANoKeyBindings = WMCreatePLString("NoKeyBindings");
|
||||||
ANoAppIcon = PLMakeString("NoAppIcon");
|
ANoAppIcon = WMCreatePLString("NoAppIcon");
|
||||||
AKeepOnTop = PLMakeString("KeepOnTop");
|
AKeepOnTop = WMCreatePLString("KeepOnTop");
|
||||||
AKeepOnBottom = PLMakeString("KeepOnBottom");
|
AKeepOnBottom = WMCreatePLString("KeepOnBottom");
|
||||||
AOmnipresent = PLMakeString("Omnipresent");
|
AOmnipresent = WMCreatePLString("Omnipresent");
|
||||||
ASkipWindowList = PLMakeString("SkipWindowList");
|
ASkipWindowList = WMCreatePLString("SkipWindowList");
|
||||||
AKeepInsideScreen = PLMakeString("KeepInsideScreen");
|
AKeepInsideScreen = WMCreatePLString("KeepInsideScreen");
|
||||||
AUnfocusable = PLMakeString("Unfocusable");
|
AUnfocusable = WMCreatePLString("Unfocusable");
|
||||||
AAlwaysUserIcon = PLMakeString("AlwaysUserIcon");
|
AAlwaysUserIcon = WMCreatePLString("AlwaysUserIcon");
|
||||||
AStartMiniaturized = PLMakeString("StartMiniaturized");
|
AStartMiniaturized = WMCreatePLString("StartMiniaturized");
|
||||||
AStartMaximized = PLMakeString("StartMaximized");
|
AStartMaximized = WMCreatePLString("StartMaximized");
|
||||||
AStartHidden = PLMakeString("StartHidden");
|
AStartHidden = WMCreatePLString("StartHidden");
|
||||||
ADontSaveSession = PLMakeString("DontSaveSession");
|
ADontSaveSession = WMCreatePLString("DontSaveSession");
|
||||||
AEmulateAppIcon = PLMakeString("EmulateAppIcon");
|
AEmulateAppIcon = WMCreatePLString("EmulateAppIcon");
|
||||||
AFullMaximize = PLMakeString("FullMaximize");
|
AFullMaximize = WMCreatePLString("FullMaximize");
|
||||||
ACollapseAppIcons = PLMakeString("CollapseAppIcons");
|
ACollapseAppIcons = WMCreatePLString("CollapseAppIcons");
|
||||||
#ifdef XKB_BUTTON_HINT
|
#ifdef XKB_BUTTON_HINT
|
||||||
ANoLanguageButton = PLMakeString("NoLanguageButton");
|
ANoLanguageButton = WMCreatePLString("NoLanguageButton");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AStartWorkspace = PLMakeString("StartWorkspace");
|
AStartWorkspace = WMCreatePLString("StartWorkspace");
|
||||||
|
|
||||||
AnyWindow = PLMakeString("*");
|
AnyWindow = WMCreatePLString("*");
|
||||||
EmptyString = PLMakeString("");
|
EmptyString = WMCreatePLString("");
|
||||||
Yes = PLMakeString("Yes");
|
Yes = WMCreatePLString("Yes");
|
||||||
No = PLMakeString("No");
|
No = WMCreatePLString("No");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -428,14 +428,14 @@ updateIcon(WMButton *button, InspectorPanel *panel)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
getBool(proplist_t value)
|
getBool(WMPropList *value)
|
||||||
{
|
{
|
||||||
char *val;
|
char *val;
|
||||||
|
|
||||||
if (!PLIsString(value)) {
|
if (!WMIsPLString(value)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (!(val = PLGetString(value))) {
|
if (!(val = WMGetFromPLString(value))) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,16 +472,16 @@ getBool(proplist_t value)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
insertAttribute(proplist_t dict, proplist_t window, proplist_t attr,
|
insertAttribute(WMPropList *dict, WMPropList *window, WMPropList *attr,
|
||||||
proplist_t value, int flags)
|
WMPropList *value, int flags)
|
||||||
{
|
{
|
||||||
proplist_t def_win, def_value=NULL;
|
WMPropList *def_win, *def_value=NULL;
|
||||||
int update = 0;
|
int update = 0;
|
||||||
int modified = 0;
|
int modified = 0;
|
||||||
|
|
||||||
if (!(flags & UPDATE_DEFAULTS) && dict) {
|
if (!(flags & UPDATE_DEFAULTS) && dict) {
|
||||||
if ((def_win = PLGetDictionaryEntry(dict, AnyWindow)) != NULL) {
|
if ((def_win = WMGetFromPLDictionary(dict, AnyWindow)) != NULL) {
|
||||||
def_value = PLGetDictionaryEntry(def_win, attr);
|
def_value = WMGetFromPLDictionary(def_win, attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,11 +494,11 @@ insertAttribute(proplist_t dict, proplist_t window, proplist_t attr,
|
|||||||
if ((flags & IS_BOOLEAN))
|
if ((flags & IS_BOOLEAN))
|
||||||
update = (getBool(value) != getBool(def_value));
|
update = (getBool(value) != getBool(def_value));
|
||||||
else {
|
else {
|
||||||
update = !PLIsEqual(value, def_value);
|
update = !WMIsPropListEqualTo(value, def_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
PLInsertDictionaryEntry(window, attr, value);
|
WMPutInPLDictionary(window, attr, value);
|
||||||
modified = 1;
|
modified = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,8 +511,8 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
{
|
{
|
||||||
WWindow *wwin = panel->inspected;
|
WWindow *wwin = panel->inspected;
|
||||||
WDDomain *db = WDWindowAttributes;
|
WDDomain *db = WDWindowAttributes;
|
||||||
proplist_t dict = db->dictionary;
|
WMPropList *dict = db->dictionary;
|
||||||
proplist_t winDic, value, key;
|
WMPropList *winDic, *value, *key;
|
||||||
char *icon_file;
|
char *icon_file;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
int different = 0;
|
int different = 0;
|
||||||
@@ -521,18 +521,18 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
applySettings(panel->applyBtn, panel);
|
applySettings(panel->applyBtn, panel);
|
||||||
|
|
||||||
if (WMGetButtonSelected(panel->instRb) != 0)
|
if (WMGetButtonSelected(panel->instRb) != 0)
|
||||||
key = PLMakeString(wwin->wm_instance);
|
key = WMCreatePLString(wwin->wm_instance);
|
||||||
else if (WMGetButtonSelected(panel->clsRb) != 0)
|
else if (WMGetButtonSelected(panel->clsRb) != 0)
|
||||||
key = PLMakeString(wwin->wm_class);
|
key = WMCreatePLString(wwin->wm_class);
|
||||||
else if (WMGetButtonSelected(panel->bothRb) != 0) {
|
else if (WMGetButtonSelected(panel->bothRb) != 0) {
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
|
||||||
buffer = wmalloc(strlen(wwin->wm_instance)+strlen(wwin->wm_class)+4);
|
buffer = wmalloc(strlen(wwin->wm_instance)+strlen(wwin->wm_class)+4);
|
||||||
strcat(strcat(strcpy(buffer, wwin->wm_instance), "."), wwin->wm_class);
|
strcat(strcat(strcpy(buffer, wwin->wm_instance), "."), wwin->wm_class);
|
||||||
key = PLMakeString(buffer);
|
key = WMCreatePLString(buffer);
|
||||||
wfree(buffer);
|
wfree(buffer);
|
||||||
} else if (WMGetButtonSelected(panel->defaultRb) != 0) {
|
} else if (WMGetButtonSelected(panel->defaultRb) != 0) {
|
||||||
key = PLRetain(AnyWindow);
|
key = WMRetainPropList(AnyWindow);
|
||||||
flags = UPDATE_DEFAULTS;
|
flags = UPDATE_DEFAULTS;
|
||||||
} else
|
} else
|
||||||
key = NULL;
|
key = NULL;
|
||||||
@@ -541,15 +541,11 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
dict = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
dict = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
if (dict) {
|
if (dict) {
|
||||||
db->dictionary = dict;
|
db->dictionary = dict;
|
||||||
value = PLMakeString(db->path);
|
} else {
|
||||||
PLSetFilename(dict, value);
|
WMReleasePropList(key);
|
||||||
PLRelease(value);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
PLRelease(key);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -558,17 +554,17 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
USE_TEXT_FIELD) < 0)
|
USE_TEXT_FIELD) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PLSetStringCmpHook(NULL);
|
WMPLSetCaseSensitive(True);
|
||||||
|
|
||||||
winDic = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
winDic = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
|
|
||||||
/* Update icon for window */
|
/* Update icon for window */
|
||||||
icon_file = WMGetTextFieldText(panel->fileText);
|
icon_file = WMGetTextFieldText(panel->fileText);
|
||||||
if (icon_file) {
|
if (icon_file) {
|
||||||
if (icon_file[0] != 0) {
|
if (icon_file[0] != 0) {
|
||||||
value = PLMakeString(icon_file);
|
value = WMCreatePLString(icon_file);
|
||||||
different |= insertAttribute(dict, winDic, AIcon, value, flags);
|
different |= insertAttribute(dict, winDic, AIcon, value, flags);
|
||||||
PLRelease(value);
|
WMReleasePropList(value);
|
||||||
}
|
}
|
||||||
wfree(icon_file);
|
wfree(icon_file);
|
||||||
}
|
}
|
||||||
@@ -579,10 +575,10 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
i--;
|
i--;
|
||||||
|
|
||||||
if (i>=0 && i < panel->frame->screen_ptr->workspace_count) {
|
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,
|
different |= insertAttribute(dict, winDic, AStartWorkspace, value,
|
||||||
flags);
|
flags);
|
||||||
PLRelease(value);
|
WMReleasePropList(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,13 +664,13 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
different |= insertAttribute(dict, winDic, ACollapseAppIcons, value, flags);
|
different |= insertAttribute(dict, winDic, ACollapseAppIcons, value, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLRemoveDictionaryEntry(dict, key);
|
WMRemoveFromPLDictionary(dict, key);
|
||||||
if (different) {
|
if (different) {
|
||||||
PLInsertDictionaryEntry(dict, key, winDic);
|
WMPutInPLDictionary(dict, key, winDic);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
PLRelease(winDic);
|
WMReleasePropList(winDic);
|
||||||
|
|
||||||
different = 0;
|
different = 0;
|
||||||
|
|
||||||
@@ -682,14 +678,14 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
if (panel->inspected->main_window != panel->inspected->client_win
|
if (panel->inspected->main_window != panel->inspected->client_win
|
||||||
&& !(flags & UPDATE_DEFAULTS)) {
|
&& !(flags & UPDATE_DEFAULTS)) {
|
||||||
WApplication *wapp;
|
WApplication *wapp;
|
||||||
proplist_t appDic;
|
WMPropList *appDic;
|
||||||
|
|
||||||
wapp = wApplicationOf(panel->inspected->main_window);
|
wapp = wApplicationOf(panel->inspected->main_window);
|
||||||
if (wapp) {
|
if (wapp) {
|
||||||
char *iconFile;
|
char *iconFile;
|
||||||
char *buffer;
|
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_instance!=NULL);
|
||||||
assert(wapp->main_window_desc->wm_class!=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);
|
+strlen(wapp->main_window_desc->wm_class)+4);
|
||||||
strcat(strcpy(buffer, wapp->main_window_desc->wm_instance), ".");
|
strcat(strcpy(buffer, wapp->main_window_desc->wm_instance), ".");
|
||||||
strcat(buffer, wapp->main_window_desc->wm_class);
|
strcat(buffer, wapp->main_window_desc->wm_class);
|
||||||
key = PLMakeString(buffer);
|
key = WMCreatePLString(buffer);
|
||||||
wfree(buffer);
|
wfree(buffer);
|
||||||
|
|
||||||
iconFile = wDefaultGetIconFile(wwin->screen_ptr,
|
iconFile = wDefaultGetIconFile(wwin->screen_ptr,
|
||||||
@@ -707,10 +703,10 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
False);
|
False);
|
||||||
|
|
||||||
if (iconFile && iconFile[0]!=0) {
|
if (iconFile && iconFile[0]!=0) {
|
||||||
value = PLMakeString(iconFile);
|
value = WMCreatePLString(iconFile);
|
||||||
different |= insertAttribute(dict, appDic, AIcon, value,
|
different |= insertAttribute(dict, appDic, AIcon, value,
|
||||||
flags&~IS_BOOLEAN);
|
flags&~IS_BOOLEAN);
|
||||||
PLRelease(value);
|
WMReleasePropList(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No;
|
value = (WMGetButtonSelected(panel->appChk[0])!=0) ? Yes : No;
|
||||||
@@ -725,19 +721,19 @@ saveSettings(WMButton *button, InspectorPanel *panel)
|
|||||||
different |= insertAttribute(dict, appDic, ACollapseAppIcons, value,
|
different |= insertAttribute(dict, appDic, ACollapseAppIcons, value,
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
PLRemoveDictionaryEntry(dict, key);
|
WMRemoveFromPLDictionary(dict, key);
|
||||||
if (different) {
|
if (different) {
|
||||||
PLInsertDictionaryEntry(dict, key, appDic);
|
WMPutInPLDictionary(dict, key, appDic);
|
||||||
}
|
}
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
PLRelease(appDic);
|
WMReleasePropList(appDic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PLSave(dict, YES);
|
WMWritePropListToFile(dict, db->path, True);
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+31
-34
@@ -50,15 +50,15 @@
|
|||||||
#include "kwm.h"
|
#include "kwm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
|
|
||||||
extern WPreferences wPreferences;
|
extern WPreferences wPreferences;
|
||||||
extern XContext wWinContext;
|
extern XContext wWinContext;
|
||||||
|
|
||||||
|
|
||||||
static proplist_t dWorkspaces=NULL;
|
static WMPropList *dWorkspaces=NULL;
|
||||||
static proplist_t dClip, dName;
|
static WMPropList *dClip, *dName;
|
||||||
|
|
||||||
#ifdef VIRTUAL_DESKTOP
|
#ifdef VIRTUAL_DESKTOP
|
||||||
static BOOL initVDesk = False;
|
static BOOL initVDesk = False;
|
||||||
@@ -70,9 +70,9 @@ make_keys()
|
|||||||
if (dWorkspaces!=NULL)
|
if (dWorkspaces!=NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dWorkspaces = PLMakeString("Workspaces");
|
dWorkspaces = WMCreatePLString("Workspaces");
|
||||||
dName = PLMakeString("Name");
|
dName = WMCreatePLString("Name");
|
||||||
dClip = PLMakeString("Clip");
|
dClip = WMCreatePLString("Clip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -996,72 +996,69 @@ wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceSaveState(WScreen *scr, proplist_t old_state)
|
wWorkspaceSaveState(WScreen *scr, WMPropList *old_state)
|
||||||
{
|
{
|
||||||
proplist_t parr, pstr;
|
WMPropList *parr, *pstr, *wks_state, *old_wks_state, *foo, *bar;
|
||||||
proplist_t wks_state, old_wks_state;
|
|
||||||
proplist_t foo, bar;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
make_keys();
|
make_keys();
|
||||||
|
|
||||||
old_wks_state = PLGetDictionaryEntry(old_state, dWorkspaces);
|
old_wks_state = WMGetFromPLDictionary(old_state, dWorkspaces);
|
||||||
parr = PLMakeArrayFromElements(NULL);
|
parr = WMCreatePLArray(NULL);
|
||||||
for (i=0; i < scr->workspace_count; i++) {
|
for (i=0; i < scr->workspace_count; i++) {
|
||||||
pstr = PLMakeString(scr->workspaces[i]->name);
|
pstr = WMCreatePLString(scr->workspaces[i]->name);
|
||||||
wks_state = PLMakeDictionaryFromEntries(dName, pstr, NULL);
|
wks_state = WMCreatePLDictionary(dName, pstr, NULL);
|
||||||
PLRelease(pstr);
|
WMReleasePropList(pstr);
|
||||||
if (!wPreferences.flags.noclip) {
|
if (!wPreferences.flags.noclip) {
|
||||||
pstr = wClipSaveWorkspaceState(scr, i);
|
pstr = wClipSaveWorkspaceState(scr, i);
|
||||||
PLInsertDictionaryEntry(wks_state, dClip, pstr);
|
WMPutInPLDictionary(wks_state, dClip, pstr);
|
||||||
PLRelease(pstr);
|
WMReleasePropList(pstr);
|
||||||
} else if (old_wks_state!=NULL) {
|
} else if (old_wks_state!=NULL) {
|
||||||
if ((foo = PLGetArrayElement(old_wks_state, i))!=NULL) {
|
if ((foo = WMGetFromPLArray(old_wks_state, i))!=NULL) {
|
||||||
if ((bar = PLGetDictionaryEntry(foo, dClip))!=NULL) {
|
if ((bar = WMGetFromPLDictionary(foo, dClip))!=NULL) {
|
||||||
PLInsertDictionaryEntry(wks_state, dClip, bar);
|
WMPutInPLDictionary(wks_state, dClip, bar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PLAppendArrayElement(parr, wks_state);
|
WMAddToPLArray(parr, wks_state);
|
||||||
PLRelease(wks_state);
|
WMReleasePropList(wks_state);
|
||||||
}
|
}
|
||||||
PLInsertDictionaryEntry(scr->session_state, dWorkspaces, parr);
|
WMPutInPLDictionary(scr->session_state, dWorkspaces, parr);
|
||||||
PLRelease(parr);
|
WMReleasePropList(parr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
wWorkspaceRestoreState(WScreen *scr)
|
wWorkspaceRestoreState(WScreen *scr)
|
||||||
{
|
{
|
||||||
proplist_t parr, pstr, wks_state;
|
WMPropList *parr, *pstr, *wks_state, *clip_state;
|
||||||
proplist_t clip_state;
|
|
||||||
int i, j, wscount;
|
int i, j, wscount;
|
||||||
|
|
||||||
make_keys();
|
make_keys();
|
||||||
|
|
||||||
parr = PLGetDictionaryEntry(scr->session_state, dWorkspaces);
|
parr = WMGetFromPLDictionary(scr->session_state, dWorkspaces);
|
||||||
|
|
||||||
if (!parr)
|
if (!parr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wscount = scr->workspace_count;
|
wscount = scr->workspace_count;
|
||||||
for (i=0; i < WMIN(PLGetNumberOfElements(parr), MAX_WORKSPACES); i++) {
|
for (i=0; i < WMIN(WMGetPropListItemCount(parr), MAX_WORKSPACES); i++) {
|
||||||
wks_state = PLGetArrayElement(parr, i);
|
wks_state = WMGetFromPLArray(parr, i);
|
||||||
if (PLIsDictionary(wks_state))
|
if (WMIsPLDictionary(wks_state))
|
||||||
pstr = PLGetDictionaryEntry(wks_state, dName);
|
pstr = WMGetFromPLDictionary(wks_state, dName);
|
||||||
else
|
else
|
||||||
pstr = wks_state;
|
pstr = wks_state;
|
||||||
if (i >= scr->workspace_count)
|
if (i >= scr->workspace_count)
|
||||||
wWorkspaceNew(scr);
|
wWorkspaceNew(scr);
|
||||||
if (scr->workspace_menu) {
|
if (scr->workspace_menu) {
|
||||||
wfree(scr->workspace_menu->entries[i+2]->text);
|
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;
|
scr->workspace_menu->flags.realized = 0;
|
||||||
}
|
}
|
||||||
wfree(scr->workspaces[i]->name);
|
wfree(scr->workspaces[i]->name);
|
||||||
scr->workspaces[i]->name = wstrdup(PLGetString(pstr));
|
scr->workspaces[i]->name = wstrdup(WMGetFromPLString(pstr));
|
||||||
if (!wPreferences.flags.noclip) {
|
if (!wPreferences.flags.noclip) {
|
||||||
clip_state = PLGetDictionaryEntry(wks_state, dClip);
|
clip_state = WMGetFromPLDictionary(wks_state, dClip);
|
||||||
if (scr->workspaces[i]->clip)
|
if (scr->workspaces[i]->clip)
|
||||||
wDockDestroy(scr->workspaces[i]->clip);
|
wDockDestroy(scr->workspaces[i]->clip);
|
||||||
scr->workspaces[i]->clip = wDockRestoreState(scr, clip_state,
|
scr->workspaces[i]->clip = wDockRestoreState(scr, clip_state,
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ void wWorkspaceMenuUpdate(WScreen *scr, WMenu *menu);
|
|||||||
|
|
||||||
void wWorkspaceMenuEdit(WScreen *scr);
|
void wWorkspaceMenuEdit(WScreen *scr);
|
||||||
|
|
||||||
void wWorkspaceSaveState(WScreen *scr, proplist_t old_state);
|
void wWorkspaceSaveState(WScreen *scr, WMPropList *old_state);
|
||||||
void wWorkspaceRestoreState(WScreen *scr);
|
void wWorkspaceRestoreState(WScreen *scr);
|
||||||
|
|
||||||
void wWorkspaceRename(WScreen *scr, int workspace, char *name);
|
void wWorkspaceRename(WScreen *scr, int workspace, char *name);
|
||||||
|
|||||||
+6
-6
@@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
|
|
||||||
#include "stdlib.h"
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
@@ -92,8 +93,7 @@ void wXDNDClearAwareness(Window window) {
|
|||||||
Bool
|
Bool
|
||||||
wXDNDProcessSelection(XEvent *event)
|
wXDNDProcessSelection(XEvent *event)
|
||||||
{
|
{
|
||||||
WScreen *scr = wScreenForWindow(event->xselection.requestor);
|
WScreen *scr = wScreenForWindow(event->xselection.requestor);
|
||||||
char *dropdata;
|
|
||||||
char *retain;
|
char *retain;
|
||||||
Atom ret_type;
|
Atom ret_type;
|
||||||
int ret_format;
|
int ret_format;
|
||||||
@@ -180,6 +180,8 @@ wXDNDProcessSelection(XEvent *event)
|
|||||||
*/
|
*/
|
||||||
wfree(scr->xdestring); /* this xdestring is not from Xlib (no XFree) */
|
wfree(scr->xdestring); /* this xdestring is not from Xlib (no XFree) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* why doesn't this function return anything ? -Dan */
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
@@ -189,7 +191,6 @@ isAwareXDND(Window window)
|
|||||||
int format;
|
int format;
|
||||||
unsigned long count, remaining;
|
unsigned long count, remaining;
|
||||||
unsigned char *data=0;
|
unsigned char *data=0;
|
||||||
Atom *types, *t;
|
|
||||||
|
|
||||||
if (!window) return False;
|
if (!window) return False;
|
||||||
XGetWindowProperty (dpy, window, _XA_XdndAware,
|
XGetWindowProperty (dpy, window, _XA_XdndAware,
|
||||||
@@ -209,8 +210,7 @@ isAwareXDND(Window window)
|
|||||||
Bool
|
Bool
|
||||||
acceptXDND(Window window)
|
acceptXDND(Window window)
|
||||||
{
|
{
|
||||||
WScreen *scr = wScreenForWindow(window);
|
WScreen *scr = wScreenForWindow(window);
|
||||||
WWindow *wwin = wWindowFor(window);
|
|
||||||
WDock *dock;
|
WDock *dock;
|
||||||
int icon_pos,i;
|
int icon_pos,i;
|
||||||
|
|
||||||
|
|||||||
+9
-10
@@ -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
|
# X_EXTRA_LIBS is for libproplist in systems that need -lsocket
|
||||||
# remove after we require lPL 0.10.2 which automatically resolves its
|
# remove after we require lPL 0.10.2 which automatically resolves its
|
||||||
# library dependancies using the libPropList.la file
|
# 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@
|
wxcopy_LDADD = @XLFLAGS@ @XLIBS@
|
||||||
|
|
||||||
wxpaste_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 = \
|
wmagnify_LDADD = \
|
||||||
$(top_builddir)/WINGs/libWINGs.a \
|
$(top_builddir)/WINGs/libWINGs.a \
|
||||||
$(top_builddir)/wrlib/libwraster.la \
|
$(top_builddir)/wrlib/libwraster.la \
|
||||||
@LIBPL@ \
|
|
||||||
@DLLIBS@
|
@DLLIBS@
|
||||||
|
|
||||||
wmsetup_LDADD = \
|
wmsetup_LDADD = \
|
||||||
$(top_builddir)/WINGs/libWINGs.a \
|
$(top_builddir)/WINGs/libWINGs.a \
|
||||||
$(top_builddir)/wrlib/libwraster.la \
|
$(top_builddir)/wrlib/libwraster.la \
|
||||||
@LIBPL@ \
|
|
||||||
@DLLIBS@
|
@DLLIBS@
|
||||||
|
|
||||||
wmsetbg_LDADD = \
|
wmsetbg_LDADD = \
|
||||||
$(top_builddir)/WINGs/libWINGs.a \
|
$(top_builddir)/WINGs/libWINGs.a \
|
||||||
$(top_builddir)/wrlib/libwraster.la \
|
$(top_builddir)/wrlib/libwraster.la \
|
||||||
@LIBPL@ \
|
|
||||||
@DLLIBS@
|
@DLLIBS@
|
||||||
|
|
||||||
CLEANFILES = wmaker.inst wmchlocale
|
CLEANFILES = wmaker.inst wmchlocale
|
||||||
|
|||||||
+19
-22
@@ -25,9 +25,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <proplist.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
#include "../src/wconfig.h"
|
#include "../src/wconfig.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -77,9 +78,8 @@ print_help()
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
proplist_t window_name, icon_key, window_attrs, icon_value;
|
WMPropList *window_name, *icon_key, *window_attrs, *icon_value;
|
||||||
proplist_t all_windows, iconset;
|
WMPropList *all_windows, *iconset, *keylist;
|
||||||
proplist_t keylist;
|
|
||||||
char *path;
|
char *path;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -99,46 +99,43 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
path = defaultsPathForDomain("WMWindowAttributes");
|
path = defaultsPathForDomain("WMWindowAttributes");
|
||||||
|
|
||||||
all_windows = PLGetProplistWithPath(path);
|
all_windows = WMReadPropListFromFile(path);
|
||||||
if (!all_windows) {
|
if (!all_windows) {
|
||||||
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
|
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
|
||||||
ProgName, path);
|
ProgName, path);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
iconset = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
iconset = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
|
|
||||||
keylist = PLGetAllDictionaryKeys(all_windows);
|
keylist = WMGetPLDictionaryKeys(all_windows);
|
||||||
icon_key = PLMakeString("Icon");
|
icon_key = WMCreatePLString("Icon");
|
||||||
|
|
||||||
for (i=0; i<PLGetNumberOfElements(keylist); i++) {
|
for (i=0; i<WMGetPropListItemCount(keylist); i++) {
|
||||||
proplist_t icondic;
|
WMPropList *icondic;
|
||||||
|
|
||||||
window_name = PLGetArrayElement(keylist, i);
|
window_name = WMGetFromPLArray(keylist, i);
|
||||||
if (!PLIsString(window_name))
|
if (!WMIsPLString(window_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
window_attrs = PLGetDictionaryEntry(all_windows, window_name);
|
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
|
||||||
if (window_attrs && PLIsDictionary(window_attrs)) {
|
if (window_attrs && WMIsPLDictionary(window_attrs)) {
|
||||||
icon_value = PLGetDictionaryEntry(window_attrs, icon_key);
|
icon_value = WMGetFromPLDictionary(window_attrs, icon_key);
|
||||||
if (icon_value) {
|
if (icon_value) {
|
||||||
|
|
||||||
icondic = PLMakeDictionaryFromEntries(icon_key, icon_value,
|
icondic = WMCreatePLDictionary(icon_key, icon_value,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
PLInsertDictionaryEntry(iconset, window_name, icondic);
|
WMPutInPLDictionary(iconset, window_name, icondic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (argc==2) {
|
if (argc==2) {
|
||||||
proplist_t val;
|
WMWritePropListToFile(iconset, argv[1], False);
|
||||||
val = PLMakeString(argv[1]);
|
|
||||||
PLSetFilename(iconset, val);
|
|
||||||
PLSave(iconset, NO);
|
|
||||||
} else {
|
} else {
|
||||||
puts(PLGetDescriptionIndent(iconset, 0));
|
puts(WMGetPropListDescription(iconset, True));
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
+71
-88
@@ -27,13 +27,13 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <proplist.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX 1024
|
#define PATH_MAX 1024
|
||||||
@@ -106,7 +106,7 @@ static char *theme_options[] = {
|
|||||||
|
|
||||||
char *ProgName;
|
char *ProgName;
|
||||||
|
|
||||||
proplist_t PixmapPath = NULL;
|
WMPropList *PixmapPath = NULL;
|
||||||
|
|
||||||
char *ThemePath = 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
|
void
|
||||||
abortar(char *reason)
|
abortar(char *reason)
|
||||||
{
|
{
|
||||||
@@ -226,7 +211,7 @@ wgethomedir()
|
|||||||
|
|
||||||
|
|
||||||
void*
|
void*
|
||||||
wmalloc(int size)
|
mymalloc(int size)
|
||||||
{
|
{
|
||||||
void *tmp;
|
void *tmp;
|
||||||
|
|
||||||
@@ -240,11 +225,11 @@ wmalloc(int size)
|
|||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
wstrdup(char *str)
|
mystrdup(char *str)
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
tmp = wmalloc(strlen(str)+1);
|
tmp = mymalloc(strlen(str)+1);
|
||||||
|
|
||||||
strcpy(tmp, str);
|
strcpy(tmp, str);
|
||||||
|
|
||||||
@@ -355,13 +340,13 @@ wexpandpath(char *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return wstrdup(buffer);
|
return mystrdup(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
wfindfileinarray(proplist_t paths, char *file)
|
wfindfileinarray(WMPropList *paths, char *file)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *path;
|
char *path;
|
||||||
@@ -371,8 +356,8 @@ wfindfileinarray(proplist_t paths, char *file)
|
|||||||
if (!file)
|
if (!file)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (*file=='/' || *file=='~' || !paths || !PLIsArray(paths)
|
if (*file=='/' || *file=='~' || !paths || !WMIsPLArray(paths)
|
||||||
|| PLGetNumberOfElements(paths)==0) {
|
|| WMGetPropListItemCount(paths)==0) {
|
||||||
if (access(file, R_OK)<0) {
|
if (access(file, R_OK)<0) {
|
||||||
fullpath = wexpandpath(file);
|
fullpath = wexpandpath(file);
|
||||||
if (!fullpath)
|
if (!fullpath)
|
||||||
@@ -385,21 +370,21 @@ wfindfileinarray(proplist_t paths, char *file)
|
|||||||
return fullpath;
|
return fullpath;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return wstrdup(file);
|
return mystrdup(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flen = strlen(file);
|
flen = strlen(file);
|
||||||
for (i=0; i < PLGetNumberOfElements(paths); i++) {
|
for (i=0; i < WMGetPropListItemCount(paths); i++) {
|
||||||
proplist_t tmp;
|
WMPropList *tmp;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
tmp = PLGetArrayElement(paths, i);
|
tmp = WMGetFromPLArray(paths, i);
|
||||||
if (!PLIsString(tmp) || !(dir = PLGetString(tmp)))
|
if (!WMIsPLString(tmp) || !(dir = WMGetFromPLString(tmp)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
len = strlen(dir);
|
len = strlen(dir);
|
||||||
path = wmalloc(len+flen+2);
|
path = mymalloc(len+flen+2);
|
||||||
path = memcpy(path, dir, len);
|
path = memcpy(path, dir, len);
|
||||||
path[len]=0;
|
path[len]=0;
|
||||||
strcat(path, "/");
|
strcat(path, "/");
|
||||||
@@ -451,21 +436,21 @@ findCopyFile(char *dir, char *file)
|
|||||||
|
|
||||||
|
|
||||||
char*
|
char*
|
||||||
makeThemePack(proplist_t style, char *themeName)
|
makeThemePack(WMPropList *style, char *themeName)
|
||||||
{
|
{
|
||||||
proplist_t keys;
|
WMPropList *keys;
|
||||||
proplist_t key;
|
WMPropList *key;
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
int i;
|
int i;
|
||||||
char *themeDir;
|
char *themeDir;
|
||||||
|
|
||||||
themeDir = wmalloc(strlen(themeName)+50);
|
themeDir = mymalloc(strlen(themeName)+50);
|
||||||
sprintf(themeDir, "%s.themed", themeName);
|
sprintf(themeDir, "%s.themed", themeName);
|
||||||
ThemePath = themeDir;
|
ThemePath = themeDir;
|
||||||
{
|
{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
tmp = wmalloc(strlen(themeDir)+20);
|
tmp = mymalloc(strlen(themeDir)+20);
|
||||||
sprintf(tmp, "/bin/mkdir \"%s\"", themeDir);
|
sprintf(tmp, "/bin/mkdir \"%s\"", themeDir);
|
||||||
if (system(tmp)!=0) {
|
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);
|
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);
|
free(tmp);
|
||||||
}
|
}
|
||||||
keys = PLGetAllDictionaryKeys(style);
|
keys = WMGetPLDictionaryKeys(style);
|
||||||
|
|
||||||
for (i = 0; i < PLGetNumberOfElements(keys); i++) {
|
for (i = 0; i < WMGetPropListItemCount(keys); i++) {
|
||||||
key = PLGetArrayElement(keys, i);
|
key = WMGetFromPLArray(keys, i);
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(style, key);
|
value = WMGetFromPLDictionary(style, key);
|
||||||
if (value && PLIsArray(value) && PLGetNumberOfElements(value) > 2) {
|
if (value && WMIsPLArray(value) && WMGetPropListItemCount(value) > 2) {
|
||||||
proplist_t type;
|
WMPropList *type;
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
type = PLGetArrayElement(value, 0);
|
type = WMGetFromPLArray(value, 0);
|
||||||
t = PLGetString(type);
|
t = WMGetFromPLString(type);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -495,55 +480,55 @@ makeThemePack(proplist_t style, char *themeName)
|
|||||||
|| strcasecmp(t, "tdgradient")==0
|
|| strcasecmp(t, "tdgradient")==0
|
||||||
|| strcasecmp(t, "tvgradient")==0
|
|| strcasecmp(t, "tvgradient")==0
|
||||||
|| strcasecmp(t, "thgradient")==0) {
|
|| strcasecmp(t, "thgradient")==0) {
|
||||||
proplist_t file;
|
WMPropList *file;
|
||||||
char *p;
|
char *p;
|
||||||
char *newPath;
|
char *newPath;
|
||||||
|
|
||||||
file = PLGetArrayElement(value, 1);
|
file = WMGetFromPLArray(value, 1);
|
||||||
|
|
||||||
p = strrchr(PLGetString(file), '/');
|
p = strrchr(WMGetFromPLString(file), '/');
|
||||||
if (p) {
|
if (p) {
|
||||||
copyFile(themeDir, PLGetString(file));
|
copyFile(themeDir, WMGetFromPLString(file));
|
||||||
|
|
||||||
newPath = wstrdup(p+1);
|
newPath = mystrdup(p+1);
|
||||||
PLRemoveArrayElement(value, 1);
|
WMDeleteFromPLArray(value, 1);
|
||||||
PLInsertArrayElement(value, PLMakeString(newPath), 1);
|
WMInsertInPLArray(value, 1, WMCreatePLString(newPath));
|
||||||
free(newPath);
|
free(newPath);
|
||||||
} else {
|
} else {
|
||||||
findCopyFile(themeDir, PLGetString(file));
|
findCopyFile(themeDir, WMGetFromPLString(file));
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(t, "bitmap")==0) {
|
} else if (strcasecmp(t, "bitmap")==0) {
|
||||||
proplist_t file;
|
WMPropList *file;
|
||||||
char *p;
|
char *p;
|
||||||
char *newPath;
|
char *newPath;
|
||||||
|
|
||||||
file = PLGetArrayElement(value, 1);
|
file = WMGetFromPLArray(value, 1);
|
||||||
|
|
||||||
p = strrchr(PLGetString(file), '/');
|
p = strrchr(WMGetFromPLString(file), '/');
|
||||||
if (p) {
|
if (p) {
|
||||||
copyFile(themeDir, PLGetString(file));
|
copyFile(themeDir, WMGetFromPLString(file));
|
||||||
|
|
||||||
newPath = wstrdup(p+1);
|
newPath = mystrdup(p+1);
|
||||||
PLRemoveArrayElement(value, 1);
|
WMDeleteFromPLArray(value, 1);
|
||||||
PLInsertArrayElement(value, PLMakeString(newPath), 1);
|
WMInsertInPLArray(value, 1, WMCreatePLString(newPath));
|
||||||
free(newPath);
|
free(newPath);
|
||||||
} else {
|
} 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) {
|
if (p) {
|
||||||
copyFile(themeDir, PLGetString(file));
|
copyFile(themeDir, WMGetFromPLString(file));
|
||||||
|
|
||||||
newPath = wstrdup(p+1);
|
newPath = mystrdup(p+1);
|
||||||
PLRemoveArrayElement(value, 2);
|
WMDeleteFromPLArray(value, 2);
|
||||||
PLInsertArrayElement(value, PLMakeString(newPath), 2);
|
WMInsertInPLArray(value, 2, WMCreatePLString(newPath));
|
||||||
free(newPath);
|
free(newPath);
|
||||||
} else {
|
} else {
|
||||||
findCopyFile(themeDir, PLGetString(file));
|
findCopyFile(themeDir, WMGetFromPLString(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -556,7 +541,7 @@ makeThemePack(proplist_t style, char *themeName)
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
proplist_t prop, style, key, val;
|
WMPropList *prop, *style, *key, *val;
|
||||||
char *path;
|
char *path;
|
||||||
int i, theme_too=0;
|
int i, theme_too=0;
|
||||||
int make_pack = 0;
|
int make_pack = 0;
|
||||||
@@ -597,11 +582,11 @@ main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
path = defaultsPathForDomain("WindowMaker");
|
path = defaultsPathForDomain("WindowMaker");
|
||||||
|
|
||||||
prop = PLGetProplistWithPath(path);
|
prop = WMReadPropListFromFile(path);
|
||||||
if (!prop) {
|
if (!prop) {
|
||||||
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
|
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
|
||||||
ProgName, path);
|
ProgName, path);
|
||||||
@@ -610,35 +595,35 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* get global value */
|
/* get global value */
|
||||||
path = globalDefaultsPathForDomain("WindowMaker");
|
path = globalDefaultsPathForDomain("WindowMaker");
|
||||||
val = PLGetProplistWithPath(path);
|
val = WMReadPropListFromFile(path);
|
||||||
if (val) {
|
if (val) {
|
||||||
PLMergeDictionaries(val, prop);
|
WMMergePLDictionaries(val, prop);
|
||||||
PLRelease(prop);
|
WMReleasePropList(prop);
|
||||||
prop = val;
|
prop = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
style = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
style = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
for (i=0; options[i]!=NULL; i++) {
|
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)
|
if (val)
|
||||||
PLInsertDictionaryEntry(style, key, val);
|
WMPutInPLDictionary(style, key, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
val = PLGetDictionaryEntry(prop, PLMakeString("PixmapPath"));
|
val = WMGetFromPLDictionary(prop, WMCreatePLString("PixmapPath"));
|
||||||
if (val)
|
if (val)
|
||||||
PixmapPath = val;
|
PixmapPath = val;
|
||||||
|
|
||||||
if (theme_too) {
|
if (theme_too) {
|
||||||
for (i=0; theme_options[i]!=NULL; i++) {
|
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)
|
if (val)
|
||||||
PLInsertDictionaryEntry(style, key, val);
|
WMPutInPLDictionary(style, key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,18 +632,16 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
makeThemePack(style, style_file);
|
makeThemePack(style, style_file);
|
||||||
|
|
||||||
path = wmalloc(strlen(ThemePath)+32);
|
path = mymalloc(strlen(ThemePath)+32);
|
||||||
strcpy(path, ThemePath);
|
strcpy(path, ThemePath);
|
||||||
strcat(path, "/style");
|
strcat(path, "/style");
|
||||||
PLSetFilename(style, PLMakeString(path));
|
WMWritePropListToFile(style, path, False);
|
||||||
PLSave(style, NO);
|
wfree(path);
|
||||||
} else {
|
} else {
|
||||||
if (style_file) {
|
if (style_file) {
|
||||||
val = PLMakeString(style_file);
|
WMWritePropListToFile(style, style_file, False);
|
||||||
PLSetFilename(style, val);
|
|
||||||
PLSave(style, NO);
|
|
||||||
} else {
|
} else {
|
||||||
puts(PLGetDescriptionIndent(style, 0));
|
puts(WMGetPropListDescription(style, True));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
+17
-19
@@ -25,9 +25,8 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <proplist.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
#include "../src/wconfig.h"
|
#include "../src/wconfig.h"
|
||||||
|
|
||||||
@@ -77,9 +76,8 @@ print_help()
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
proplist_t window_name, icon_key, window_attrs, icon_value;
|
WMPropList *window_name, *icon_key, *window_attrs, *icon_value;
|
||||||
proplist_t all_windows, iconset;
|
WMPropList *all_windows, *iconset, *keylist;
|
||||||
proplist_t keylist;
|
|
||||||
int i;
|
int i;
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
|
|
||||||
@@ -111,43 +109,43 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
path = defaultsPathForDomain("WMWindowAttributes");
|
path = defaultsPathForDomain("WMWindowAttributes");
|
||||||
|
|
||||||
all_windows = PLGetProplistWithPath(path);
|
all_windows = WMReadPropListFromFile(path);
|
||||||
if (!all_windows) {
|
if (!all_windows) {
|
||||||
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
|
printf("%s:could not load WindowMaker configuration file \"%s\".\n",
|
||||||
ProgName, path);
|
ProgName, path);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
iconset = PLGetProplistWithPath(argv[1]);
|
iconset = WMReadPropListFromFile(argv[1]);
|
||||||
if (!iconset) {
|
if (!iconset) {
|
||||||
printf("%s:could not load icon set file \"%s\".\n", ProgName, argv[1]);
|
printf("%s:could not load icon set file \"%s\".\n", ProgName, argv[1]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
keylist = PLGetAllDictionaryKeys(iconset);
|
keylist = WMGetPLDictionaryKeys(iconset);
|
||||||
icon_key = PLMakeString("Icon");
|
icon_key = WMCreatePLString("Icon");
|
||||||
|
|
||||||
for (i=0; i<PLGetNumberOfElements(keylist); i++) {
|
for (i=0; i<WMGetPropListItemCount(keylist); i++) {
|
||||||
window_name = PLGetArrayElement(keylist, i);
|
window_name = WMGetFromPLArray(keylist, i);
|
||||||
if (!PLIsString(window_name))
|
if (!WMIsPLString(window_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
icon_value = PLGetDictionaryEntry(iconset, window_name);
|
icon_value = WMGetFromPLDictionary(iconset, window_name);
|
||||||
if (!icon_value || !PLIsDictionary(icon_value))
|
if (!icon_value || !WMIsPLDictionary(icon_value))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
window_attrs = PLGetDictionaryEntry(all_windows, window_name);
|
window_attrs = WMGetFromPLDictionary(all_windows, window_name);
|
||||||
if (window_attrs) {
|
if (window_attrs) {
|
||||||
if (PLIsDictionary(window_attrs)) {
|
if (WMIsPLDictionary(window_attrs)) {
|
||||||
PLMergeDictionaries(window_attrs, icon_value);
|
WMMergePLDictionaries(window_attrs, icon_value);
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|||||||
+89
-107
@@ -25,13 +25,13 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <proplist.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "../src/wconfig.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
|
void
|
||||||
hackPathInTexture(proplist_t texture, char *prefix)
|
hackPathInTexture(WMPropList *texture, char *prefix)
|
||||||
{
|
{
|
||||||
proplist_t type;
|
WMPropList *type;
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
/* get texture type */
|
/* get texture type */
|
||||||
type = PLGetArrayElement(texture, 0);
|
type = WMGetFromPLArray(texture, 0);
|
||||||
t = PLGetString(type);
|
t = WMGetFromPLString(type);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
return;
|
return;
|
||||||
if (strcasecmp(t, "tpixmap")==0
|
if (strcasecmp(t, "tpixmap")==0
|
||||||
@@ -129,64 +129,64 @@ hackPathInTexture(proplist_t texture, char *prefix)
|
|||||||
|| strcasecmp(t, "tvgradient")==0
|
|| strcasecmp(t, "tvgradient")==0
|
||||||
|| strcasecmp(t, "thgradient")==0
|
|| strcasecmp(t, "thgradient")==0
|
||||||
|| strcasecmp(t, "tdgradient")==0) {
|
|| strcasecmp(t, "tdgradient")==0) {
|
||||||
proplist_t file;
|
WMPropList *file;
|
||||||
char buffer[4018];
|
char buffer[4018];
|
||||||
|
|
||||||
/* get pixmap file path */
|
/* get pixmap file path */
|
||||||
file = PLGetArrayElement(texture, 1);
|
file = WMGetFromPLArray(texture, 1);
|
||||||
sprintf(buffer, "%s/%s", prefix, PLGetString(file));
|
sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
|
||||||
/* replace path with full path */
|
/* replace path with full path */
|
||||||
PLRemoveArrayElement(texture, 1);
|
WMDeleteFromPLArray(texture, 1);
|
||||||
PLInsertArrayElement(texture, PLMakeString(buffer), 1);
|
WMInsertInPLArray(texture, 1, WMCreatePLString(buffer));
|
||||||
} else if (strcasecmp(t, "bitmap") == 0) {
|
} else if (strcasecmp(t, "bitmap") == 0) {
|
||||||
proplist_t file;
|
WMPropList *file;
|
||||||
char buffer[4018];
|
char buffer[4018];
|
||||||
|
|
||||||
/* get bitmap file path */
|
/* get bitmap file path */
|
||||||
file = PLGetArrayElement(texture, 1);
|
file = WMGetFromPLArray(texture, 1);
|
||||||
sprintf(buffer, "%s/%s", prefix, PLGetString(file));
|
sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
|
||||||
/* replace path with full path */
|
/* replace path with full path */
|
||||||
PLRemoveArrayElement(texture, 1);
|
WMDeleteFromPLArray(texture, 1);
|
||||||
PLInsertArrayElement(texture, PLMakeString(buffer), 1);
|
WMInsertInPLArray(texture, 1, WMCreatePLString(buffer));
|
||||||
|
|
||||||
/* get mask file path */
|
/* get mask file path */
|
||||||
file = PLGetArrayElement(texture, 2);
|
file = WMGetFromPLArray(texture, 2);
|
||||||
sprintf(buffer, "%s/%s", prefix, PLGetString(file));
|
sprintf(buffer, "%s/%s", prefix, WMGetFromPLString(file));
|
||||||
/* replace path with full path */
|
/* replace path with full path */
|
||||||
PLRemoveArrayElement(texture, 2);
|
WMDeleteFromPLArray(texture, 2);
|
||||||
PLInsertArrayElement(texture, PLMakeString(buffer), 2);
|
WMInsertInPLArray(texture, 2, WMCreatePLString(buffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
hackPaths(proplist_t style, char *prefix)
|
hackPaths(WMPropList *style, char *prefix)
|
||||||
{
|
{
|
||||||
proplist_t keys;
|
WMPropList *keys;
|
||||||
proplist_t key;
|
WMPropList *key;
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
keys = PLGetAllDictionaryKeys(style);
|
keys = WMGetPLDictionaryKeys(style);
|
||||||
|
|
||||||
for (i = 0; i < PLGetNumberOfElements(keys); i++) {
|
for (i = 0; i < WMGetPropListItemCount(keys); i++) {
|
||||||
key = PLGetArrayElement(keys, i);
|
key = WMGetFromPLArray(keys, i);
|
||||||
|
|
||||||
value = PLGetDictionaryEntry(style, key);
|
value = WMGetFromPLDictionary(style, key);
|
||||||
if (!value)
|
if (!value)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcasecmp(PLGetString(key), "WorkspaceSpecificBack")==0) {
|
if (strcasecmp(WMGetFromPLString(key), "WorkspaceSpecificBack")==0) {
|
||||||
if (PLIsArray(value)) {
|
if (WMIsPLArray(value)) {
|
||||||
int j;
|
int j;
|
||||||
proplist_t texture;
|
WMPropList *texture;
|
||||||
|
|
||||||
for (j = 0; j < PLGetNumberOfElements(value); j++) {
|
for (j = 0; j < WMGetPropListItemCount(value); j++) {
|
||||||
texture = PLGetArrayElement(value, j);
|
texture = WMGetFromPLArray(value, j);
|
||||||
|
|
||||||
if (texture && PLIsArray(texture)
|
if (texture && WMIsPLArray(texture)
|
||||||
&& PLGetNumberOfElements(texture) > 2) {
|
&& WMGetPropListItemCount(texture) > 2) {
|
||||||
|
|
||||||
hackPathInTexture(texture, prefix);
|
hackPathInTexture(texture, prefix);
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ hackPaths(proplist_t style, char *prefix)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (PLIsArray(value) && PLGetNumberOfElements(value) > 2) {
|
if (WMIsPLArray(value) && WMGetPropListItemCount(value) > 2) {
|
||||||
|
|
||||||
hackPathInTexture(value, prefix);
|
hackPathInTexture(value, prefix);
|
||||||
}
|
}
|
||||||
@@ -204,36 +204,36 @@ hackPaths(proplist_t style, char *prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static proplist_t
|
static WMPropList*
|
||||||
getColor(proplist_t texture)
|
getColor(WMPropList *texture)
|
||||||
{
|
{
|
||||||
proplist_t value, type;
|
WMPropList *value, *type;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
type = PLGetArrayElement(texture, 0);
|
type = WMGetFromPLArray(texture, 0);
|
||||||
if (!type)
|
if (!type)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
value = NULL;
|
value = NULL;
|
||||||
|
|
||||||
str = PLGetString(type);
|
str = WMGetFromPLString(type);
|
||||||
if (strcasecmp(str, "solid")==0) {
|
if (strcasecmp(str, "solid")==0) {
|
||||||
value = PLGetArrayElement(texture, 1);
|
value = WMGetFromPLArray(texture, 1);
|
||||||
} else if (strcasecmp(str, "dgradient")==0
|
} else if (strcasecmp(str, "dgradient")==0
|
||||||
|| strcasecmp(str, "hgradient")==0
|
|| strcasecmp(str, "hgradient")==0
|
||||||
|| strcasecmp(str, "vgradient")==0) {
|
|| strcasecmp(str, "vgradient")==0) {
|
||||||
proplist_t c1, c2;
|
WMPropList *c1, *c2;
|
||||||
int r1, g1, b1, r2, g2, b2;
|
int r1, g1, b1, r2, g2, b2;
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
|
|
||||||
c1 = PLGetArrayElement(texture, 1);
|
c1 = WMGetFromPLArray(texture, 1);
|
||||||
c2 = PLGetArrayElement(texture, 2);
|
c2 = WMGetFromPLArray(texture, 2);
|
||||||
if (!dpy) {
|
if (!dpy) {
|
||||||
if (sscanf(PLGetString(c1), "#%2x%2x%2x", &r1, &g1, &b1)==3
|
if (sscanf(WMGetFromPLString(c1), "#%2x%2x%2x", &r1, &g1, &b1)==3
|
||||||
&& sscanf(PLGetString(c2), "#%2x%2x%2x", &r2, &g2, &b2)==3) {
|
&& sscanf(WMGetFromPLString(c2), "#%2x%2x%2x", &r2, &g2, &b2)==3) {
|
||||||
sprintf(buffer, "#%02x%02x%02x", (r1+r2)/2, (g1+g2)/2,
|
sprintf(buffer, "#%02x%02x%02x", (r1+r2)/2, (g1+g2)/2,
|
||||||
(b1+b2)/2);
|
(b1+b2)/2);
|
||||||
value = PLMakeString(buffer);
|
value = WMCreatePLString(buffer);
|
||||||
} else {
|
} else {
|
||||||
value = c1;
|
value = c1;
|
||||||
}
|
}
|
||||||
@@ -242,27 +242,27 @@ getColor(proplist_t texture)
|
|||||||
XColor color2;
|
XColor color2;
|
||||||
|
|
||||||
XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
|
XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
|
||||||
PLGetString(c1), &color1);
|
WMGetFromPLString(c1), &color1);
|
||||||
XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
|
XParseColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)),
|
||||||
PLGetString(c2), &color2);
|
WMGetFromPLString(c2), &color2);
|
||||||
|
|
||||||
sprintf(buffer, "#%02x%02x%02x",
|
sprintf(buffer, "#%02x%02x%02x",
|
||||||
(color1.red+color2.red)>>9,
|
(color1.red+color2.red)>>9,
|
||||||
(color1.green+color2.green)>>9,
|
(color1.green+color2.green)>>9,
|
||||||
(color1.blue+color2.blue)>>9);
|
(color1.blue+color2.blue)>>9);
|
||||||
value = PLMakeString(buffer);
|
value = WMCreatePLString(buffer);
|
||||||
}
|
}
|
||||||
} else if (strcasecmp(str, "mdgradient")==0
|
} else if (strcasecmp(str, "mdgradient")==0
|
||||||
|| strcasecmp(str, "mhgradient")==0
|
|| strcasecmp(str, "mhgradient")==0
|
||||||
|| strcasecmp(str, "mvgradient")==0) {
|
|| strcasecmp(str, "mvgradient")==0) {
|
||||||
|
|
||||||
value = PLGetArrayElement(texture, 1);
|
value = WMGetFromPLArray(texture, 1);
|
||||||
|
|
||||||
} else if (strcasecmp(str, "tpixmap")==0
|
} else if (strcasecmp(str, "tpixmap")==0
|
||||||
|| strcasecmp(str, "cpixmap")==0
|
|| strcasecmp(str, "cpixmap")==0
|
||||||
|| strcasecmp(str, "spixmap")==0) {
|
|| strcasecmp(str, "spixmap")==0) {
|
||||||
|
|
||||||
value = PLGetArrayElement(texture, 2);
|
value = WMGetFromPLArray(texture, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
@@ -277,28 +277,26 @@ getColor(proplist_t texture)
|
|||||||
* IconTitleBack
|
* IconTitleBack
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
hackStyle(proplist_t style)
|
hackStyle(WMPropList *style)
|
||||||
{
|
{
|
||||||
proplist_t keys;
|
WMPropList *keys, *tmp;
|
||||||
proplist_t tmp;
|
int foundIconTitle = 0, foundResizebarBack = 0;
|
||||||
int i;
|
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;
|
char *str;
|
||||||
|
|
||||||
tmp = PLGetArrayElement(keys, i);
|
tmp = WMGetFromPLArray(keys, i);
|
||||||
str = PLGetString(tmp);
|
str = WMGetFromPLString(tmp);
|
||||||
if (str) {
|
if (str) {
|
||||||
int j, found;
|
int j, found;
|
||||||
|
|
||||||
if (ignoreFonts) {
|
if (ignoreFonts) {
|
||||||
for (j = 0, found = 0; FontOptions[j]!=NULL; j++) {
|
for (j = 0, found = 0; FontOptions[j]!=NULL; j++) {
|
||||||
if (strcasecmp(str, FontOptions[j])==0) {
|
if (strcasecmp(str, FontOptions[j])==0) {
|
||||||
PLRemoveDictionaryEntry(style, tmp);
|
WMRemoveFromPLDictionary(style, tmp);
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -309,7 +307,7 @@ hackStyle(proplist_t style)
|
|||||||
if (ignoreCursors) {
|
if (ignoreCursors) {
|
||||||
for (j = 0, found = 0; CursorOptions[j] != NULL; j++) {
|
for (j = 0, found = 0; CursorOptions[j] != NULL; j++) {
|
||||||
if (strcasecmp(str, CursorOptions[j]) == 0) {
|
if (strcasecmp(str, CursorOptions[j]) == 0) {
|
||||||
PLRemoveDictionaryEntry(style, tmp);
|
WMRemoveFromPLDictionary(style, tmp);
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -329,20 +327,20 @@ hackStyle(proplist_t style)
|
|||||||
|
|
||||||
if (!foundIconTitle) {
|
if (!foundIconTitle) {
|
||||||
/* set the default values */
|
/* set the default values */
|
||||||
tmp = PLGetDictionaryEntry(style, PLMakeString("FTitleColor"));
|
tmp = WMGetFromPLDictionary(style, WMCreatePLString("FTitleColor"));
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
PLInsertDictionaryEntry(style, PLMakeString("IconTitleColor"),
|
WMPutInPLDictionary(style, WMCreatePLString("IconTitleColor"),
|
||||||
tmp);
|
tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = PLGetDictionaryEntry(style, PLMakeString("FTitleBack"));
|
tmp = WMGetFromPLDictionary(style, WMCreatePLString("FTitleBack"));
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
|
|
||||||
value = getColor(tmp);
|
value = getColor(tmp);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
PLInsertDictionaryEntry(style, PLMakeString("IconTitleBack"),
|
WMPutInPLDictionary(style, WMCreatePLString("IconTitleBack"),
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,46 +348,31 @@ hackStyle(proplist_t style)
|
|||||||
|
|
||||||
if (!foundResizebarBack) {
|
if (!foundResizebarBack) {
|
||||||
/* set the default values */
|
/* set the default values */
|
||||||
tmp = PLGetDictionaryEntry(style, PLMakeString("UTitleBack"));
|
tmp = WMGetFromPLDictionary(style, WMCreatePLString("UTitleBack"));
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
proplist_t value;
|
WMPropList *value;
|
||||||
|
|
||||||
value = getColor(tmp);
|
value = getColor(tmp);
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
proplist_t t;
|
WMPropList *t;
|
||||||
|
|
||||||
t = PLMakeArrayFromElements(PLMakeString("solid"), value,
|
t = WMCreatePLArray(WMCreatePLString("solid"), value,
|
||||||
NULL);
|
NULL);
|
||||||
PLInsertDictionaryEntry(style, PLMakeString("ResizebarBack"),
|
WMPutInPLDictionary(style, WMCreatePLString("ResizebarBack"),
|
||||||
t);
|
t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!PLGetDictionaryEntry(style, PLMakeString("MenuStyle"))) {
|
if (!WMGetFromPLDictionary(style, WMCreatePLString("MenuStyle"))) {
|
||||||
PLInsertDictionaryEntry(style, PLMakeString("MenuStyle"),
|
WMPutInPLDictionary(style, WMCreatePLString("MenuStyle"),
|
||||||
PLMakeString("normal"));
|
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
|
void
|
||||||
print_help()
|
print_help()
|
||||||
{
|
{
|
||||||
@@ -418,7 +401,7 @@ print_help()
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
proplist_t prop, style;
|
WMPropList *prop, *style;
|
||||||
char *path;
|
char *path;
|
||||||
char *file = NULL;
|
char *file = NULL;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
@@ -479,11 +462,11 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PLSetStringCmpHook(StringCompareHook);
|
WMPLSetCaseSensitive(False);
|
||||||
|
|
||||||
path = defaultsPathForDomain("WindowMaker");
|
path = defaultsPathForDomain("WindowMaker");
|
||||||
|
|
||||||
prop = PLGetProplistWithPath(path);
|
prop = WMReadPropListFromFile(path);
|
||||||
if (!prop) {
|
if (!prop) {
|
||||||
perror(path);
|
perror(path);
|
||||||
printf("%s:could not load WindowMaker configuration file.\n",
|
printf("%s:could not load WindowMaker configuration file.\n",
|
||||||
@@ -536,7 +519,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
strcat(buffer, "/style");
|
strcat(buffer, "/style");
|
||||||
|
|
||||||
style = PLGetProplistWithPath(buffer);
|
style = WMReadPropListFromFile(buffer);
|
||||||
if (!style) {
|
if (!style) {
|
||||||
perror(buffer);
|
perror(buffer);
|
||||||
printf("%s:could not load style file.\n", ProgName);
|
printf("%s:could not load style file.\n", ProgName);
|
||||||
@@ -548,7 +531,7 @@ main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
/* normal style file */
|
/* normal style file */
|
||||||
|
|
||||||
style = PLGetProplistWithPath(file);
|
style = WMReadPropListFromFile(file);
|
||||||
if (!style) {
|
if (!style) {
|
||||||
perror(file);
|
perror(file);
|
||||||
printf("%s:could not load style file.\n", ProgName);
|
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);
|
printf("%s: '%s' is not a style file/theme\n", ProgName, file);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -566,13 +549,13 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if (ignoreCount > 0) {
|
if (ignoreCount > 0) {
|
||||||
for (i = 0; i < ignoreCount; i++) {
|
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;
|
XEvent ev;
|
||||||
|
|
||||||
@@ -609,13 +592,12 @@ getToken(char *str, int i, char *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
proplist_t
|
static WMPropList*
|
||||||
readBlackBoxStyle(char *path)
|
readBlackBoxStyle(char *path)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char buffer[128], char token[128];
|
char buffer[128], char token[128];
|
||||||
proplist_t style;
|
WMPropList *style, *p;
|
||||||
proplist_t p;
|
|
||||||
|
|
||||||
f = fopen(path, "r");
|
f = fopen(path, "r");
|
||||||
if (!f) {
|
if (!f) {
|
||||||
|
|||||||
+7
-6
@@ -36,7 +36,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ void help()
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char path[256];
|
char path[256];
|
||||||
proplist_t key, value, dict;
|
WMPropList *key, *value, *dict;
|
||||||
char *gsdir;
|
char *gsdir;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
key = PLMakeString(argv[2]);
|
key = WMCreatePLString(argv[2]);
|
||||||
|
|
||||||
gsdir = getenv("GNUSTEP_USER_ROOT");
|
gsdir = getenv("GNUSTEP_USER_ROOT");
|
||||||
if (gsdir) {
|
if (gsdir) {
|
||||||
@@ -119,12 +120,12 @@ int main(int argc, char **argv)
|
|||||||
strcat(path, "/");
|
strcat(path, "/");
|
||||||
strcat(path, argv[1]);
|
strcat(path, argv[1]);
|
||||||
|
|
||||||
if ((dict = PLGetProplistWithPath(path)) == NULL)
|
if ((dict = WMReadPropListFromFile(path)) == NULL)
|
||||||
return 1; /* bad domain */
|
return 1; /* bad domain */
|
||||||
if ((value = PLGetDictionaryEntry(dict, key)) == NULL)
|
if ((value = WMGetFromPLDictionary(dict, key)) == NULL)
|
||||||
return 2; /* bad key */
|
return 2; /* bad key */
|
||||||
|
|
||||||
printf("%s\n", PLGetString(value));
|
printf("%s\n", WMGetFromPLString(value));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-19
@@ -35,7 +35,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <proplist.h>
|
#include <WINGs/WUtil.h>
|
||||||
|
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -81,8 +82,8 @@ void help()
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char path[256];
|
char *path;
|
||||||
proplist_t dom, key, value, dict;
|
WMPropList *dom, *key, *value, *dict;
|
||||||
char *gsdir;
|
char *gsdir;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -104,35 +105,34 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
dom = PLMakeString(argv[1]);
|
dom = WMCreatePLString(argv[1]);
|
||||||
key = PLMakeString(argv[2]);
|
key = WMCreatePLString(argv[2]);
|
||||||
value = PLGetProplistWithDescription(argv[3]);
|
value = WMCreatePropListFromDescription(argv[3]);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
printf("%s:syntax error in value \"%s\"", ProgName, argv[3]);
|
printf("%s:syntax error in value \"%s\"", ProgName, argv[3]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
gsdir = getenv("GNUSTEP_USER_ROOT");
|
gsdir = getenv("GNUSTEP_USER_ROOT");
|
||||||
if (gsdir) {
|
if (gsdir) {
|
||||||
strcpy(path, gsdir);
|
path = wstrdup(gsdir);
|
||||||
} else {
|
} else {
|
||||||
strcpy(path, gethomedir());
|
path = wstrdup(gethomedir());
|
||||||
strcat(path, "/GNUstep");
|
path = wstrappend(path, "/GNUstep");
|
||||||
}
|
}
|
||||||
strcat(path, "/");
|
path = wstrappend(path, "/");
|
||||||
strcat(path, DEFAULTS_DIR);
|
path = wstrappend(path, DEFAULTS_DIR);
|
||||||
strcat(path, "/");
|
path = wstrappend(path, "/");
|
||||||
strcat(path, argv[1]);
|
path = wstrappend(path, argv[1]);
|
||||||
|
|
||||||
dict = PLGetProplistWithPath(path);
|
dict = WMReadPropListFromFile(path);
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
dict = PLMakeDictionaryFromEntries(key, value, NULL);
|
dict = WMCreatePLDictionary(key, value, NULL);
|
||||||
PLSetFilename(dict, PLMakeString(path));
|
|
||||||
} else {
|
} else {
|
||||||
PLRemoveDictionaryEntry(dict, key);
|
WMPutInPLDictionary(dict, key, value);
|
||||||
PLInsertDictionaryEntry(dict, key, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PLSave(dict, YES);
|
WMWritePropListToFile(dict, path, True);
|
||||||
|
wfree(path);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+56
-60
@@ -49,7 +49,6 @@
|
|||||||
#include <WINGs/WINGs.h>
|
#include <WINGs/WINGs.h>
|
||||||
#include <wraster.h>
|
#include <wraster.h>
|
||||||
|
|
||||||
#include <proplist.h>
|
|
||||||
|
|
||||||
#define PROG_VERSION "wmsetbg (Window Maker) 2.7"
|
#define PROG_VERSION "wmsetbg (Window Maker) 2.7"
|
||||||
|
|
||||||
@@ -121,27 +120,27 @@ BackgroundTexture*
|
|||||||
parseTexture(RContext *rc, char *text)
|
parseTexture(RContext *rc, char *text)
|
||||||
{
|
{
|
||||||
BackgroundTexture *texture = NULL;
|
BackgroundTexture *texture = NULL;
|
||||||
proplist_t texarray;
|
WMPropList *texarray;
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
int count;
|
int count;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
char *type;
|
char *type;
|
||||||
|
|
||||||
#define GETSTRORGOTO(val, str, i, label) \
|
#define GETSTRORGOTO(val, str, i, label) \
|
||||||
val = PLGetArrayElement(texarray, i);\
|
val = WMGetFromPLArray(texarray, i);\
|
||||||
if (!PLIsString(val)) {\
|
if (!WMIsPLString(val)) {\
|
||||||
wwarning("could not parse texture %s", text);\
|
wwarning("could not parse texture %s", text);\
|
||||||
goto label;\
|
goto label;\
|
||||||
}\
|
}\
|
||||||
str = PLGetString(val)
|
str = WMGetFromPLString(val)
|
||||||
|
|
||||||
texarray = PLGetProplistWithDescription(text);
|
texarray = WMCreatePropListFromDescription(text);
|
||||||
if (!texarray || !PLIsArray(texarray)
|
if (!texarray || !WMIsPLArray(texarray)
|
||||||
|| (count = PLGetNumberOfElements(texarray)) < 2) {
|
|| (count = WMGetPropListItemCount(texarray)) < 2) {
|
||||||
|
|
||||||
wwarning("could not parse texture %s", text);
|
wwarning("could not parse texture %s", text);
|
||||||
if (texarray)
|
if (texarray)
|
||||||
PLRelease(texarray);
|
WMReleasePropList(texarray);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,8 +262,8 @@ parseTexture(RContext *rc, char *text)
|
|||||||
memset(colors, 0, sizeof(RColor*)*(count-1));
|
memset(colors, 0, sizeof(RColor*)*(count-1));
|
||||||
|
|
||||||
for (i = 2; i < count; i++) {
|
for (i = 2; i < count; i++) {
|
||||||
val = PLGetArrayElement(texarray, i);
|
val = WMGetFromPLArray(texarray, i);
|
||||||
if (!PLIsString(val)) {
|
if (!WMIsPLString(val)) {
|
||||||
wwarning("could not parse texture %s", text);
|
wwarning("could not parse texture %s", text);
|
||||||
|
|
||||||
for (j = 0; colors[j]!=NULL; j++)
|
for (j = 0; colors[j]!=NULL; j++)
|
||||||
@@ -272,7 +271,7 @@ parseTexture(RContext *rc, char *text)
|
|||||||
wfree(colors);
|
wfree(colors);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
tmp = PLGetString(val);
|
tmp = WMGetFromPLString(val);
|
||||||
|
|
||||||
if (!XParseColor(dpy, DefaultColormap(dpy, scr), tmp, &color)) {
|
if (!XParseColor(dpy, DefaultColormap(dpy, scr), tmp, &color)) {
|
||||||
wwarning("could not parse color %s in texture %s",
|
wwarning("could not parse color %s in texture %s",
|
||||||
@@ -687,7 +686,7 @@ error:
|
|||||||
if (texture)
|
if (texture)
|
||||||
wfree(texture);
|
wfree(texture);
|
||||||
if (texarray)
|
if (texarray)
|
||||||
PLRelease(texarray);
|
WMReleasePropList(texarray);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -1032,30 +1031,28 @@ globalDefaultsPathForDomain(char *domain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
proplist_t
|
static WMPropList*
|
||||||
getValueForKey(char *domain, char *keyName)
|
getValueForKey(char *domain, char *keyName)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
proplist_t key;
|
WMPropList *key, *val, *d;
|
||||||
proplist_t d;
|
|
||||||
proplist_t val;
|
|
||||||
|
|
||||||
key = PLMakeString(keyName);
|
key = WMCreatePLString(keyName);
|
||||||
|
|
||||||
/* try to find PixmapPath in user defaults */
|
/* try to find PixmapPath in user defaults */
|
||||||
path = wdefaultspathfordomain(domain);
|
path = wdefaultspathfordomain(domain);
|
||||||
d = PLGetProplistWithPath(path);
|
d = WMReadPropListFromFile(path);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
wwarning("could not open domain file %s", path);
|
wwarning("could not open domain file %s", path);
|
||||||
}
|
}
|
||||||
wfree(path);
|
wfree(path);
|
||||||
|
|
||||||
if (d && !PLIsDictionary(d)) {
|
if (d && !WMIsPLDictionary(d)) {
|
||||||
PLRelease(d);
|
WMReleasePropList(d);
|
||||||
d = NULL;
|
d = NULL;
|
||||||
}
|
}
|
||||||
if (d) {
|
if (d) {
|
||||||
val = PLGetDictionaryEntry(d, key);
|
val = WMGetFromPLDictionary(d, key);
|
||||||
} else {
|
} else {
|
||||||
val = NULL;
|
val = NULL;
|
||||||
}
|
}
|
||||||
@@ -1066,16 +1063,16 @@ getValueForKey(char *domain, char *keyName)
|
|||||||
wwarning("could not locate file for domain %s", domain);
|
wwarning("could not locate file for domain %s", domain);
|
||||||
d = NULL;
|
d = NULL;
|
||||||
} else {
|
} else {
|
||||||
d = PLGetProplistWithPath(path);
|
d = WMReadPropListFromFile(path);
|
||||||
wfree(path);
|
wfree(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d && !PLIsDictionary(d)) {
|
if (d && !WMIsPLDictionary(d)) {
|
||||||
PLRelease(d);
|
WMReleasePropList(d);
|
||||||
d = NULL;
|
d = NULL;
|
||||||
}
|
}
|
||||||
if (d) {
|
if (d) {
|
||||||
val = PLGetDictionaryEntry(d, key);
|
val = WMGetFromPLDictionary(d, key);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
val = NULL;
|
val = NULL;
|
||||||
@@ -1083,11 +1080,11 @@ getValueForKey(char *domain, char *keyName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
PLRetain(val);
|
WMRetainPropList(val);
|
||||||
|
|
||||||
PLRelease(key);
|
WMReleasePropList(key);
|
||||||
if (d)
|
if (d)
|
||||||
PLRelease(d);
|
WMReleasePropList(d);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@@ -1097,50 +1094,50 @@ getValueForKey(char *domain, char *keyName)
|
|||||||
char*
|
char*
|
||||||
getPixmapPath(char *domain)
|
getPixmapPath(char *domain)
|
||||||
{
|
{
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
char *ptr, *data;
|
char *ptr, *data;
|
||||||
int len, i, count;
|
int len, i, count;
|
||||||
|
|
||||||
val = getValueForKey(domain, "PixmapPath");
|
val = getValueForKey(domain, "PixmapPath");
|
||||||
|
|
||||||
if (!val || !PLIsArray(val)) {
|
if (!val || !WMIsPLArray(val)) {
|
||||||
if (val)
|
if (val)
|
||||||
PLRelease(val);
|
WMReleasePropList(val);
|
||||||
return wstrdup("");
|
return wstrdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
count = PLGetNumberOfElements(val);
|
count = WMGetPropListItemCount(val);
|
||||||
len = 0;
|
len = 0;
|
||||||
for (i=0; i<count; i++) {
|
for (i=0; i<count; i++) {
|
||||||
proplist_t v;
|
WMPropList *v;
|
||||||
|
|
||||||
v = PLGetArrayElement(val, i);
|
v = WMGetFromPLArray(val, i);
|
||||||
if (!v || !PLIsString(v)) {
|
if (!v || !WMIsPLString(v)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
len += strlen(PLGetString(v))+1;
|
len += strlen(WMGetFromPLString(v))+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = data = wmalloc(len+1);
|
ptr = data = wmalloc(len+1);
|
||||||
*ptr = 0;
|
*ptr = 0;
|
||||||
|
|
||||||
for (i=0; i<count; i++) {
|
for (i=0; i<count; i++) {
|
||||||
proplist_t v;
|
WMPropList *v;
|
||||||
|
|
||||||
v = PLGetArrayElement(val, i);
|
v = WMGetFromPLArray(val, i);
|
||||||
if (!v || !PLIsString(v)) {
|
if (!v || !WMIsPLString(v)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
strcpy(ptr, PLGetString(v));
|
strcpy(ptr, WMGetFromPLString(v));
|
||||||
|
|
||||||
ptr += strlen(PLGetString(v));
|
ptr += strlen(WMGetFromPLString(v));
|
||||||
*ptr = ':';
|
*ptr = ':';
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
if (i>0)
|
if (i>0)
|
||||||
ptr--; *(ptr--) = 0;
|
ptr--; *(ptr--) = 0;
|
||||||
|
|
||||||
PLRelease(val);
|
WMReleasePropList(val);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -1216,12 +1213,11 @@ P(" --help show this help and exit");
|
|||||||
void
|
void
|
||||||
changeTextureForWorkspace(char *domain, char *texture, int workspace)
|
changeTextureForWorkspace(char *domain, char *texture, int workspace)
|
||||||
{
|
{
|
||||||
proplist_t array;
|
WMPropList *array, *val;
|
||||||
proplist_t val;
|
|
||||||
char *value;
|
char *value;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
val = PLGetProplistWithDescription(texture);
|
val = WMCreatePropListFromDescription(texture);
|
||||||
if (!val) {
|
if (!val) {
|
||||||
wwarning("could not parse texture %s", texture);
|
wwarning("could not parse texture %s", texture);
|
||||||
return;
|
return;
|
||||||
@@ -1230,25 +1226,25 @@ changeTextureForWorkspace(char *domain, char *texture, int workspace)
|
|||||||
array = getValueForKey("WindowMaker", "WorkspaceSpecificBack");
|
array = getValueForKey("WindowMaker", "WorkspaceSpecificBack");
|
||||||
|
|
||||||
if (!array) {
|
if (!array) {
|
||||||
array = PLMakeArrayFromElements(NULL, NULL);
|
array = WMCreatePLArray(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = PLGetNumberOfElements(array);
|
j = WMGetPropListItemCount(array);
|
||||||
if (workspace >= j) {
|
if (workspace >= j) {
|
||||||
proplist_t empty;
|
WMPropList *empty;
|
||||||
|
|
||||||
empty = PLMakeArrayFromElements(NULL, NULL);
|
empty = WMCreatePLArray(NULL, NULL);
|
||||||
|
|
||||||
while (j++ < workspace-1) {
|
while (j++ < workspace-1) {
|
||||||
PLAppendArrayElement(array, empty);
|
WMAddToPLArray(array, empty);
|
||||||
}
|
}
|
||||||
PLAppendArrayElement(array, val);
|
WMAddToPLArray(array, val);
|
||||||
} else {
|
} else {
|
||||||
PLRemoveArrayElement(array, workspace);
|
WMDeleteFromPLArray(array, workspace);
|
||||||
PLInsertArrayElement(array, val, workspace);
|
WMInsertInPLArray(array, workspace, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
value = PLGetDescription(array);
|
value = WMGetPropListDescription(array, False);
|
||||||
updateDomain(domain, "WorkspaceSpecificBack", value);
|
updateDomain(domain, "WorkspaceSpecificBack", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1391,15 +1387,15 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
PixmapPath = getPixmapPath(domain);
|
PixmapPath = getPixmapPath(domain);
|
||||||
if (!smooth) {
|
if (!smooth) {
|
||||||
proplist_t val;
|
WMPropList *val;
|
||||||
#if 0 /* some problem with Alpha... TODO: check if its right */
|
#if 0 /* some problem with Alpha... TODO: check if its right */
|
||||||
val = PLGetDictionaryEntry(domain,
|
val = WMGetFromPLDictionary(domain,
|
||||||
PLMakeString("SmoothWorkspaceBack"));
|
WMCreatePLString("SmoothWorkspaceBack"));
|
||||||
#else
|
#else
|
||||||
val = getValueForKey(domain, "SmoothWorkspaceBack");
|
val = getValueForKey(domain, "SmoothWorkspaceBack");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (val && PLIsString(val) && strcasecmp(PLGetString(val), "YES")==0)
|
if (val && WMIsPLString(val) && strcasecmp(WMGetFromPLString(val), "YES")==0)
|
||||||
smooth = True;
|
smooth = True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,6 @@
|
|||||||
/* the definitions in this file can change at any time. WINGs has more
|
/* the definitions in this file can change at any time. WINGs has more
|
||||||
* stable definitions */
|
* stable definitions */
|
||||||
|
|
||||||
#undef BOOL
|
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xmd.h>
|
#include <X11/Xmd.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user