1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-02 22:25:48 +01:00

changed indentation to use spaces only

This commit is contained in:
dan
2004-10-12 21:28:27 +00:00
parent 5912898b06
commit 6830b05716
240 changed files with 35951 additions and 35773 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* Configurations.c- misc. configurations
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -25,12 +25,12 @@
typedef struct _Panel {
WMBox *box;
char *sectionName;
char *sectionName;
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMFrame *icoF;
@@ -58,7 +58,7 @@ typedef struct _Panel {
WMLabel *dithL;
WMLabel *dith1L;
WMLabel *dith2L;
int cmapSize;
} _Panel;
@@ -87,17 +87,17 @@ static void
showData(_Panel *panel)
{
WMPerformButtonClick(panel->icoB[GetSpeedForKey("IconSlideSpeed")]);
WMPerformButtonClick(panel->shaB[GetSpeedForKey("ShadeSpeed")]);
if (GetBoolForKey("NewStyle")) {
WMPerformButtonClick(panel->newsB);
WMPerformButtonClick(panel->newsB);
} else {
WMPerformButtonClick(panel->oldsB);
WMPerformButtonClick(panel->oldsB);
}
WMSetButtonSelected(panel->animB, !GetBoolForKey("DisableAnimations"));
WMSetButtonSelected(panel->supB, GetBoolForKey("Superfluous"));
WMSetButtonSelected(panel->sfxB, !GetBoolForKey("DisableSound"));
@@ -105,7 +105,7 @@ showData(_Panel *panel)
WMSetButtonSelected(panel->smoB, GetBoolForKey("SmoothWorkspaceBack"));
WMSetButtonSelected(panel->dithB, GetBoolForKey("DisableDithering"));
WMSetSliderValue(panel->dithS, GetIntegerForKey("ColormapSize"));
updateLabel(panel->dithS, panel);
@@ -119,19 +119,19 @@ updateLabel(WMWidget *self, void *data)
_Panel *panel = (_Panel*)data;
char buffer[64];
float fl;
fl = WMGetSliderValue(sPtr);
panel->cmapSize = (int)fl;
sprintf(buffer, "%i", panel->cmapSize*panel->cmapSize*panel->cmapSize);
WMSetLabelText(panel->dithL, buffer);
}
static void
createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
WMPixmap **icon1, WMPixmap **icon2)
createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
WMPixmap **icon1, WMPixmap **icon2)
{
RImage *icon;
char *path;
@@ -142,33 +142,32 @@ createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
path = LocateImage(file);
if (!path) {
return;
return;
}
*icon1 = WMCreatePixmapFromFile(scr, path);
if (!*icon1) {
wwarning(_("could not load icon %s"), path);
wfree(path);
return;
wwarning(_("could not load icon %s"), path);
wfree(path);
return;
}
icon = RLoadImage(rc, path, 0);
if (!icon) {
wwarning(_("could not load icon %s"), path);
wfree(path);
return;
wwarning(_("could not load icon %s"), path);
wfree(path);
return;
}
RCombineImageWithColor(icon, &gray);
if (xis) {
RCombineImagesWithOpaqueness(icon, xis, 180);
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127)))
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
RCombineImagesWithOpaqueness(icon, xis, 180);
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127)))
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
}
RReleaseImage(icon);
wfree(path);
}
static void
createPanel(Panel *p)
{
@@ -181,14 +180,14 @@ createPanel(Panel *p)
RContext *rc = WMScreenRContext(scr);
WMFont *font = WMSystemFontOfSize(scr, 10);
char *path;
path = LocateImage(ARQUIVO_XIS);
if (path) {
xis = RLoadImage(rc, path, 0);
if (!xis) {
wwarning(_("could not load image file %s"), path);
}
wfree(path);
xis = RLoadImage(rc, path, 0);
if (!xis) {
wwarning(_("could not load image file %s"), path);
}
wfree(path);
}
@@ -196,70 +195,70 @@ createPanel(Panel *p)
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/*********** Icon Slide Speed **********/
panel->icoF = WMCreateFrame(panel->box);
WMResizeWidget(panel->icoF, 230, 45);
WMMoveWidget(panel->icoF, 15, 10);
WMSetFrameTitle(panel->icoF, _("Icon Slide Speed"));
/*********** Shade Animation Speed **********/
panel->shaF = WMCreateFrame(panel->box);
WMResizeWidget(panel->shaF, 230, 45);
WMMoveWidget(panel->shaF, 15, 60);
WMSetFrameTitle(panel->shaF, _("Shade Animation Speed"));
buf1 = wmalloc(strlen(SPEED_IMAGE)+1);
buf2 = wmalloc(strlen(SPEED_IMAGE_S)+1);
for (i = 0; i < 5; i++) {
panel->icoB[i] = WMCreateCustomButton(panel->icoF, WBBStateChangeMask);
panel->shaB[i] = WMCreateCustomButton(panel->shaF, WBBStateChangeMask);
WMResizeWidget(panel->icoB[i], 40, 24);
WMMoveWidget(panel->icoB[i], 10+(40*i), 15);
WMResizeWidget(panel->shaB[i], 40, 24);
WMMoveWidget(panel->shaB[i], 10+(40*i), 15);
WMSetButtonBordered(panel->icoB[i], False);
WMSetButtonImagePosition(panel->icoB[i], WIPImageOnly);
if (i > 0) {
WMGroupButtons(panel->icoB[0], panel->icoB[i]);
}
WMSetButtonBordered(panel->shaB[i], False);
WMSetButtonImagePosition(panel->shaB[i], WIPImageOnly);
if (i > 0) {
WMGroupButtons(panel->shaB[0], panel->shaB[i]);
}
sprintf(buf1, SPEED_IMAGE, i);
sprintf(buf2, SPEED_IMAGE_S, i);
path = LocateImage(buf1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->icoB[i], icon);
WMSetButtonImage(panel->shaB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonAltImage(panel->icoB[i], icon);
WMSetButtonAltImage(panel->shaB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
panel->icoB[i] = WMCreateCustomButton(panel->icoF, WBBStateChangeMask);
panel->shaB[i] = WMCreateCustomButton(panel->shaF, WBBStateChangeMask);
WMResizeWidget(panel->icoB[i], 40, 24);
WMMoveWidget(panel->icoB[i], 10+(40*i), 15);
WMResizeWidget(panel->shaB[i], 40, 24);
WMMoveWidget(panel->shaB[i], 10+(40*i), 15);
WMSetButtonBordered(panel->icoB[i], False);
WMSetButtonImagePosition(panel->icoB[i], WIPImageOnly);
if (i > 0) {
WMGroupButtons(panel->icoB[0], panel->icoB[i]);
}
WMSetButtonBordered(panel->shaB[i], False);
WMSetButtonImagePosition(panel->shaB[i], WIPImageOnly);
if (i > 0) {
WMGroupButtons(panel->shaB[0], panel->shaB[i]);
}
sprintf(buf1, SPEED_IMAGE, i);
sprintf(buf2, SPEED_IMAGE_S, i);
path = LocateImage(buf1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->icoB[i], icon);
WMSetButtonImage(panel->shaB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonAltImage(panel->icoB[i], icon);
WMSetButtonAltImage(panel->shaB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
}
wfree(buf1);
wfree(buf2);
WMMapSubwidgets(panel->icoF);
WMMapSubwidgets(panel->shaF);
@@ -270,9 +269,9 @@ createPanel(Panel *p)
WMMoveWidget(panel->smoF, 18, 115);
WMSetFrameTitle(panel->smoF, _("Smooth Scaling"));
WMSetBalloonTextForView(_("Smooth scaled background images, neutralizing\n"
"the `pixelization' effect. This will slow\n"
"down loading of background images considerably."),
WMWidgetView(panel->smoF));
"the `pixelization' effect. This will slow\n"
"down loading of background images considerably."),
WMWidgetView(panel->smoF));
panel->smoB = WMCreateButton(panel->smoF, WBTToggle);
WMResizeWidget(panel->smoB, 64, 64);
@@ -280,28 +279,28 @@ createPanel(Panel *p)
WMSetButtonImagePosition(panel->smoB, WIPImageOnly);
path = LocateImage(SMOOTH_IMAGE);
if (path) {
RImage *image, *scaled;
RImage *image, *scaled;
image = RLoadImage(WMScreenRContext(scr), path, 0);
wfree(path);
scaled = RScaleImage(image, 61, 61);
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
RReleaseImage(scaled);
if (icon) {
WMSetButtonImage(panel->smoB, icon);
WMReleasePixmap(icon);
}
image = RLoadImage(WMScreenRContext(scr), path, 0);
wfree(path);
scaled = RSmoothScaleImage(image, 61, 61);
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
RReleaseImage(scaled);
if (icon) {
WMSetButtonAltImage(panel->smoB, icon);
WMReleasePixmap(icon);
}
scaled = RScaleImage(image, 61, 61);
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
RReleaseImage(scaled);
if (icon) {
WMSetButtonImage(panel->smoB, icon);
WMReleasePixmap(icon);
}
RReleaseImage(image);
scaled = RSmoothScaleImage(image, 61, 61);
icon = WMCreatePixmapFromRImage(scr, scaled, 128);
RReleaseImage(scaled);
if (icon) {
WMSetButtonAltImage(panel->smoB, icon);
WMReleasePixmap(icon);
}
RReleaseImage(image);
}
WMMapSubwidgets(panel->smoF);
@@ -311,18 +310,18 @@ createPanel(Panel *p)
WMResizeWidget(panel->titlF, 105, 110);
WMMoveWidget(panel->titlF, 140, 115);
WMSetFrameTitle(panel->titlF, _("Titlebar Style"));
panel->newsB = WMCreateButton(panel->titlF, WBTOnOff);
WMResizeWidget(panel->newsB, 74, 40);
WMMoveWidget(panel->newsB, 15, 20);
WMSetButtonImagePosition(panel->newsB, WIPImageOnly);
path = LocateImage(NEWS_IMAGE);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->newsB, icon);
WMReleasePixmap(icon);
}
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->newsB, icon);
WMReleasePixmap(icon);
}
}
panel->oldsB = WMCreateButton(panel->titlF, WBTOnOff);
@@ -331,25 +330,25 @@ createPanel(Panel *p)
WMSetButtonImagePosition(panel->oldsB, WIPImageOnly);
path = LocateImage(OLDS_IMAGE);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->oldsB, icon);
WMReleasePixmap(icon);
}
wfree(path);
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->oldsB, icon);
WMReleasePixmap(icon);
}
wfree(path);
}
WMGroupButtons(panel->newsB, panel->oldsB);
WMMapSubwidgets(panel->titlF);
/**************** Features ******************/
panel->animF = WMCreateFrame(panel->box);
WMResizeWidget(panel->animF, 255, 115);
WMMoveWidget(panel->animF, 255, 10);
WMSetFrameTitle(panel->animF, _("Animations and Sound"));
panel->animB = WMCreateButton(panel->animF, WBTToggle);
WMResizeWidget(panel->animB, 64, 64);
WMMoveWidget(panel->animB, 15, 20);
@@ -358,16 +357,16 @@ createPanel(Panel *p)
WMSetButtonImagePosition(panel->animB, WIPAbove);
createImages(scr, rc, xis, ANIM_IMAGE, &altIcon, &icon);
if (icon) {
WMSetButtonImage(panel->animB, icon);
WMReleasePixmap(icon);
WMSetButtonImage(panel->animB, icon);
WMReleasePixmap(icon);
}
if (altIcon) {
WMSetButtonAltImage(panel->animB, altIcon);
WMReleasePixmap(altIcon);
WMSetButtonAltImage(panel->animB, altIcon);
WMReleasePixmap(altIcon);
}
WMSetBalloonTextForView(_("Disable/enable animations such as those shown\n"
"for window miniaturization, shading etc."),
WMWidgetView(panel->animB));
"for window miniaturization, shading etc."),
WMWidgetView(panel->animB));
panel->supB = WMCreateButton(panel->animF, WBTToggle);
WMResizeWidget(panel->supB, 64, 64);
@@ -377,19 +376,19 @@ createPanel(Panel *p)
WMSetButtonImagePosition(panel->supB, WIPAbove);
createImages(scr, rc, xis, SUPERF_IMAGE, &altIcon, &icon);
if (icon) {
WMSetButtonImage(panel->supB, icon);
WMReleasePixmap(icon);
WMSetButtonImage(panel->supB, icon);
WMReleasePixmap(icon);
}
if (altIcon) {
WMSetButtonAltImage(panel->supB, altIcon);
WMReleasePixmap(altIcon);
WMSetButtonAltImage(panel->supB, altIcon);
WMReleasePixmap(altIcon);
}
WMSetBalloonTextForView(_("Disable/enable `superfluous' features and\n"
"animations. These include the `ghosting' of the\n"
"dock when it's being moved to another side and\n"
"the explosion animation when undocking icons."),
WMWidgetView(panel->supB));
"animations. These include the `ghosting' of the\n"
"dock when it's being moved to another side and\n"
"the explosion animation when undocking icons."),
WMWidgetView(panel->supB));
panel->sfxB = WMCreateButton(panel->animF, WBTToggle);
WMResizeWidget(panel->sfxB, 64, 64);
WMMoveWidget(panel->sfxB, 175, 20);
@@ -398,40 +397,40 @@ createPanel(Panel *p)
WMSetButtonImagePosition(panel->sfxB, WIPAbove);
createImages(scr, rc, xis, SOUND_IMAGE, &altIcon, &icon);
if (icon) {
WMSetButtonImage(panel->sfxB, icon);
WMReleasePixmap(icon);
WMSetButtonImage(panel->sfxB, icon);
WMReleasePixmap(icon);
}
if (altIcon) {
WMSetButtonAltImage(panel->sfxB, altIcon);
WMReleasePixmap(altIcon);
WMSetButtonAltImage(panel->sfxB, altIcon);
WMReleasePixmap(altIcon);
}
WMSetBalloonTextForView(_("Disable/enable support for sound effects played\n"
"for actions like shading and closing a window.\n"
"You will need a module distributed separately\n"
"for this. You can get it at:\n"
"http://shadowmere.student.utwente.nl/"),
WMWidgetView(panel->sfxB));
"for actions like shading and closing a window.\n"
"You will need a module distributed separately\n"
"for this. You can get it at:\n"
"http://shadowmere.student.utwente.nl/"),
WMWidgetView(panel->sfxB));
panel->noteL = WMCreateLabel(panel->animF);
WMResizeWidget(panel->noteL, 235, 28);
WMMoveWidget(panel->noteL, 10, 85);
WMSetLabelFont(panel->noteL, font);
WMSetLabelText(panel->noteL, _("Note: sound requires a module distributed\nseparately"));
WMMapSubwidgets(panel->animF);
/*********** Dithering **********/
panel->cmapSize = 4;
panel->dithF = WMCreateFrame(panel->box);
WMResizeWidget(panel->dithF, 255, 95);
WMMoveWidget(panel->dithF, 255, 130);
WMSetFrameTitle(panel->dithF, _("Dithering colormap for 8bpp"));
WMSetBalloonTextForView(_("Number of colors to reserve for Window Maker\n"
"on displays that support only 8bpp (PseudoColor)."),
WMWidgetView(panel->dithF));
"on displays that support only 8bpp (PseudoColor)."),
WMWidgetView(panel->dithF));
panel->dithB = WMCreateSwitchButton(panel->dithF);
WMResizeWidget(panel->dithB, 235, 32);
WMMoveWidget(panel->dithB, 15, 15);
@@ -450,7 +449,7 @@ createPanel(Panel *p)
WMSetSliderMaxValue(panel->dithS, 6);
WMSetSliderContinuous(panel->dithS, True);
WMSetSliderAction(panel->dithS, updateLabel, panel);
panel->dith1L = WMCreateLabel(panel->dithF);
WMResizeWidget(panel->dith1L, 70, 35);
WMMoveWidget(panel->dith1L, 5, 50);
@@ -466,14 +465,14 @@ createPanel(Panel *p)
WMSetLabelText(panel->dith2L, _("More colors for\nWindow Maker"));
WMMapSubwidgets(panel->dithF);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
if (xis)
RReleaseImage(xis);
RReleaseImage(xis);
WMReleaseFont(font);
showData(panel);
}
@@ -484,26 +483,26 @@ storeData(_Panel *panel)
int i;
for (i=0; i<5; i++) {
if (WMGetButtonSelected(panel->icoB[i]))
break;
if (WMGetButtonSelected(panel->icoB[i]))
break;
}
SetSpeedForKey(i, "IconSlideSpeed");
for (i=0; i<5; i++) {
if (WMGetButtonSelected(panel->shaB[i]))
break;
if (WMGetButtonSelected(panel->shaB[i]))
break;
}
SetSpeedForKey(i, "ShadeSpeed");
SetBoolForKey(WMGetButtonSelected(panel->newsB), "NewStyle");
SetBoolForKey(!WMGetButtonSelected(panel->animB), "DisableAnimations");
SetBoolForKey(WMGetButtonSelected(panel->supB), "Superfluous");
SetBoolForKey(!WMGetButtonSelected(panel->sfxB), "DisableSound");
SetBoolForKey(WMGetButtonSelected(panel->smoB), "SmoothWorkspaceBack");
SetBoolForKey(WMGetButtonSelected(panel->dithB), "DisableDithering");
SetIntegerForKey(WMGetSliderValue(panel->dithS), "ColormapSize");
}
@@ -521,8 +520,8 @@ InitConfigurations(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Other Configurations");
panel->description = _("Animation speeds, titlebar styles, various option\n"
"toggling and number of colors to reserve for\n"
"Window Maker on 8bit displays.");
"toggling and number of colors to reserve for\n"
"Window Maker on 8bit displays.");
panel->parent = parent;
@@ -533,3 +532,5 @@ InitConfigurations(WMScreen *scr, WMWidget *parent)
return panel;
}

View File

@@ -1,9 +1,9 @@
/* Expert.c- expert user options
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -30,7 +30,7 @@ typedef struct _Panel {
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMButton *swi[8];
@@ -55,7 +55,7 @@ showData(_Panel *panel)
WMSetButtonSelected(panel->swi[5], GetBoolForKey("DontConfirmKill"));
WMSetButtonSelected(panel->swi[6], GetBoolForKey("DisableBlinking"));
//if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
WMSetButtonSelected(panel->swi[7], GetBoolForKey("AntialiasedText"));
WMSetButtonSelected(panel->swi[7], GetBoolForKey("AntialiasedText"));
}
@@ -69,11 +69,11 @@ createPanel(Panel *p)
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
for (i=0; i<8; i++) {
panel->swi[i] = WMCreateSwitchButton(panel->box);
WMResizeWidget(panel->swi[i], FRAME_WIDTH-40, 25);
WMMoveWidget(panel->swi[i], 20, 20+i*25);
panel->swi[i] = WMCreateSwitchButton(panel->box);
WMResizeWidget(panel->swi[i], FRAME_WIDTH-40, 25);
WMMoveWidget(panel->swi[i], 20, 20+i*25);
}
WMSetButtonText(panel->swi[0], _("Disable miniwindows (icons for miniaturized windows). For use with KDE/GNOME."));
WMSetButtonText(panel->swi[1], _("Do not set non-WindowMaker specific parameters (do not use xset)."));
WMSetButtonText(panel->swi[2], _("Automatically save session when exiting Window Maker."));
@@ -84,11 +84,11 @@ createPanel(Panel *p)
WMSetButtonText(panel->swi[7], _("Smooth font edges (needs restart)."));
//if (!WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
WMSetButtonEnabled(panel->swi[7], True);
WMSetButtonEnabled(panel->swi[7], True);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
@@ -108,7 +108,7 @@ storeDefaults(_Panel *panel)
SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DontConfirmKill");
SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "DisableBlinking");
//if (WMHasAntialiasingSupport(WMWidgetScreen(panel->box)))
SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "AntialiasedText");
SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "AntialiasedText");
}
@@ -123,14 +123,15 @@ InitExpert(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Expert User Preferences");
panel->description = _("Options for people who know what they're doing...\n"
"Also have some other misc. options.");
"Also have some other misc. options.");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeDefaults;
AddSection(panel, ICON_FILE);
return panel;
}

View File

@@ -1,9 +1,9 @@
/* Focus.c- input and colormap focus stuff
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -31,25 +31,25 @@ typedef struct _Panel {
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMFrame *kfocF;
WMButton *kfocB[2];
WMFrame *cfocF;
WMButton *autB;
WMButton *manB;
WMFrame *raisF;
WMButton *raisB[5];
WMTextField *raisT;
WMLabel *raisL;
WMFrame *optF;
WMButton *ignB;
WMButton *newB;
char raiseDelaySelected;
} _Panel;
@@ -67,33 +67,33 @@ showData(_Panel *panel)
char *str;
int i;
char buffer[32];
str = GetStringForKey("FocusMode");
if (!str)
str = "manual";
str = "manual";
if (strcasecmp(str, "manual")==0 || strcasecmp(str, "clicktofocus")==0)
WMSetButtonSelected(panel->kfocB[0], 1);
else if (strcasecmp(str, "auto")==0 || strcasecmp(str, "semiauto")==0
|| strcasecmp(str, "sloppy")==0)
WMSetButtonSelected(panel->kfocB[1], 1);
WMSetButtonSelected(panel->kfocB[0], 1);
else if (strcasecmp(str, "auto")==0 || strcasecmp(str, "semiauto")==0
|| strcasecmp(str, "sloppy")==0)
WMSetButtonSelected(panel->kfocB[1], 1);
else {
wwarning(_("bad option value %s for option FocusMode. Using default Manual"),
str);
WMSetButtonSelected(panel->kfocB[0], 1);
wwarning(_("bad option value %s for option FocusMode. Using default Manual"),
str);
WMSetButtonSelected(panel->kfocB[0], 1);
}
/**/
str = GetStringForKey("ColormapMode");
if (!str)
str = "auto";
str = "auto";
if (strcasecmp(str, "manual")==0 || strcasecmp(str, "clicktofocus")==0) {
WMPerformButtonClick(panel->manB);
WMPerformButtonClick(panel->manB);
} else if (strcasecmp(str, "auto")==0 || strcasecmp(str, "focusfollowsmouse")==0) {
WMPerformButtonClick(panel->autB);
WMPerformButtonClick(panel->autB);
} else {
wwarning(_("bad option value %s for option ColormapMode. Using default Auto"),
str);
WMPerformButtonClick(panel->manB);
wwarning(_("bad option value %s for option ColormapMode. Using default Auto"),
str);
WMPerformButtonClick(panel->manB);
}
/**/
@@ -102,21 +102,21 @@ showData(_Panel *panel)
WMSetTextFieldText(panel->raisT, buffer);
switch (i) {
case 0:
WMPerformButtonClick(panel->raisB[0]);
break;
case 10:
WMPerformButtonClick(panel->raisB[1]);
break;
case 100:
WMPerformButtonClick(panel->raisB[2]);
break;
case 350:
WMPerformButtonClick(panel->raisB[3]);
break;
case 800:
WMPerformButtonClick(panel->raisB[4]);
break;
case 0:
WMPerformButtonClick(panel->raisB[0]);
break;
case 10:
WMPerformButtonClick(panel->raisB[1]);
break;
case 100:
WMPerformButtonClick(panel->raisB[2]);
break;
case 350:
WMPerformButtonClick(panel->raisB[3]);
break;
case 800:
WMPerformButtonClick(panel->raisB[4]);
break;
}
/**/
@@ -134,25 +134,25 @@ storeData(_Panel *panel)
int i;
if (WMGetButtonSelected(panel->kfocB[1]))
str = "sloppy";
str = "sloppy";
else
str = "manual";
str = "manual";
SetStringForKey(str, "FocusMode");
if (WMGetButtonSelected(panel->manB)) {
SetStringForKey("manual", "ColormapMode");
SetStringForKey("manual", "ColormapMode");
} else {
SetStringForKey("auto", "ColormapMode");
SetStringForKey("auto", "ColormapMode");
}
str = WMGetTextFieldText(panel->raisT);
if (sscanf(str, "%i", &i)!=1)
i = 0;
i = 0;
SetIntegerForKey(i, "RaiseDelay");
SetBoolForKey(WMGetButtonSelected(panel->ignB), "IgnoreFocusClick");
SetBoolForKey(WMGetButtonSelected(panel->newB), "AutoFocus");
SetBoolForKey(WMGetButtonSelected(panel->newB), "AutoFocus");
}
@@ -163,15 +163,15 @@ pushDelayButton(WMWidget *w, void *data)
panel->raiseDelaySelected = 1;
if (w == panel->raisB[0]) {
WMSetTextFieldText(panel->raisT, "OFF");
WMSetTextFieldText(panel->raisT, "OFF");
} else if (w == panel->raisB[1]) {
WMSetTextFieldText(panel->raisT, "10");
WMSetTextFieldText(panel->raisT, "10");
} else if (w == panel->raisB[2]) {
WMSetTextFieldText(panel->raisT, "100");
WMSetTextFieldText(panel->raisT, "100");
} else if (w == panel->raisB[3]) {
WMSetTextFieldText(panel->raisT, "350");
WMSetTextFieldText(panel->raisT, "350");
} else if (w == panel->raisB[4]) {
WMSetTextFieldText(panel->raisT, "800");
WMSetTextFieldText(panel->raisT, "800");
}
}
@@ -183,10 +183,10 @@ raiseTextChanged(void *observerData, WMNotification *notification)
int i;
if (panel->raiseDelaySelected) {
for (i=0; i<5; i++) {
WMSetButtonSelected(panel->raisB[i], False);
}
panel->raiseDelaySelected = 0;
for (i=0; i<5; i++) {
WMSetButtonSelected(panel->raisB[i], False);
}
panel->raiseDelaySelected = 0;
}
}
@@ -206,7 +206,7 @@ createPanel(Panel *p)
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/***************** Input Focus Mode *****************/
panel->kfocF = WMCreateFrame(panel->box);
WMResizeWidget(panel->kfocF, 240, 130);
@@ -214,29 +214,29 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->kfocF, _("Input Focus Mode"));
{
WMBox *box = WMCreateBox(panel->kfocF);
WMSetViewExpandsToParent(WMWidgetView(box), 10, 15, 10, 10);
WMSetBoxHorizontal(box, False);
panel->kfocB[0] = WMCreateRadioButton(box);
WMBox *box = WMCreateBox(panel->kfocF);
WMSetViewExpandsToParent(WMWidgetView(box), 10, 15, 10, 10);
WMSetBoxHorizontal(box, False);
panel->kfocB[0] = WMCreateRadioButton(box);
WMSetButtonText(panel->kfocB[0], _("Manual: Click on the window to set "\
"keyboard input focus"));
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[0]), True, True,
20, 0, 0);
"keyboard input focus"));
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[0]), True, True,
20, 0, 0);
panel->kfocB[1] = WMCreateRadioButton(box);
WMGroupButtons(panel->kfocB[0], panel->kfocB[1]);
WMSetButtonText(panel->kfocB[1], _("Auto: Set keyboard input focus to "\
"the window under the mouse pointer"));
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[1]), True, True,
20, 0, 0);
panel->kfocB[1] = WMCreateRadioButton(box);
WMGroupButtons(panel->kfocB[0], panel->kfocB[1]);
WMSetButtonText(panel->kfocB[1], _("Auto: Set keyboard input focus to "\
"the window under the mouse pointer"));
WMAddBoxSubview(box, WMWidgetView(panel->kfocB[1]), True, True,
20, 0, 0);
WMMapSubwidgets(box);
WMMapWidget(box);
WMMapSubwidgets(box);
WMMapWidget(box);
}
/***************** Colormap Installation Mode ****************/
panel->cfocF = WMCreateFrame(panel->box);
WMResizeWidget(panel->cfocF, 240, 70);
WMMoveWidget(panel->cfocF, 15, 150);
@@ -252,84 +252,84 @@ createPanel(Panel *p)
WMMoveWidget(panel->autB, 10, 43);
WMSetButtonText(panel->autB, _("...that is under the mouse pointer."));
WMGroupButtons(panel->manB, panel->autB);
WMMapSubwidgets(panel->cfocF);
/***************** Automatic window raise delay *****************/
panel->raisF = WMCreateFrame(panel->box);
WMResizeWidget(panel->raisF, 245, 70);
WMMoveWidget(panel->raisF, 265, 15);
WMSetFrameTitle(panel->raisF, _("Automatic Window Raise Delay"));
buf1 = wmalloc(strlen(DELAY_ICON)+1);
buf2 = wmalloc(strlen(DELAY_ICON_S)+1);
for (i = 0; i < 5; i++) {
char *path;
panel->raisB[i] = WMCreateCustomButton(panel->raisF,
WBBStateChangeMask);
WMResizeWidget(panel->raisB[i], 25, 25);
WMMoveWidget(panel->raisB[i], 10+(30*i), 25);
WMSetButtonBordered(panel->raisB[i], False);
WMSetButtonImagePosition(panel->raisB[i], WIPImageOnly);
WMSetButtonAction(panel->raisB[i], pushDelayButton, panel);
if (i>0)
WMGroupButtons(panel->raisB[0], panel->raisB[i]);
sprintf(buf1, DELAY_ICON, i);
sprintf(buf2, DELAY_ICON_S, i);
path = LocateImage(buf1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->raisB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonAltImage(panel->raisB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
char *path;
panel->raisB[i] = WMCreateCustomButton(panel->raisF,
WBBStateChangeMask);
WMResizeWidget(panel->raisB[i], 25, 25);
WMMoveWidget(panel->raisB[i], 10+(30*i), 25);
WMSetButtonBordered(panel->raisB[i], False);
WMSetButtonImagePosition(panel->raisB[i], WIPImageOnly);
WMSetButtonAction(panel->raisB[i], pushDelayButton, panel);
if (i>0)
WMGroupButtons(panel->raisB[0], panel->raisB[i]);
sprintf(buf1, DELAY_ICON, i);
sprintf(buf2, DELAY_ICON_S, i);
path = LocateImage(buf1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->raisB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonAltImage(panel->raisB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
}
wfree(buf1);
wfree(buf2);
panel->raisT = WMCreateTextField(panel->raisF);
WMResizeWidget(panel->raisT, 36, 20);
WMMoveWidget(panel->raisT, 165, 30);
WMAddNotificationObserver(raiseTextChanged, panel,
WMTextDidChangeNotification, panel->raisT);
WMAddNotificationObserver(raiseTextChanged, panel,
WMTextDidChangeNotification, panel->raisT);
color = WMDarkGrayColor(scr);
font = WMSystemFontOfSize(scr, 10);
panel->raisL = WMCreateLabel(panel->raisF);
WMResizeWidget(panel->raisL, 36, 16);
WMMoveWidget(panel->raisL, 205, 35);
WMSetLabelText(panel->raisL, _("msec"));
WMSetLabelTextColor(panel->raisL, color);
WMSetLabelFont(panel->raisL, font);
WMReleaseColor(color);
WMReleaseFont(font);
WMMapSubwidgets(panel->raisF);
/***************** Options ****************/
panel->optF = WMCreateFrame(panel->box);
WMResizeWidget(panel->optF, 245, 125);
WMMoveWidget(panel->optF, 265, 95);
panel->ignB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->ignB, 225, 50);
WMMoveWidget(panel->ignB, 10, 10);
@@ -343,10 +343,10 @@ createPanel(Panel *p)
WMMapSubwidgets(panel->optF);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
@@ -363,14 +363,15 @@ InitFocus(WMScreen *scr, WMWindow *win)
panel->sectionName = _("Window Focus Preferences");
panel->description = _("Keyboard focus switching policy, colormap switching\n"
"policy for 8bpp displays and other related options.");
"policy for 8bpp displays and other related options.");
panel->parent = win;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
AddSection(panel, ICON_FILE);
return panel;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* Icons.c- icon preferences
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -32,9 +32,9 @@ typedef struct _Panel {
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMFrame *posF;
WMFrame *posVF;
WMFrame *posV;
@@ -47,7 +47,7 @@ typedef struct _Panel {
WMFrame *optF;
WMButton *arrB;
WMButton *omnB;
WMFrame *sizeF;
WMPopUpButton *sizeP;
@@ -65,36 +65,36 @@ showIconLayout(WMWidget *widget, void *data)
_Panel *panel = (_Panel*)data;
int w, h;
int i;
for (i=0; i<8; i++) {
if (panel->posB[i] == widget) {
panel->iconPos = i;
break;
}
if (panel->posB[i] == widget) {
panel->iconPos = i;
break;
}
}
if (panel->iconPos & 1) {
w = 32;
h = 8;
w = 32;
h = 8;
} else {
w = 8;
h = 32;
w = 8;
h = 32;
}
WMResizeWidget(panel->posV, w, h);
switch (panel->iconPos & ~1) {
case 0:
WMMoveWidget(panel->posV, 2, 2);
break;
case 2:
WMMoveWidget(panel->posV, 95-2-w, 2);
break;
case 4:
WMMoveWidget(panel->posV, 2, 70-2-h);
break;
default:
WMMoveWidget(panel->posV, 95-2-w, 70-2-h);
break;
case 0:
WMMoveWidget(panel->posV, 2, 2);
break;
case 2:
WMMoveWidget(panel->posV, 95-2-w, 2);
break;
case 4:
WMMoveWidget(panel->posV, 2, 70-2-h);
break;
default:
WMMoveWidget(panel->posV, 95-2-w, 70-2-h);
break;
}
}
@@ -105,56 +105,56 @@ showData(_Panel *panel)
int i;
char *str;
char *def = "blh";
WMSetButtonSelected(panel->arrB, GetBoolForKey("AutoArrangeIcons"));
WMSetButtonSelected(panel->omnB, GetBoolForKey("StickyIcons"));
str = GetStringForKey("IconPosition");
if (!str)
str = def;
str = def;
if (strlen(str)!=3) {
wwarning("bad value %s for option IconPosition. Using default blh",
str);
str = def;
wwarning("bad value %s for option IconPosition. Using default blh",
str);
str = def;
}
if (str[0]=='t' || str[0]=='T') {
i = 0;
i = 0;
} else {
i = 4;
i = 4;
}
if (str[1]=='r' || str[1]=='R') {
i += 2;
i += 2;
}
if (str[2]=='v' || str[2]=='V') {
i += 0;
i += 0;
} else {
i += 1;
i += 1;
}
panel->iconPos = i;
WMPerformButtonClick(panel->posB[i]);
i = GetIntegerForKey("IconSize");
i = (i-24)/8;
if (i<0)
i = 0;
i = 0;
else if (i>9)
i = 9;
i = 9;
WMSetPopUpButtonSelectedItem(panel->sizeP, i);
str = GetStringForKey("IconificationStyle");
if (!str)
str = "zoom";
str = "zoom";
if (strcasecmp(str, "none")==0)
WMPerformButtonClick(panel->animB[3]);
WMPerformButtonClick(panel->animB[3]);
else if (strcasecmp(str, "twist")==0)
WMPerformButtonClick(panel->animB[1]);
WMPerformButtonClick(panel->animB[1]);
else if (strcasecmp(str, "flip")==0)
WMPerformButtonClick(panel->animB[2]);
WMPerformButtonClick(panel->animB[2]);
else {
WMPerformButtonClick(panel->animB[0]);
WMPerformButtonClick(panel->animB[0]);
}
}
@@ -172,7 +172,7 @@ createPanel(Panel *p)
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/***************** Positioning of Icons *****************/
panel->posF = WMCreateFrame(panel->box);
WMResizeWidget(panel->posF, 260, 135);
@@ -180,11 +180,11 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->posF, _("Icon Positioning"));
for (i=0; i<8; i++) {
panel->posB[i] = WMCreateButton(panel->posF, WBTOnOff);
WMSetButtonAction(panel->posB[i], showIconLayout, panel);
panel->posB[i] = WMCreateButton(panel->posF, WBTOnOff);
WMSetButtonAction(panel->posB[i], showIconLayout, panel);
if (i>0)
WMGroupButtons(panel->posB[0], panel->posB[i]);
if (i>0)
WMGroupButtons(panel->posB[0], panel->posB[i]);
}
WMMoveWidget(panel->posB[1], 70, 23);
WMResizeWidget(panel->posB[1], 47, 15);
@@ -206,8 +206,8 @@ createPanel(Panel *p)
WMMoveWidget(panel->posB[6], 70+95, 38+35);
WMResizeWidget(panel->posB[6], 15, 35);
color = WMCreateRGBColor(WMWidgetScreen(panel->parent), 0x5100, 0x5100,
0x7100, True);
color = WMCreateRGBColor(WMWidgetScreen(panel->parent), 0x5100, 0x5100,
0x7100, True);
panel->posVF = WMCreateFrame(panel->posF);
WMResizeWidget(panel->posVF, 95, 70);
WMMoveWidget(panel->posVF, 70, 38);
@@ -217,9 +217,9 @@ createPanel(Panel *p)
panel->posV = WMCreateFrame(panel->posVF);
WMSetFrameRelief(panel->posV, WRSimple);
WMMapSubwidgets(panel->posF);
/***************** Animation ****************/
panel->animF = WMCreateFrame(panel->box);
WMResizeWidget(panel->animF, 205, 135);
@@ -227,9 +227,9 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->animF, _("Iconification Animation"));
for (i=0; i<4; i++) {
panel->animB[i] = WMCreateRadioButton(panel->animF);
WMResizeWidget(panel->animB[i], 170, 20);
WMMoveWidget(panel->animB[i], 20, 24+i*25);
panel->animB[i] = WMCreateRadioButton(panel->animF);
WMResizeWidget(panel->animB[i], 170, 20);
WMMoveWidget(panel->animB[i], 20, 24+i*25);
}
WMGroupButtons(panel->animB[0], panel->animB[1]);
WMGroupButtons(panel->animB[0], panel->animB[2]);
@@ -246,15 +246,15 @@ createPanel(Panel *p)
panel->optF = WMCreateFrame(panel->box);
WMResizeWidget(panel->optF, 260, 70);
WMMoveWidget(panel->optF, 25, 150);
/* WMSetFrameTitle(panel->optF, _("Icon Display"));*/
/* WMSetFrameTitle(panel->optF, _("Icon Display"));*/
panel->arrB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->arrB, 235, 20);
WMMoveWidget(panel->arrB, 15, 15);
WMSetButtonText(panel->arrB, _("Auto-arrange icons"));
WMSetBalloonTextForView(_("Keep icons and miniwindows arranged all the time."),
WMWidgetView(panel->arrB));
WMWidgetView(panel->arrB));
panel->omnB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->omnB, 235, 20);
@@ -262,10 +262,10 @@ createPanel(Panel *p)
WMSetButtonText(panel->omnB, _("Omnipresent miniwindows"));
WMSetBalloonTextForView(_("Make miniwindows be present in all workspaces."),
WMWidgetView(panel->omnB));
WMWidgetView(panel->omnB));
WMMapSubwidgets(panel->optF);
/***************** Icon Size ****************/
panel->sizeF = WMCreateFrame(panel->box);
WMResizeWidget(panel->sizeF, 205, 70);
@@ -273,21 +273,21 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->sizeF, _("Icon Size"));
WMSetBalloonTextForView(_("The size of the dock/application icon and miniwindows"),
WMWidgetView(panel->sizeF));
WMWidgetView(panel->sizeF));
panel->sizeP = WMCreatePopUpButton(panel->sizeF);
WMResizeWidget(panel->sizeP, 156, 20);
WMMoveWidget(panel->sizeP, 25, 30);
for (i=24; i<=96; i+=8) {
sprintf(buf, "%ix%i", i, i);
WMAddPopUpButtonItem(panel->sizeP, buf);
sprintf(buf, "%ix%i", i, i);
WMAddPopUpButtonItem(panel->sizeP, buf);
}
WMMapSubwidgets(panel->sizeF);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
@@ -301,35 +301,35 @@ storeData(_Panel *panel)
SetBoolForKey(WMGetButtonSelected(panel->omnB), "StickyIcons");
SetIntegerForKey(WMGetPopUpButtonSelectedItem(panel->sizeP)*8+24,
"IconSize");
"IconSize");
buf[3] = 0;
if (panel->iconPos < 4) {
buf[0] = 't';
buf[0] = 't';
} else {
buf[0] = 'b';
buf[0] = 'b';
}
if (panel->iconPos & 2) {
buf[1] = 'r';
buf[1] = 'r';
} else {
buf[1] = 'l';
buf[1] = 'l';
}
if (panel->iconPos & 1) {
buf[2] = 'h';
buf[2] = 'h';
} else {
buf[2] = 'v';
buf[2] = 'v';
}
SetStringForKey(buf, "IconPosition");
if (WMGetButtonSelected(panel->animB[0]))
SetStringForKey("zoom", "IconificationStyle");
SetStringForKey("zoom", "IconificationStyle");
else if (WMGetButtonSelected(panel->animB[1]))
SetStringForKey("twist", "IconificationStyle");
SetStringForKey("twist", "IconificationStyle");
else if (WMGetButtonSelected(panel->animB[2]))
SetStringForKey("flip", "IconificationStyle");
else
SetStringForKey("none", "IconificationStyle");
SetStringForKey("flip", "IconificationStyle");
else
SetStringForKey("none", "IconificationStyle");
}
@@ -345,7 +345,7 @@ InitIcons(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Icon Preferences");
panel->description = _("Icon/Miniwindow handling options. Icon positioning\n"
"area, sizes of icons, miniaturization animation style.");
"area, sizes of icons, miniaturization animation style.");
panel->parent = parent;
@@ -356,3 +356,4 @@ InitIcons(WMScreen *scr, WMWidget *parent)
return panel;
}

View File

@@ -1,9 +1,9 @@
/* KeyboardSettings.c- keyboard options (equivalent to xset)
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -38,12 +38,12 @@ typedef struct _Panel {
WMButton *delaB[4];
WMLabel *dmsL;
WMTextField *dmsT;
WMFrame *rateF;
WMButton *rateB[4];
WMLabel *rmsL;
WMTextField *rmsT;
WMTextField *testT;
} _Panel;
@@ -65,38 +65,38 @@ createPanel(Panel *p)
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/**************** Initial Key Repeat ***************/
panel->delaF = WMCreateFrame(panel->box);
WMResizeWidget(panel->delaF, 495, 60);
WMMoveWidget(panel->delaF, 15, 10);
WMSetFrameTitle(panel->delaF, _("Initial Key Repeat"));
for (i = 0; i < 4; i++) {
panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
WMResizeWidget(panel->delaB[i], 60, 20);
WMMoveWidget(panel->delaB[i], 70+i*60, 25);
if (i>0)
WMGroupButtons(panel->delaB[0], panel->delaB[i]);
switch (i) {
case 0:
WMSetButtonText(panel->delaB[i], "....a");
break;
case 1:
WMSetButtonText(panel->delaB[i], "...a");
break;
case 2:
WMSetButtonText(panel->delaB[i], "..a");
break;
case 3:
WMSetButtonText(panel->delaB[i], ".a");
break;
}
panel->delaB[i] = WMCreateButton(panel->delaF, WBTOnOff);
WMResizeWidget(panel->delaB[i], 60, 20);
WMMoveWidget(panel->delaB[i], 70+i*60, 25);
if (i>0)
WMGroupButtons(panel->delaB[0], panel->delaB[i]);
switch (i) {
case 0:
WMSetButtonText(panel->delaB[i], "....a");
break;
case 1:
WMSetButtonText(panel->delaB[i], "...a");
break;
case 2:
WMSetButtonText(panel->delaB[i], "..a");
break;
case 3:
WMSetButtonText(panel->delaB[i], ".a");
break;
}
}
panel->dmsT = WMCreateTextField(panel->delaF);
WMResizeWidget(panel->dmsT, 50, 20);
WMMoveWidget(panel->dmsT, 345, 25);
/* WMSetTextFieldAlignment(panel->dmsT, WARight);*/
/* WMSetTextFieldAlignment(panel->dmsT, WARight);*/
panel->dmsL = WMCreateLabel(panel->delaF);
WMResizeWidget(panel->dmsL, 30, 16);
@@ -104,48 +104,48 @@ createPanel(Panel *p)
WMSetLabelTextColor(panel->dmsL, color);
WMSetLabelFont(panel->dmsL, font);
WMSetLabelText(panel->dmsL, "msec");
WMMapSubwidgets(panel->delaF);
/**************** Key Repeat Rate ***************/
panel->rateF = WMCreateFrame(panel->box);
WMResizeWidget(panel->rateF, 495, 60);
WMMoveWidget(panel->rateF, 15, 95);
WMSetFrameTitle(panel->rateF, _("Key Repeat Rate"));
for (i = 0; i < 4; i++) {
panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
WMResizeWidget(panel->rateB[i], 60, 20);
WMMoveWidget(panel->rateB[i], 70+i*60, 25);
if (i>0)
WMGroupButtons(panel->rateB[0], panel->rateB[i]);
switch (i) {
case 0:
WMSetButtonText(panel->rateB[i], "a....a");
break;
case 1:
WMSetButtonText(panel->rateB[i], "a...a");
break;
case 2:
WMSetButtonText(panel->rateB[i], "a..a");
break;
case 3:
WMSetButtonText(panel->rateB[i], "a.a");
break;
}
panel->rateB[i] = WMCreateButton(panel->rateF, WBTOnOff);
WMResizeWidget(panel->rateB[i], 60, 20);
WMMoveWidget(panel->rateB[i], 70+i*60, 25);
if (i>0)
WMGroupButtons(panel->rateB[0], panel->rateB[i]);
switch (i) {
case 0:
WMSetButtonText(panel->rateB[i], "a....a");
break;
case 1:
WMSetButtonText(panel->rateB[i], "a...a");
break;
case 2:
WMSetButtonText(panel->rateB[i], "a..a");
break;
case 3:
WMSetButtonText(panel->rateB[i], "a.a");
break;
}
}
panel->rmsT = WMCreateTextField(panel->rateF);
WMResizeWidget(panel->rmsT, 50, 20);
WMMoveWidget(panel->rmsT, 345, 25);
/* WMSetTextFieldAlignment(panel->rmsT, WARight);*/
/* WMSetTextFieldAlignment(panel->rmsT, WARight);*/
panel->rmsL = WMCreateLabel(panel->rateF);
WMResizeWidget(panel->rmsL, 30, 16);
WMMoveWidget(panel->rmsL, 400, 30);
WMSetLabelTextColor(panel->rmsL, color);
WMSetLabelFont(panel->rmsL, font);
WMSetLabelText(panel->rmsL, "msec");
WMMapSubwidgets(panel->rateF);
panel->testT = WMCreateTextField(panel->box);
@@ -155,7 +155,7 @@ createPanel(Panel *p)
WMReleaseColor(color);
WMReleaseFont(font);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
}
@@ -175,10 +175,11 @@ InitKeyboardSettings(WMScreen *scr, WMWidget *parent)
panel->description = _("Not done");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
AddSection(panel, ICON_FILE);
return panel;
}

View File

@@ -1,9 +1,9 @@
/* KeyboardShortcuts.c- keyboard shortcut bindings
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -43,7 +43,7 @@ typedef struct _Panel {
WMLabel *actL;
WMList *actLs;
WMFrame *shoF;
WMTextField *shoT;
WMButton *cleB;
@@ -70,61 +70,61 @@ typedef struct _Panel {
/* must be in the same order as the corresponding items in actions list */
static char *keyOptions[] = {
"RootMenuKey",
"WindowListKey",
"WindowMenuKey",
"HideKey",
"HideOthersKey",
"MiniaturizeKey",
"CloseKey",
"MaximizeKey",
"VMaximizeKey",
"HMaximizeKey",
"RaiseKey",
"LowerKey",
"RaiseLowerKey",
"ShadeKey",
"MoveResizeKey",
"SelectKey",
"FocusNextKey",
"FocusPrevKey",
"NextWorkspaceKey",
"PrevWorkspaceKey",
"NextWorkspaceLayerKey",
"PrevWorkspaceLayerKey",
"Workspace1Key",
"Workspace2Key",
"Workspace3Key",
"Workspace4Key",
"Workspace5Key",
"Workspace6Key",
"Workspace7Key",
"Workspace8Key",
"Workspace9Key",
"Workspace10Key",
"WindowShortcut1Key",
"WindowShortcut2Key",
"WindowShortcut3Key",
"WindowShortcut4Key",
"WindowShortcut5Key",
"WindowShortcut6Key",
"WindowShortcut7Key",
"WindowShortcut8Key",
"WindowShortcut9Key",
"WindowShortcut10Key",
"ScreenSwitchKey",
"WindowListKey",
"WindowMenuKey",
"HideKey",
"HideOthersKey",
"MiniaturizeKey",
"CloseKey",
"MaximizeKey",
"VMaximizeKey",
"HMaximizeKey",
"RaiseKey",
"LowerKey",
"RaiseLowerKey",
"ShadeKey",
"MoveResizeKey",
"SelectKey",
"FocusNextKey",
"FocusPrevKey",
"NextWorkspaceKey",
"PrevWorkspaceKey",
"NextWorkspaceLayerKey",
"PrevWorkspaceLayerKey",
"Workspace1Key",
"Workspace2Key",
"Workspace3Key",
"Workspace4Key",
"Workspace5Key",
"Workspace6Key",
"Workspace7Key",
"Workspace8Key",
"Workspace9Key",
"Workspace10Key",
"WindowShortcut1Key",
"WindowShortcut2Key",
"WindowShortcut3Key",
"WindowShortcut4Key",
"WindowShortcut5Key",
"WindowShortcut6Key",
"WindowShortcut7Key",
"WindowShortcut8Key",
"WindowShortcut9Key",
"WindowShortcut10Key",
"ScreenSwitchKey",
#ifdef VIRTUAL_DESKTOP
"VirtualEdgeLeftKey",
"VirtualEdgeRightKey",
"VirtualEdgeUpKey",
"VirtualEdgeDownKey",
"VirtualEdgeLeftKey",
"VirtualEdgeRightKey",
"VirtualEdgeUpKey",
"VirtualEdgeDownKey",
#endif
"ClipRaiseKey",
"ClipLowerKey",
"ClipRaiseKey",
"ClipLowerKey",
#ifndef XKB_MODELOCK
"ClipRaiseLowerKey"
"ClipRaiseLowerKey"
#else
"ClipRaiseLowerKey",
"ToggleKbdModeKey"
"ClipRaiseLowerKey",
"ToggleKbdModeKey"
#endif /* XKB_MODELOCK */
};
@@ -134,111 +134,108 @@ static char *keyOptions[] = {
/* from Xlib */
static void
XConvertCase(sym, lower, upper)
register KeySym sym;
KeySym *lower;
KeySym *upper;
XConvertCase(register KeySym sym, KeySym *lower, KeySym *upper)
{
*lower = sym;
*upper = sym;
switch(sym >> 8) {
case 0: /* Latin 1 */
if ((sym >= XK_A) && (sym <= XK_Z))
*lower += (XK_a - XK_A);
else if ((sym >= XK_a) && (sym <= XK_z))
*upper -= (XK_a - XK_A);
else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
*lower += (XK_agrave - XK_Agrave);
else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis))
*upper -= (XK_agrave - XK_Agrave);
else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn))
*lower += (XK_oslash - XK_Ooblique);
else if ((sym >= XK_oslash) && (sym <= XK_thorn))
*upper -= (XK_oslash - XK_Ooblique);
break;
if ((sym >= XK_A) && (sym <= XK_Z))
*lower += (XK_a - XK_A);
else if ((sym >= XK_a) && (sym <= XK_z))
*upper -= (XK_a - XK_A);
else if ((sym >= XK_Agrave) && (sym <= XK_Odiaeresis))
*lower += (XK_agrave - XK_Agrave);
else if ((sym >= XK_agrave) && (sym <= XK_odiaeresis))
*upper -= (XK_agrave - XK_Agrave);
else if ((sym >= XK_Ooblique) && (sym <= XK_Thorn))
*lower += (XK_oslash - XK_Ooblique);
else if ((sym >= XK_oslash) && (sym <= XK_thorn))
*upper -= (XK_oslash - XK_Ooblique);
break;
case 1: /* Latin 2 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym == XK_Aogonek)
*lower = XK_aogonek;
else if (sym >= XK_Lstroke && sym <= XK_Sacute)
*lower += (XK_lstroke - XK_Lstroke);
else if (sym >= XK_Scaron && sym <= XK_Zacute)
*lower += (XK_scaron - XK_Scaron);
else if (sym >= XK_Zcaron && sym <= XK_Zabovedot)
*lower += (XK_zcaron - XK_Zcaron);
else if (sym == XK_aogonek)
*upper = XK_Aogonek;
else if (sym >= XK_lstroke && sym <= XK_sacute)
*upper -= (XK_lstroke - XK_Lstroke);
else if (sym >= XK_scaron && sym <= XK_zacute)
*upper -= (XK_scaron - XK_Scaron);
else if (sym >= XK_zcaron && sym <= XK_zabovedot)
*upper -= (XK_zcaron - XK_Zcaron);
else if (sym >= XK_Racute && sym <= XK_Tcedilla)
*lower += (XK_racute - XK_Racute);
else if (sym >= XK_racute && sym <= XK_tcedilla)
*upper -= (XK_racute - XK_Racute);
break;
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym == XK_Aogonek)
*lower = XK_aogonek;
else if (sym >= XK_Lstroke && sym <= XK_Sacute)
*lower += (XK_lstroke - XK_Lstroke);
else if (sym >= XK_Scaron && sym <= XK_Zacute)
*lower += (XK_scaron - XK_Scaron);
else if (sym >= XK_Zcaron && sym <= XK_Zabovedot)
*lower += (XK_zcaron - XK_Zcaron);
else if (sym == XK_aogonek)
*upper = XK_Aogonek;
else if (sym >= XK_lstroke && sym <= XK_sacute)
*upper -= (XK_lstroke - XK_Lstroke);
else if (sym >= XK_scaron && sym <= XK_zacute)
*upper -= (XK_scaron - XK_Scaron);
else if (sym >= XK_zcaron && sym <= XK_zabovedot)
*upper -= (XK_zcaron - XK_Zcaron);
else if (sym >= XK_Racute && sym <= XK_Tcedilla)
*lower += (XK_racute - XK_Racute);
else if (sym >= XK_racute && sym <= XK_tcedilla)
*upper -= (XK_racute - XK_Racute);
break;
case 2: /* Latin 3 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= XK_Hstroke && sym <= XK_Hcircumflex)
*lower += (XK_hstroke - XK_Hstroke);
else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex)
*lower += (XK_gbreve - XK_Gbreve);
else if (sym >= XK_hstroke && sym <= XK_hcircumflex)
*upper -= (XK_hstroke - XK_Hstroke);
else if (sym >= XK_gbreve && sym <= XK_jcircumflex)
*upper -= (XK_gbreve - XK_Gbreve);
else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex)
*lower += (XK_cabovedot - XK_Cabovedot);
else if (sym >= XK_cabovedot && sym <= XK_scircumflex)
*upper -= (XK_cabovedot - XK_Cabovedot);
break;
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= XK_Hstroke && sym <= XK_Hcircumflex)
*lower += (XK_hstroke - XK_Hstroke);
else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex)
*lower += (XK_gbreve - XK_Gbreve);
else if (sym >= XK_hstroke && sym <= XK_hcircumflex)
*upper -= (XK_hstroke - XK_Hstroke);
else if (sym >= XK_gbreve && sym <= XK_jcircumflex)
*upper -= (XK_gbreve - XK_Gbreve);
else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex)
*lower += (XK_cabovedot - XK_Cabovedot);
else if (sym >= XK_cabovedot && sym <= XK_scircumflex)
*upper -= (XK_cabovedot - XK_Cabovedot);
break;
case 3: /* Latin 4 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= XK_Rcedilla && sym <= XK_Tslash)
*lower += (XK_rcedilla - XK_Rcedilla);
else if (sym >= XK_rcedilla && sym <= XK_tslash)
*upper -= (XK_rcedilla - XK_Rcedilla);
else if (sym == XK_ENG)
*lower = XK_eng;
else if (sym == XK_eng)
*upper = XK_ENG;
else if (sym >= XK_Amacron && sym <= XK_Umacron)
*lower += (XK_amacron - XK_Amacron);
else if (sym >= XK_amacron && sym <= XK_umacron)
*upper -= (XK_amacron - XK_Amacron);
break;
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= XK_Rcedilla && sym <= XK_Tslash)
*lower += (XK_rcedilla - XK_Rcedilla);
else if (sym >= XK_rcedilla && sym <= XK_tslash)
*upper -= (XK_rcedilla - XK_Rcedilla);
else if (sym == XK_ENG)
*lower = XK_eng;
else if (sym == XK_eng)
*upper = XK_ENG;
else if (sym >= XK_Amacron && sym <= XK_Umacron)
*lower += (XK_amacron - XK_Amacron);
else if (sym >= XK_amacron && sym <= XK_umacron)
*upper -= (XK_amacron - XK_Amacron);
break;
case 6: /* Cyrillic */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE)
*lower -= (XK_Serbian_DJE - XK_Serbian_dje);
else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze)
*upper += (XK_Serbian_DJE - XK_Serbian_dje);
else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN)
*lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu);
else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign)
*upper += (XK_Cyrillic_YU - XK_Cyrillic_yu);
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE)
*lower -= (XK_Serbian_DJE - XK_Serbian_dje);
else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze)
*upper += (XK_Serbian_DJE - XK_Serbian_dje);
else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN)
*lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu);
else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign)
*upper += (XK_Cyrillic_YU - XK_Cyrillic_yu);
break;
case 7: /* Greek */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent)
*lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent &&
sym != XK_Greek_iotaaccentdieresis &&
sym != XK_Greek_upsilonaccentdieresis)
*upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA)
*lower += (XK_Greek_alpha - XK_Greek_ALPHA);
else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega &&
sym != XK_Greek_finalsmallsigma)
*upper -= (XK_Greek_alpha - XK_Greek_ALPHA);
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent)
*lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent &&
sym != XK_Greek_iotaaccentdieresis &&
sym != XK_Greek_upsilonaccentdieresis)
*upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent);
else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA)
*lower += (XK_Greek_alpha - XK_Greek_ALPHA);
else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega &&
sym != XK_Greek_finalsmallsigma)
*upper -= (XK_Greek_alpha - XK_Greek_ALPHA);
break;
case 0x14: /* Armenian */
if (sym >= XK_Armenian_AYB && sym <= XK_Armenian_fe) {
*lower = sym | 1;
*upper = sym & ~1;
}
if (sym >= XK_Armenian_AYB && sym <= XK_Armenian_fe) {
*lower = sym | 1;
*upper = sym & ~1;
}
break;
}
}
@@ -254,49 +251,49 @@ captureShortcut(Display *dpy, _Panel *panel)
char *key = NULL;
while (panel->capturing) {
XAllowEvents(dpy, AsyncKeyboard, CurrentTime);
WMNextEvent(dpy, &ev);
if (ev.type==KeyPress && ev.xkey.keycode!=0) {
ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0);
XAllowEvents(dpy, AsyncKeyboard, CurrentTime);
WMNextEvent(dpy, &ev);
if (ev.type==KeyPress && ev.xkey.keycode!=0) {
ksym = XKeycodeToKeysym(dpy, ev.xkey.keycode, 0);
if (!IsModifierKey(ksym)) {
XConvertCase(ksym, &lksym, &uksym);
key=XKeysymToString(uksym);
key=XKeysymToString(uksym);
panel->capturing = 0;
break;
}
}
WMHandleEvent(&ev);
break;
}
}
WMHandleEvent(&ev);
}
if (!key)
return NULL;
return NULL;
buffer[0] = 0;
if (ev.xkey.state & ControlMask) {
strcat(buffer, "Control+");
}
strcat(buffer, "Control+");
}
if (ev.xkey.state & ShiftMask) {
strcat(buffer, "Shift+");
}
strcat(buffer, "Shift+");
}
if (ev.xkey.state & Mod1Mask) {
strcat(buffer, "Mod1+");
}
strcat(buffer, "Mod1+");
}
if (ev.xkey.state & Mod2Mask) {
strcat(buffer, "Mod2+");
}
strcat(buffer, "Mod2+");
}
if (ev.xkey.state & Mod3Mask) {
strcat(buffer, "Mod3+");
}
strcat(buffer, "Mod3+");
}
if (ev.xkey.state & Mod4Mask) {
strcat(buffer, "Mod4+");
}
strcat(buffer, "Mod4+");
}
if (ev.xkey.state & Mod5Mask) {
strcat(buffer, "Mod5+");
strcat(buffer, "Mod5+");
}
strcat(buffer, key);
return wstrdup(buffer);
}
@@ -307,28 +304,28 @@ captureClick(WMWidget *w, void *data)
_Panel *panel = (_Panel*)data;
Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->parent));
char *shortcut;
if (!panel->capturing) {
panel->capturing = 1;
WMSetButtonText(w, _("Cancel"));
WMSetLabelText(panel->instructionsL, _("Press the desired shortcut key(s) or click Cancel to stop capturing."));
XGrabKeyboard(dpy, WMWidgetXID(panel->parent), True, GrabModeAsync,
GrabModeAsync, CurrentTime);
shortcut = captureShortcut(dpy, panel);
if (shortcut) {
int row = WMGetListSelectedItemRow(panel->actLs);
WMSetTextFieldText(panel->shoT, shortcut);
if (row>=0) {
if (panel->shortcuts[row])
wfree(panel->shortcuts[row]);
panel->shortcuts[row] = shortcut;
WMRedisplayWidget(panel->actLs);
} else {
wfree(shortcut);
}
}
if (!panel->capturing) {
panel->capturing = 1;
WMSetButtonText(w, _("Cancel"));
WMSetLabelText(panel->instructionsL, _("Press the desired shortcut key(s) or click Cancel to stop capturing."));
XGrabKeyboard(dpy, WMWidgetXID(panel->parent), True, GrabModeAsync,
GrabModeAsync, CurrentTime);
shortcut = captureShortcut(dpy, panel);
if (shortcut) {
int row = WMGetListSelectedItemRow(panel->actLs);
WMSetTextFieldText(panel->shoT, shortcut);
if (row>=0) {
if (panel->shortcuts[row])
wfree(panel->shortcuts[row]);
panel->shortcuts[row] = shortcut;
WMRedisplayWidget(panel->actLs);
} else {
wfree(shortcut);
}
}
}
panel->capturing = 0;
WMSetButtonText(w, _("Capture"));
@@ -347,10 +344,10 @@ clearShortcut(WMWidget *w, void *data)
WMSetTextFieldText(panel->shoT, NULL);
if (row>=0) {
if (panel->shortcuts[row])
wfree(panel->shortcuts[row]);
panel->shortcuts[row]=NULL;
WMRedisplayWidget(panel->actLs);
if (panel->shortcuts[row])
wfree(panel->shortcuts[row]);
panel->shortcuts[row]=NULL;
WMRedisplayWidget(panel->actLs);
}
}
@@ -359,18 +356,18 @@ clearShortcut(WMWidget *w, void *data)
static void
typedKeys(void *observerData, WMNotification *notification)
{
_Panel *panel = (_Panel*)observerData;
_Panel *panel = (_Panel*)observerData;
int row = WMGetListSelectedItemRow(panel->actLs);
if (row<0)
return;
return;
if (panel->shortcuts[row])
wfree(panel->shortcuts[row]);
wfree(panel->shortcuts[row]);
panel->shortcuts[row] = WMGetTextFieldText(panel->shoT);
if (strlen(panel->shortcuts[row])==0) {
wfree(panel->shortcuts[row]);
panel->shortcuts[row] = NULL;
wfree(panel->shortcuts[row]);
panel->shortcuts[row] = NULL;
}
WMRedisplayWidget(panel->actLs);
}
@@ -382,7 +379,7 @@ listClick(WMWidget *w, void *data)
{
_Panel *panel = (_Panel*)data;
int row = WMGetListSelectedItemRow(w);
WMSetTextFieldText(panel->shoT, panel->shortcuts[row]);
}
@@ -392,13 +389,13 @@ trimstr(char *str)
{
char *p = str;
int i;
while (isspace(*p)) p++;
p = wstrdup(p);
i = strlen(p);
while (isspace(p[i]) && i>0) {
p[i]=0;
i--;
p[i]=0;
i--;
}
return p;
@@ -413,20 +410,20 @@ showData(_Panel *panel)
for (i=0; i<panel->actionCount; i++) {
str = GetStringForKey(keyOptions[i]);
if (panel->shortcuts[i])
wfree(panel->shortcuts[i]);
if (str)
panel->shortcuts[i] = trimstr(str);
else
panel->shortcuts[i] = NULL;
str = GetStringForKey(keyOptions[i]);
if (panel->shortcuts[i])
wfree(panel->shortcuts[i]);
if (str)
panel->shortcuts[i] = trimstr(str);
else
panel->shortcuts[i] = NULL;
if (panel->shortcuts[i] &&
(strcasecmp(panel->shortcuts[i], "none")==0
|| strlen(panel->shortcuts[i])==0)) {
wfree(panel->shortcuts[i]);
panel->shortcuts[i] = NULL;
}
if (panel->shortcuts[i] &&
(strcasecmp(panel->shortcuts[i], "none")==0
|| strlen(panel->shortcuts[i])==0)) {
wfree(panel->shortcuts[i]);
panel->shortcuts[i] = NULL;
}
}
WMRedisplayWidget(panel->actLs);
}
@@ -434,7 +431,7 @@ showData(_Panel *panel)
static void
paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
WMRect *rect)
WMRect *rect)
{
int width, height, x, y;
_Panel *panel = (_Panel*)WMGetHangedData(lPtr);
@@ -450,11 +447,11 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
XFillRectangle(dpy, d, WMColorGC(backColor), x, y, width, height);
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);
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, panel->black, panel->font, x+20, y, text, strlen(text));
@@ -463,7 +460,7 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
static void
createPanel(Panel *p)
{
{
_Panel *panel = (_Panel*)p;
WMScreen *scr = WMWidgetScreen(panel->parent);
WMColor *color;
@@ -490,16 +487,16 @@ createPanel(Panel *p)
WMSetLabelRelief(panel->actL, WRSunken);
WMSetLabelTextAlignment(panel->actL, WACenter);
color = WMDarkGrayColor(scr);
WMSetWidgetBackgroundColor(panel->actL, color);
WMSetWidgetBackgroundColor(panel->actL, color);
WMReleaseColor(color);
WMSetLabelTextColor(panel->actL, panel->white);
panel->actLs = WMCreateList(panel->box);
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"));
WMAddListItem(panel->actLs, _("Open window commands menu"));
@@ -568,13 +565,13 @@ createPanel(Panel *p)
WMResizeWidget(panel->shoF, 190, 210);
WMMoveWidget(panel->shoF, 315, 10);
WMSetFrameTitle(panel->shoF, _("Shortcut"));
panel->shoT = WMCreateTextField(panel->shoF);
WMResizeWidget(panel->shoT, 160, 20);
WMMoveWidget(panel->shoT, 15, 65);
WMAddNotificationObserver(typedKeys, panel,
WMTextDidChangeNotification, panel->shoT);
WMTextDidChangeNotification, panel->shoT);
panel->cleB = WMCreateCommandButton(panel->shoF);
WMResizeWidget(panel->cleB, 75, 24);
WMMoveWidget(panel->cleB, 15, 95);
@@ -586,7 +583,7 @@ createPanel(Panel *p)
WMMoveWidget(panel->defB, 100, 95);
WMSetButtonText(panel->defB, _("Capture"));
WMSetButtonAction(panel->defB, captureClick, panel);
panel->instructionsL = WMCreateLabel(panel->shoF);
WMResizeWidget(panel->instructionsL, 160, 55);
WMMoveWidget(panel->instructionsL, 15, 140);
@@ -595,13 +592,13 @@ createPanel(Panel *p)
WMSetLabelText(panel->instructionsL, _("Click on Capture to interactively define the shortcut key."));
WMMapSubwidgets(panel->shoF);
WMReleaseFont(boldFont);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
@@ -611,22 +608,22 @@ storeData(_Panel *panel)
{
int i;
char *str;
for (i=0; i<panel->actionCount; i++) {
str = NULL;
if (panel->shortcuts[i]) {
str = trimstr(panel->shortcuts[i]);
if (strlen(str)==0) {
wfree(str);
str = NULL;
}
}
if (str) {
SetStringForKey(str, keyOptions[i]);
wfree(str);
} else {
SetStringForKey("None", keyOptions[i]);
}
str = NULL;
if (panel->shortcuts[i]) {
str = trimstr(panel->shortcuts[i]);
if (strlen(str)==0) {
wfree(str);
str = NULL;
}
}
if (str) {
SetStringForKey(str, keyOptions[i]);
wfree(str);
} else {
SetStringForKey("None", keyOptions[i]);
}
}
}
@@ -654,3 +651,4 @@ InitKeyboardShortcuts(WMScreen *scr, WMWidget *parent)
return panel;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* MenuPreferences.c- menu related preferences
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -31,16 +31,16 @@ typedef struct _Panel {
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMFrame *scrF;
WMButton *scrB[5];
WMFrame *aliF;
WMButton *aliyB;
WMButton *alinB;
WMFrame *optF;
WMButton *autoB;
WMButton *wrapB;
@@ -61,14 +61,14 @@ static void
showData(_Panel *panel)
{
WMPerformButtonClick(panel->scrB[GetSpeedForKey("MenuScrollSpeed")]);
if (GetBoolForKey("AlignSubmenus"))
WMPerformButtonClick(panel->aliyB);
WMPerformButtonClick(panel->aliyB);
else
WMPerformButtonClick(panel->alinB);
WMPerformButtonClick(panel->alinB);
WMSetButtonSelected(panel->wrapB, GetBoolForKey("WrapMenus"));
WMSetButtonSelected(panel->autoB, GetBoolForKey("ScrollableMenus"));
}
@@ -77,10 +77,10 @@ static void
storeData(_Panel *panel)
{
int i;
for (i=0; i<5; i++) {
if (WMGetButtonSelected(panel->scrB[i]))
break;
if (WMGetButtonSelected(panel->scrB[i]))
break;
}
SetSpeedForKey(i, "MenuScrollSpeed");
@@ -100,52 +100,52 @@ createPanel(Panel *p)
int i;
char *buf1, *buf2;
char *path;
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/***************** Menu Scroll Speed ****************/
panel->scrF = WMCreateFrame(panel->box);
WMResizeWidget(panel->scrF, 235, 90);
WMMoveWidget(panel->scrF, 25, 20);
WMSetFrameTitle(panel->scrF, _("Menu Scrolling Speed"));
buf1 = wmalloc(strlen(SPEED_IMAGE)+1);
buf2 = wmalloc(strlen(SPEED_IMAGE_S)+1);
for (i = 0; i < 5; i++) {
panel->scrB[i] = WMCreateCustomButton(panel->scrF, WBBStateChangeMask);
WMResizeWidget(panel->scrB[i], 40, 40);
WMMoveWidget(panel->scrB[i], 15+(40*i), 30);
WMSetButtonBordered(panel->scrB[i], False);
WMSetButtonImagePosition(panel->scrB[i], WIPImageOnly);
if (i > 0) {
WMGroupButtons(panel->scrB[0], panel->scrB[i]);
}
sprintf(buf1, SPEED_IMAGE, i);
sprintf(buf2, SPEED_IMAGE_S, i);
path = LocateImage(buf1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->scrB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonAltImage(panel->scrB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
panel->scrB[i] = WMCreateCustomButton(panel->scrF, WBBStateChangeMask);
WMResizeWidget(panel->scrB[i], 40, 40);
WMMoveWidget(panel->scrB[i], 15+(40*i), 30);
WMSetButtonBordered(panel->scrB[i], False);
WMSetButtonImagePosition(panel->scrB[i], WIPImageOnly);
if (i > 0) {
WMGroupButtons(panel->scrB[0], panel->scrB[i]);
}
sprintf(buf1, SPEED_IMAGE, i);
sprintf(buf2, SPEED_IMAGE_S, i);
path = LocateImage(buf1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->scrB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonAltImage(panel->scrB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
}
wfree(buf1);
wfree(buf2);
@@ -153,26 +153,26 @@ createPanel(Panel *p)
WMMapSubwidgets(panel->scrF);
/***************** Submenu Alignment ****************/
panel->aliF = WMCreateFrame(panel->box);
WMResizeWidget(panel->aliF, 220, 90);
WMMoveWidget(panel->aliF, 280, 20);
WMSetFrameTitle(panel->aliF, _("Submenu Alignment"));
panel->alinB = WMCreateButton(panel->aliF, WBTOnOff);
WMResizeWidget(panel->alinB, 48, 48);
WMMoveWidget(panel->alinB, 56, 25);
WMSetButtonImagePosition(panel->alinB, WIPImageOnly);
path = LocateImage(MENU_ALIGN1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->alinB, icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->alinB, icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
panel->aliyB = WMCreateButton(panel->aliF, WBTOnOff);
WMResizeWidget(panel->aliyB, 48, 48);
@@ -180,24 +180,24 @@ createPanel(Panel *p)
WMSetButtonImagePosition(panel->aliyB, WIPImageOnly);
path = LocateImage(MENU_ALIGN2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->aliyB, icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->aliyB, icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
WMGroupButtons(panel->alinB, panel->aliyB);
WMMapSubwidgets(panel->aliF);
/***************** Options ****************/
panel->optF = WMCreateFrame(panel->box);
WMResizeWidget(panel->optF, 475, 80);
WMMoveWidget(panel->optF, 25, 130);
panel->wrapB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->wrapB, 440, 32);
WMMoveWidget(panel->wrapB, 25, 8);
@@ -207,9 +207,9 @@ createPanel(Panel *p)
WMResizeWidget(panel->autoB, 440, 32);
WMMoveWidget(panel->autoB, 25, 45);
WMSetButtonText(panel->autoB, _("Scroll off-screen menus when pointer is moved over them."));
WMMapSubwidgets(panel->optF);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
@@ -229,10 +229,10 @@ InitMenuPreferences(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Menu Preferences");
panel->description = _("Menu usability related options. Scrolling speed,\n"
"alignment of submenus etc.");
"alignment of submenus etc.");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
@@ -240,3 +240,4 @@ InitMenuPreferences(WMScreen *scr, WMWidget *parent)
return panel;
}

View File

@@ -1,10 +1,10 @@
/* MouseSettings.c- mouse options (some are equivalent to xset)
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -17,7 +17,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -45,9 +45,9 @@ typedef struct _Panel {
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMFrame *speedF;
WMLabel *speedL;
WMSlider *speedS;
@@ -55,13 +55,13 @@ typedef struct _Panel {
WMTextField *acceT;
WMLabel *threL;
WMTextField *threT;
WMFrame *ddelaF;
WMButton *ddelaB[5];
WMTextField *ddelaT;
WMLabel *ddelaL;
DoubleTest *tester;
WMFrame *menuF;
WMLabel *button1L;
WMLabel *button2L;
@@ -96,7 +96,7 @@ typedef struct _Panel {
static char *modifierNames[8];
static char *modifierNames[8];
static char *buttonActions[4];
@@ -114,7 +114,7 @@ static void
setMouseAccel(WMScreen *scr, float accel, int threshold)
{
int n, d;
d = 10;
n = accel*d;
@@ -132,37 +132,37 @@ speedChange(WMWidget *w, void *data)
char *tmp;
if (w == NULL) {
float accel;
float accel;
tmp = WMGetTextFieldText(panel->acceT);
if (sscanf(tmp, "%f", &accel)!=1 || accel < 0) {
WMRunAlertPanel(WMWidgetScreen(panel->acceT), GetWindow(panel),
_("Error"),
_("Invalid mouse acceleration value. Must be a positive real value."),
_("OK"), NULL, NULL);
wfree(tmp);
return;
}
panel->acceleration = accel;
wfree(tmp);
tmp = WMGetTextFieldText(panel->acceT);
if (sscanf(tmp, "%f", &accel)!=1 || accel < 0) {
WMRunAlertPanel(WMWidgetScreen(panel->acceT), GetWindow(panel),
_("Error"),
_("Invalid mouse acceleration value. Must be a positive real value."),
_("OK"), NULL, NULL);
wfree(tmp);
return;
}
panel->acceleration = accel;
wfree(tmp);
} else {
i = (int)WMGetSliderValue(panel->speedS);
panel->acceleration = 0.25+(i*0.25);
i = (int)WMGetSliderValue(panel->speedS);
sprintf(buffer, "%.2f", 0.25+(i*0.25));
WMSetTextFieldText(panel->acceT, buffer);
panel->acceleration = 0.25+(i*0.25);
sprintf(buffer, "%.2f", 0.25+(i*0.25));
WMSetTextFieldText(panel->acceT, buffer);
}
tmp = WMGetTextFieldText(panel->threT);
if (sscanf(tmp, "%i", &threshold)!=1 || threshold < 0
|| threshold > panel->maxThreshold) {
WMRunAlertPanel(WMWidgetScreen(panel->parent), GetWindow(panel), _("Error"),
_("Invalid mouse acceleration threshold value. Must be the number of pixels to travel before accelerating."),
_("OK"), NULL, NULL);
if (sscanf(tmp, "%i", &threshold)!=1 || threshold < 0
|| threshold > panel->maxThreshold) {
WMRunAlertPanel(WMWidgetScreen(panel->parent), GetWindow(panel), _("Error"),
_("Invalid mouse acceleration threshold value. Must be the number of pixels to travel before accelerating."),
_("OK"), NULL, NULL);
} else {
setMouseAccel(WMWidgetScreen(panel->parent), panel->acceleration,
threshold);
setMouseAccel(WMWidgetScreen(panel->parent), panel->acceleration,
threshold);
}
wfree(tmp);
}
@@ -186,11 +186,11 @@ doubleClick(WMWidget *w, void *data)
char buffer[32];
for (i=0; i<5; i++) {
if (panel->ddelaB[i]==w)
break;
if (panel->ddelaB[i]==w)
break;
}
WINGsConfiguration.doubleClickDelay = DELAY(i);
sprintf(buffer, "%i", DELAY(i));
WMSetTextFieldText(panel->ddelaT, buffer);
}
@@ -200,16 +200,16 @@ static int
getButtonAction(char *str)
{
if (!str)
return -2;
return -2;
if (strcasecmp(str, "None")==0)
return 0;
return 0;
else if (strcasecmp(str, "OpenApplicationsMenu")==0)
return 1;
return 1;
else if (strcasecmp(str, "OpenWindowListMenu")==0)
return 2;
return 2;
else if (strcasecmp(str, "SelectWindows")==0)
return 3;
return 3;
else
return -1;
@@ -220,14 +220,14 @@ static int
getWheelAction(char *str)
{
if (!str)
return -2;
return -2;
if (strcasecmp(str, "None")==0)
return 0;
return 0;
else if (strcasecmp(str, "SwitchWorkspaces")==0)
return 1;
return 1;
else
return -1;
return -1;
}
@@ -236,9 +236,9 @@ static void
getMouseParameters(Display *dpy, float *accel, int *thre)
{
int n, d;
XGetPointerControl(dpy, &n, &d, thre);
*accel = (float)n/(float)d;
}
@@ -265,7 +265,7 @@ showData(_Panel *panel)
a = i;
}
WMSetPopUpButtonSelectedItem(panel->button1P, a);
str = GetStringForKey("MouseMiddleButtonAction");
i = getButtonAction(str);
if (i<0) {
@@ -277,7 +277,7 @@ showData(_Panel *panel)
b = i;
}
WMSetPopUpButtonSelectedItem(panel->button2P, b);
str = GetStringForKey("MouseRightButtonAction");
i = getButtonAction(str);
if (i<0) {
@@ -303,12 +303,12 @@ showData(_Panel *panel)
WMSetPopUpButtonSelectedItem(panel->wheelP, w);
WMSetButtonSelected(panel->disaB, GetBoolForKey("DisableWSMouseActions"));
/**/
getMouseParameters(dpy, &accel, &a);
panel->maxThreshold = WidthOfScreen(DefaultScreenOfDisplay(dpy));
if (a > panel->maxThreshold) {
panel->maxThreshold = a;
panel->maxThreshold = a;
}
sprintf(buffer, "%i", a);
WMSetTextFieldText(panel->threT, buffer);
@@ -324,38 +324,38 @@ showData(_Panel *panel)
/* find best match */
a = -1;
for (i=0; i<5; i++) {
if (DELAY(i) == b)
a = i;
if (DELAY(i) == b)
a = i;
}
if (a >= 0)
WMPerformButtonClick(panel->ddelaB[a]);
WMPerformButtonClick(panel->ddelaB[a]);
sprintf(buffer, "%i", b);
WMSetTextFieldText(panel->ddelaT, buffer);
/**/
str = GetStringForKey("ModifierKey");
if (!str)
str = "mod1";
str = "mod1";
a = ModifierFromKey(dpy, str);
if (a != -1) {
str = modifierNames[a];
a = 0;
for (i=0; i<WMGetPopUpButtonNumberOfItems(panel->grabP); i++) {
if (strstr(WMGetPopUpButtonItem(panel->grabP, i), str)) {
WMSetPopUpButtonSelectedItem(panel->grabP, i);
a = 1;
break;
}
}
str = modifierNames[a];
a = 0;
for (i=0; i<WMGetPopUpButtonNumberOfItems(panel->grabP); i++) {
if (strstr(WMGetPopUpButtonItem(panel->grabP, i), str)) {
WMSetPopUpButtonSelectedItem(panel->grabP, i);
a = 1;
break;
}
}
}
if (a < 1) {
sscanf(WMGetPopUpButtonItem(panel->grabP, 0), "%s", buffer);
WMSetPopUpButtonSelectedItem(panel->grabP, 0);
wwarning(_("modifier key %s for option ModifierKey was not recognized. Using %s as default"),
str, buffer);
sscanf(WMGetPopUpButtonItem(panel->grabP, 0), "%s", buffer);
WMSetPopUpButtonSelectedItem(panel->grabP, 0);
wwarning(_("modifier key %s for option ModifierKey was not recognized. Using %s as default"),
str, buffer);
}
}
@@ -370,84 +370,84 @@ fillModifierPopUp(WMPopUpButton *pop)
char *str;
char buffer[64];
mapping = XGetModifierMapping(dpy);
if (!mapping || mapping->max_keypermod==0) {
WMAddPopUpButtonItem(pop, "Mod1");
WMAddPopUpButtonItem(pop, "Mod2");
WMAddPopUpButtonItem(pop, "Mod3");
WMAddPopUpButtonItem(pop, "Mod4");
WMAddPopUpButtonItem(pop, "Mod5");
wwarning(_("could not retrieve keyboard modifier mapping"));
return;
WMAddPopUpButtonItem(pop, "Mod1");
WMAddPopUpButtonItem(pop, "Mod2");
WMAddPopUpButtonItem(pop, "Mod3");
WMAddPopUpButtonItem(pop, "Mod4");
WMAddPopUpButtonItem(pop, "Mod5");
wwarning(_("could not retrieve keyboard modifier mapping"));
return;
}
for (j=0; j<8; j++) {
int idx;
char *array[8];
int a;
KeySym ksym;
int k;
char *ptr;
char *tmp;
int idx;
char *array[8];
int a;
KeySym ksym;
int k;
char *ptr;
char *tmp;
a = 0;
memset(array, 0, sizeof(char*)*8);
for (i=0; i < mapping->max_keypermod; i++) {
idx = i+j*mapping->max_keypermod;
if (mapping->modifiermap[idx]!=0) {
int l;
for (l=0; l<4; l++) {
ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], l);
if (ksym!=NoSymbol)
break;
}
if (ksym!=NoSymbol)
str = XKeysymToString(ksym);
else
str = NULL;
if (str && !strstr(str, "_Lock") && !strstr(str, "Shift")
&& !strstr(str, "Control")) {
array[a++] = wstrdup(str);
}
}
}
a = 0;
memset(array, 0, sizeof(char*)*8);
for (i=0; i < mapping->max_keypermod; i++) {
idx = i+j*mapping->max_keypermod;
if (mapping->modifiermap[idx]!=0) {
int l;
for (l=0; l<4; l++) {
ksym = XKeycodeToKeysym(dpy, mapping->modifiermap[idx], l);
if (ksym!=NoSymbol)
break;
}
if (ksym!=NoSymbol)
str = XKeysymToString(ksym);
else
str = NULL;
if (str && !strstr(str, "_Lock") && !strstr(str, "Shift")
&& !strstr(str, "Control")) {
array[a++] = wstrdup(str);
}
}
}
for (k=0; k<a; k++) {
if (array[k]==NULL)
continue;
tmp = wstrdup(array[k]);
ptr = strstr(tmp, "_L");
if (ptr)
*ptr = 0;
ptr = strstr(tmp, "_R");
if (ptr)
*ptr = 0;
for (k=0; k<a; k++) {
if (array[k]==NULL)
continue;
tmp = wstrdup(array[k]);
ptr = strstr(tmp, "_L");
if (ptr)
*ptr = 0;
ptr = strstr(tmp, "_R");
if (ptr)
*ptr = 0;
sprintf(buffer, "%s (%s)", modifierNames[j], tmp);
/*sprintf(buffer, "%s", tmp);*/
WMAddPopUpButtonItem(pop, buffer);
for (i=k+1; i<a; i++) {
if (array[i] == NULL)
continue;
if (strstr(array[i], tmp)) {
wfree(array[i]);
array[i]=NULL;
break;
}
}
wfree(tmp);
}
while (--a>0) {
if (array[a])
wfree(array[a]);
}
WMAddPopUpButtonItem(pop, buffer);
for (i=k+1; i<a; i++) {
if (array[i] == NULL)
continue;
if (strstr(array[i], tmp)) {
wfree(array[i]);
array[i]=NULL;
break;
}
}
wfree(tmp);
}
while (--a>0) {
if (array[a])
wfree(array[a]);
}
}
if (mapping)
XFreeModifiermap(mapping);
XFreeModifiermap(mapping);
}
@@ -466,30 +466,30 @@ createPanel(Panel *p)
color.red = 0xae;
color.green = 0xaa;
color.blue = 0xae;
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/**************** Mouse Speed ****************/
panel->speedF = WMCreateFrame(panel->box);
WMResizeWidget(panel->speedF, 245, 100);
WMMoveWidget(panel->speedF, 15, 5);
WMSetFrameTitle(panel->speedF, _("Mouse Speed"));
panel->speedL = WMCreateLabel(panel->speedF);
WMResizeWidget(panel->speedL, 40, 46);
WMMoveWidget(panel->speedL, 15, 14);
WMSetLabelImagePosition(panel->speedL, WIPImageOnly);
path = LocateImage(SPEED_ICON_FILE);
if (path) {
icon = WMCreateBlendedPixmapFromFile(scr, path, &color);
if (icon) {
WMSetLabelImage(panel->speedL, icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon %s"), path);
}
wfree(path);
icon = WMCreateBlendedPixmapFromFile(scr, path, &color);
if (icon) {
WMSetLabelImage(panel->speedL, icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon %s"), path);
}
wfree(path);
}
panel->speedS = WMCreateSlider(panel->speedF);
@@ -510,7 +510,7 @@ createPanel(Panel *p)
WMResizeWidget(panel->acceT, 40, 20);
WMMoveWidget(panel->acceT, 80, 65);
WMAddNotificationObserver(returnPressed, panel,
WMTextDidEndEditingNotification, panel->acceT);
WMTextDidEndEditingNotification, panel->acceT);
panel->threL = WMCreateLabel(panel->speedF);
@@ -518,60 +518,60 @@ createPanel(Panel *p)
WMMoveWidget(panel->threL, 120, 67);
WMSetLabelTextAlignment(panel->threL, WARight);
WMSetLabelText(panel->threL, _("Threshold:"));
panel->threT = WMCreateTextField(panel->speedF);
WMResizeWidget(panel->threT, 30, 20);
WMMoveWidget(panel->threT, 200, 65);
WMAddNotificationObserver(returnPressed, panel,
WMTextDidEndEditingNotification, panel->threT);
WMTextDidEndEditingNotification, panel->threT);
WMMapSubwidgets(panel->speedF);
/***************** Doubleclick Delay ****************/
panel->ddelaF = WMCreateFrame(panel->box);
WMResizeWidget(panel->ddelaF, 245, 105);
WMMoveWidget(panel->ddelaF, 15, 115);
WMSetFrameTitle(panel->ddelaF, _("Double-Click Delay"));
buf1 = wmalloc(strlen(DELAY_ICON)+2);
buf2 = wmalloc(strlen(DELAY_ICON_S)+2);
for (i = 0; i < 5; i++) {
panel->ddelaB[i] = WMCreateCustomButton(panel->ddelaF,
WBBStateChangeMask);
WMResizeWidget(panel->ddelaB[i], 25, 25);
WMMoveWidget(panel->ddelaB[i], 30+(40*i), 25);
WMSetButtonBordered(panel->ddelaB[i], False);
WMSetButtonImagePosition(panel->ddelaB[i], WIPImageOnly);
WMSetButtonAction(panel->ddelaB[i], doubleClick, panel);
if (i>0) {
WMGroupButtons(panel->ddelaB[0], panel->ddelaB[i]);
}
sprintf(buf1, DELAY_ICON, i+1);
sprintf(buf2, DELAY_ICON_S, i+1);
path = LocateImage(buf1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->ddelaB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonAltImage(panel->ddelaB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
panel->ddelaB[i] = WMCreateCustomButton(panel->ddelaF,
WBBStateChangeMask);
WMResizeWidget(panel->ddelaB[i], 25, 25);
WMMoveWidget(panel->ddelaB[i], 30+(40*i), 25);
WMSetButtonBordered(panel->ddelaB[i], False);
WMSetButtonImagePosition(panel->ddelaB[i], WIPImageOnly);
WMSetButtonAction(panel->ddelaB[i], doubleClick, panel);
if (i>0) {
WMGroupButtons(panel->ddelaB[0], panel->ddelaB[i]);
}
sprintf(buf1, DELAY_ICON, i+1);
sprintf(buf2, DELAY_ICON_S, i+1);
path = LocateImage(buf1);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonImage(panel->ddelaB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
path = LocateImage(buf2);
if (path) {
icon = WMCreatePixmapFromFile(scr, path);
if (icon) {
WMSetButtonAltImage(panel->ddelaB[i], icon);
WMReleasePixmap(icon);
} else {
wwarning(_("could not load icon file %s"), path);
}
wfree(path);
}
}
wfree(buf1);
wfree(buf2);
@@ -588,15 +588,15 @@ createPanel(Panel *p)
WMResizeWidget(panel->ddelaL, 40, 16);
WMMoveWidget(panel->ddelaL, 185, 70);
{
WMFont *font;
WMColor *color;
font = WMSystemFontOfSize(scr, 10);
color = WMDarkGrayColor(scr);
WMSetLabelTextColor(panel->ddelaL, color);
WMSetLabelFont(panel->ddelaL, font);
WMReleaseFont(font);
WMReleaseColor(color);
WMFont *font;
WMColor *color;
font = WMSystemFontOfSize(scr, 10);
color = WMDarkGrayColor(scr);
WMSetLabelTextColor(panel->ddelaL, color);
WMSetLabelFont(panel->ddelaL, font);
WMReleaseFont(font);
WMReleaseColor(color);
}
WMSetLabelText(panel->ddelaL, _("msec"));
@@ -622,13 +622,13 @@ createPanel(Panel *p)
panel->button1P = WMCreatePopUpButton(panel->menuF);
WMResizeWidget(panel->button1P, 135, 20);
WMMoveWidget(panel->button1P, 95, 45);
panel->button2L = WMCreateLabel(panel->menuF);
WMResizeWidget(panel->button2L, 87, 20);
WMMoveWidget(panel->button2L, 5, 73);
WMSetLabelTextAlignment(panel->button2L, WARight);
WMSetLabelText(panel->button2L, _("Middle Button"));
panel->button2P = WMCreatePopUpButton(panel->menuF);
WMResizeWidget(panel->button2P, 135, 20);
WMMoveWidget(panel->button2P, 95, 73);
@@ -672,22 +672,22 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->grabF, _("Mouse Grab Modifier"));
WMSetBalloonTextForView(_("Keyboard modifier to use for actions that\n"
"involve dragging windows with the mouse,\n"
"clicking inside the window."),
WMWidgetView(panel->grabF));
"involve dragging windows with the mouse,\n"
"clicking inside the window."),
WMWidgetView(panel->grabF));
panel->grabP = WMCreatePopUpButton(panel->grabF);
WMResizeWidget(panel->grabP, 160, 20);
WMMoveWidget(panel->grabP, 40, 20);
fillModifierPopUp(panel->grabP);
WMMapSubwidgets(panel->grabF);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
@@ -700,35 +700,35 @@ storeCommandInScript(char *cmd, char *line)
char buffer[128];
path = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart");
f = fopen(path, "rb");
if (!f) {
f = fopen(path, "wb");
if (!f) {
wsyserror(_("could not create %s"), path);
goto end;
}
fprintf(f, "#!/bin/sh\n");
fputs(line, f);
fputs("\n", f);
f = fopen(path, "wb");
if (!f) {
wsyserror(_("could not create %s"), path);
goto end;
}
fprintf(f, "#!/bin/sh\n");
fputs(line, f);
fputs("\n", f);
} else {
int len = strlen(cmd);
int ok = 0;
char *tmppath;
FILE *fo;
int len = strlen(cmd);
int ok = 0;
char *tmppath;
FILE *fo;
tmppath = wstrconcat(wusergnusteppath(),
"/Library/WindowMaker/autostart.tmp");
fo = fopen(tmppath, "wb");
if (!fo) {
tmppath = wstrconcat(wusergnusteppath(),
"/Library/WindowMaker/autostart.tmp");
fo = fopen(tmppath, "wb");
if (!fo) {
wsyserror(_("could not create temporary file %s"), tmppath);
wfree(tmppath);
goto end;
}
goto end;
}
while (!feof(f)) {
if (!fgets(buffer, 127, f)) {
break;
while (!feof(f)) {
if (!fgets(buffer, 127, f)) {
break;
}
if (buffer[0] == '\n') {
/* don't write empty lines, else the file will grow
@@ -736,26 +736,26 @@ storeCommandInScript(char *cmd, char *line)
*/
continue;
}
if (strncmp(buffer, cmd, len)==0) {
if (!ok) {
fputs(line, fo);
fputs("\n", fo);
ok = 1;
}
} else {
fputs(buffer, fo);
}
}
if (!ok) {
fputs(line, fo);
fputs("\n", fo);
}
fclose(fo);
if (strncmp(buffer, cmd, len)==0) {
if (!ok) {
fputs(line, fo);
fputs("\n", fo);
ok = 1;
}
} else {
fputs(buffer, fo);
}
}
if (!ok) {
fputs(line, fo);
fputs("\n", fo);
}
fclose(fo);
if (rename(tmppath, path)!=0) {
wsyserror(_("could not rename file %s to %s\n"), tmppath, path);
}
wfree(tmppath);
if (rename(tmppath, path)!=0) {
wsyserror(_("could not rename file %s to %s\n"), tmppath, path);
}
wfree(tmppath);
}
sprintf(buffer, "chmod u+x %s", path);
system(buffer);
@@ -763,7 +763,7 @@ storeCommandInScript(char *cmd, char *line)
end:
wfree(path);
if (f)
fclose(f);
fclose(f);
}
@@ -778,22 +778,22 @@ storeData(_Panel *panel)
WMUserDefaults *udb = WMGetStandardUserDefaults();
if (!WMGetUDBoolForKey(udb, "NoXSetStuff")) {
tmp = WMGetTextFieldText(panel->threT);
if (strlen(tmp)==0) {
wfree(tmp);
tmp = wstrdup("4");
}
tmp = WMGetTextFieldText(panel->threT);
if (strlen(tmp)==0) {
wfree(tmp);
tmp = wstrdup("4");
}
sprintf(buffer, XSET" m %i/%i %s\n", (int)(panel->acceleration*10),
10, tmp);
storeCommandInScript(XSET" m", buffer);
sprintf(buffer, XSET" m %i/%i %s\n", (int)(panel->acceleration*10),
10, tmp);
storeCommandInScript(XSET" m", buffer);
wfree(tmp);
wfree(tmp);
}
tmp = WMGetTextFieldText(panel->ddelaT);
if (sscanf(tmp, "%i", &i) == 1 && i > 0)
SetIntegerForKey(i, "DoubleClickTime");
SetIntegerForKey(i, "DoubleClickTime");
SetBoolForKey(WMGetButtonSelected(panel->disaB), "DisableWSMouseActions");
@@ -802,15 +802,15 @@ storeData(_Panel *panel)
i = WMGetPopUpButtonSelectedItem(panel->button2P);
SetStringForKey(button[i], "MouseMiddleButtonAction");
i = WMGetPopUpButtonSelectedItem(panel->button3P);
SetStringForKey(button[i], "MouseRightButtonAction");
i = WMGetPopUpButtonSelectedItem(panel->wheelP);
SetStringForKey(wheel[i], "MouseWheelAction");
tmp = WMGetPopUpButtonItem(panel->grabP,
WMGetPopUpButtonSelectedItem(panel->grabP));
WMGetPopUpButtonSelectedItem(panel->grabP));
tmp = wstrdup(tmp);
p = strchr(tmp, ' ');
*p = 0;
@@ -849,7 +849,7 @@ InitMouseSettings(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Mouse Preferences");
panel->description = _("Mouse speed/acceleration, double click delay,\n"
"mouse button bindings etc.");
"mouse button bindings etc.");
panel->parent = parent;
@@ -860,3 +860,4 @@ InitMouseSettings(WMScreen *scr, WMWidget *parent)
return panel;
}

View File

@@ -1,9 +1,9 @@
/* Paths.c- pixmap/icon paths
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -29,11 +29,11 @@ typedef struct _Panel {
char *sectionName;
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMTabView *tabv;
WMFrame *pixF;
@@ -67,7 +67,7 @@ addPathToList(WMList *list, int index, char *path)
item = WMInsertListItem(list, index, path);
if (access(fpath, X_OK)!=0) {
item->uflags = 1;
item->uflags = 1;
}
wfree(fpath);
}
@@ -78,36 +78,36 @@ showData(_Panel *panel)
{
WMPropList *array, *val;
int i;
array = GetObjectForKey("IconPath");
if (!array || !WMIsPLArray(array)) {
if (array)
wwarning(_("bad value in option IconPath. Using default path list"));
addPathToList(panel->icoL, -1, "~/pixmaps");
addPathToList(panel->icoL, -1, "~/GNUstep/Library/Icons");
addPathToList(panel->icoL, -1, "/usr/include/X11/pixmaps");
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Icons");
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Pixmaps");
addPathToList(panel->icoL, -1, "/usr/share/WindowMaker/Icons");
if (array)
wwarning(_("bad value in option IconPath. Using default path list"));
addPathToList(panel->icoL, -1, "~/pixmaps");
addPathToList(panel->icoL, -1, "~/GNUstep/Library/Icons");
addPathToList(panel->icoL, -1, "/usr/include/X11/pixmaps");
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Icons");
addPathToList(panel->icoL, -1, "/usr/local/share/WindowMaker/Pixmaps");
addPathToList(panel->icoL, -1, "/usr/share/WindowMaker/Icons");
} else {
for (i=0; i<WMGetPropListItemCount(array); i++) {
val = WMGetFromPLArray(array, i);
addPathToList(panel->icoL, -1, WMGetFromPLString(val));
}
for (i=0; i<WMGetPropListItemCount(array); i++) {
val = WMGetFromPLArray(array, i);
addPathToList(panel->icoL, -1, WMGetFromPLString(val));
}
}
array = GetObjectForKey("PixmapPath");
if (!array || !WMIsPLArray(array)) {
if (array)
wwarning(_("bad value in option PixmapPath. Using default path list"));
addPathToList(panel->pixL, -1, "~/pixmaps");
addPathToList(panel->pixL, -1, "~/GNUstep/Library/WindowMaker/Pixmaps");
addPathToList(panel->pixL, -1, "/usr/local/share/WindowMaker/Pixmaps");
if (array)
wwarning(_("bad value in option PixmapPath. Using default path list"));
addPathToList(panel->pixL, -1, "~/pixmaps");
addPathToList(panel->pixL, -1, "~/GNUstep/Library/WindowMaker/Pixmaps");
addPathToList(panel->pixL, -1, "/usr/local/share/WindowMaker/Pixmaps");
} else {
for (i=0; i<WMGetPropListItemCount(array); i++) {
val = WMGetFromPLArray(array, i);
addPathToList(panel->pixL, -1, WMGetFromPLString(val));
}
for (i=0; i<WMGetPropListItemCount(array); i++) {
val = WMGetFromPLArray(array, i);
addPathToList(panel->pixL, -1, WMGetFromPLString(val));
}
}
}
@@ -120,18 +120,18 @@ pushButton(WMWidget *w, void *data)
/* icon paths */
if (w == panel->icorB) {
i = WMGetListSelectedItemRow(panel->icoL);
i = WMGetListSelectedItemRow(panel->icoL);
if (i>=0)
WMRemoveListItem(panel->icoL, i);
if (i>=0)
WMRemoveListItem(panel->icoL, i);
}
/* pixmap paths */
if (w == panel->pixrB) {
i = WMGetListSelectedItemRow(panel->pixL);
i = WMGetListSelectedItemRow(panel->pixL);
if (i>=0)
WMRemoveListItem(panel->pixL, i);
if (i>=0)
WMRemoveListItem(panel->pixL, i);
}
}
@@ -197,9 +197,9 @@ paintItem(WMList *lPtr, int index, Drawable d, char *text, int state, WMRect *re
XFillRectangle(dpy, d, WMColorGC(backColor), x, y, width, height);
if (state & 1) {
WMDrawString(scr, d, panel->red, panel->font, x+4, y, text, strlen(text));
WMDrawString(scr, d, panel->red, panel->font, x+4, y, text, strlen(text));
} else {
WMDrawString(scr, d, panel->black, panel->font, x+4, y, text, strlen(text));
WMDrawString(scr, d, panel->black, panel->font, x+4, y, text, strlen(text));
}
}
@@ -212,20 +212,20 @@ storeData(_Panel *panel)
WMPropList *tmp;
int i;
char *p;
list = WMCreatePLArray(NULL, NULL);
for (i=0; i<WMGetListNumberOfRows(panel->icoL); i++) {
p = WMGetListItem(panel->icoL, i)->text;
tmp = WMCreatePLString(p);
WMAddToPLArray(list, tmp);
p = WMGetListItem(panel->icoL, i)->text;
tmp = WMCreatePLString(p);
WMAddToPLArray(list, tmp);
}
SetObjectForKey(list, "IconPath");
list = WMCreatePLArray(NULL, NULL);
for (i=0; i<WMGetListNumberOfRows(panel->pixL); i++) {
p = WMGetListItem(panel->pixL, i)->text;
tmp = WMCreatePLString(p);
WMAddToPLArray(list, tmp);
p = WMGetListItem(panel->pixL, i)->text;
tmp = WMCreatePLString(p);
WMAddToPLArray(list, tmp);
}
SetObjectForKey(list, "PixmapPath");
}
@@ -244,16 +244,16 @@ createPanel(Panel *p)
panel->gray = WMGrayColor(scr);
panel->red = WMCreateRGBColor(scr, 0xffff, 0, 0, True);
panel->font = WMSystemFontOfSize(scr, 12);
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
panel->tabv = WMCreateTabView(panel->box);
WMMoveWidget(panel->tabv, 12, 10);
WMResizeWidget(panel->tabv, 500, 215);
/* icon path */
panel->icoF = WMCreateFrame(panel->box);
@@ -264,13 +264,13 @@ createPanel(Panel *p)
WMSetTabViewItemView(tab, WMWidgetView(panel->icoF));
WMAddItemInTabView(panel->tabv, tab);
WMSetTabViewItemLabel(tab, _("Icon Search Paths"));
panel->icoL = WMCreateList(panel->icoF);
WMResizeWidget(panel->icoL, 480, 147);
WMMoveWidget(panel->icoL, 10, 10);
WMSetListUserDrawProc(panel->icoL, paintItem);
WMHangData(panel->icoL, panel);
panel->icoaB = WMCreateCommandButton(panel->icoF);
WMResizeWidget(panel->icoaB, 95, 24);
WMMoveWidget(panel->icoaB, 293, 165);
@@ -290,25 +290,25 @@ createPanel(Panel *p)
panel->pixF = WMCreateFrame(panel->box);
WMSetFrameRelief(panel->pixF, WRFlat);
WMResizeWidget(panel->pixF, 230, 210);
tab = WMCreateTabViewItemWithIdentifier(0);
WMSetTabViewItemView(tab, WMWidgetView(panel->pixF));
WMAddItemInTabView(panel->tabv, tab);
WMSetTabViewItemLabel(tab, _("Pixmap Search Paths"));
panel->pixL = WMCreateList(panel->pixF);
WMResizeWidget(panel->pixL, 480, 147);
WMMoveWidget(panel->pixL, 10, 10);
WMSetListUserDrawProc(panel->pixL, paintItem);
WMHangData(panel->pixL, panel);
panel->pixaB = WMCreateCommandButton(panel->pixF);
WMResizeWidget(panel->pixaB, 95, 24);
WMMoveWidget(panel->pixaB, 293, 165);
WMSetButtonText(panel->pixaB, _("Add"));
WMSetButtonAction(panel->pixaB, browseForFile, panel);
WMSetButtonImagePosition(panel->pixaB, WIPRight);
panel->pixrB = WMCreateCommandButton(panel->pixF);
WMResizeWidget(panel->pixrB, 95, 24);
WMMoveWidget(panel->pixrB, 395, 165);
@@ -317,10 +317,10 @@ createPanel(Panel *p)
WMMapSubwidgets(panel->pixF);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
@@ -337,14 +337,15 @@ InitPaths(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Search Path Configuration");
panel->description = _("Search paths to use when looking for pixmaps\n"
"and icons.");
"and icons.");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
AddSection(panel, ICON_FILE);
return panel;
}

View File

@@ -1,9 +1,9 @@
/* Preferences.c- misc personal preferences
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -31,12 +31,12 @@ typedef struct _Panel {
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMFrame *sizeF;
WMPopUpButton *sizeP;
WMFrame *posiF;
WMPopUpButton *posiP;
@@ -72,15 +72,15 @@ borderCallback(WMWidget *w, void *data)
i = WMGetSliderValue(panel->borderS);
if (i == 0)
sprintf(buffer, _("OFF"));
sprintf(buffer, _("OFF"));
else if (i == 1)
sprintf(buffer, _("1 pixel"));
sprintf(buffer, _("1 pixel"));
else if (i <= 4)
/* 2-4 */
sprintf(buffer, _("%i pixels"), i);
/* 2-4 */
sprintf(buffer, _("%i pixels"), i);
else
/* >4 */
sprintf(buffer, _("%i pixels "), i); /* note space! */
/* >4 */
sprintf(buffer, _("%i pixels "), i); /* note space! */
WMSetLabelText(panel->borderL, buffer);
}
@@ -93,29 +93,29 @@ showData(_Panel *panel)
str = GetStringForKey("ResizeDisplay");
if (!str)
str = "corner";
str = "corner";
if (strcasecmp(str, "corner")==0)
WMSetPopUpButtonSelectedItem(panel->sizeP, 0);
WMSetPopUpButtonSelectedItem(panel->sizeP, 0);
else if (strcasecmp(str, "center")==0)
WMSetPopUpButtonSelectedItem(panel->sizeP, 1);
WMSetPopUpButtonSelectedItem(panel->sizeP, 1);
else if (strcasecmp(str, "floating")==0)
WMSetPopUpButtonSelectedItem(panel->sizeP, 2);
WMSetPopUpButtonSelectedItem(panel->sizeP, 2);
else if (strcasecmp(str, "line")==0)
WMSetPopUpButtonSelectedItem(panel->sizeP, 3);
WMSetPopUpButtonSelectedItem(panel->sizeP, 3);
else if (strcasecmp(str, "none")==0)
WMSetPopUpButtonSelectedItem(panel->sizeP, 4);
WMSetPopUpButtonSelectedItem(panel->sizeP, 4);
str = GetStringForKey("MoveDisplay");
if (!str)
str = "corner";
str = "corner";
if (strcasecmp(str, "corner")==0)
WMSetPopUpButtonSelectedItem(panel->posiP, 0);
WMSetPopUpButtonSelectedItem(panel->posiP, 0);
else if (strcasecmp(str, "center")==0)
WMSetPopUpButtonSelectedItem(panel->posiP, 1);
WMSetPopUpButtonSelectedItem(panel->posiP, 1);
else if (strcasecmp(str, "floating")==0)
WMSetPopUpButtonSelectedItem(panel->posiP, 2);
WMSetPopUpButtonSelectedItem(panel->posiP, 2);
else if (strcasecmp(str, "none")==0)
WMSetPopUpButtonSelectedItem(panel->posiP, 3);
WMSetPopUpButtonSelectedItem(panel->posiP, 3);
x = GetIntegerForKey("WorkspaceBorderSize");
x = x<0 ? 0 : x;
@@ -154,37 +154,37 @@ storeData(_Panel *panel)
Bool lr, tb;
switch (WMGetPopUpButtonSelectedItem(panel->sizeP)) {
case 0:
str = "corner";
break;
case 1:
str = "center";
break;
case 2:
str = "floating";
break;
case 4:
str = "none";
break;
default:
str = "line";
break;
case 0:
str = "corner";
break;
case 1:
str = "center";
break;
case 2:
str = "floating";
break;
case 4:
str = "none";
break;
default:
str = "line";
break;
}
SetStringForKey(str, "ResizeDisplay");
switch (WMGetPopUpButtonSelectedItem(panel->posiP)) {
case 0:
str = "corner";
break;
case 1:
str = "center";
break;
case 3:
str = "none";
break;
default:
str = "floating";
break;
case 0:
str = "corner";
break;
case 1:
str = "center";
break;
case 3:
str = "none";
break;
default:
str = "floating";
break;
}
SetStringForKey(str, "MoveDisplay");
@@ -217,11 +217,11 @@ createPanel(Panel *p)
{
_Panel *panel = (_Panel*)p;
int i;
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/***************** Size Display ****************/
panel->sizeF = WMCreateFrame(panel->box);
WMResizeWidget(panel->sizeF, 240, 60);
@@ -268,11 +268,11 @@ createPanel(Panel *p)
WMResizeWidget(panel->ballF, 235, 125);
WMMoveWidget(panel->ballF, 270, 10);
WMSetFrameTitle(panel->ballF, _("Show balloon text for..."));
for (i=0; i<4; i++) {
panel->ballB[i] = WMCreateSwitchButton(panel->ballF);
WMResizeWidget(panel->ballB[i], 205, 20);
WMMoveWidget(panel->ballB[i], 15, 20+i*25);
panel->ballB[i] = WMCreateSwitchButton(panel->ballF);
WMResizeWidget(panel->ballB[i], 205, 20);
WMMoveWidget(panel->ballB[i], 15, 20+i*25);
}
WMSetButtonText(panel->ballB[0], _("incomplete window titles"));
WMSetButtonText(panel->ballB[1], _("miniwindow titles"));
@@ -299,13 +299,13 @@ createPanel(Panel *p)
#endif
WMMapSubwidgets(panel->optF);
/***************** Workspace border ****************/
panel->borderF = WMCreateFrame(panel->box);
WMResizeWidget(panel->borderF, 240, 75);
WMMoveWidget(panel->borderF, 20, 145);
WMSetFrameTitle(panel->borderF, _("Workspace border"));
panel->borderS = WMCreateSlider(panel->borderF);
WMResizeWidget(panel->borderS, 80, 15);
WMMoveWidget(panel->borderS, 20, 20);
@@ -329,7 +329,7 @@ createPanel(Panel *p)
WMMapSubwidgets(panel->borderF);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
@@ -348,10 +348,10 @@ InitPreferences(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Miscellaneous Ergonomic Preferences");
panel->description = _("Various settings like balloon text, geometry\n"
"displays etc.");
"displays etc.");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
@@ -359,3 +359,4 @@ InitPreferences(WMScreen *scr, WMWidget *parent)
return panel;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* TexturePanel.h- texture editting panel
*
*
* WPrefs - WindowMaker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -36,22 +36,22 @@ void ShowTexturePanel(TexturePanel *panel);
void HideTexturePanel(TexturePanel *panel);
void SetTexturePanelTexture(TexturePanel *panel, char *name,
WMPropList *texture);
void SetTexturePanelTexture(TexturePanel *panel, char *name,
WMPropList *texture);
char *GetTexturePanelTextureName(TexturePanel *panel);
WMPropList *GetTexturePanelTexture(TexturePanel *panel);
RImage *RenderTexturePanelTexture(TexturePanel *panel, unsigned width,
unsigned height);
RImage *RenderTexturePanelTexture(TexturePanel *panel, unsigned width,
unsigned height);
void SetTexturePanelOkAction(TexturePanel *panel, WMCallback *action,
void *clientData);
void *clientData);
void SetTexturePanelCancelAction(TexturePanel *panel, WMCallback *action,
void *clientData);
void *clientData);
void SetTexturePanelPixmapPath(TexturePanel *panel, WMPropList *array);

View File

@@ -1,9 +1,9 @@
/* Themes.c- Theme stuff
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -31,18 +31,18 @@ typedef struct _Panel {
char *sectionName;
CallbackRec callbacks;
WMWidget *parent;
WMButton *saveB;
WMList *list;
WMButton *loadB;
WMButton *instB;
WMFrame *totF;
WMButton *totB;
WMLabel *totL;
WMFrame *botF;
WMButton *botB;
WMLabel *botL;
@@ -88,23 +88,23 @@ static pid_t
downloadFile(WMScreen *scr, _Panel *panel, char *file)
{
pid_t pid;
pid = fork();
if (pid < 0) {
wsyserror("could not fork() process");
wsyserror("could not fork() process");
WMRunAlertPanel(scr, GetWindow(panel), _("Error"),
"Could not start download. fork() failed",
_("OK"), NULL, NULL);
return -1;
WMRunAlertPanel(scr, GetWindow(panel), _("Error"),
"Could not start download. fork() failed",
_("OK"), NULL, NULL);
return -1;
}
if (pid != 0) {
return pid;
return pid;
}
close(ConnectionNumber(WMScreenDisplay(scr)));
exit(1);
}
@@ -119,28 +119,28 @@ downloadCallback(WMWidget *w, void *data)
pid_t *pid;
if (button == panel->totB) {
pid = &panel->tilePID;
pid = &panel->tilePID;
} else {
pid = &panel->barPID;
pid = &panel->barPID;
}
if (*pid == 0) {
newPid = downloadFile(WMWidgetScreen(w), panel, NULL);
if (newPid < 0) {
return;
}
WMSetButtonText(button, _("Stop"));
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;
if (button == panel->totB) {
AddDeadChildHandler(newPid, finishedTileDownload, data);
} else {
AddDeadChildHandler(newPid, finishedBarDownload, data);
}
*pid = newPid;
} else {
*pid = 0;
*pid = 0;
WMSetButtonText(button, _("Download"));
WMSetButtonText(button, _("Download"));
}
}
@@ -151,8 +151,8 @@ updateThemeList(_Panel *panel)
{
WMClearList(panel->list);
}
@@ -184,9 +184,9 @@ createPanel(Panel *p)
WMMoveWidget(panel->instB, 95, 200);
WMSetButtonText(panel->instB, _("Install"));
/**************** Tile of the day ****************/
panel->totF = WMCreateFrame(panel->box);
WMResizeWidget(panel->totF, 210, 105);
WMMoveWidget(panel->totF, 240, 10);
@@ -204,7 +204,7 @@ createPanel(Panel *p)
WMSetButtonAction(panel->totB, downloadCallback, panel);
WMMapSubwidgets(panel->totF);
/**************** Bar of the day ****************/
panel->botF = WMCreateFrame(panel->box);
@@ -227,7 +227,7 @@ createPanel(Panel *p)
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
showData(panel);
}
@@ -248,9 +248,9 @@ InitThemes(WMScreen *scr, WMWidget *parent)
memset(panel, 0, sizeof(_Panel));
panel->sectionName = _("Themes");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
@@ -258,3 +258,4 @@ InitThemes(WMScreen *scr, WMWidget *parent)
return panel;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* WPrefs.h- general definitions
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -48,7 +48,7 @@ typedef struct _Panel Panel;
typedef struct {
unsigned flags; /* reserved for WPrefs.c Don't access it */
void (*createWidgets)(Panel*); /* called when showing for first time */
void (*updateDomain)(Panel*); /* save the changes to the dictionary */
Bool (*requiresRestart)(Panel*); /* return True if some static option was changed */

View File

@@ -1,9 +1,9 @@
/* WindowHandling.c- options for handling windows
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -31,16 +31,16 @@ typedef struct _Panel {
char *description;
CallbackRec callbacks;
WMWidget *parent;
WMFrame *placF;
WMPopUpButton *placP;
WMLabel *porigL;
WMLabel *porigvL;
WMFrame *porigF;
WMLabel *porigW;
WMSlider *vsli;
WMSlider *hsli;
@@ -53,7 +53,7 @@ typedef struct _Panel {
WMFrame *maxiF;
WMButton *miconB;
WMButton *mdockB;
WMFrame *opaqF;
WMButton *opaqB;
@@ -74,10 +74,10 @@ typedef struct _Panel {
static char *placements[] = {
"auto",
"random",
"manual",
"cascade",
"smart"
"random",
"manual",
"cascade",
"smart"
};
@@ -92,11 +92,11 @@ sliderCallback(WMWidget *w, void *data)
x = WMGetSliderValue(panel->hsli);
y = WMGetSliderValue(panel->vsli);
rx = x*(WMWidgetWidth(panel->porigF)-3)/swidth+2;
ry = y*(WMWidgetHeight(panel->porigF)-3)/sheight+2;
WMMoveWidget(panel->porigW, rx, ry);
sprintf(buffer, "(%i,%i)", x, y);
WMSetLabelText(panel->porigvL, buffer);
}
@@ -113,33 +113,33 @@ resistanceCallback(WMWidget *w, void *data)
i = WMGetSliderValue(panel->resS);
if (i == 0)
WMSetLabelText(panel->resL, "OFF");
WMSetLabelText(panel->resL, "OFF");
else {
sprintf(buffer, "%i", i);
WMSetLabelText(panel->resL, buffer);
sprintf(buffer, "%i", i);
WMSetLabelText(panel->resL, buffer);
}
}
static int
getPlacement(char *str)
getPlacement(char *str)
{
if (!str)
return 0;
return 0;
if (strcasecmp(str, "auto")==0)
return 0;
return 0;
else if (strcasecmp(str, "random")==0)
return 1;
return 1;
else if (strcasecmp(str, "manual")==0)
return 2;
return 2;
else if (strcasecmp(str, "cascade")==0)
return 3;
return 3;
else if (strcasecmp(str, "smart")==0)
return 4;
else
wwarning(_("bad option value %s in WindowPlacement. Using default value"),
str);
wwarning(_("bad option value %s in WindowPlacement. Using default value"),
str);
return 0;
}
@@ -157,15 +157,15 @@ showData(_Panel *panel)
arr = GetObjectForKey("WindowPlaceOrigin");
x = 0;
x = 0;
y = 0;
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 {
if (arr) {
x = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 0)));
y = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 1)));
}
if (arr) {
x = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 0)));
y = atoi(WMGetFromPLString(WMGetFromPLArray(arr, 1)));
}
}
WMSetSliderValue(panel->hsli, x);
@@ -178,16 +178,16 @@ showData(_Panel *panel)
resistanceCallback(NULL, panel);
WMSetButtonSelected(panel->tranB, GetBoolForKey("OpenTransientOnOwnerWorkspace"));
WMSetButtonSelected(panel->opaqB, GetBoolForKey("OpaqueMove"));
WMSetButtonSelected(panel->miconB, GetBoolForKey("NoWindowOverIcons"));
WMSetButtonSelected(panel->mdockB, GetBoolForKey("NoWindowOverDock"));
if (GetBoolForKey("Attraction"))
WMPerformButtonClick(panel->resrB);
else
else
WMPerformButtonClick(panel->resaB);
}
@@ -197,13 +197,13 @@ storeData(_Panel *panel)
{
WMPropList *arr;
char x[16], y[16];
SetBoolForKey(WMGetButtonSelected(panel->miconB), "NoWindowOverIcons");
SetBoolForKey(WMGetButtonSelected(panel->mdockB), "NoWindowOverDock");
SetBoolForKey(WMGetButtonSelected(panel->opaqB), "OpaqueMove");
SetBoolForKey(WMGetButtonSelected(panel->tranB), "OpenTransientOnOwnerWorkspace");
SetStringForKey(placements[WMGetPopUpButtonSelectedItem(panel->placP)],
"WindowPlacement");
"WindowPlacement");
sprintf(x, "%i", WMGetSliderValue(panel->hsli));
sprintf(y, "%i", WMGetSliderValue(panel->vsli));
arr = WMCreatePLArray(WMCreatePLString(x), WMCreatePLString(y), NULL);
@@ -225,16 +225,16 @@ createPanel(Panel *p)
int swidth, sheight;
char *path;
WMBox *hbox;
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
WMSetBoxHorizontal(panel->box, False);
WMSetBoxBorderWidth(panel->box, 8);
hbox = WMCreateBox(panel->box);
WMSetBoxHorizontal(hbox, True);
WMAddBoxSubview(panel->box, WMWidgetView(hbox), False, True, 110, 0, 10);
/************** Window Placement ***************/
panel->placF = WMCreateFrame(hbox);
WMMapWidget(panel->placF);
@@ -242,7 +242,7 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->placF, _("Window Placement"));
WMSetBalloonTextForView(_("How to place windows when they are first put\n"
"on screen."), WMWidgetView(panel->placF));
"on screen."), WMWidgetView(panel->placF));
panel->placP = WMCreatePopUpButton(panel->placF);
WMResizeWidget(panel->placP, 105, 20);
@@ -252,39 +252,39 @@ createPanel(Panel *p)
WMAddPopUpButtonItem(panel->placP, _("Manual"));
WMAddPopUpButtonItem(panel->placP, _("Cascade"));
WMAddPopUpButtonItem(panel->placP, _("Smart"));
panel->porigL = WMCreateLabel(panel->placF);
WMResizeWidget(panel->porigL, 120, 32);
WMMoveWidget(panel->porigL, 5, 45);
WMSetLabelTextAlignment(panel->porigL, WACenter);
WMSetLabelText(panel->porigL, _("Placement Origin"));
panel->porigvL = WMCreateLabel(panel->placF);
WMResizeWidget(panel->porigvL, 80, 20);
WMMoveWidget(panel->porigvL, 30, 75);
WMSetLabelTextAlignment(panel->porigvL, WACenter);
WMSetLabelTextAlignment(panel->porigvL, WACenter);
color = WMCreateRGBColor(scr, 0x5100, 0x5100, 0x7100, True);
panel->porigF = WMCreateFrame(panel->placF);
WMSetWidgetBackgroundColor(panel->porigF, color);
WMReleaseColor(color);
WMSetFrameRelief(panel->porigF, WRSunken);
swidth = WidthOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr)));
sheight = HeightOfScreen(DefaultScreenOfDisplay(WMScreenDisplay(scr)));
if (sheight > swidth) {
height = 70;
width = 70*swidth/sheight;
if (width > 240)
width = 240;
height = 240*sheight/swidth;
height = 70;
width = 70*swidth/sheight;
if (width > 240)
width = 240;
height = 240*sheight/swidth;
} else {
width = 240;
height = 240*sheight/swidth;
if (height > 70)
height = 70;
width = 70*swidth/sheight;
width = 240;
height = 240*sheight/swidth;
if (height > 70)
height = 70;
width = 70*swidth/sheight;
}
WMResizeWidget(panel->porigF, width, height);
WMMoveWidget(panel->porigF, 130+(240-width)/2, 20+(70-height)/2);
@@ -294,7 +294,7 @@ createPanel(Panel *p)
WMMoveWidget(panel->porigW, 2, 2);
WMSetLabelRelief(panel->porigW, WRRaised);
panel->hsli = WMCreateSlider(panel->placF);
WMResizeWidget(panel->hsli, width, 12);
WMMoveWidget(panel->hsli, 130+(240-width)/2, 20+(70-height)/2+height+2);
@@ -317,12 +317,12 @@ createPanel(Panel *p)
panel->opaqF = WMCreateFrame(hbox);
WMMapWidget(panel->opaqF);
WMAddBoxSubview(hbox, WMWidgetView(panel->opaqF), False, True, 110, 0, 0);
WMSetFrameTitle(panel->opaqF, _("Opaque Move"));
WMSetBalloonTextForView(_("Whether the window contents should be moved\n"
"when dragging windows aroung or if only a\n"
"frame should be displayed.\n"),
WMWidgetView(panel->opaqF));
"when dragging windows aroung or if only a\n"
"frame should be displayed.\n"),
WMWidgetView(panel->opaqF));
panel->opaqB = WMCreateButton(panel->opaqF, WBTToggle);
WMResizeWidget(panel->opaqB, 64, 64);
@@ -331,35 +331,35 @@ createPanel(Panel *p)
path = LocateImage(NON_OPAQUE_MOVE_PIXMAP);
if (path) {
pixmap = WMCreatePixmapFromFile(scr, path);
if (pixmap) {
WMSetButtonImage(panel->opaqB, pixmap);
WMReleasePixmap(pixmap);
} else {
wwarning(_("could not load icon %s"), path);
}
wfree(path);
pixmap = WMCreatePixmapFromFile(scr, path);
if (pixmap) {
WMSetButtonImage(panel->opaqB, pixmap);
WMReleasePixmap(pixmap);
} else {
wwarning(_("could not load icon %s"), path);
}
wfree(path);
}
path = LocateImage(OPAQUE_MOVE_PIXMAP);
if (path) {
pixmap = WMCreatePixmapFromFile(scr, path);
if (pixmap) {
WMSetButtonAltImage(panel->opaqB, pixmap);
WMReleasePixmap(pixmap);
} else {
wwarning(_("could not load icon %s"), path);
}
wfree(path);
pixmap = WMCreatePixmapFromFile(scr, path);
if (pixmap) {
WMSetButtonAltImage(panel->opaqB, pixmap);
WMReleasePixmap(pixmap);
} else {
wwarning(_("could not load icon %s"), path);
}
wfree(path);
}
WMMapSubwidgets(panel->opaqF);
/**************** Account for Icon/Dock ***************/
panel->maxiF = WMCreateFrame(panel->box);
WMResizeWidget(panel->maxiF, 205, 95);
WMMoveWidget(panel->maxiF, 305, 125);
WMSetFrameTitle(panel->maxiF, _("When maximizing..."));
panel->miconB = WMCreateSwitchButton(panel->maxiF);
WMResizeWidget(panel->miconB, 190, 30);
WMMoveWidget(panel->miconB, 10, 18);
@@ -381,9 +381,9 @@ createPanel(Panel *p)
WMSetFrameTitle(panel->resF, _("Edge Resistance"));
WMSetBalloonTextForView(_("Edge resistance will make windows `resist'\n"
"being moved further for the defined threshold\n"
"when moved against other windows or the edges\n"
"of the screen."), WMWidgetView(panel->resF));
"being moved further for the defined threshold\n"
"when moved against other windows or the edges\n"
"of the screen."), WMWidgetView(panel->resF));
panel->resS = WMCreateSlider(panel->resF);
WMResizeWidget(panel->resS, 80, 15);
@@ -410,21 +410,21 @@ createPanel(Panel *p)
WMMapSubwidgets(panel->resF);
/**************** Transients on Parent Workspace ****************/
panel->tranF = WMCreateFrame(panel->box);
WMResizeWidget(panel->tranF, 285, 40);
WMMoveWidget(panel->tranF, 8, 180);
panel->tranB = WMCreateSwitchButton(panel->tranF);
WMMoveWidget(panel->tranB, 10, 5);
WMResizeWidget(panel->tranB, 250, 30);
WMSetButtonText(panel->tranB, _("Open dialogs in the same workspace\nas their owners"));
WMMapSubwidgets(panel->tranF);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
/* show the config data */
showData(panel);
}
@@ -448,15 +448,16 @@ InitWindowHandling(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Window Handling Preferences");
panel->description = _("Window handling options. Initial placement style\n"
"edge resistance, opaque move etc.");
"edge resistance, opaque move etc.");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
panel->callbacks.undoChanges = undo;
AddSection(panel, ICON_FILE);
return panel;
}

View File

@@ -1,9 +1,9 @@
/* Workspace.c- workspace options
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -68,47 +68,47 @@ typedef struct _Panel {
static char *WSNamePositions[] = {
"none",
"center",
"top",
"bottom",
"topleft",
"topright",
"bottomleft",
"bottomright"
"center",
"top",
"bottom",
"topleft",
"topright",
"bottomleft",
"bottomright"
};
static void
createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
WMPixmap **icon1, WMPixmap **icon2)
createImages(WMScreen *scr, RContext *rc, RImage *xis, char *file,
WMPixmap **icon1, WMPixmap **icon2)
{
RImage *icon;
RColor gray = {0xae,0xaa,0xae};
*icon1 = WMCreatePixmapFromFile(scr, file);
if (!*icon1) {
wwarning(_("could not load icon %s"), file);
if (icon2)
*icon2 = NULL;
return;
wwarning(_("could not load icon %s"), file);
if (icon2)
*icon2 = NULL;
return;
}
if (!icon2)
return;
return;
icon = RLoadImage(rc, file, 0);
if (!icon) {
wwarning(_("could not load icon %s"), file);
*icon2 = NULL;
return;
wwarning(_("could not load icon %s"), file);
*icon2 = NULL;
return;
}
RCombineImageWithColor(icon, &gray);
if (xis) {
RCombineImagesWithOpaqueness(icon, xis, 180);
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127))) {
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
*icon2 = NULL;
}
RCombineImagesWithOpaqueness(icon, xis, 180);
if (!(*icon2 = WMCreatePixmapFromRImage(scr, icon, 127))) {
wwarning(_("could not process icon %s:"), file, RMessageForError(RErrorCode));
*icon2 = NULL;
}
}
RReleaseImage(icon);
}
@@ -122,25 +122,25 @@ showData(_Panel *panel)
char *str;
WMSetButtonSelected(panel->linkB, !GetBoolForKey("DontLinkWorkspaces"));
WMSetButtonSelected(panel->cyclB, GetBoolForKey("CycleWorkspaces"));
WMSetButtonSelected(panel->newB, GetBoolForKey("AdvanceToNewWorkspace"));
WMSetButtonSelected(panel->dockB, !GetBoolForKey("DisableDock"));
WMSetButtonSelected(panel->clipB, !GetBoolForKey("DisableClip"));
str = GetStringForKey("WorkspaceNameDisplayPosition");
if (!str)
str = "center";
str = "center";
idx = 1; /* center */
for (i = 0; i < sizeof(WSNamePositions)/sizeof(char*); i++) {
if (strcasecmp(WSNamePositions[i], str) == 0) {
idx = i;
break;
}
if (strcasecmp(WSNamePositions[i], str) == 0) {
idx = i;
break;
}
}
WMSetPopUpButtonSelectedItem(panel->posP, idx);
}
@@ -156,31 +156,31 @@ createPanel(Panel *p)
RImage *xis = NULL;
RContext *rc = WMScreenRContext(scr);
char *path;
path = LocateImage(ARQUIVO_XIS);
if (path) {
xis = RLoadImage(rc, path, 0);
if (!xis) {
wwarning(_("could not load image file %s"), path);
}
wfree(path);
xis = RLoadImage(rc, path, 0);
if (!xis) {
wwarning(_("could not load image file %s"), path);
}
wfree(path);
}
panel->box = WMCreateBox(panel->parent);
WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
/***************** Workspace Navigation *****************/
panel->navF = WMCreateFrame(panel->box);
WMResizeWidget(panel->navF, 365, 210);
WMMoveWidget(panel->navF, 15, 10);
WMSetFrameTitle(panel->navF, _("Workspace Navigation"));
panel->cyclB = WMCreateSwitchButton(panel->navF);
WMResizeWidget(panel->cyclB, 280, 34);
WMMoveWidget(panel->cyclB, 75, 30);
WMSetButtonText(panel->cyclB,
_("Wrap to the first workspace from the last workspace."));
_("Wrap to the first workspace from the last workspace."));
panel->cyclL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->cyclL, 60, 60);
@@ -188,12 +188,12 @@ createPanel(Panel *p)
WMSetLabelImagePosition(panel->cyclL, WIPImageOnly);
path = LocateImage(CYCLE_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
WMSetLabelImage(panel->cyclL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
WMSetLabelImage(panel->cyclL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
/**/
@@ -202,7 +202,7 @@ createPanel(Panel *p)
WMResizeWidget(panel->linkB, 280, 34);
WMMoveWidget(panel->linkB, 75, 75);
WMSetButtonText(panel->linkB,
_("Switch workspaces while dragging windows."));
_("Switch workspaces while dragging windows."));
panel->linkL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->linkL, 60, 40);
@@ -210,21 +210,21 @@ createPanel(Panel *p)
WMSetLabelImagePosition(panel->linkL, WIPImageOnly);
path = LocateImage(DONT_LINK_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
WMSetLabelImage(panel->linkL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
WMSetLabelImage(panel->linkL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
/**/
panel->newB = WMCreateSwitchButton(panel->navF);
WMResizeWidget(panel->newB, 280, 34);
WMMoveWidget(panel->newB, 75, 120);
WMSetButtonText(panel->newB,
_("Automatically create new workspaces."));
_("Automatically create new workspaces."));
panel->newL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->newL, 60, 20);
@@ -232,37 +232,37 @@ createPanel(Panel *p)
WMSetLabelImagePosition(panel->newL, WIPImageOnly);
path = LocateImage(ADVANCE_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
WMSetLabelImage(panel->newL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
WMSetLabelImage(panel->newL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
/**/
panel->posL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->posL, 140, 30);
WMMoveWidget(panel->posL, 75, 165);
WMSetLabelTextAlignment(panel->posL, WARight);
WMSetLabelText(panel->posL,
_("Position of workspace\nname display"));
WMSetLabelText(panel->posL,
_("Position of workspace\nname display"));
panel->posiL = WMCreateLabel(panel->navF);
WMResizeWidget(panel->posiL, 60, 40);
WMMoveWidget(panel->posiL, 10, 160);
WMSetLabelImagePosition(panel->posiL, WIPImageOnly);
path = LocateImage(WSNAME_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
WMSetLabelImage(panel->posiL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
createImages(scr, rc, xis, path, &icon1, NULL);
if (icon1) {
WMSetLabelImage(panel->posiL, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
panel->posP = WMCreatePopUpButton(panel->navF);
WMResizeWidget(panel->posP, 125, 20);
WMMoveWidget(panel->posP, 225, 175);
@@ -274,7 +274,7 @@ createPanel(Panel *p)
WMAddPopUpButtonItem(panel->posP, _("Top/Right"));
WMAddPopUpButtonItem(panel->posP, _("Bottom/Left"));
WMAddPopUpButtonItem(panel->posP, _("Bottom/Right"));
WMMapSubwidgets(panel->navF);
/***************** Dock/Clip *****************/
@@ -289,20 +289,20 @@ createPanel(Panel *p)
WMSetButtonImagePosition(panel->dockB, WIPImageOnly);
path = LocateImage(DOCK_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, &icon2);
if (icon2) {
WMSetButtonImage(panel->dockB, icon2);
WMReleasePixmap(icon2);
}
if (icon1) {
WMSetButtonAltImage(panel->dockB, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
createImages(scr, rc, xis, path, &icon1, &icon2);
if (icon2) {
WMSetButtonImage(panel->dockB, icon2);
WMReleasePixmap(icon2);
}
if (icon1) {
WMSetButtonAltImage(panel->dockB, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
WMSetBalloonTextForView(_("Disable/enable the application Dock (the\n"
"vertical icon bar in the side of the screen)."),
WMWidgetView(panel->dockB));
"vertical icon bar in the side of the screen)."),
WMWidgetView(panel->dockB));
panel->clipB = WMCreateButton(panel->dockF, WBTToggle);
WMResizeWidget(panel->clipB, 64, 64);
@@ -310,26 +310,26 @@ createPanel(Panel *p)
WMSetButtonImagePosition(panel->clipB, WIPImageOnly);
path = LocateImage(CLIP_FILE);
if (path) {
createImages(scr, rc, xis, path, &icon1, &icon2);
if (icon2) {
WMSetButtonImage(panel->clipB, icon2);
WMReleasePixmap(icon2);
}
if (icon1) {
WMSetButtonAltImage(panel->clipB, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
createImages(scr, rc, xis, path, &icon1, &icon2);
if (icon2) {
WMSetButtonImage(panel->clipB, icon2);
WMReleasePixmap(icon2);
}
if (icon1) {
WMSetButtonAltImage(panel->clipB, icon1);
WMReleasePixmap(icon1);
}
wfree(path);
}
WMSetBalloonTextForView(_("Disable/enable the Clip (that thing with\n"
"a paper clip icon)."),
WMWidgetView(panel->clipB));
"a paper clip icon)."),
WMWidgetView(panel->clipB));
WMMapSubwidgets(panel->dockF);
if (xis)
RReleaseImage(xis);
RReleaseImage(xis);
WMRealizeWidget(panel->box);
WMMapSubwidgets(panel->box);
@@ -343,12 +343,12 @@ storeData(_Panel *panel)
SetBoolForKey(!WMGetButtonSelected(panel->linkB), "DontLinkWorkspaces");
SetBoolForKey(WMGetButtonSelected(panel->cyclB), "CycleWorkspaces");
SetBoolForKey(WMGetButtonSelected(panel->newB), "AdvanceToNewWorkspace");
SetBoolForKey(!WMGetButtonSelected(panel->dockB), "DisableDock");
SetBoolForKey(!WMGetButtonSelected(panel->clipB), "DisableClip");
SetStringForKey(WSNamePositions[WMGetPopUpButtonSelectedItem(panel->posP)],
"WorkspaceNameDisplayPosition");
"WorkspaceNameDisplayPosition");
}
@@ -364,10 +364,10 @@ InitWorkspace(WMScreen *scr, WMWidget *parent)
panel->sectionName = _("Workspace Preferences");
panel->description = _("Workspace navigation features.\n"
"You can also enable/disable the Dock and Clip here.");
"You can also enable/disable the Dock and Clip here.");
panel->parent = parent;
panel->callbacks.createWidgets = createPanel;
panel->callbacks.updateDomain = storeData;
@@ -375,3 +375,4 @@ InitWorkspace(WMScreen *scr, WMWidget *parent)
return panel;
}

View File

@@ -1,7 +1,7 @@
/*
* Widget for testing double-clicks
*
*
*/
#include <WINGs/WINGsP.h>
@@ -46,7 +46,7 @@ InitDoubleTest(WMScreen *scr)
{
/* register our widget with WINGs and get our widget class ID */
if (!DoubleTestClass) {
DoubleTestClass = W_RegisterUserWidget();
DoubleTestClass = W_RegisterUserWidget();
}
return DoubleTestClass;
@@ -62,8 +62,8 @@ CreateDoubleTest(WMWidget *parent, char *text)
DoubleTest *dPtr;
if (!DoubleTestClass)
InitDoubleTest(WMWidgetScreen(parent));
InitDoubleTest(WMWidgetScreen(parent));
/* allocate some storage for our new widget instance */
dPtr = wmalloc(sizeof(DoubleTest));
/* initialize it */
@@ -71,20 +71,20 @@ CreateDoubleTest(WMWidget *parent, char *text)
/* set the class ID */
dPtr->widgetClass = DoubleTestClass;
dPtr->view = W_CreateView(W_VIEW(parent));
if (!dPtr->view) {
wfree(dPtr);
return NULL;
wfree(dPtr);
return NULL;
}
/* always do this */
dPtr->view->self = dPtr;
dPtr->text = wstrdup(text);
WMCreateEventHandler(dPtr->view, ExposureMask /* this allows us to know when we should paint */
|StructureNotifyMask, /* this allows us to know things like when we are destroyed */
handleEvents, dPtr);
|StructureNotifyMask, /* this allows us to know things like when we are destroyed */
handleEvents, dPtr);
WMCreateEventHandler(dPtr->view, ButtonPressMask,handleActionEvents, dPtr);
@@ -99,21 +99,21 @@ paintDoubleTest(_DoubleTest *dPtr)
W_Screen *scr = dPtr->view->screen;
if (dPtr->active) {
XFillRectangle(scr->display, dPtr->view->window, WMColorGC(scr->white),
0, 0, dPtr->view->size.width, dPtr->view->size.height);
XFillRectangle(scr->display, dPtr->view->window, WMColorGC(scr->white),
0, 0, dPtr->view->size.width, dPtr->view->size.height);
} else {
XClearWindow(scr->display, dPtr->view->window);
XClearWindow(scr->display, dPtr->view->window);
}
W_DrawRelief(scr, dPtr->view->window, 0, 0, dPtr->view->size.width,
dPtr->view->size.height, dPtr->on ? WRSunken : WRRaised);
dPtr->view->size.height, dPtr->on ? WRSunken : WRRaised);
if (dPtr->text) {
int y;
y = (dPtr->view->size.height-scr->normalFont->height)/2;
W_PaintText(dPtr->view, dPtr->view->window, scr->normalFont,
dPtr->on, dPtr->on+y, dPtr->view->size.width, WACenter,
scr->black, False, dPtr->text, strlen(dPtr->text));
int y;
y = (dPtr->view->size.height-scr->normalFont->height)/2;
W_PaintText(dPtr->view, dPtr->view->window, scr->normalFont,
dPtr->on, dPtr->on+y, dPtr->view->size.width, WACenter,
scr->black, False, dPtr->text, strlen(dPtr->text));
}
}
@@ -125,17 +125,17 @@ handleEvents(XEvent *event, void *data)
_DoubleTest *dPtr = (_DoubleTest*)data;
switch (event->type) {
case Expose:
if (event->xexpose.count!=0)
break;
paintDoubleTest(dPtr);
break;
case DestroyNotify:
destroyDoubleTest(dPtr);
break;
switch (event->type) {
case Expose:
if (event->xexpose.count!=0)
break;
paintDoubleTest(dPtr);
break;
case DestroyNotify:
destroyDoubleTest(dPtr);
break;
}
}
@@ -143,12 +143,12 @@ handleEvents(XEvent *event, void *data)
static void
deactivate(void *data)
{
_DoubleTest *dPtr = (_DoubleTest*)data;
_DoubleTest *dPtr = (_DoubleTest*)data;
if (dPtr->active)
dPtr->active = 0;
dPtr->active = 0;
paintDoubleTest(dPtr);
dPtr->timer = NULL;
}
@@ -160,21 +160,21 @@ handleActionEvents(XEvent *event, void *data)
extern _WINGsConfiguration WINGsConfiguration;
switch (event->type) {
case ButtonPress:
if (WMIsDoubleClick(event)) {
if (dPtr->timer)
WMDeleteTimerHandler(dPtr->timer);
dPtr->timer = NULL;
dPtr->on = !dPtr->on;
dPtr->active = 0;
paintDoubleTest(dPtr);
} else {
dPtr->timer=WMAddTimerHandler(WINGsConfiguration.doubleClickDelay,
deactivate, dPtr);
dPtr->active = 1;
paintDoubleTest(dPtr);
}
break;
case ButtonPress:
if (WMIsDoubleClick(event)) {
if (dPtr->timer)
WMDeleteTimerHandler(dPtr->timer);
dPtr->timer = NULL;
dPtr->on = !dPtr->on;
dPtr->active = 0;
paintDoubleTest(dPtr);
} else {
dPtr->timer=WMAddTimerHandler(WINGsConfiguration.doubleClickDelay,
deactivate, dPtr);
dPtr->active = 1;
paintDoubleTest(dPtr);
}
break;
}
}
@@ -184,10 +184,10 @@ static void
destroyDoubleTest(_DoubleTest *dPtr)
{
if (dPtr->timer)
WMDeleteTimerHandler(dPtr->timer);
WMDeleteTimerHandler(dPtr->timer);
if (dPtr->text)
wfree(dPtr->text);
wfree(dPtr->text);
wfree(dPtr);
}

View File

@@ -3,3 +3,4 @@ typedef struct W_DoubleTest DoubleTest;
DoubleTest *CreateDoubleTest(WMWidget *parent, char *text);

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* editmenu.h - editable menus
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 2000-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -32,30 +32,30 @@ typedef struct WEditMenuDelegate {
void *data;
void (*itemCloned)(struct WEditMenuDelegate*, WEditMenu*,
WEditMenuItem*, WEditMenuItem *);
WEditMenuItem*, WEditMenuItem *);
void (*itemEdited)(struct WEditMenuDelegate*, WEditMenu*,
WEditMenuItem*);
WEditMenuItem*);
void (*itemSelected)(struct WEditMenuDelegate*, WEditMenu*,
WEditMenuItem*);
WEditMenuItem*);
void (*itemDeselected)(struct WEditMenuDelegate*, WEditMenu*,
WEditMenuItem*);
WEditMenuItem*);
Bool (*shouldRemoveItem)(struct WEditMenuDelegate*, WEditMenu*,
WEditMenuItem*);
WEditMenuItem*);
} WEditMenuDelegate;
WEditMenuItem *WCreateEditMenuItem(WMWidget *parent, char *title,
Bool isTitle);
WEditMenuItem *WCreateEditMenuItem(WMWidget *parent, char *title,
Bool isTitle);
char *WGetEditMenuItemTitle(WEditMenuItem *item);
void *WGetEditMenuItemData(WEditMenuItem *item);
void WSetEditMenuItemData(WEditMenuItem *item, void *data,
WMCallback *destroyer);
void WSetEditMenuItemData(WEditMenuItem *item, void *data,
WMCallback *destroyer);
void WSetEditMenuItemImage(WEditMenuItem *item, WMPixmap *pixmap);
@@ -65,8 +65,8 @@ WEditMenu *WCreateEditMenuPad(WMWidget *parent);
void WSetEditMenuDelegate(WEditMenu *mPtr, WEditMenuDelegate *delegate);
WEditMenuItem *WInsertMenuItemWithTitle(WEditMenu *mPtr, int index,
char *title);
WEditMenuItem *WInsertMenuItemWithTitle(WEditMenu *mPtr, int index,
char *title);
WEditMenuItem *WAddMenuItemWithTitle(WEditMenu *mPtr, char *title);
@@ -79,7 +79,7 @@ char *WGetEditMenuTitle(WEditMenu *mPtr);
void WSetEditMenuAcceptsDrop(WEditMenu *mPtr, Bool flag);
void WSetEditMenuSubmenu(WEditMenu *mPtr, WEditMenuItem *item,
WEditMenu *submenu);
WEditMenu *submenu);
WEditMenu *WGetEditMenuSubmenu(WEditMenu *mPtr, WEditMenuItem *item);

View File

@@ -1,9 +1,9 @@
/* imagebrowser.c- image browser widget
*
*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 2000-2003 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
@@ -16,7 +16,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -42,22 +42,22 @@ struct _ImageBrowser {
WMWindow *win;
WMPopUpButton *pathP;
WMScrollView *sview;
WMFrame *frame;
WMWidget *auxWidget;
WMButton *viewBtn;
WMButton *okBtn;
WMButton *cancelBtn;
WMSize maxPreviewSize;
ImageBrowserDelegate *delegate;
WMArray *previews;
};
@@ -71,26 +71,26 @@ struct _ImageBrowser {
ImageBrowser*
CreateImageBrowser(WMScreen *scr, char *title, char **paths, int pathN,
WMSize *maxSize, WMWidget *auxWidget)
WMSize *maxSize, WMWidget *auxWidget)
{
ImageBrowser *br;
int i;
int h;
br = wmalloc(sizeof(ImageBrowser));
br->win = WMCreateWindow(scr, "imageBrowser");
WMResizeWidget(br->win, DEFAULT_WIDTH, DEFAULT_HEIGHT);
br->pathP = WMCreatePopUpButton(br->win);
WMMoveWidget(br->pathP, (DEFAULT_WIDTH - 80)/2, 10);
WMResizeWidget(br->pathP, DEFAULT_WIDTH - 80, 20);
for (i = 0; i < pathN; i++) {
WMAddPopUpButtonItem(br->pathP, paths[i]);
WMAddPopUpButtonItem(br->pathP, paths[i]);
}
br->viewBtn = WMCreateCommandButton(br->win);
WMSetButtonText(br->viewBtn, _("View"));
WMResizeWidget(br->viewBtn, 80, 24);
@@ -106,32 +106,32 @@ CreateImageBrowser(WMScreen *scr, char *title, char **paths, int pathN,
WMResizeWidget(br->okBtn, 80, 24);
WMMoveWidget(br->okBtn, DEFAULT_WIDTH - 10 - 160 - 5, DEFAULT_HEIGHT - 29);
br->auxWidget = auxWidget;
h = DEFAULT_HEIGHT
- 20 /* top and bottom spacing */
- 25 /* popup menu and spacing */
- 29; /* button row and spacing */
h = DEFAULT_HEIGHT
- 20 /* top and bottom spacing */
- 25 /* popup menu and spacing */
- 29; /* button row and spacing */
if (auxWidget != NULL) {
h -= WMWidgetHeight(auxWidget) + 5;
W_ReparentView(WMWidgetView(auxWidget),
WMWidgetView(br->win),
10, 10 + 25 + h + 5);
h -= WMWidgetHeight(auxWidget) + 5;
W_ReparentView(WMWidgetView(auxWidget),
WMWidgetView(br->win),
10, 10 + 25 + h + 5);
}
br->sview = WMCreateScrollView(br->win);
WMResizeWidget(br->sview, DEFAULT_WIDTH-20, h);
WMMoveWidget(br->sview, 10, 5 + 20 + 5);
WMMapSubwidgets(br->win);
return br;
}
@@ -142,24 +142,24 @@ ShowImageBrowser(ImageBrowser *browser)
WMMapWidget(browser->win);
}
void
void
CloseImageBrowser(ImageBrowser *browser)
{
WMUnmapWidget(browser->win);
}
void
void
SetImageBrowserPathList(ImageBrowser *browser, char **paths, int pathN)
{
}
void
SetImageBrowserDelegate(ImageBrowser *browser,
ImageBrowserDelegate *delegate)
SetImageBrowserDelegate(ImageBrowser *browser,
ImageBrowserDelegate *delegate)
{
}
@@ -170,9 +170,9 @@ void
DestroyImageBrowser(ImageBrowser *browser)
{
WMDestroyWidget(browser->win);
/**/
wfree(browser);
}

View File

@@ -11,18 +11,18 @@ struct _ImageBrowserDelegate {
void *data;
void (*selected)(ImageBrowserDelegate *self,
ImageBrowser *browser,
char *path);
ImageBrowser *browser,
char *path);
void (*closed)(ImageBrowserDelegate *self,
ImageBrowser *browser,
Bool canceled);
ImageBrowser *browser,
Bool canceled);
};
ImageBrowser *CreateImageBrowser(WMScreen *scr, char *title, char **paths,
int pathN, WMSize *maxSize,
WMWidget *auxWidget);
int pathN, WMSize *maxSize,
WMWidget *auxWidget);

View File

@@ -1,8 +1,8 @@
/*
* WPrefs - Window Maker Preferences Program
*
*
* Copyright (c) 1998-2003 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
@@ -15,7 +15,7 @@
*
* 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,
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
* USA.
*/
@@ -70,10 +70,10 @@ handleDeadChild(int sig)
{
pid_t pid;
int status;
pid = waitpid(-1, &status, WNOHANG);
if (pid > 0) {
DeadChildren[DeadChildrenCount++] = pid;
DeadChildren[DeadChildrenCount++] = pid;
}
}
#endif
@@ -84,18 +84,18 @@ 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;
}
if (DeadHandlers[i].pid == 0) {
DeadHandlers[i].pid = pid;
DeadHandlers[i].handler = handler;
DeadHandlers[i].data = data;
break;
}
}
assert(i!=MAX_DEATHS);
}
int
int
main(int argc, char **argv)
{
Display *dpy;
@@ -105,29 +105,29 @@ main(int argc, char **argv)
char *display_name="";
wsetabort(wAbort);
memset(DeadHandlers, 0, sizeof(DeadHandlers));
WMInitializeApplication("WPrefs", &argc, argv);
if (argc>1) {
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "-version")==0
|| strcmp(argv[i], "--version")==0) {
printf("WPrefs (Window Maker) %s\n", WVERSION);
exit(0);
} else if (strcmp(argv[i], "-display")==0) {
i++;
if (i>=argc) {
wwarning(_("too few arguments for %s"), argv[i-1]);
exit(0);
}
display_name = argv[i];
} else {
print_help(argv[0]);
exit(0);
}
}
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "-version")==0
|| strcmp(argv[i], "--version")==0) {
printf("WPrefs (Window Maker) %s\n", WVERSION);
exit(0);
} else if (strcmp(argv[i], "-display")==0) {
i++;
if (i>=argc) {
wwarning(_("too few arguments for %s"), argv[i-1]);
exit(0);
}
display_name = argv[i];
} else {
print_help(argv[0]);
exit(0);
}
}
}
locale = getenv("LANG");
@@ -135,31 +135,31 @@ main(int argc, char **argv)
#ifdef I18N
if (getenv("NLSPATH"))
bindtextdomain("WPrefs", getenv("NLSPATH"));
bindtextdomain("WPrefs", getenv("NLSPATH"));
else
bindtextdomain("WPrefs", LOCALEDIR);
bindtextdomain("WPrefs", LOCALEDIR);
textdomain("WPrefs");
if (!XSupportsLocale()) {
wwarning(_("X server does not support locale"));
wwarning(_("X server does not support locale"));
}
if (XSetLocaleModifiers("") == NULL) {
wwarning(_("cannot set locale modifiers"));
wwarning(_("cannot set locale modifiers"));
}
#endif
dpy = XOpenDisplay(display_name);
if (!dpy) {
wfatal(_("could not open display %s"), XDisplayName(display_name));
exit(0);
wfatal(_("could not open display %s"), XDisplayName(display_name));
exit(0);
}
#if 0
XSynchronize(dpy, 1);
#endif
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
if (!scr) {
wfatal(_("could not initialize application"));
exit(0);
wfatal(_("could not initialize application"));
exit(0);
}
WMPLSetCaseSensitive(False);
@@ -167,21 +167,22 @@ main(int argc, char **argv)
Initialize(scr);
while (1) {
XEvent event;
XEvent event;
WMNextEvent(dpy, &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;
}
}
}
while (DeadChildrenCount-- > 0) {
int i;
WMHandleEvent(&event);
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

@@ -1,35 +1,35 @@
/* Grok X modifier mappings for shortcuts.
Most of this code was taken from src/event-Xt.c in XEmacs 20.3-b17.
The copyright(s) from the original XEmacs code are included below.
Perpetrator: Sudish Joseph <sj@eng.mindspring.net>, Sept. 1997. */
Most of this code was taken from src/event-Xt.c in XEmacs 20.3-b17.
The copyright(s) from the original XEmacs code are included below.
Perpetrator: Sudish Joseph <sj@eng.mindspring.net>, Sept. 1997. */
/*
* More changes for WPrefs by Alfredo Kojima, Aug 1998
*/
/* The event_stream interface for X11 with Xt, and/or tty frames.
Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
Copyright (C) 1995 Sun Microsystems, Inc.
Copyright (C) 1996 Ben Wing.
Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
Copyright (C) 1995 Sun Microsystems, Inc.
Copyright (C) 1996 Ben Wing.
This file is part of XEmacs.
This file is part of XEmacs.
XEmacs 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, or (at your option) any
later version.
XEmacs 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, or (at your option) any
later version.
XEmacs 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.
XEmacs 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 XEmacs; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with XEmacs; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <string.h>
#include <X11/Xlib.h>
@@ -44,43 +44,43 @@ Boston, MA 02111-1307, USA. */
/************************************************************************/
/* X bogusly doesn't define the interpretations of any bits besides
ModControl, ModShift, and ModLock; so the Interclient Communication
Conventions Manual says that we have to bend over backwards to figure
out what the other modifier bits mean. According to ICCCM:
ModControl, ModShift, and ModLock; so the Interclient Communication
Conventions Manual says that we have to bend over backwards to figure
out what the other modifier bits mean. According to ICCCM:
- Any keycode which is assigned ModControl is a "control" key.
- Any keycode which is assigned ModControl is a "control" key.
- Any modifier bit which is assigned to a keycode which generates Meta_L
or Meta_R is the modifier bit meaning "meta". Likewise for Super, Hyper,
etc.
- Any modifier bit which is assigned to a keycode which generates Meta_L
or Meta_R is the modifier bit meaning "meta". Likewise for Super, Hyper,
etc.
- Any keypress event which contains ModControl in its state should be
interpreted as a "control" character.
- Any keypress event which contains ModControl in its state should be
interpreted as a "control" character.
- Any keypress event which contains a modifier bit in its state which is
generated by a keycode whose corresponding keysym is Meta_L or Meta_R
should be interpreted as a "meta" character. Likewise for Super, Hyper,
etc.
- Any keypress event which contains a modifier bit in its state which is
generated by a keycode whose corresponding keysym is Meta_L or Meta_R
should be interpreted as a "meta" character. Likewise for Super, Hyper,
etc.
- It is illegal for a keysym to be associated with more than one modifier
bit.
- It is illegal for a keysym to be associated with more than one modifier
bit.
This means that the only thing that emacs can reasonably interpret as a
"meta" key is a key whose keysym is Meta_L or Meta_R, and which generates
one of the modifier bits Mod1-Mod5.
This means that the only thing that emacs can reasonably interpret as a
"meta" key is a key whose keysym is Meta_L or Meta_R, and which generates
one of the modifier bits Mod1-Mod5.
Unfortunately, many keyboards don't have Meta keys in their default
configuration. So, if there are no Meta keys, but there are "Alt" keys,
emacs will interpret Alt as Meta. If there are both Meta and Alt keys,
then the Meta keys mean "Meta", and the Alt keys mean "Alt" (it used to
mean "Symbol," but that just confused the hell out of way too many people).
Unfortunately, many keyboards don't have Meta keys in their default
configuration. So, if there are no Meta keys, but there are "Alt" keys,
emacs will interpret Alt as Meta. If there are both Meta and Alt keys,
then the Meta keys mean "Meta", and the Alt keys mean "Alt" (it used to
mean "Symbol," but that just confused the hell out of way too many people).
This works with the default configurations of the 19 keyboard-types I've
checked.
This works with the default configurations of the 19 keyboard-types I've
checked.
Emacs detects keyboard configurations which violate the above rules, and
prints an error message on the standard-error-output. (Perhaps it should
use a pop-up-window instead.)
Emacs detects keyboard configurations which violate the above rules, and
prints an error message on the standard-error-output. (Perhaps it should
use a pop-up-window instead.)
*/
static int MetaIndex, HyperIndex, SuperIndex, AltIndex, ModeIndex;
@@ -88,10 +88,10 @@ static int MetaIndex, HyperIndex, SuperIndex, AltIndex, ModeIndex;
static const char *
index_to_name (int indice)
{
switch (indice)
switch (indice)
{
case ShiftMapIndex: return "ModShift";
case LockMapIndex: return "ModLock";
case LockMapIndex: return "ModLock";
case ControlMapIndex: return "ModControl";
case Mod1MapIndex: return "Mod1";
case Mod2MapIndex: return "Mod2";
@@ -105,131 +105,131 @@ index_to_name (int indice)
static void
x_reset_modifier_mapping (Display *display)
{
int modifier_index, modifier_key, column, mkpm;
int warned_about_overlapping_modifiers = 0;
int warned_about_predefined_modifiers = 0;
int warned_about_duplicate_modifiers = 0;
int meta_bit = 0;
int hyper_bit = 0;
int super_bit = 0;
int alt_bit = 0;
int mode_bit = 0;
XModifierKeymap *x_modifier_keymap = XGetModifierMapping (display);
int modifier_index, modifier_key, column, mkpm;
int warned_about_overlapping_modifiers = 0;
int warned_about_predefined_modifiers = 0;
int warned_about_duplicate_modifiers = 0;
int meta_bit = 0;
int hyper_bit = 0;
int super_bit = 0;
int alt_bit = 0;
int mode_bit = 0;
XModifierKeymap *x_modifier_keymap = XGetModifierMapping (display);
#define modwarn(name,old,other) \
wwarning ("%s (0x%x) generates %s, which is generated by %s.\n\n", \
name, code, index_to_name (old), other), \
warned_about_overlapping_modifiers = 1
wwarning ("%s (0x%x) generates %s, which is generated by %s.\n\n", \
name, code, index_to_name (old), other), \
warned_about_overlapping_modifiers = 1
#define modbarf(name,other) \
wwarning ("%s (0x%x) generates %s, which is nonsensical.\n\n", \
name, code, other), \
warned_about_predefined_modifiers = 1
wwarning ("%s (0x%x) generates %s, which is nonsensical.\n\n", \
name, code, other), \
warned_about_predefined_modifiers = 1
#define check_modifier(name,mask) \
if ((1<<modifier_index) != mask) \
if ((1<<modifier_index) != mask) \
wwarning ("%s (0x%x) generates %s, which is nonsensical.\n\n", \
name, code, index_to_name (modifier_index)), \
name, code, index_to_name (modifier_index)), \
warned_about_predefined_modifiers = 1
#define store_modifier(name,old) \
if (old && old != modifier_index) \
if (old && old != modifier_index) \
wwarning ("%s (0x%x) generates both %s and %s, which is nonsensical.\n\n",\
name, code, index_to_name (old), \
index_to_name (modifier_index)), \
name, code, index_to_name (old), \
index_to_name (modifier_index)), \
warned_about_duplicate_modifiers = 1; \
if (modifier_index == ShiftMapIndex) modbarf (name,"ModShift"); \
else if (modifier_index == LockMapIndex) modbarf (name,"ModLock"); \
else if (modifier_index == ControlMapIndex) modbarf (name,"ModControl"); \
else if (sym == XK_Mode_switch) \
if (modifier_index == ShiftMapIndex) modbarf (name,"ModShift"); \
else if (modifier_index == LockMapIndex) modbarf (name,"ModLock"); \
else if (modifier_index == ControlMapIndex) modbarf (name,"ModControl"); \
else if (sym == XK_Mode_switch) \
mode_bit = modifier_index; /* Mode_switch is special, see below... */ \
else if (modifier_index == meta_bit && old != meta_bit) \
else if (modifier_index == meta_bit && old != meta_bit) \
modwarn (name, meta_bit, "Meta"); \
else if (modifier_index == super_bit && old != super_bit) \
else if (modifier_index == super_bit && old != super_bit) \
modwarn (name, super_bit, "Super"); \
else if (modifier_index == hyper_bit && old != hyper_bit) \
else if (modifier_index == hyper_bit && old != hyper_bit) \
modwarn (name, hyper_bit, "Hyper"); \
else if (modifier_index == alt_bit && old != alt_bit) \
else if (modifier_index == alt_bit && old != alt_bit) \
modwarn (name, alt_bit, "Alt"); \
else \
else \
old = modifier_index;
mkpm = x_modifier_keymap->max_keypermod;
for (modifier_index = 0; modifier_index < 8; modifier_index++)
for (modifier_key = 0; modifier_key < mkpm; modifier_key++) {
KeySym last_sym = 0;
for (column = 0; column < 4; column += 2) {
KeyCode code = x_modifier_keymap->modifiermap[modifier_index * mkpm
+ modifier_key];
KeySym sym = (code ? XKeycodeToKeysym (display, code, column) : 0);
if (sym == last_sym) continue;
last_sym = sym;
switch (sym) {
case XK_Mode_switch:store_modifier ("Mode_switch", mode_bit); break;
case XK_Meta_L: store_modifier ("Meta_L", meta_bit); break;
case XK_Meta_R: store_modifier ("Meta_R", meta_bit); break;
case XK_Super_L: store_modifier ("Super_L", super_bit); break;
case XK_Super_R: store_modifier ("Super_R", super_bit); break;
case XK_Hyper_L: store_modifier ("Hyper_L", hyper_bit); break;
case XK_Hyper_R: store_modifier ("Hyper_R", hyper_bit); break;
case XK_Alt_L: store_modifier ("Alt_L", alt_bit); break;
case XK_Alt_R: store_modifier ("Alt_R", alt_bit); break;
case XK_Control_L: check_modifier ("Control_L", ControlMask); break;
case XK_Control_R: check_modifier ("Control_R", ControlMask); break;
case XK_Shift_L: check_modifier ("Shift_L", ShiftMask); break;
case XK_Shift_R: check_modifier ("Shift_R", ShiftMask); break;
case XK_Shift_Lock: check_modifier ("Shift_Lock", LockMask); break;
case XK_Caps_Lock: check_modifier ("Caps_Lock", LockMask); break;
mkpm = x_modifier_keymap->max_keypermod;
for (modifier_index = 0; modifier_index < 8; modifier_index++)
for (modifier_key = 0; modifier_key < mkpm; modifier_key++) {
KeySym last_sym = 0;
for (column = 0; column < 4; column += 2) {
KeyCode code = x_modifier_keymap->modifiermap[modifier_index * mkpm
+ modifier_key];
KeySym sym = (code ? XKeycodeToKeysym (display, code, column) : 0);
if (sym == last_sym) continue;
last_sym = sym;
switch (sym) {
case XK_Mode_switch:store_modifier ("Mode_switch", mode_bit); break;
case XK_Meta_L: store_modifier ("Meta_L", meta_bit); break;
case XK_Meta_R: store_modifier ("Meta_R", meta_bit); break;
case XK_Super_L: store_modifier ("Super_L", super_bit); break;
case XK_Super_R: store_modifier ("Super_R", super_bit); break;
case XK_Hyper_L: store_modifier ("Hyper_L", hyper_bit); break;
case XK_Hyper_R: store_modifier ("Hyper_R", hyper_bit); break;
case XK_Alt_L: store_modifier ("Alt_L", alt_bit); break;
case XK_Alt_R: store_modifier ("Alt_R", alt_bit); break;
case XK_Control_L: check_modifier ("Control_L", ControlMask); break;
case XK_Control_R: check_modifier ("Control_R", ControlMask); break;
case XK_Shift_L: check_modifier ("Shift_L", ShiftMask); break;
case XK_Shift_R: check_modifier ("Shift_R", ShiftMask); break;
case XK_Shift_Lock: check_modifier ("Shift_Lock", LockMask); break;
case XK_Caps_Lock: check_modifier ("Caps_Lock", LockMask); break;
/* It probably doesn't make any sense for a modifier bit to be
assigned to a key that is not one of the above, but OpenWindows
assigns modifier bits to a couple of random function keys for
no reason that I can discern, so printing a warning here would
be annoying. */
}
}
}
/* It probably doesn't make any sense for a modifier bit to be
assigned to a key that is not one of the above, but OpenWindows
assigns modifier bits to a couple of random function keys for
no reason that I can discern, so printing a warning here would
be annoying. */
}
}
}
#undef store_modifier
#undef check_modifier
#undef modwarn
#undef modbarf
/* If there was no Meta key, then try using the Alt key instead.
/* If there was no Meta key, then try using the Alt key instead.
If there is both a Meta key and an Alt key, then the Alt key
is not disturbed and remains an Alt key. */
if (! meta_bit && alt_bit)
meta_bit = alt_bit, alt_bit = 0;
if (! meta_bit && alt_bit)
meta_bit = alt_bit, alt_bit = 0;
/* mode_bit overrides everything, since it's processed down inside of
/* mode_bit overrides everything, since it's processed down inside of
XLookupString() instead of by us. If Meta and Mode_switch both
generate the same modifier bit (which is an error), then we don't
interpret that bit as Meta, because we can't make XLookupString()
not interpret it as Mode_switch; and interpreting it as both would
be totally wrong. */
if (mode_bit)
if (mode_bit)
{
const char *warn = 0;
if (mode_bit == meta_bit) warn = "Meta", meta_bit = 0;
else if (mode_bit == hyper_bit) warn = "Hyper", hyper_bit = 0;
else if (mode_bit == super_bit) warn = "Super", super_bit = 0;
else if (mode_bit == alt_bit) warn = "Alt", alt_bit = 0;
if (warn)
{
wwarning
("%s is being used for both Mode_switch and %s.\n\n",
index_to_name (mode_bit), warn),
warned_about_overlapping_modifiers = 1;
}
const char *warn = 0;
if (mode_bit == meta_bit) warn = "Meta", meta_bit = 0;
else if (mode_bit == hyper_bit) warn = "Hyper", hyper_bit = 0;
else if (mode_bit == super_bit) warn = "Super", super_bit = 0;
else if (mode_bit == alt_bit) warn = "Alt", alt_bit = 0;
if (warn)
{
wwarning
("%s is being used for both Mode_switch and %s.\n\n",
index_to_name (mode_bit), warn),
warned_about_overlapping_modifiers = 1;
}
}
MetaIndex = meta_bit;
HyperIndex = hyper_bit;
SuperIndex = super_bit;
AltIndex = alt_bit;
ModeIndex = mode_bit;
MetaIndex = meta_bit;
HyperIndex = hyper_bit;
SuperIndex = super_bit;
AltIndex = alt_bit;
ModeIndex = mode_bit;
if (x_modifier_keymap != NULL)
XFreeModifiermap(x_modifier_keymap);
if (x_modifier_keymap != NULL)
XFreeModifiermap(x_modifier_keymap);
}
@@ -237,33 +237,35 @@ int
ModifierFromKey(Display *dpy, char *key)
{
static int eqw = 0;
if (!eqw)
x_reset_modifier_mapping(dpy);
x_reset_modifier_mapping(dpy);
eqw = 1;
if (strcasecmp(key, "SHIFT")==0)
return ShiftMapIndex;
return ShiftMapIndex;
else if (strcasecmp(key, "CONTROL")==0)
return ControlMapIndex;
return ControlMapIndex;
else if (strcasecmp(key, "ALT")==0)
return AltIndex;
return AltIndex;
else if (strcasecmp(key, "META")==0)
return MetaIndex;
return MetaIndex;
else if (strcasecmp(key, "SUPER")==0)
return SuperIndex;
return SuperIndex;
else if (strcasecmp(key, "HYPER")==0)
return HyperIndex;
return HyperIndex;
else if (strcasecmp(key, "MOD1")==0)
return Mod1MapIndex;
return Mod1MapIndex;
else if (strcasecmp(key, "MOD2")==0)
return Mod2MapIndex;
return Mod2MapIndex;
else if (strcasecmp(key, "MOD3")==0)
return Mod3MapIndex;
return Mod3MapIndex;
else if (strcasecmp(key, "MOD4")==0)
return Mod4MapIndex;
return Mod4MapIndex;
else if (strcasecmp(key, "MOD5")==0)
return Mod5MapIndex;
return Mod5MapIndex;
else
return -1;
return -1;
}