1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-10 18:45:47 +01:00

Code update for Window Maker version 0.50.0

Read changes in ChangeLog and NEWS
This commit is contained in:
dan
1999-01-06 15:22:33 +00:00
parent 16698efd45
commit 0261c32636
232 changed files with 20628 additions and 8087 deletions

236
WPrefs.app/Appearance.c Normal file
View File

@@ -0,0 +1,236 @@
/* TextureAndColor.c- color/texture for titlebar etc.
*
* WPrefs - Window Maker Preferences Program
*
* Copyright (c) 1999 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 "WPrefs.h"
#include "TexturePanel.h"
typedef struct _Panel {
WMFrame *frame;
char *sectionName;
CallbackRec callbacks;
WMWindow *win;
WMLabel *prevL;
WMPopUpButton *secP;
/* texture list */
WMLabel *texL;
WMList *texLs;
WMPopUpButton *cmdP;
WMTextField *texT;
WMButton *editB;
/* for preview shit */
Pixmap preview;
Pixmap ftitle;
Pixmap utitle;
Pixmap otitle;
Pixmap icon;
Pixmap back;
Pixmap mtitle;
Pixmap mitem;
} _Panel;
#define ICON_FILE "appearance"
#define FTITLE (1<<0)
#define UTITLE (1<<1)
#define OTITLE (1<<2)
#define ICON (1<<3)
#define BACK (1<<4)
#define MTITLE (1<<5)
#define MITEM (1<<6)
#define EVERYTHING 0xff
static Pixmap
renderTexture(_Panel *panel, char *texture, int width, int height,
Bool bordered)
{
return None;
}
static void
updatePreviewBox(_Panel *panel, int elements)
{
WMScreen *scr = WMWidgetScreen(panel->win);
Display *dpy = WMScreenDisplay(scr);
/* RContext *rc = WMScreenRContext(scr);*/
int refresh = 0;
char *tmp;
if (!panel->preview) {
panel->preview = XCreatePixmap(dpy, WMWidgetXID(panel->win),
220-4, 185-4, WMScreenDepth(scr));
refresh = -1;
}
if (elements & FTITLE) {
if (panel->ftitle)
XFreePixmap(dpy, panel->ftitle);
panel->ftitle = renderTexture(panel, tmp, 180, 20, True);
free(tmp);
}
/* have to repaint everything to make things simple, eliminating
* clipping stuff */
if (refresh) {
}
if (refresh<0) {
WMPixmap *pix;
pix = WMCreatePixmapFromXPixmaps(scr, panel->preview, None,
220-4, 185-4, WMScreenDepth(scr));
WMSetLabelImage(panel->prevL, pix);
WMReleasePixmap(pix);
}
}
static char*
getStrArrayForKey(char *key)
{
proplist_t v;
v = GetObjectForKey(key);
if (!v)
return NULL;
return PLGetDescription(v);
}
static void
createPanel(Panel *p)
{
_Panel *panel = (_Panel*)p;
WMColor *color;
WMFont *boldFont;
WMScreen *scr = WMWidgetScreen(panel->win);
panel->frame = WMCreateFrame(panel->win);
WMResizeWidget(panel->frame, FRAME_WIDTH, FRAME_HEIGHT);
WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
/* preview box */
panel->prevL = WMCreateLabel(panel->frame);
WMResizeWidget(panel->prevL, 260, 190);
WMMoveWidget(panel->prevL, 10, 10);
WMSetLabelRelief(panel->prevL, WRSunken);
panel->secP = WMCreatePopUpButton(panel->frame);
WMResizeWidget(panel->secP, 242, 20);
WMMoveWidget(panel->secP, 10, 207);
// WMSetPopUpButtonAction(panel->secP, changePage, panel);
/* texture list */
boldFont = WMBoldSystemFontOfSize(scr, 12);
panel->texL = WMCreateLabel(panel->frame);
WMResizeWidget(panel->texL, 225, 18);
WMMoveWidget(panel->texL, 285, 10);
WMSetLabelFont(panel->texL, boldFont);
WMSetLabelText(panel->texL, _("Textures"));
WMSetLabelRelief(panel->texL, WRSunken);
WMSetLabelTextAlignment(panel->texL, WACenter);
color = WMDarkGrayColor(scr);
WMSetWidgetBackgroundColor(panel->texL, color);
WMReleaseColor(color);
color = WMWhiteColor(scr);
WMSetLabelTextColor(panel->texL, color);
WMReleaseColor(color);
WMReleaseFont(boldFont);
panel->texLs = WMCreateList(panel->frame);
WMResizeWidget(panel->texLs, 225, 144);
WMMoveWidget(panel->texLs, 285, 30);
panel->cmdP = WMCreatePopUpButton(panel->frame);
WMResizeWidget(panel->cmdP, 225, 20);
WMMoveWidget(panel->cmdP, 285, 180);
WMSetPopUpButtonPullsDown(panel->cmdP, True);
WMSetPopUpButtonText(panel->cmdP, _("Texture Commands"));
WMAddPopUpButtonItem(panel->cmdP, _("Create New"));
WMAddPopUpButtonItem(panel->cmdP, _("Add From Text Field"));
WMAddPopUpButtonItem(panel->cmdP, _("Remove Selected"));
WMAddPopUpButtonItem(panel->cmdP, _("Extract From File"));
panel->editB = WMCreateCommandButton(panel->frame);
WMResizeWidget(panel->editB, 64, 20);
WMMoveWidget(panel->editB, 260, 207);
WMSetButtonText(panel->editB, _("Browse..."));
panel->texT = WMCreateTextField(panel->frame);
WMResizeWidget(panel->texT, 176, 20);
WMMoveWidget(panel->texT, 330, 207);
/**/
WMRealizeWidget(panel->frame);
WMMapSubwidgets(panel->frame);
WMSetPopUpButtonSelectedItem(panel->secP, 0);
}
Panel*
InitAppearance(WMScreen *scr, WMWindow *win)
{
_Panel *panel;
panel = wmalloc(sizeof(_Panel));
memset(panel, 0, sizeof(_Panel));
panel->sectionName = _("Appearance Preferences");
panel->win = win;
panel->callbacks.createWidgets = createPanel;
AddSection(panel, ICON_FILE);
return panel;
}

View File

@@ -355,7 +355,7 @@ createPanel(Panel *p)
panel->ignB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->ignB, 210, 50);
WMMoveWidget(panel->ignB, 15, 10);
WMSetButtonText(panel->ignB, _("Do not let aplications receive the "\
WMSetButtonText(panel->ignB, _("Do not let applications receive the "\
"click used to focus windows."));
panel->newB = WMCreateSwitchButton(panel->optF);

View File

@@ -45,7 +45,11 @@ typedef struct _Panel {
WMButton *defB;
WMLabel *instructionsL;
WMColor *white;
WMColor *black;
WMFont *font;
/**/
char capturing;
char **shortcuts;
@@ -71,6 +75,7 @@ static char *keyOptions[] = {
"LowerKey",
"RaiseLowerKey",
"ShadeKey",
"MoveResizeKey",
"SelectKey",
"FocusNextKey",
"FocusPrevKey",
@@ -92,6 +97,14 @@ static char *keyOptions[] = {
"WindowShortcut2Key",
"WindowShortcut3Key",
"WindowShortcut4Key",
#ifdef EXTEND_WINDOWSHORTCUT
"WindowShortcut5Key",
"WindowShortcut6Key",
"WindowShortcut7Key",
"WindowShortcut8Key",
"WindowShortcut9Key",
"WindowShortcut10Key",
#endif
"ClipRaiseKey",
"ClipLowerKey",
#ifndef XKB_MODELOCK
@@ -180,6 +193,8 @@ captureClick(WMWidget *w, void *data)
if (panel->shortcuts[row])
free(panel->shortcuts[row]);
panel->shortcuts[row] = shortcut;
WMRedisplayWidget(panel->actLs);
} else {
free(shortcut);
}
@@ -205,6 +220,7 @@ clearShortcut(WMWidget *w, void *data)
if (panel->shortcuts[row])
free(panel->shortcuts[row]);
panel->shortcuts[row]=NULL;
WMRedisplayWidget(panel->actLs);
}
}
@@ -226,6 +242,7 @@ typedKeys(void *observerData, WMNotification *notification)
free(panel->shortcuts[row]);
panel->shortcuts[row] = NULL;
}
WMRedisplayWidget(panel->actLs);
}
@@ -281,6 +298,40 @@ showData(_Panel *panel)
panel->shortcuts[i] = NULL;
}
}
WMRedisplayWidget(panel->actLs);
}
static void
paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
WMRect *rect)
{
int width, height, x, y;
_Panel *panel = (_Panel*)WMGetHangedData(lPtr);
WMScreen *scr = WMWidgetScreen(lPtr);
Display *dpy = WMScreenDisplay(scr);
width = rect->size.width;
height = rect->size.height;
x = rect->pos.x;
y = rect->pos.y;
if (state & WLDSSelected)
XFillRectangle(dpy, d, WMColorGC(panel->white), x, y, width,
height);
else
XClearArea(dpy, d, x, y, width, height, False);
if (panel->shortcuts[index]) {
WMPixmap *pix = WMGetSystemPixmap(scr, WSICheckMark);
WMSize size = WMGetPixmapSize(pix);
WMDrawPixmap(pix, d, x+(20-size.width)/2, (height-size.height)/2+y);
WMReleasePixmap(pix);
}
WMDrawString(scr, d, WMColorGC(panel->black), panel->font, x+20, y,
text, strlen(text));
}
@@ -318,6 +369,8 @@ createPanel(Panel *p)
panel->actLs = WMCreateList(panel->frame);
WMResizeWidget(panel->actLs, 280, 190);
WMMoveWidget(panel->actLs, 20, 32);
WMSetListUserDrawProc(panel->actLs, paintItem);
WMHangData(panel->actLs, panel);
WMAddListItem(panel->actLs, _("Open applications menu"));
WMAddListItem(panel->actLs, _("Open window list menu"));
@@ -332,6 +385,7 @@ createPanel(Panel *p)
WMAddListItem(panel->actLs, _("Raise/Lower window under mouse pointer"));
WMAddListItem(panel->actLs, _("Shade active window"));
WMAddListItem(panel->actLs, _("Select active window"));
WMAddListItem(panel->actLs, _("Move/Resize active window"));
WMAddListItem(panel->actLs, _("Focus next window"));
WMAddListItem(panel->actLs, _("Focus previous window"));
WMAddListItem(panel->actLs, _("Switch to next workspace"));
@@ -448,7 +502,11 @@ InitKeyboardShortcuts(WMScreen *scr, WMWindow *win)
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
panel->white = WMWhiteColor(scr);
panel->black = WMBlackColor(scr);
panel->font = WMSystemFontOfSize(scr, 12);
AddSection(panel, ICON_FILE);
return panel;

View File

@@ -18,6 +18,7 @@ WPrefs_SOURCES = \
main.c \
WPrefs.c \
WPrefs.h \
Appearance.c \
Configurations.c \
Expert.c \
Focus.c \
@@ -33,6 +34,7 @@ WPrefs_SOURCES = \
TextureAndColor.c \
TexturePanel.c \
TexturePanel.h \
Themes.c \
WindowHandling.c \
Workspace.c \
double.c \
@@ -56,8 +58,8 @@ WPrefs_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
WPrefs_LDADD = \
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.a \
$(top_builddir)/libPropList/libPropList.a \
$(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/libPropList/libPropList.la \
@GFXLFLAGS@ \
@XLFLAGS@ \
@GFXLIBS@ \

View File

@@ -69,6 +69,9 @@ I18N = @I18N@
I18N_MB = @I18N_MB@
ICONEXT = @ICONEXT@
INTLIBS = @INTLIBS@
LD = @LD@
LIBTOOL = @LIBTOOL@
LITE = @LITE@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MOFILES = @MOFILES@
@@ -110,6 +113,7 @@ WPrefs_SOURCES = \
main.c \
WPrefs.c \
WPrefs.h \
Appearance.c \
Configurations.c \
Expert.c \
Focus.c \
@@ -125,6 +129,7 @@ WPrefs_SOURCES = \
TextureAndColor.c \
TexturePanel.c \
TexturePanel.h \
Themes.c \
WindowHandling.c \
Workspace.c \
double.c \
@@ -147,8 +152,8 @@ WPrefs_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
WPrefs_LDADD = \
$(top_builddir)/WINGs/libWINGs.a\
$(top_builddir)/wrlib/libwraster.a \
$(top_builddir)/libPropList/libPropList.a \
$(top_builddir)/wrlib/libwraster.la \
$(top_builddir)/libPropList/libPropList.la \
@GFXLFLAGS@ \
@XLFLAGS@ \
@GFXLIBS@ \
@@ -168,15 +173,16 @@ LIBS = @LIBS@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
WPrefs_OBJECTS = main.o WPrefs.o Configurations.o Expert.o Focus.o \
Icons.o KeyboardSettings.o KeyboardShortcuts.o Menu.o MenuPreferences.o \
MouseSettings.o Paths.o Preferences.o Text.o TextureAndColor.o \
TexturePanel.o WindowHandling.o Workspace.o double.o MenuGuru.o \
xmodifier.o
WPrefs_OBJECTS = main.o WPrefs.o Appearance.o Configurations.o Expert.o \
Focus.o Icons.o KeyboardSettings.o KeyboardShortcuts.o Menu.o \
MenuPreferences.o MouseSettings.o Paths.o Preferences.o Text.o \
TextureAndColor.o TexturePanel.o Themes.o WindowHandling.o Workspace.o \
double.o MenuGuru.o xmodifier.o
WPrefs_LDFLAGS =
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
DATA = $(wpdata_DATA)
DIST_COMMON = README Makefile.am Makefile.in
@@ -192,7 +198,7 @@ OBJECTS = $(WPrefs_OBJECTS)
all: all-recursive all-am
.SUFFIXES:
.SUFFIXES: .S .c .o .s
.SUFFIXES: .S .c .lo .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu WPrefs.app/Makefile
@@ -215,8 +221,8 @@ install-wpexecbinPROGRAMS: $(wpexecbin_PROGRAMS)
$(mkinstalldirs) $(DESTDIR)$(wpexecbindir)
@list='$(wpexecbin_PROGRAMS)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(wpexecbindir)/`echo $$p|sed '$(transform)'`"; \
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(wpexecbindir)/`echo $$p|sed '$(transform)'`; \
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(wpexecbindir)/`echo $$p|sed '$(transform)'`"; \
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(wpexecbindir)/`echo $$p|sed '$(transform)'`; \
else :; fi; \
done
@@ -245,6 +251,25 @@ distclean-compile:
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
WPrefs: $(WPrefs_OBJECTS) $(WPrefs_DEPENDENCIES)
@rm -f WPrefs
$(LINK) $(WPrefs_LDFLAGS) $(WPrefs_OBJECTS) $(WPrefs_LDADD) $(LIBS)
@@ -397,17 +422,20 @@ maintainer-clean-generic:
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-wpexecbinPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-generic
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
clean-am: clean-wpexecbinPROGRAMS clean-compile clean-tags \
clean-generic mostlyclean-am
clean-am: clean-wpexecbinPROGRAMS clean-compile clean-libtool \
clean-tags clean-generic mostlyclean-am
distclean-am: distclean-wpexecbinPROGRAMS distclean-compile \
distclean-tags distclean-generic clean-am
distclean-libtool distclean-tags distclean-generic \
clean-am
maintainer-clean-am: maintainer-clean-wpexecbinPROGRAMS \
maintainer-clean-compile maintainer-clean-tags \
maintainer-clean-generic distclean-am
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
mostlyclean: mostlyclean-recursive mostlyclean-am
@@ -415,6 +443,7 @@ clean: clean-recursive clean-am
distclean: distclean-recursive distclean-am
-rm -f config.status
-rm -f libtool
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
@echo "This command is intended for maintainers to use;"
@@ -424,11 +453,13 @@ maintainer-clean: maintainer-clean-recursive maintainer-clean-am
clean-wpexecbinPROGRAMS maintainer-clean-wpexecbinPROGRAMS \
uninstall-wpexecbinPROGRAMS install-wpexecbinPROGRAMS \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile uninstall-wpdataDATA install-wpdataDATA \
install-data-recursive uninstall-data-recursive install-exec-recursive \
uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \
all-recursive check-recursive installcheck-recursive info-recursive \
dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool uninstall-wpdataDATA \
install-wpdataDATA install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
installcheck all-am install-exec-am install-data-am uninstall-am \

View File

@@ -546,15 +546,24 @@ browserClick(WMWidget *w, void *data)
if (isMenu(item)) {
updateForItemType(panel, TNothing);
WMSetPopUpButtonEnabled(panel->cmd2P, True);
return;
} else {
int column = WMGetBrowserSelectedColumn(panel->browser);
if (column == WMGetBrowserNumberOfColumns(panel->browser)-1
&& column > 0)
WMSetPopUpButtonEnabled(panel->cmd2P, True);
else
WMSetPopUpButtonEnabled(panel->cmd2P, False);
if (column==WMGetBrowserFirstVisibleColumn(panel->browser)) {
/* second column is empty, because selected item is not a submenu */
WMSetTextFieldText(panel->tit2T, NULL);
}
}
if (WMGetBrowserSelectedColumn(panel->browser)==
WMGetBrowserFirstVisibleColumn(panel->browser)) {
/* second column is empty, because selected item is not a submenu */
WMSetTextFieldText(panel->tit2T, NULL);
}
command = getItemCommand(item);
WMSetTextFieldText(panel->shoT, getItemShortcut(item));

View File

@@ -633,8 +633,8 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->menuF, _("Workspace Mouse Actions"));
panel->disaB = WMCreateSwitchButton(panel->menuF);
WMResizeWidget(panel->disaB, 185, 19);
WMMoveWidget(panel->disaB, 20, 20);
WMResizeWidget(panel->disaB, 205, 18);
WMMoveWidget(panel->disaB, 10, 20);
WMSetButtonText(panel->disaB, _("Disable mouse actions"));
panel->mblL = WMCreateLabel(panel->menuF);

View File

@@ -223,7 +223,8 @@ listClick(WMWidget *w, void *data)
static void
paintItem(WMList *lPtr, Drawable d, char *text, int state, WMRect *rect)
paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
WMRect *rect)
{
int width, height, x, y;
_Panel *panel = (_Panel*)WMGetHangedData(lPtr);

View File

@@ -33,6 +33,17 @@ the contents of the ~/GNUstep/Defaults directory before using it.
License
-------
Like Window Maker, WPrefs is distributed with through the General Public
License (as stated in the file COPYING). As an exception, the icons and
original graphical artwork included with WPrefs has the additional
restriction that they must not be redistributed without the rest of the
Window Maker distribution. In other words, you can use and distribute the
WPrefs icons freely, as long as they are distributed for use with Window
Maker (ripping the icons and putting them in your program is prohibited).
Notes
-----

View File

@@ -114,7 +114,7 @@ char *WMGetColorWellRGBString(WMColorWell *cPtr) {
*/
static void buttonCallback(WMWidget *self, void *data);
static void renderTextureButtons (_TexturePanel *panel);
static void paintListItem(WMList *lPtr, Drawable d, char *text, int state, WMRect *rect);
static void paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect);
static void notificationObserver(void *self, WMNotification *notif);
static void
@@ -139,7 +139,7 @@ notificationObserver(void *self, WMNotification *notif)
static void
paintListItem(WMList *lPtr, Drawable d, char *text, int state, WMRect *rect)
paintListItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *rect)
{
WMScreen *scr;
int width, height, x, y;

262
WPrefs.app/Themes.c Normal file
View File

@@ -0,0 +1,262 @@
/* Themes.c- Theme stuff
*
* WPrefs - Window Maker Preferences Program
*
* 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 "WPrefs.h"
#include <unistd.h>
typedef struct _Panel {
WMFrame *frame;
char *sectionName;
CallbackRec callbacks;
WMWindow *win;
WMButton *saveB;
WMList *list;
WMButton *loadB;
WMButton *instB;
WMFrame *totF;
WMButton *totB;
WMLabel *totL;
WMFrame *botF;
WMButton *botB;
WMLabel *botL;
pid_t tilePID;
pid_t barPID;
} _Panel;
#define ICON_FILE "theme"
static void
showData(_Panel *panel)
{
}
static void
finishedTileDownload(void *data)
{
_Panel *panel = (_Panel*)data;
WMSetButtonText(panel->totB, _("Set"));
panel->tilePID = 0;
}
static void
finishedBarDownload(void *data)
{
_Panel *panel = (_Panel*)data;
WMSetButtonText(panel->botB, _("Set"));
panel->barPID = 0;
}
static pid_t
downloadFile(WMScreen *scr, _Panel *panel, char *file)
{
pid_t pid;
pid = fork();
if (pid < 0) {
wsyserror("could not fork() process");
WMRunAlertPanel(scr, panel->win, _("Error"),
"Could not start download. fork() failed",
_("OK"), NULL, NULL);
return -1;
}
if (pid != 0) {
return pid;
}
close(ConnectionNumber(WMScreenDisplay(scr)));
exit(1);
}
static void
downloadCallback(WMWidget *w, void *data)
{
_Panel *panel = (_Panel*)data;
pid_t newPid;
WMButton *button = (WMButton*)w;
pid_t *pid;
if (button == panel->totB) {
pid = &panel->tilePID;
} else {
pid = &panel->barPID;
}
if (*pid == 0) {
newPid = downloadFile(WMWidgetScreen(w), panel, NULL);
if (newPid < 0) {
return;
}
WMSetButtonText(button, _("Stop"));
if (button == panel->totB) {
AddDeadChildHandler(newPid, finishedTileDownload, data);
} else {
AddDeadChildHandler(newPid, finishedBarDownload, data);
}
*pid = newPid;
} else {
*pid = 0;
WMSetButtonText(button, _("Download"));
}
}
static void
updateThemeList(_Panel *panel)
{
WMClearList(panel->list);
}
static void
createPanel(Panel *p)
{
_Panel *panel = (_Panel*)p;
WMScreen *scr = WMWidgetScreen(panel->win);
panel->frame = WMCreateFrame(panel->win);
WMResizeWidget(panel->frame, FRAME_WIDTH, FRAME_HEIGHT);
WMMoveWidget(panel->frame, FRAME_LEFT, FRAME_TOP);
panel->saveB = WMCreateCommandButton(panel->frame);
WMResizeWidget(panel->saveB, 154, 24);
WMMoveWidget(panel->saveB, 15, 10);
WMSetButtonText(panel->saveB, _("Save Current Theme"));
panel->list = WMCreateList(panel->frame);
WMResizeWidget(panel->list, 154, 150);
WMMoveWidget(panel->list, 15, 40);
panel->loadB = WMCreateCommandButton(panel->frame);
WMResizeWidget(panel->loadB, 74, 24);
WMMoveWidget(panel->loadB, 15, 200);
WMSetButtonText(panel->loadB, _("Load"));
panel->instB = WMCreateCommandButton(panel->frame);
WMResizeWidget(panel->instB, 74, 24);
WMMoveWidget(panel->instB, 95, 200);
WMSetButtonText(panel->instB, _("Install"));
/**************** Tile of the day ****************/
panel->totF = WMCreateFrame(panel->frame);
WMResizeWidget(panel->totF, 210, 105);
WMMoveWidget(panel->totF, 240, 10);
WMSetFrameTitle(panel->totF, _("Tile of The Day"));
panel->totL = WMCreateLabel(panel->totF);
WMResizeWidget(panel->totL, 67, 67);
WMMoveWidget(panel->totL, 25, 25);
WMSetLabelRelief(panel->totL, WRSunken);
panel->totB = WMCreateCommandButton(panel->totF);
WMResizeWidget(panel->totB, 86, 24);
WMMoveWidget(panel->totB, 105, 45);
WMSetButtonText(panel->totB, _("Download"));
WMSetButtonAction(panel->totB, downloadCallback, panel);
WMMapSubwidgets(panel->totF);
/**************** Bar of the day ****************/
panel->botF = WMCreateFrame(panel->frame);
WMResizeWidget(panel->botF, 315, 95);
WMMoveWidget(panel->botF, 190, 125);
WMSetFrameTitle(panel->botF, _("Bar of The Day"));
panel->botL = WMCreateLabel(panel->botF);
WMResizeWidget(panel->botL, 285, 32);
WMMoveWidget(panel->botL, 15, 20);
WMSetLabelRelief(panel->botL, WRSunken);
panel->botB = WMCreateCommandButton(panel->botF);
WMResizeWidget(panel->botB, 86, 24);
WMMoveWidget(panel->botB, 110, 60);
WMSetButtonText(panel->botB, _("Download"));
WMSetButtonAction(panel->botB, downloadCallback, panel);
WMMapSubwidgets(panel->botF);
WMRealizeWidget(panel->frame);
WMMapSubwidgets(panel->frame);
showData(panel);
}
static void
storeData(_Panel *panel)
{
}
Panel*
InitThemes(WMScreen *scr, WMWindow *win)
{
_Panel *panel;
panel = wmalloc(sizeof(_Panel));
memset(panel, 0, sizeof(_Panel));
panel->sectionName = _("Themes");
panel->win = win;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
AddSection(panel, ICON_FILE);
return panel;
}

View File

@@ -39,8 +39,6 @@ extern Panel *InitFocus(WMScreen *scr, WMWindow *win);
extern Panel *InitPreferences(WMScreen *scr, WMWindow *win);
extern Panel *InitTextureAndColor(WMScreen *scr, WMWindow *win);
extern Panel *InitText(WMScreen *scr, WMWindow *win);
extern Panel *InitConfigurations(WMScreen *scr, WMWindow *win);
@@ -55,6 +53,13 @@ extern Panel *InitMenuPreferences(WMScreen *scr, WMWindow *win);
extern Panel *InitIcons(WMScreen *scr, WMWindow *win);
extern Panel *InitThemes(WMScreen *scr, WMWindow *win);
extern Panel *InitTextureAndColor(WMScreen *scr, WMWindow *win);
extern Panel *InitAppearance(WMScreen *scr, WMWindow *win);
#define MAX_SECTIONS 16
@@ -506,15 +511,21 @@ Initialize(WMScreen *scr)
#endif
InitKeyboardShortcuts(scr, WPrefs.win);
InitMouseSettings(scr, WPrefs.win);
#ifdef not_yet_fully_implemented
InitTextureAndColor(scr, WPrefs.win);
InitAppearance(scr, WPrefs.win);
InitText(scr, WPrefs.win);
InitThemes(scr, WPrefs.win);
#endif
InitExpert(scr, WPrefs.win);
WMRealizeWidget(WPrefs.scrollV);
WMSetLabelText(WPrefs.statusL, "This program is still under development. Backup your ~/GNUstep/Defaults directory, before using it.");
WMSetLabelText(WPrefs.statusL,
"WPrefs is free software and is distributed WITHOUT ANY "
"WARRANTY under the terms of the GNU General Public License."
"Redistribution of the icons in this program separately from the program itself is prohibited.");
}
@@ -555,7 +566,7 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
file = popen("wmaker -version", "r");
if (!file || !fgets(buffer, 1023, file)) {
wsyserror(_("could not extract version information from Window Maker"));
wfatal(_("Make sure Window Maker is in your search path."));
wfatal(_("Make sure wmaker is in your search path."));
WMRunAlertPanel(scr, mainw, _("Error"),
_("Could not extract version from Window Maker. Make sure it is correctly installed and is in your PATH environment variable."),

View File

@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <X11/Xlib.h>
@@ -36,8 +37,12 @@
#include <WINGs.h>
#include <WUtil.h>
/** some config options **/
#undef EXTEND_WINDOWSHORTCUT
#define WVERSION "0.8"
/****/
#define WVERSION "0.9"
#define WMVERSION "0.20.x"
@@ -63,6 +68,7 @@ typedef struct PanelRec {
} PanelRec;
void AddSection(Panel *panel, char *iconFile);
char *LocateImage(char *name);
@@ -93,6 +99,11 @@ void SetBoolForKey(Bool value, char *defaultName);
void SetSpeedForKey(int speed, char *defaultName);
void AddDeadChildHandler(pid_t pid, void (*handler)(void*), void *data);
#define FRAME_TOP 105
#define FRAME_LEFT -2
#define FRAME_WIDTH 524

View File

@@ -21,11 +21,27 @@
#include "WPrefs.h"
#include <assert.h>
#include <X11/Xlocale.h>
#include <sys/wait.h>
#include <unistd.h>
extern void Initialize(WMScreen *scr);
#define MAX_DEATHS 64
struct {
pid_t pid;
void *data;
void (*handler)(void*);
} DeadHandlers[MAX_DEATHS];
static pid_t DeadChildren[MAX_DEATHS];
static int DeadChildrenCount = 0;
void
@@ -60,6 +76,38 @@ print_help(char *progname)
}
static RETSIGTYPE
handleDeadChild(int sig)
{
pid_t pid;
int status;
pid = waitpid(-1, &status, WNOHANG);
if (pid > 0) {
DeadChildren[DeadChildrenCount++] = pid;
}
}
void
AddDeadChildHandler(pid_t pid, void (*handler)(void*), void *data)
{
int i;
for (i = 0; i < MAX_DEATHS; i++) {
if (DeadHandlers[i].pid == 0) {
DeadHandlers[i].pid = pid;
DeadHandlers[i].handler = handler;
DeadHandlers[i].data = data;
break;
}
}
assert(i!=MAX_DEATHS);
}
int
main(int argc, char **argv)
{
@@ -69,6 +117,8 @@ main(int argc, char **argv)
int i;
char *display_name="";
memset(DeadHandlers, 0, sizeof(DeadHandlers));
WMInitializeApplication("WPrefs", &argc, argv);
if (argc>1) {
@@ -128,8 +178,20 @@ main(int argc, char **argv)
while (1) {
XEvent event;
WMNextEvent(dpy, &event);
while (DeadChildrenCount-- > 0) {
int i;
for (i=0; i<MAX_DEATHS; i++) {
if (DeadChildren[i] == DeadHandlers[i].pid) {
(*DeadHandlers[i].handler)(DeadHandlers[i].data);
DeadHandlers[i].pid = 0;
}
}
}
WMHandleEvent(&event);
}
}

View File

@@ -10,6 +10,7 @@ POTFILES = \
$(top_builddir)/WPrefs/Configurations.c \
$(top_builddir)/WPrefs/Expert.c \
$(top_builddir)/WPrefs/Focus.c \
$(top_builddir)/WPrefs/Icons.c \
$(top_builddir)/WPrefs/KeyboardSettings.c \
$(top_builddir)/WPrefs/KeyboardShortcuts.c \
$(top_builddir)/WPrefs/Menu.c \
@@ -20,6 +21,7 @@ POTFILES = \
$(top_builddir)/WPrefs/Preferences.c \
$(top_builddir)/WPrefs/Text.c \
$(top_builddir)/WPrefs/TextureAndColor.c \
$(top_builddir)/WPrefs/Themes.c \
$(top_builddir)/WPrefs/WPrefs.c \
$(top_builddir)/WPrefs/WindowHandling.c \
$(top_builddir)/WPrefs/Workspace.c \

View File

@@ -69,6 +69,9 @@ I18N = @I18N@
I18N_MB = @I18N_MB@
ICONEXT = @ICONEXT@
INTLIBS = @INTLIBS@
LD = @LD@
LIBTOOL = @LIBTOOL@
LITE = @LITE@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MOFILES = @MOFILES@
@@ -102,6 +105,7 @@ POTFILES = \
$(top_builddir)/WPrefs/Configurations.c \
$(top_builddir)/WPrefs/Expert.c \
$(top_builddir)/WPrefs/Focus.c \
$(top_builddir)/WPrefs/Icons.c \
$(top_builddir)/WPrefs/KeyboardSettings.c \
$(top_builddir)/WPrefs/KeyboardShortcuts.c \
$(top_builddir)/WPrefs/Menu.c \
@@ -112,6 +116,7 @@ POTFILES = \
$(top_builddir)/WPrefs/Preferences.c \
$(top_builddir)/WPrefs/Text.c \
$(top_builddir)/WPrefs/TextureAndColor.c \
$(top_builddir)/WPrefs/Themes.c \
$(top_builddir)/WPrefs/WPrefs.c \
$(top_builddir)/WPrefs/WindowHandling.c \
$(top_builddir)/WPrefs/Workspace.c \
@@ -196,6 +201,7 @@ clean: clean-generic mostlyclean
distclean: distclean-generic clean
-rm -f config.status
-rm -f libtool
maintainer-clean: maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -69,6 +69,9 @@ I18N = @I18N@
I18N_MB = @I18N_MB@
ICONEXT = @ICONEXT@
INTLIBS = @INTLIBS@
LD = @LD@
LIBTOOL = @LIBTOOL@
LITE = @LITE@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MOFILES = @MOFILES@
@@ -250,6 +253,7 @@ clean: clean-generic mostlyclean
distclean: distclean-generic clean
-rm -f config.status
-rm -f libtool
maintainer-clean: maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"

View File

@@ -69,6 +69,9 @@ I18N = @I18N@
I18N_MB = @I18N_MB@
ICONEXT = @ICONEXT@
INTLIBS = @INTLIBS@
LD = @LD@
LIBTOOL = @LIBTOOL@
LITE = @LITE@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MOFILES = @MOFILES@
@@ -250,6 +253,7 @@ clean: clean-generic mostlyclean
distclean: distclean-generic clean
-rm -f config.status
-rm -f libtool
maintainer-clean: maintainer-clean-generic distclean
@echo "This command is intended for maintainers to use;"