1 /* MouseSettings.c- mouse options (some are equivalent to xset)
3 * WPrefs - Window Maker Preferences Program
5 * Copyright (c) 1998 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
26 #include <X11/Xutil.h>
30 /* double-click tester */
39 typedef struct _Panel
{
44 CallbackRec callbacks
;
78 WMButton
*lastClickedSpeed
;
84 #define ICON_FILE "mousesettings"
86 #define SPEED_ICON_FILE "mousespeed"
87 #define SPEED_IMAGE "speed%i"
88 #define SPEED_IMAGE_S "speed%is"
90 #define DELAY_ICON "timer%i"
91 #define DELAY_ICON_S "timer%is"
93 #define MOUSEB_L "minimouseleft"
94 #define MOUSEB_M "minimousemiddle"
95 #define MOUSEB_R "minimouseright"
97 /* need access to the double click variables */
102 static char *modifierNames
[] = {
114 #define DELAY(i) ((i)*75+170)
117 int ModifierFromKey(Display
*dpy
, char *key
);
121 setMouseAccel(WMScreen
*scr
, float accel
, int threshold
)
128 XChangePointerControl(WMScreenDisplay(scr
), True
, True
, n
, d
, threshold
);
133 speedClick(WMWidget
*w
, void *data
)
135 _Panel
*panel
= (_Panel
*)data
;
144 tmp
= WMGetTextFieldText(panel
->acceT
);
145 if (sscanf(tmp
, "%f", &accel
)!=1 || accel
< 0) {
146 WMRunAlertPanel(WMWidgetScreen(w
), GetWindow(panel
), _("Error"),
147 _("Invalid mouse acceleration value. Must be a positive real value."),
148 _("OK"), NULL
, NULL
);
152 panel
->acceleration
= accel
;
155 for (i
=0; i
<5; i
++) {
156 if (panel
->speedB
[i
]==w
)
160 panel
->acceleration
= 0.5+(i
*0.5);
162 sprintf(buffer
, "%.2f", 0.5+(i
*0.5));
163 WMSetTextFieldText(panel
->acceT
, buffer
);
166 tmp
= WMGetTextFieldText(panel
->threT
);
167 if (sscanf(tmp
, "%i", &threshold
)!=1 || threshold
< 0
168 || threshold
> panel
->maxThreshold
) {
169 WMRunAlertPanel(WMWidgetScreen(panel
->win
), GetWindow(panel
), _("Error"),
170 _("Invalid mouse acceleration threshold value. Must be the number of pixels to travel before accelerating."),
171 _("OK"), NULL
, NULL
);
173 setMouseAccel(WMWidgetScreen(panel
->win
), panel
->acceleration
,
181 returnPressed(void *observerData
, WMNotification
*notification
)
183 _Panel
*panel
= (_Panel
*)observerData
;
185 speedClick(NULL
, panel
);
190 doubleClick(WMWidget
*w
, void *data
)
192 _Panel
*panel
= (_Panel
*)data
;
194 extern _WINGsConfiguration WINGsConfiguration
;
196 for (i
=0; i
<5; i
++) {
197 if (panel
->ddelaB
[i
]==w
)
200 WINGsConfiguration
.doubleClickDelay
= DELAY(i
);
211 if (strcasecmp(str
, "left")==0)
213 else if (strcasecmp(str
, "middle")==0)
215 else if (strcasecmp(str
, "right")==0)
217 else if (strcasecmp(str
, "button1")==0)
219 else if (strcasecmp(str
, "button2")==0)
221 else if (strcasecmp(str
, "button3")==0)
223 else if (strcasecmp(str
, "button4")==0
224 || strcasecmp(str
, "button5")==0) {
225 wwarning(_("mouse button %s not supported by WPrefs."), str
);
234 getMouseParameters(Display
*dpy
, float *accel
, int *thre
)
238 XGetPointerControl(dpy
, &n
, &d
, thre
);
240 *accel
= (float)n
/(float)d
;
246 showData(_Panel
*panel
)
250 int a
=-1, b
=-1, c
=-1;
253 Display
*dpy
= WMScreenDisplay(WMWidgetScreen(panel
->win
));
255 str
= GetStringForKey("SelectWindowsMouseButton");
259 wwarning(_("bad value %s for option %s"),str
, "SelectWindowsMouseButton");
260 WMPerformButtonClick(panel
->smb
[0]);
263 WMPerformButtonClick(panel
->smb
[i
]);
266 str
= GetStringForKey("WindowListMouseButton");
270 wwarning(_("bad value %s for option %s"), str
, "WindowListMouseButton");
271 WMPerformButtonClick(panel
->lmb
[1]);
274 WMPerformButtonClick(panel
->lmb
[i
]);
277 str
= GetStringForKey("ApplicationMenuMouseButton");
281 wwarning(_("bad value %s for option %s"), str
, "ApplicationMenuMouseButton");
282 WMPerformButtonClick(panel
->amb
[2]);
285 WMPerformButtonClick(panel
->amb
[i
]);
289 WMSetButtonSelected(panel
->disaB
, GetBoolForKey("DisableWSMouseActions"));
292 getMouseParameters(dpy
, &accel
, &a
);
293 panel
->maxThreshold
= WidthOfScreen(DefaultScreenOfDisplay(dpy
));
294 if (a
> panel
->maxThreshold
) {
295 panel
->maxThreshold
= a
;
297 sprintf(buffer
, "%i", a
);
298 WMSetTextFieldText(panel
->threT
, buffer
);
299 /* find best match */
301 for (i
=0; i
<5; i
++) {
302 if (fabs((0.5+((float)i
*0.5))-accel
) < fabs((0.5+((float)a
*0.5))-accel
))
305 WMPerformButtonClick(panel
->speedB
[a
]);
306 panel
->lastClickedSpeed
= panel
->speedB
[a
];
307 panel
->acceleration
= accel
;
309 speedClick(panel
->lastClickedSpeed
, panel
);
311 b
= GetIntegerForKey("DoubleClickTime");
312 /* find best match */
314 for (i
=0; i
<5; i
++) {
315 if (abs(b
- DELAY(i
)) < abs(b
- DELAY(a
)))
318 WMPerformButtonClick(panel
->ddelaB
[a
]);
321 str
= GetStringForKey("ModifierKey");
323 a
= ModifierFromKey(dpy
, str
);
326 str
= modifierNames
[a
];
329 for (i
=0; i
<WMGetPopUpButtonNumberOfItems(panel
->grabP
); i
++) {
330 if (strstr(WMGetPopUpButtonItem(panel
->grabP
, i
), str
)) {
331 WMSetPopUpButtonSelectedItem(panel
->grabP
, i
);
339 sscanf(WMGetPopUpButtonItem(panel
->grabP
, 0), "%s", buffer
);
340 WMSetPopUpButtonSelectedItem(panel
->grabP
, 0);
341 wwarning(_("modifier key %s for option ModifierKey was not recognized. Using %s as default"),
349 fillModifierPopUp(WMPopUpButton
*pop
)
351 XModifierKeymap
*mapping
;
352 Display
*dpy
= WMScreenDisplay(WMWidgetScreen(pop
));
358 mapping
= XGetModifierMapping(dpy
);
360 if (!mapping
|| mapping
->max_keypermod
==0) {
361 WMAddPopUpButtonItem(pop
, "Mod1");
362 WMAddPopUpButtonItem(pop
, "Mod2");
363 WMAddPopUpButtonItem(pop
, "Mod3");
364 WMAddPopUpButtonItem(pop
, "Mod4");
365 WMAddPopUpButtonItem(pop
, "Mod5");
366 wwarning(_("could not retrieve keyboard modifier mapping"));
371 for (j
=0; j
<8; j
++) {
381 memset(array
, 0, sizeof(char*)*8);
382 for (i
=0; i
< mapping
->max_keypermod
; i
++) {
383 idx
= i
+j
*mapping
->max_keypermod
;
384 if (mapping
->modifiermap
[idx
]!=0) {
386 for (l
=0; l
<4; l
++) {
387 ksym
= XKeycodeToKeysym(dpy
, mapping
->modifiermap
[idx
], l
);
392 str
= XKeysymToString(ksym
);
395 if (str
&& !strstr(str
, "_Lock") && !strstr(str
, "Shift")
396 && !strstr(str
, "Control")) {
397 array
[a
++] = wstrdup(str
);
402 for (k
=0; k
<a
; k
++) {
405 tmp
= wstrdup(array
[k
]);
406 ptr
= strstr(tmp
, "_L");
409 ptr
= strstr(tmp
, "_R");
412 sprintf(buffer
, "%s (%s)", modifierNames
[j
], tmp
);
413 WMAddPopUpButtonItem(pop
, buffer
);
414 for (i
=k
+1; i
<a
; i
++) {
415 if (strstr(array
[i
], tmp
)) {
431 XFreeModifiermap(mapping
);
437 mouseButtonClickA(WMWidget
*w
, void *data
)
439 _Panel
*panel
= (_Panel
*)data
;
442 for (i
=0; i
<3; i
++) {
443 if (panel
->amb
[i
]==w
)
448 if (WMGetButtonSelected(panel
->lmb
[i
]))
449 WMSetButtonSelected(panel
->lmb
[i
], False
);
450 if (WMGetButtonSelected(panel
->smb
[i
]))
451 WMSetButtonSelected(panel
->smb
[i
], False
);
455 mouseButtonClickL(WMWidget
*w
, void *data
)
457 _Panel
*panel
= (_Panel
*)data
;
460 for (i
=0; i
<3; i
++) {
461 if (panel
->lmb
[i
]==w
)
466 if (WMGetButtonSelected(panel
->smb
[i
]))
467 WMSetButtonSelected(panel
->smb
[i
], False
);
468 if (WMGetButtonSelected(panel
->amb
[i
]))
469 WMSetButtonSelected(panel
->amb
[i
], False
);
473 mouseButtonClickS(WMWidget
*w
, void *data
)
475 _Panel
*panel
= (_Panel
*)data
;
478 for (i
=0; i
<3; i
++) {
479 if (panel
->smb
[i
]==w
)
484 if (WMGetButtonSelected(panel
->lmb
[i
]))
485 WMSetButtonSelected(panel
->lmb
[i
], False
);
486 if (WMGetButtonSelected(panel
->amb
[i
]))
487 WMSetButtonSelected(panel
->amb
[i
], False
);
491 createPanel(Panel
*p
)
493 _Panel
*panel
= (_Panel
*)p
;
494 WMScreen
*scr
= WMWidgetScreen(panel
->win
);
505 panel
->frame
= WMCreateFrame(panel
->win
);
506 WMResizeWidget(panel
->frame
, FRAME_WIDTH
, FRAME_HEIGHT
);
507 WMMoveWidget(panel
->frame
, FRAME_LEFT
, FRAME_TOP
);
509 /**************** Mouse Speed ****************/
510 panel
->speedF
= WMCreateFrame(panel
->frame
);
511 WMResizeWidget(panel
->speedF
, 245, 100);
512 WMMoveWidget(panel
->speedF
, 15, 15);
513 WMSetFrameTitle(panel
->speedF
, _("Mouse Speed"));
515 panel
->speedL
= WMCreateLabel(panel
->speedF
);
516 WMResizeWidget(panel
->speedL
, 40, 46);
517 WMMoveWidget(panel
->speedL
, 15, 14);
518 WMSetLabelImagePosition(panel
->speedL
, WIPImageOnly
);
519 path
= LocateImage(SPEED_ICON_FILE
);
521 icon
= WMCreateBlendedPixmapFromFile(scr
, path
, &color
);
523 WMSetLabelImage(panel
->speedL
, icon
);
524 WMReleasePixmap(icon
);
526 wwarning(_("could not load icon %s"), path
);
531 buf1
= wmalloc(strlen(SPEED_IMAGE
)+1);
532 buf2
= wmalloc(strlen(SPEED_IMAGE_S
)+1);
534 for (i
= 0; i
< 5; i
++) {
535 panel
->speedB
[i
] = WMCreateCustomButton(panel
->speedF
,
537 WMResizeWidget(panel
->speedB
[i
], 26, 26);
538 WMMoveWidget(panel
->speedB
[i
], 60+(35*i
), 25);
539 WMSetButtonBordered(panel
->speedB
[i
], False
);
540 WMSetButtonImagePosition(panel
->speedB
[i
], WIPImageOnly
);
541 WMSetButtonAction(panel
->speedB
[i
], speedClick
, panel
);
543 WMGroupButtons(panel
->speedB
[0], panel
->speedB
[i
]);
545 sprintf(buf1
, SPEED_IMAGE
, i
);
546 sprintf(buf2
, SPEED_IMAGE_S
, i
);
547 path
= LocateImage(buf1
);
549 icon
= WMCreatePixmapFromFile(scr
, path
);
551 WMSetButtonImage(panel
->speedB
[i
], icon
);
552 WMReleasePixmap(icon
);
554 wwarning(_("could not load icon file %s"), path
);
558 path
= LocateImage(buf2
);
560 icon
= WMCreatePixmapFromFile(scr
, path
);
562 WMSetButtonAltImage(panel
->speedB
[i
], icon
);
563 WMReleasePixmap(icon
);
565 wwarning(_("could not load icon file %s"), path
);
572 panel
->acceL
= WMCreateLabel(panel
->speedF
);
573 WMResizeWidget(panel
->acceL
, 80, 16);
574 WMMoveWidget(panel
->acceL
, 10, 67);
575 WMSetLabelText(panel
->acceL
, _("Acceler.:"));
577 panel
->acceT
= WMCreateTextField(panel
->speedF
);
578 WMResizeWidget(panel
->acceT
, 35, 20);
579 WMMoveWidget(panel
->acceT
, 85, 65);
580 WMAddNotificationObserver(returnPressed
, panel
,
581 WMTextDidEndEditingNotification
, panel
->acceT
);
584 panel
->threL
= WMCreateLabel(panel
->speedF
);
585 WMResizeWidget(panel
->threL
, 80, 16);
586 WMMoveWidget(panel
->threL
, 120, 67);
587 WMSetLabelText(panel
->threL
, _("Threshold:"));
589 panel
->threT
= WMCreateTextField(panel
->speedF
);
590 WMResizeWidget(panel
->threT
, 30, 20);
591 WMMoveWidget(panel
->threT
, 200, 65);
592 WMAddNotificationObserver(returnPressed
, panel
,
593 WMTextDidEndEditingNotification
, panel
->threT
);
595 WMMapSubwidgets(panel
->speedF
);
597 /***************** Doubleclick Delay ****************/
599 panel
->ddelaF
= WMCreateFrame(panel
->frame
);
600 WMResizeWidget(panel
->ddelaF
, 245, 95);
601 WMMoveWidget(panel
->ddelaF
, 15, 125);
602 WMSetFrameTitle(panel
->ddelaF
, _("Double-Click Delay"));
604 buf1
= wmalloc(strlen(DELAY_ICON
)+1);
605 buf2
= wmalloc(strlen(DELAY_ICON_S
)+1);
607 for (i
= 0; i
< 5; i
++) {
608 panel
->ddelaB
[i
] = WMCreateCustomButton(panel
->ddelaF
,
610 WMResizeWidget(panel
->ddelaB
[i
], 25, 25);
611 WMMoveWidget(panel
->ddelaB
[i
], 30+(40*i
), 20);
612 WMSetButtonBordered(panel
->ddelaB
[i
], False
);
613 WMSetButtonImagePosition(panel
->ddelaB
[i
], WIPImageOnly
);
614 WMSetButtonAction(panel
->ddelaB
[i
], doubleClick
, panel
);
616 WMGroupButtons(panel
->ddelaB
[0], panel
->ddelaB
[i
]);
618 sprintf(buf1
, DELAY_ICON
, i
+1);
619 sprintf(buf2
, DELAY_ICON_S
, i
+1);
620 path
= LocateImage(buf1
);
622 icon
= WMCreatePixmapFromFile(scr
, path
);
624 WMSetButtonImage(panel
->ddelaB
[i
], icon
);
625 WMReleasePixmap(icon
);
627 wwarning(_("could not load icon file %s"), path
);
631 path
= LocateImage(buf2
);
633 icon
= WMCreatePixmapFromFile(scr
, path
);
635 WMSetButtonAltImage(panel
->ddelaB
[i
], icon
);
636 WMReleasePixmap(icon
);
638 wwarning(_("could not load icon file %s"), path
);
646 panel
->tester
= CreateDoubleTest(panel
->ddelaF
, _("Test"));
647 WMResizeWidget(panel
->tester
, 84, 29);
648 WMMoveWidget(panel
->tester
, 85, 55);
650 WMMapSubwidgets(panel
->ddelaF
);
652 /* ************** Workspace Action Buttons **************** */
653 panel
->menuF
= WMCreateFrame(panel
->frame
);
654 WMResizeWidget(panel
->menuF
, 240, 145);
655 WMMoveWidget(panel
->menuF
, 270, 15);
656 WMSetFrameTitle(panel
->menuF
, _("Workspace Mouse Actions"));
658 panel
->disaB
= WMCreateSwitchButton(panel
->menuF
);
659 WMResizeWidget(panel
->disaB
, 205, 18);
660 WMMoveWidget(panel
->disaB
, 10, 20);
661 WMSetButtonText(panel
->disaB
, _("Disable mouse actions"));
663 panel
->mblL
= WMCreateLabel(panel
->menuF
);
664 WMResizeWidget(panel
->mblL
, 16, 22);
665 WMMoveWidget(panel
->mblL
, 135, 40);
666 WMSetLabelImagePosition(panel
->mblL
, WIPImageOnly
);
667 path
= LocateImage(MOUSEB_L
);
669 icon
= WMCreatePixmapFromFile(scr
, path
);
671 WMSetLabelImage(panel
->mblL
, icon
);
672 WMReleasePixmap(icon
);
674 wwarning(_("could not load icon file %s"), path
);
678 panel
->mbmL
= WMCreateLabel(panel
->menuF
);
679 WMResizeWidget(panel
->mbmL
, 16, 22);
680 WMMoveWidget(panel
->mbmL
, 170, 40);
681 WMSetLabelImagePosition(panel
->mbmL
, WIPImageOnly
);
682 path
= LocateImage(MOUSEB_M
);
684 icon
= WMCreatePixmapFromFile(scr
, path
);
686 WMSetLabelImage(panel
->mbmL
, icon
);
687 WMReleasePixmap(icon
);
689 wwarning(_("could not load icon file %s"), path
);
694 panel
->mbrL
= WMCreateLabel(panel
->menuF
);
695 WMResizeWidget(panel
->mbrL
, 16, 22);
696 WMMoveWidget(panel
->mbrL
, 205, 40);
697 WMSetLabelImagePosition(panel
->mbrL
, WIPImageOnly
);
698 path
= LocateImage(MOUSEB_R
);
700 icon
= WMCreatePixmapFromFile(scr
, path
);
702 WMSetLabelImage(panel
->mbrL
, icon
);
703 WMReleasePixmap(icon
);
705 wwarning(_("could not load icon file %s"), path
);
710 panel
->appL
= WMCreateLabel(panel
->menuF
);
711 WMResizeWidget(panel
->appL
, 125, 16);
712 WMMoveWidget(panel
->appL
, 5, 65);
713 WMSetLabelTextAlignment(panel
->appL
, WARight
);
714 WMSetLabelText(panel
->appL
, _("Applications menu"));
716 panel
->listL
= WMCreateLabel(panel
->menuF
);
717 WMResizeWidget(panel
->listL
, 125, 16);
718 WMMoveWidget(panel
->listL
, 5, 90);
719 WMSetLabelTextAlignment(panel
->listL
, WARight
);
720 WMSetLabelText(panel
->listL
, _("Window list menu"));
722 panel
->selL
= WMCreateLabel(panel
->menuF
);
723 WMResizeWidget(panel
->selL
, 125, 16);
724 WMMoveWidget(panel
->selL
, 5, 115);
725 WMSetLabelTextAlignment(panel
->selL
, WARight
);
726 WMSetLabelText(panel
->selL
, _("Select windows"));
729 for (i
=0; i
<3; i
++) {
730 panel
->amb
[i
] = WMCreateRadioButton(panel
->menuF
);
731 WMResizeWidget(panel
->amb
[i
], 24, 24);
732 WMMoveWidget(panel
->amb
[i
], 135+35*i
, 65);
733 WMSetButtonText(panel
->amb
[i
], NULL
);
734 WMSetButtonAction(panel
->amb
[i
], mouseButtonClickA
, panel
);
736 panel
->lmb
[i
] = WMCreateRadioButton(panel
->menuF
);
737 WMResizeWidget(panel
->lmb
[i
], 24, 24);
738 WMMoveWidget(panel
->lmb
[i
], 135+35*i
, 90);
739 WMSetButtonText(panel
->lmb
[i
], NULL
);
740 WMSetButtonAction(panel
->lmb
[i
], mouseButtonClickL
, panel
);
742 panel
->smb
[i
] = WMCreateRadioButton(panel
->menuF
);
743 WMResizeWidget(panel
->smb
[i
], 24, 24);
744 WMMoveWidget(panel
->smb
[i
], 135+35*i
, 115);
745 WMSetButtonText(panel
->smb
[i
], NULL
);
746 WMSetButtonAction(panel
->smb
[i
], mouseButtonClickS
, panel
);
749 WMGroupButtons(panel
->lmb
[0], panel
->lmb
[i
]);
750 WMGroupButtons(panel
->amb
[0], panel
->amb
[i
]);
751 WMGroupButtons(panel
->smb
[0], panel
->smb
[i
]);
755 WMMapSubwidgets(panel
->menuF
);
757 /* ************** Grab Modifier **************** */
758 panel
->grabF
= WMCreateFrame(panel
->frame
);
759 WMResizeWidget(panel
->grabF
, 240, 55);
760 WMMoveWidget(panel
->grabF
, 270, 165);
761 WMSetFrameTitle(panel
->grabF
, _("Mouse Grab Modifier"));
763 panel
->grabP
= WMCreatePopUpButton(panel
->grabF
);
764 WMResizeWidget(panel
->grabP
, 160, 20);
765 WMMoveWidget(panel
->grabP
, 40, 25);
767 fillModifierPopUp(panel
->grabP
);
769 WMMapSubwidgets(panel
->grabF
);
771 WMRealizeWidget(panel
->frame
);
772 WMMapSubwidgets(panel
->frame
);
780 storeCommandInScript(char *cmd
, char *line
)
787 p
= wusergnusteppath();
788 path
= wmalloc(strlen(p
)+64);
789 sprintf(path
, "%s/Library/WindowMaker/autostart", p
);
791 f
= fopen(path
, "r");
793 f
= fopen(path
, "w");
795 wsyserror(_("could not create %s"), path
);
798 fprintf(f
, "#!/bin/sh\n");
802 int len
= strlen(cmd
);
807 tmppath
= wmalloc(strlen(p
)+64);
808 sprintf(tmppath
, "%s/Library/WindowMaker/autostart.tmp", p
);
809 fo
= fopen(tmppath
, "w");
811 wsyserror(_("could not create temporary file %s"), tmppath
);
816 if (!fgets(buffer
, 127, f
)) {
819 if (strncmp(buffer
, cmd
, len
)==0) {
835 if (rename(tmppath
, path
)!=0) {
836 wsyserror(_("could not rename file %s to %s\n"), tmppath
, path
);
840 sprintf(buffer
, "chmod u+x %s", path
);
852 storeData(_Panel
*panel
)
857 static char *button
[3] = {"left", "middle", "right"};
859 tmp
= WMGetTextFieldText(panel
->threT
);
860 if (strlen(tmp
)==0) {
865 sprintf(buffer
, XSET
" m %i/%i %s\n", (int)(panel
->acceleration
*10),10, tmp
);
866 storeCommandInScript(XSET
" m", buffer
);
870 for (i
=0; i
<5; i
++) {
871 if (WMGetButtonSelected(panel
->ddelaB
[i
]))
874 SetIntegerForKey(DELAY(i
), "DoubleClickTime");
876 SetBoolForKey(WMGetButtonSelected(panel
->disaB
), "DisableWSMouseActions");
878 for (i
=0; i
<3; i
++) {
879 if (WMGetButtonSelected(panel
->amb
[i
]))
883 SetStringForKey(button
[i
], "ApplicationMenuMouseButton");
885 for (i
=0; i
<3; i
++) {
886 if (WMGetButtonSelected(panel
->lmb
[i
]))
890 SetStringForKey(button
[i
], "WindowListMouseButton");
892 for (i
=0; i
<3; i
++) {
893 if (WMGetButtonSelected(panel
->smb
[i
]))
897 SetStringForKey(button
[i
], "SelectWindowsMouseButton");
899 tmp
= WMGetPopUpButtonItem(panel
->grabP
,
900 WMGetPopUpButtonSelectedItem(panel
->grabP
));
902 p
= strchr(tmp
, ' ');
905 SetStringForKey(tmp
, "ModifierKey");
912 InitMouseSettings(WMScreen
*scr
, WMWindow
*win
)
916 panel
= wmalloc(sizeof(_Panel
));
917 memset(panel
, 0, sizeof(_Panel
));
919 panel
->sectionName
= _("Mouse Preferences");
923 panel
->callbacks
.createWidgets
= createPanel
;
924 panel
->callbacks
.updateDomain
= storeData
;
926 AddSection(panel
, ICON_FILE
);