mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-11 19:25:49 +01:00
changed indentation to use spaces only
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user