Lines 1-8
Link Here
|
1 |
diff --git src/hotkeys.c src/hotkeys.c |
1 |
--- src/hotkeys.c.orig Sun Mar 19 01:51:24 UTC |
2 |
index b3ac52a..9a7cc82 100644 |
|
|
3 |
--- src/hotkeys.c |
4 |
+++ src/hotkeys.c |
2 |
+++ src/hotkeys.c |
5 |
@@ -54,7 +54,7 @@ extern char *getenv(); |
3 |
@@ -54,7 +54,7 @@ |
6 |
#include <fcntl.h> |
4 |
#include <fcntl.h> |
7 |
#include <sys/ioctl.h> |
5 |
#include <sys/ioctl.h> |
8 |
#if defined (__FreeBSD__) |
6 |
#if defined (__FreeBSD__) |
Lines 11-17
index b3ac52a..9a7cc82 100644
Link Here
|
11 |
#else |
9 |
#else |
12 |
# if defined (__NetBSD__) || defined (__OpenBSD__) |
10 |
# if defined (__NetBSD__) || defined (__OpenBSD__) |
13 |
# include <soundcard.h> /* OSS emulation */ |
11 |
# include <soundcard.h> /* OSS emulation */ |
14 |
@@ -66,9 +66,9 @@ extern char *getenv(); |
12 |
@@ -66,9 +66,9 @@ |
15 |
#endif /* __FreeBSD__ */ |
13 |
#endif /* __FreeBSD__ */ |
16 |
|
14 |
|
17 |
/* CDROM related */ |
15 |
/* CDROM related */ |
Lines 23-29
index b3ac52a..9a7cc82 100644
Link Here
|
23 |
#if HAVE_GTK |
21 |
#if HAVE_GTK |
24 |
#include "splash.h" |
22 |
#include "splash.h" |
25 |
#endif |
23 |
#endif |
26 |
@@ -585,7 +585,7 @@ adjustVol(int adj) |
24 |
@@ -585,7 +585,7 @@ |
27 |
{ |
25 |
{ |
28 |
int mixer_fd = -1, cdrom_fd = -1; |
26 |
int mixer_fd = -1, cdrom_fd = -1; |
29 |
int master_vol, cd_vol; |
27 |
int master_vol, cd_vol; |
Lines 32-38
index b3ac52a..9a7cc82 100644
Link Here
|
32 |
int left, right; |
30 |
int left, right; |
33 |
static struct timeval last_time; |
31 |
static struct timeval last_time; |
34 |
struct timeval this_time; |
32 |
struct timeval this_time; |
35 |
@@ -595,7 +595,7 @@ adjustVol(int adj) |
33 |
@@ -595,7 +595,7 @@ |
36 |
int sign = adj > 0 ? 1 : -1; |
34 |
int sign = adj > 0 ? 1 : -1; |
37 |
|
35 |
|
38 |
if ( adj == 0 ) |
36 |
if ( adj == 0 ) |
Lines 41-47
index b3ac52a..9a7cc82 100644
Link Here
|
41 |
|
39 |
|
42 |
if ( multiplier == 0 ) |
40 |
if ( multiplier == 0 ) |
43 |
{ |
41 |
{ |
44 |
@@ -683,6 +683,7 @@ adjustVol(int adj) |
42 |
@@ -683,6 +683,7 @@ |
45 |
} |
43 |
} |
46 |
|
44 |
|
47 |
/* open the cdrom/dvdrom drive device */ |
45 |
/* open the cdrom/dvdrom drive device */ |
Lines 49-55
index b3ac52a..9a7cc82 100644
Link Here
|
49 |
if ( cdromDevice != NULL ) |
47 |
if ( cdromDevice != NULL ) |
50 |
{ |
48 |
{ |
51 |
if ( (cdrom_fd = open( cdromDevice, O_RDONLY|O_NONBLOCK )) == -1 ) |
49 |
if ( (cdrom_fd = open( cdromDevice, O_RDONLY|O_NONBLOCK )) == -1 ) |
52 |
@@ -691,7 +692,7 @@ adjustVol(int adj) |
50 |
@@ -691,7 +692,7 @@ |
53 |
} |
51 |
} |
54 |
else |
52 |
else |
55 |
{ |
53 |
{ |
Lines 58-64
index b3ac52a..9a7cc82 100644
Link Here
|
58 |
if ( ioctl(cdrom_fd, CDROMVOLREAD, &cdrom_vol) == -1 ) |
56 |
if ( ioctl(cdrom_fd, CDROMVOLREAD, &cdrom_vol) == -1 ) |
59 |
{ |
57 |
{ |
60 |
uError("Unable to read the CDROM volume of `%s'", cdromDevice); |
58 |
uError("Unable to read the CDROM volume of `%s'", cdromDevice); |
61 |
@@ -699,7 +700,7 @@ adjustVol(int adj) |
59 |
@@ -699,7 +700,7 @@ |
62 |
} |
60 |
} |
63 |
else |
61 |
else |
64 |
{ |
62 |
{ |
Lines 67-73
index b3ac52a..9a7cc82 100644
Link Here
|
67 |
int t; |
65 |
int t; |
68 |
float myAdj; |
66 |
float myAdj; |
69 |
myAdj = 0xFF / 100.0 * adj; |
67 |
myAdj = 0xFF / 100.0 * adj; |
70 |
@@ -721,9 +722,10 @@ adjustVol(int adj) |
68 |
@@ -721,9 +722,10 @@ |
71 |
} |
69 |
} |
72 |
} |
70 |
} |
73 |
} |
71 |
} |
Lines 79-85
index b3ac52a..9a7cc82 100644
Link Here
|
79 |
|
77 |
|
80 |
return ret; |
78 |
return ret; |
81 |
} |
79 |
} |
82 |
@@ -737,10 +739,10 @@ doMute(void) |
80 |
@@ -737,10 +739,10 @@ |
83 |
{ |
81 |
{ |
84 |
static Bool muted = False; |
82 |
static Bool muted = False; |
85 |
static int last_mixer_vol, last_cd_vol; |
83 |
static int last_mixer_vol, last_cd_vol; |
Lines 92-98
index b3ac52a..9a7cc82 100644
Link Here
|
92 |
int mixer_fd = -1, cdrom_fd = -1; |
90 |
int mixer_fd = -1, cdrom_fd = -1; |
93 |
|
91 |
|
94 |
short ret = 0; /* return value */ |
92 |
short ret = 0; /* return value */ |
95 |
@@ -751,6 +753,7 @@ doMute(void) |
93 |
@@ -751,6 +753,7 @@ |
96 |
uError("Unable to open `%s'", MIXER_DEV); |
94 |
uError("Unable to open `%s'", MIXER_DEV); |
97 |
} |
95 |
} |
98 |
/* open the cdrom/dvdrom drive device */ |
96 |
/* open the cdrom/dvdrom drive device */ |
Lines 100-106
index b3ac52a..9a7cc82 100644
Link Here
|
100 |
if ( cdromDevice != NULL ) |
98 |
if ( cdromDevice != NULL ) |
101 |
{ |
99 |
{ |
102 |
if ( (cdrom_fd = open( cdromDevice, O_RDONLY|O_NONBLOCK )) == -1 ) |
100 |
if ( (cdrom_fd = open( cdromDevice, O_RDONLY|O_NONBLOCK )) == -1 ) |
103 |
@@ -758,6 +761,7 @@ doMute(void) |
101 |
@@ -758,6 +761,7 @@ |
104 |
uError("Unable to open `%s'", cdromDevice); |
102 |
uError("Unable to open `%s'", cdromDevice); |
105 |
} |
103 |
} |
106 |
} |
104 |
} |
Lines 108-114
index b3ac52a..9a7cc82 100644
Link Here
|
108 |
|
106 |
|
109 |
if ( muted ) |
107 |
if ( muted ) |
110 |
{ |
108 |
{ |
111 |
@@ -783,6 +787,7 @@ doMute(void) |
109 |
@@ -783,6 +787,7 @@ |
112 |
#endif |
110 |
#endif |
113 |
} |
111 |
} |
114 |
} |
112 |
} |
Lines 116-122
index b3ac52a..9a7cc82 100644
Link Here
|
116 |
#if 0 |
114 |
#if 0 |
117 |
if (SOUND_IOCTL(mixer_fd, SOUND_MIXER_WRITE_CD, &last_cd_vol) == -1) |
115 |
if (SOUND_IOCTL(mixer_fd, SOUND_MIXER_WRITE_CD, &last_cd_vol) == -1) |
118 |
{ |
116 |
{ |
119 |
@@ -800,6 +805,7 @@ doMute(void) |
117 |
@@ -800,6 +805,7 @@ |
120 |
} else |
118 |
} else |
121 |
muted = False; |
119 |
muted = False; |
122 |
} |
120 |
} |
Lines 124-130
index b3ac52a..9a7cc82 100644
Link Here
|
124 |
} |
122 |
} |
125 |
else /* ! muted */ |
123 |
else /* ! muted */ |
126 |
{ |
124 |
{ |
127 |
@@ -837,6 +843,7 @@ doMute(void) |
125 |
@@ -837,6 +843,7 @@ |
128 |
} |
126 |
} |
129 |
} |
127 |
} |
130 |
} |
128 |
} |
Lines 132-138
index b3ac52a..9a7cc82 100644
Link Here
|
132 |
#if 0 |
130 |
#if 0 |
133 |
if ( SOUND_IOCTL(mixer_fd, SOUND_MIXER_READ_CD, &last_cd_vol) == -1) |
131 |
if ( SOUND_IOCTL(mixer_fd, SOUND_MIXER_READ_CD, &last_cd_vol) == -1) |
134 |
{ |
132 |
{ |
135 |
@@ -853,7 +860,9 @@ doMute(void) |
133 |
@@ -853,7 +860,9 @@ |
136 |
muted = True; |
134 |
muted = True; |
137 |
} |
135 |
} |
138 |
#endif |
136 |
#endif |
Lines 142-148
index b3ac52a..9a7cc82 100644
Link Here
|
142 |
if (cdrom_fd != -1) |
140 |
if (cdrom_fd != -1) |
143 |
{ |
141 |
{ |
144 |
if ( ioctl(cdrom_fd, CDROMVOLREAD, &last_cdrom_vol) == -1 ) |
142 |
if ( ioctl(cdrom_fd, CDROMVOLREAD, &last_cdrom_vol) == -1 ) |
145 |
@@ -863,8 +872,8 @@ doMute(void) |
143 |
@@ -863,8 +872,8 @@ |
146 |
} |
144 |
} |
147 |
else |
145 |
else |
148 |
{ |
146 |
{ |
Lines 153-159
index b3ac52a..9a7cc82 100644
Link Here
|
153 |
cdrom_vol.channel0 = cdrom_vol.channel1 = cdrom_vol.channel2 = |
151 |
cdrom_vol.channel0 = cdrom_vol.channel1 = cdrom_vol.channel2 = |
154 |
cdrom_vol.channel3 = 0; |
152 |
cdrom_vol.channel3 = 0; |
155 |
if ( ioctl(cdrom_fd, CDROMVOLCTRL, &cdrom_vol) == -1 ) |
153 |
if ( ioctl(cdrom_fd, CDROMVOLCTRL, &cdrom_vol) == -1 ) |
156 |
@@ -875,10 +884,11 @@ doMute(void) |
154 |
@@ -875,10 +884,11 @@ |
157 |
muted = True; |
155 |
muted = True; |
158 |
} |
156 |
} |
159 |
} |
157 |
} |
Lines 166-172
index b3ac52a..9a7cc82 100644
Link Here
|
166 |
|
164 |
|
167 |
return ret; |
165 |
return ret; |
168 |
} |
166 |
} |
169 |
@@ -886,19 +896,20 @@ doMute(void) |
167 |
@@ -886,19 +896,20 @@ |
170 |
static int |
168 |
static int |
171 |
ejectDisc(void) |
169 |
ejectDisc(void) |
172 |
{ |
170 |
{ |
Lines 191-197
index b3ac52a..9a7cc82 100644
Link Here
|
191 |
case CDS_TRAY_OPEN: |
189 |
case CDS_TRAY_OPEN: |
192 |
#ifdef HAVE_LIBXOSD |
190 |
#ifdef HAVE_LIBXOSD |
193 |
if ( osd ) |
191 |
if ( osd ) |
194 |
@@ -929,7 +940,7 @@ ejectDisc(void) |
192 |
@@ -929,7 +940,7 @@ |
195 |
case CDS_NO_INFO: |
193 |
case CDS_NO_INFO: |
196 |
case CDS_DRIVE_NOT_READY: |
194 |
case CDS_DRIVE_NOT_READY: |
197 |
default: |
195 |
default: |
Lines 200-206
index b3ac52a..9a7cc82 100644
Link Here
|
200 |
break; |
198 |
break; |
201 |
} |
199 |
} |
202 |
close(fd); |
200 |
close(fd); |
203 |
@@ -940,6 +951,7 @@ ejectDisc(void) |
201 |
@@ -940,6 +951,7 @@ |
204 |
SYSLOG(LOG_NOTICE, "CDROM_DRIVE_STATUS failed: %s\n", strerror(errno)); |
202 |
SYSLOG(LOG_NOTICE, "CDROM_DRIVE_STATUS failed: %s\n", strerror(errno)); |
205 |
return -1; |
203 |
return -1; |
206 |
} |
204 |
} |
Lines 208-214
index b3ac52a..9a7cc82 100644
Link Here
|
208 |
} |
206 |
} |
209 |
|
207 |
|
210 |
|
208 |
|
211 |
@@ -1002,8 +1014,8 @@ launchApp(int keycode) |
209 |
@@ -1002,8 +1014,8 @@ |
212 |
#ifdef HAVE_LIBXOSD |
210 |
#ifdef HAVE_LIBXOSD |
213 |
if ( osd ) |
211 |
if ( osd ) |
214 |
{ |
212 |
{ |
Lines 219-225
index b3ac52a..9a7cc82 100644
Link Here
|
219 |
} |
217 |
} |
220 |
#endif |
218 |
#endif |
221 |
} |
219 |
} |
222 |
@@ -1015,13 +1027,14 @@ launchApp(int keycode) |
220 |
@@ -1015,13 +1027,14 @@ |
223 |
int |
221 |
int |
224 |
sleepState(int mode) |
222 |
sleepState(int mode) |
225 |
{ |
223 |
{ |
Lines 236-242
index b3ac52a..9a7cc82 100644
Link Here
|
236 |
error = system("apm -S"); |
234 |
error = system("apm -S"); |
237 |
break; |
235 |
break; |
238 |
default: |
236 |
default: |
239 |
@@ -1039,10 +1052,10 @@ sleepState(int mode) |
237 |
@@ -1039,10 +1052,10 @@ |
240 |
} |
238 |
} |
241 |
switch (mode) |
239 |
switch (mode) |
242 |
{ |
240 |
{ |
Lines 249-255
index b3ac52a..9a7cc82 100644
Link Here
|
249 |
error = apm_standby(fd); |
247 |
error = apm_standby(fd); |
250 |
break; |
248 |
break; |
251 |
default: |
249 |
default: |
252 |
@@ -1050,7 +1063,9 @@ sleepState(int mode) |
250 |
@@ -1050,7 +1063,9 @@ |
253 |
break; |
251 |
break; |
254 |
} |
252 |
} |
255 |
apm_close(fd); |
253 |
apm_close(fd); |
Lines 260-266
index b3ac52a..9a7cc82 100644
Link Here
|
260 |
} |
258 |
} |
261 |
|
259 |
|
262 |
|
260 |
|
263 |
@@ -1105,8 +1120,8 @@ lookupUserCmd(const int keycode) |
261 |
@@ -1105,8 +1120,8 @@ |
264 |
#ifdef HAVE_LIBXOSD |
262 |
#ifdef HAVE_LIBXOSD |
265 |
if ( osd ) |
263 |
if ( osd ) |
266 |
{ |
264 |
{ |
Lines 271-277
index b3ac52a..9a7cc82 100644
Link Here
|
271 |
} |
269 |
} |
272 |
#endif |
270 |
#endif |
273 |
break; /* break the for loop */ |
271 |
break; /* break the for loop */ |
274 |
@@ -1435,15 +1450,16 @@ initXOSD(void) |
272 |
@@ -1435,15 +1450,16 @@ |
275 |
#ifdef HAVE_LIBXOSD |
273 |
#ifdef HAVE_LIBXOSD |
276 |
if ( osd ) |
274 |
if ( osd ) |
277 |
{ |
275 |
{ |
Lines 297-303
index b3ac52a..9a7cc82 100644
Link Here
|
297 |
} |
295 |
} |
298 |
#endif |
296 |
#endif |
299 |
} |
297 |
} |
300 |
@@ -1592,6 +1608,7 @@ main(int argc, char *argv[]) |
298 |
@@ -1592,6 +1608,7 @@ |
301 |
doMute(); |
299 |
doMute(); |
302 |
} else |
300 |
} else |
303 |
/* APM stuffs */ |
301 |
/* APM stuffs */ |
Lines 305-311
index b3ac52a..9a7cc82 100644
Link Here
|
305 |
if ( ev.message.keycode == (kbd.defCmds)[sleepKey].key || |
303 |
if ( ev.message.keycode == (kbd.defCmds)[sleepKey].key || |
306 |
ev.message.keycode == (kbd.defCmds)[wakeupKey].key ) { |
304 |
ev.message.keycode == (kbd.defCmds)[wakeupKey].key ) { |
307 |
sleepState(STANDBY); |
305 |
sleepState(STANDBY); |
308 |
@@ -1601,14 +1618,15 @@ main(int argc, char *argv[]) |
306 |
@@ -1601,14 +1618,15 @@ |
309 |
} |
307 |
} |
310 |
else |
308 |
else |
311 |
{ |
309 |
{ |