Constrain switching workspace name to one head.
[wmaker-crm.git] / contrib / single_click.diff
blob92ccc5211d27d0a2409fd7ee4d710a3a14cc9978
1 This patch allows dock icons, appicons and miniwindows to be activated with
2 a single-click (as opposed to a double-click). Great for weary fingers!
4 Index: WPrefs.app/Expert.c
5 ===================================================================
6 RCS file: /cvsroot/wm/WPrefs.app/Expert.c,v
7 retrieving revision 1.25
8 diff -u -r1.25 Expert.c
9 --- WPrefs.app/Expert.c 23 Oct 2004 03:30:04 -0000 1.25
10 +++ WPrefs.app/Expert.c 23 Oct 2004 04:16:07 -0000
11 @@ -54,6 +54,7 @@
12 WMSetButtonSelected(panel->swi[4], GetBoolForKey("DontConfirmKill"));
13 WMSetButtonSelected(panel->swi[5], GetBoolForKey("DisableBlinking"));
14 WMSetButtonSelected(panel->swi[6], GetBoolForKey("AntialiasedText"));
15 + WMSetButtonSelected(panel->swi[7], GetBoolForKey("SingleClickLaunch"));
19 @@ -66,7 +67,7 @@
20 panel->box = WMCreateBox(panel->parent);
21 WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
23 - for (i=0; i<7; i++) {
24 + for (i=0; i<8; i++) {
25 panel->swi[i] = WMCreateSwitchButton(panel->box);
26 WMResizeWidget(panel->swi[i], FRAME_WIDTH-40, 25);
27 WMMoveWidget(panel->swi[i], 20, 20+i*25);
28 @@ -79,6 +80,7 @@
29 WMSetButtonText(panel->swi[4], _("Disable confirmation panel for the Kill command."));
30 WMSetButtonText(panel->swi[5], _("Disable selection animation for selected icons."));
31 WMSetButtonText(panel->swi[6], _("Smooth font edges (needs restart)."));
32 + WMSetButtonText(panel->swi[7], _("Launch applications and restore windows with a single click."));
34 WMSetButtonEnabled(panel->swi[6], True);
36 @@ -103,6 +105,7 @@
37 SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "DontConfirmKill");
38 SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DisableBlinking");
39 SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "AntialiasedText");
40 + SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "SingleClickLaunch");
44 Index: src/WindowMaker.h
45 ===================================================================
46 RCS file: /cvsroot/wm/src/WindowMaker.h,v
47 retrieving revision 1.60
48 diff -u -r1.60 WindowMaker.h
49 --- src/WindowMaker.h 18 Oct 2004 01:30:02 -0000 1.60
50 +++ src/WindowMaker.h 23 Oct 2004 04:16:07 -0000
51 @@ -472,6 +472,9 @@
52 unsigned int workspace_border_size; /* Size in pixels of the workspace border */
53 char workspace_border_position; /* Where to leave a workspace border */
55 + /* single click to lauch applications */
56 + char single_click;
58 struct {
59 unsigned int nodock:1; /* don't display the dock */
60 unsigned int noclip:1; /* don't display the clip */
61 Index: src/appicon.c
62 ===================================================================
63 RCS file: /cvsroot/wm/src/appicon.c,v
64 retrieving revision 1.50
65 diff -u -r1.50 appicon.c
66 --- src/appicon.c 13 Oct 2004 05:09:08 -0000 1.50
67 +++ src/appicon.c 23 Oct 2004 04:16:08 -0000
68 @@ -590,6 +590,7 @@
69 Bool movingSingle = False;
70 int oldX = x;
71 int oldY = y;
72 + Bool hasMoved = False;
74 if (aicon->editing || WCHECK_STATE(WSTATE_MODAL))
75 return;
76 @@ -665,6 +666,7 @@
77 break;
79 case MotionNotify:
80 + hasMoved = True;
81 if (!grabbed) {
82 if (abs(dx-ev.xmotion.x)>=MOVE_THRESHOLD
83 || abs(dy-ev.xmotion.y)>=MOVE_THRESHOLD) {
84 @@ -802,6 +804,9 @@
85 if (wPreferences.auto_arrange_icons)
86 wArrangeIcons(scr, True);
88 + if (wPreferences.single_click && !hasMoved)
89 + iconDblClick(desc, event);
91 done = 1;
92 break;
94 Index: src/defaults.c
95 ===================================================================
96 RCS file: /cvsroot/wm/src/defaults.c,v
97 retrieving revision 1.90
98 diff -u -r1.90 defaults.c
99 --- src/defaults.c 22 Oct 2004 23:39:11 -0000 1.90
100 +++ src/defaults.c 23 Oct 2004 04:16:08 -0000
101 @@ -562,6 +562,9 @@
102 {"DisableBlinking", "NO", NULL,
103 &wPreferences.dont_blink, getBool, NULL
105 + {"SingleClickLaunch", "NO", NULL,
106 + &wPreferences.single_click, getBool, NULL
107 + },
108 /* style options */
109 {"MenuStyle", "normal", seMenuStyles,
110 &wPreferences.menu_style, getEnum, setMenuStyle
111 Index: src/dock.c
112 ===================================================================
113 RCS file: /cvsroot/wm/src/dock.c,v
114 retrieving revision 1.91
115 diff -u -r1.91 dock.c
116 --- src/dock.c 23 Oct 2004 03:30:04 -0000 1.91
117 +++ src/dock.c 23 Oct 2004 04:16:09 -0000
118 @@ -3758,7 +3758,7 @@
122 -static void
123 +static Bool
124 handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
126 WScreen *scr = dock->screen_ptr;
127 @@ -3776,6 +3776,7 @@
128 Bool docked;
129 int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */
130 int omnipresent = aicon->omnipresent; /* this must be cached!!! */
131 + Bool hasMoved = False;
134 if (wPreferences.flags.noupdates)
135 @@ -3828,6 +3829,7 @@
136 break;
138 case MotionNotify:
139 + hasMoved = True;
140 if (!grabbed) {
141 if (abs(ofs_x-ev.xmotion.x)>=MOVE_THRESHOLD
142 || abs(ofs_y-ev.xmotion.y)>=MOVE_THRESHOLD) {
143 @@ -3977,9 +3979,11 @@
144 #ifdef DEBUG
145 puts("End icon move");
146 #endif
147 - return;
148 + return hasMoved;
152 + return False; /* never reached */
156 @@ -4116,8 +4120,11 @@
157 handleClipChangeWorkspace(scr, event);
158 else
159 handleDockMove(dock, aicon, event);
160 - } else
161 - handleIconMove(dock, aicon, event);
162 + } else {
163 + Bool hasMoved = handleIconMove(dock, aicon, event);
164 + if (wPreferences.single_click && !hasMoved)
165 + iconDblClick(desc, event);
168 } else if (event->xbutton.button==Button2 && dock->type==WM_CLIP &&
169 aicon==scr->clip_icon) {
170 Index: src/icon.c
171 ===================================================================
172 RCS file: /cvsroot/wm/src/icon.c,v
173 retrieving revision 1.27
174 diff -u -r1.27 icon.c
175 --- src/icon.c 16 Oct 2004 22:05:04 -0000 1.27
176 +++ src/icon.c 23 Oct 2004 04:16:10 -0000
177 @@ -891,6 +891,7 @@
178 int dx=event->xbutton.x, dy=event->xbutton.y;
179 int grabbed=0;
180 int clickButton=event->xbutton.button;
181 + Bool hasMoved = False;
183 if (WCHECK_STATE(WSTATE_MODAL))
184 return;
185 @@ -942,6 +943,7 @@
186 break;
188 case MotionNotify:
189 + hasMoved = True;
190 if (!grabbed) {
191 if (abs(dx-ev.xmotion.x)>=MOVE_THRESHOLD
192 || abs(dy-ev.xmotion.y)>=MOVE_THRESHOLD) {
193 @@ -979,6 +981,8 @@
195 if (wPreferences.auto_arrange_icons)
196 wArrangeIcons(wwin->screen_ptr, True);
197 + if (wPreferences.single_click && !hasMoved)
198 + miniwindowDblClick(desc, event);
199 return;