new version of the 'single click' patch
[wmaker-crm.git] / contrib / single_click.diff
bloba03d4d152805e6ea7bb13c5af90c891790289bb4
1 diff -ur WindowMaker-0.65.1/WPrefs.app/Expert.c WindowMaker-0.65.1-patched/WPrefs.app/Expert.c
2 --- WindowMaker-0.65.1/WPrefs.app/Expert.c Mon Jun 4 13:47:32 2001
3 +++ WindowMaker-0.65.1-patched/WPrefs.app/Expert.c Sat Aug 18 03:53:25 2001
4 @@ -33,7 +33,7 @@
6 WMWidget *parent;
8 - WMButton *swi[8];
9 + WMButton *swi[9];
11 } _Panel;
13 @@ -54,6 +54,7 @@
14 WMSetButtonSelected(panel->swi[4], GetBoolForKey("WindozeCycling"));
15 WMSetButtonSelected(panel->swi[5], GetBoolForKey("DontConfirmKill"));
16 WMSetButtonSelected(panel->swi[6], GetBoolForKey("DisableBlinking"));
17 + WMSetButtonSelected(panel->swi[7], GetBoolForKey("SingleClickLaunch"));
21 @@ -66,7 +67,7 @@
22 panel->box = WMCreateBox(panel->parent);
23 WMSetViewExpandsToParent(WMWidgetView(panel->box), 2, 2, 2, 2);
25 - for (i=0; i<7; i++) {
26 + for (i=0; i<8; i++) {
27 panel->swi[i] = WMCreateSwitchButton(panel->box);
28 WMResizeWidget(panel->swi[i], FRAME_WIDTH-40, 25);
29 WMMoveWidget(panel->swi[i], 20, 20+i*25);
30 @@ -79,6 +80,7 @@
31 WMSetButtonText(panel->swi[4], _("Use Windoze style cycling."));
32 WMSetButtonText(panel->swi[5], _("Disable confirmation panel for the Kill command."));
33 WMSetButtonText(panel->swi[6], _("Disable selection animation for selected icons."));
34 + WMSetButtonText(panel->swi[7], _("Launch applications and restore windows with a single click"));
36 WMRealizeWidget(panel->box);
37 WMMapSubwidgets(panel->box);
38 @@ -101,6 +103,7 @@
39 SetBoolForKey(WMGetButtonSelected(panel->swi[4]), "WindozeCycling");
40 SetBoolForKey(WMGetButtonSelected(panel->swi[5]), "DontConfirmKill");
41 SetBoolForKey(WMGetButtonSelected(panel->swi[6]), "DisableBlinking");
42 + SetBoolForKey(WMGetButtonSelected(panel->swi[7]), "SingleClickLaunch");
46 diff -ur WindowMaker-0.65.1/src/WindowMaker.h WindowMaker-0.65.1-patched/src/WindowMaker.h
47 --- WindowMaker-0.65.1/src/WindowMaker.h Wed Jun 6 15:07:42 2001
48 +++ WindowMaker-0.65.1-patched/src/WindowMaker.h Sat Aug 18 03:47:36 2001
49 @@ -463,6 +463,9 @@
50 /* shading animation */
51 signed char shade_speed;
53 + /* single click to lauch applications */
54 + char single_click;
56 int edge_resistance;
57 char attract;
59 diff -ur WindowMaker-0.65.1/src/appicon.c WindowMaker-0.65.1-patched/src/appicon.c
60 --- WindowMaker-0.65.1/src/appicon.c Mon Jul 23 14:32:46 2001
61 +++ WindowMaker-0.65.1-patched/src/appicon.c Sat Aug 18 03:47:36 2001
62 @@ -704,6 +704,7 @@
63 int shad_x = 0, shad_y = 0, docking=0, dockable, collapsed = 0;
64 int ix, iy;
65 int clickButton = event->xbutton.button;
66 + Bool hasMoved = False;
67 Pixmap ghost = None;
68 Window wins[2];
69 Bool movingSingle = False;
70 @@ -794,6 +795,7 @@
71 break;
73 case MotionNotify:
74 + hasMoved = True;
75 if (!grabbed) {
76 if (abs(dx-ev.xmotion.x)>=MOVE_THRESHOLD
77 || abs(dy-ev.xmotion.y)>=MOVE_THRESHOLD) {
78 @@ -939,6 +941,8 @@
80 if (wPreferences.auto_arrange_icons)
81 wArrangeIcons(scr, True);
82 + if (!hasMoved && wPreferences.single_click)
83 + iconDblClick(desc, event);
85 done = 1;
86 break;
87 diff -ur WindowMaker-0.65.1/src/defaults.c WindowMaker-0.65.1-patched/src/defaults.c
88 --- WindowMaker-0.65.1/src/defaults.c Mon Jul 23 14:31:36 2001
89 +++ WindowMaker-0.65.1-patched/src/defaults.c Sat Aug 18 03:47:36 2001
90 @@ -557,6 +557,9 @@
91 {"DisableBlinking", "NO", NULL,
92 &wPreferences.dont_blink, getBool, NULL
94 + {"SingleClickLaunch", "NO", NULL,
95 + &wPreferences.single_click, getBool, NULL
96 + },
97 /* style options */
98 {"MenuStyle", "normal", seMenuStyles,
99 &wPreferences.menu_style, getEnum, setMenuStyle
100 diff -ur WindowMaker-0.65.1/src/dock.c WindowMaker-0.65.1-patched/src/dock.c
101 --- WindowMaker-0.65.1/src/dock.c Mon Jul 23 14:37:25 2001
102 +++ WindowMaker-0.65.1-patched/src/dock.c Sat Aug 18 03:47:36 2001
103 @@ -3690,7 +3690,7 @@
107 -static void
108 +static Bool
109 handleIconMove(WDock *dock, WAppIcon *aicon, XEvent *event)
111 WScreen *scr = dock->screen_ptr;
112 @@ -3706,6 +3706,7 @@
113 int tmp;
114 Pixmap ghost = None;
115 Bool docked;
116 + Bool hasMoved = False;
117 int superfluous = wPreferences.superfluous; /* we catch it to avoid problems */
118 int omnipresent = aicon->omnipresent; /* this must be cached!!! */
120 @@ -3760,6 +3761,7 @@
121 break;
123 case MotionNotify:
124 + hasMoved = True;
125 if (!grabbed) {
126 if (abs(ofs_x-ev.xmotion.x)>=MOVE_THRESHOLD
127 || abs(ofs_y-ev.xmotion.y)>=MOVE_THRESHOLD) {
128 @@ -3909,7 +3911,7 @@
129 #ifdef DEBUG
130 puts("End icon move");
131 #endif
132 - return;
133 + return hasMoved;
137 @@ -4048,8 +4050,11 @@
138 handleClipChangeWorkspace(scr, event);
139 else
140 handleDockMove(dock, aicon, event);
141 - } else
142 - handleIconMove(dock, aicon, event);
143 + } else {
144 + Bool hasMoved = handleIconMove(dock, aicon, event);
145 + if (!hasMoved && wPreferences.single_click)
146 + iconDblClick(desc, event);
149 } else if (event->xbutton.button==Button2 && dock->type==WM_CLIP &&
150 aicon==scr->clip_icon) {
151 diff -ur WindowMaker-0.65.1/src/icon.c WindowMaker-0.65.1-patched/src/icon.c
152 --- WindowMaker-0.65.1/src/icon.c Mon Jul 23 14:20:27 2001
153 +++ WindowMaker-0.65.1-patched/src/icon.c Sat Aug 18 03:47:36 2001
154 @@ -877,6 +877,7 @@
155 int dx=event->xbutton.x, dy=event->xbutton.y;
156 int grabbed=0;
157 int clickButton=event->xbutton.button;
158 + Bool hasMoved = False;
160 if (WCHECK_STATE(WSTATE_MODAL))
161 return;
162 @@ -928,6 +929,7 @@
163 break;
165 case MotionNotify:
166 + hasMoved = True;
167 if (!grabbed) {
168 if (abs(dx-ev.xmotion.x)>=MOVE_THRESHOLD
169 || abs(dy-ev.xmotion.y)>=MOVE_THRESHOLD) {
170 @@ -965,6 +967,9 @@
172 if (wPreferences.auto_arrange_icons)
173 wArrangeIcons(wwin->screen_ptr, True);
174 + if (!hasMoved && wPreferences.single_click)
175 + miniwindowDblClick(desc, event);
177 return;