1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
|
diff --git src/hotkeys.c src/hotkeys.c
index b3ac52a..9a7cc82 100644
--- src/hotkeys.c
+++ src/hotkeys.c
@@ -54,7 +54,7 @@ extern char *getenv();
#include <fcntl.h>
#include <sys/ioctl.h>
#if defined (__FreeBSD__)
-#include <machine/soundcard.h>
+#include <sys/soundcard.h>
#else
# if defined (__NetBSD__) || defined (__OpenBSD__)
# include <soundcard.h> /* OSS emulation */
@@ -66,9 +66,9 @@ extern char *getenv();
#endif /* __FreeBSD__ */
/* CDROM related */
-#include <linux/cdrom.h> /* FIXME: linux specific! */
+//#include <linux/cdrom.h> /* FIXME: linux specific! */
/* APM (suspend/standby) support */
-#include "apm.h"
+//#include "apm.h"
#if HAVE_GTK
#include "splash.h"
#endif
@@ -585,7 +585,7 @@ adjustVol(int adj)
{
int mixer_fd = -1, cdrom_fd = -1;
int master_vol, cd_vol;
- struct cdrom_volctrl cdrom_vol;
+// struct cdrom_volctrl cdrom_vol;
int left, right;
static struct timeval last_time;
struct timeval this_time;
@@ -595,7 +595,7 @@ adjustVol(int adj)
int sign = adj > 0 ? 1 : -1;
if ( adj == 0 )
- return;
+ return 0;
if ( multiplier == 0 )
{
@@ -683,6 +683,7 @@ adjustVol(int adj)
}
/* open the cdrom/dvdrom drive device */
+/***** ANDY: No CD support yet
if ( cdromDevice != NULL )
{
if ( (cdrom_fd = open( cdromDevice, O_RDONLY|O_NONBLOCK )) == -1 )
@@ -691,7 +692,7 @@ adjustVol(int adj)
}
else
{
- /* read the cdrom volume */
+ || read the cdrom volume ||
if ( ioctl(cdrom_fd, CDROMVOLREAD, &cdrom_vol) == -1 )
{
uError("Unable to read the CDROM volume of `%s'", cdromDevice);
@@ -699,7 +700,7 @@ adjustVol(int adj)
}
else
{
- /* Set the CDROM volume */
+ || Set the CDROM volume ||
int t;
float myAdj;
myAdj = 0xFF / 100.0 * adj;
@@ -721,9 +722,10 @@ adjustVol(int adj)
}
}
}
+END Andy *****/
if (mixer_fd != -1) close(mixer_fd);
- if (cdrom_fd != -1) close(cdrom_fd);
+//Andy if (cdrom_fd != -1) close(cdrom_fd);
return ret;
}
@@ -737,10 +739,10 @@ doMute(void)
{
static Bool muted = False;
static int last_mixer_vol, last_cd_vol;
- static struct cdrom_volctrl last_cdrom_vol;
+//Andy static struct cdrom_volctrl last_cdrom_vol;
int vol, cd_vol;
- struct cdrom_volctrl cdrom_vol;
+//Andy struct cdrom_volctrl cdrom_vol;
int mixer_fd = -1, cdrom_fd = -1;
short ret = 0; /* return value */
@@ -751,6 +753,7 @@ doMute(void)
uError("Unable to open `%s'", MIXER_DEV);
}
/* open the cdrom/dvdrom drive device */
+/***** Andy: No CD support
if ( cdromDevice != NULL )
{
if ( (cdrom_fd = open( cdromDevice, O_RDONLY|O_NONBLOCK )) == -1 )
@@ -758,6 +761,7 @@ doMute(void)
uError("Unable to open `%s'", cdromDevice);
}
}
+END Andy *****/
if ( muted )
{
@@ -783,6 +787,7 @@ doMute(void)
#endif
}
}
+/***** Andy: No CD support
#if 0
if (SOUND_IOCTL(mixer_fd, SOUND_MIXER_WRITE_CD, &last_cd_vol) == -1)
{
@@ -800,6 +805,7 @@ doMute(void)
} else
muted = False;
}
+End Andy *****/
}
else /* ! muted */
{
@@ -837,6 +843,7 @@ doMute(void)
}
}
}
+/***** Andy: No CD support
#if 0
if ( SOUND_IOCTL(mixer_fd, SOUND_MIXER_READ_CD, &last_cd_vol) == -1)
{
@@ -853,7 +860,9 @@ doMute(void)
muted = True;
}
#endif
+End Andy *****/
/* read and store the cdrom volume */
+/***** Andy: No CD support
if (cdrom_fd != -1)
{
if ( ioctl(cdrom_fd, CDROMVOLREAD, &last_cdrom_vol) == -1 )
@@ -863,8 +872,8 @@ doMute(void)
}
else
{
- /* Set the volume to 0. FIXME: is this linux specific? Do
- * other platforms also have 4 channels? */
+ || Set the volume to 0. FIXME: is this linux specific? Do
+ * other platforms also have 4 channels? ||
cdrom_vol.channel0 = cdrom_vol.channel1 = cdrom_vol.channel2 =
cdrom_vol.channel3 = 0;
if ( ioctl(cdrom_fd, CDROMVOLCTRL, &cdrom_vol) == -1 )
@@ -875,10 +884,11 @@ doMute(void)
muted = True;
}
}
+End Andy *****/
}
if (mixer_fd != -1) close(mixer_fd);
- if (cdrom_fd != -1) close(cdrom_fd);
+//Andy if (cdrom_fd != -1) close(cdrom_fd);
return ret;
}
@@ -886,19 +896,20 @@ doMute(void)
static int
ejectDisc(void)
{
+/***** Andy: No CD support
int fd, status;
if ( cdromDevice == NULL )
return 0;
- /* the idea of this code is from xine's vcd plugin, mostly linux
- specific FIXME */
+ || the idea of this code is from xine's vcd plugin, mostly linux
+ specific FIXME ||
if ( (fd = open( cdromDevice, O_RDONLY | O_NONBLOCK)) > -1 ) {
status = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
switch (status)
{
- /* Looks like ATAPI drives doesn't return CDS_TRAY_OPEN,
- * at least it's the case on my ASUS DVD drive... */
+ || Looks like ATAPI drives doesn't return CDS_TRAY_OPEN,
+ * at least it's the case on my ASUS DVD drive... ||
case CDS_TRAY_OPEN:
#ifdef HAVE_LIBXOSD
if ( osd )
@@ -929,7 +940,7 @@ ejectDisc(void)
case CDS_NO_INFO:
case CDS_DRIVE_NOT_READY:
default:
- /* Ignore */
+ || Ignore ||
break;
}
close(fd);
@@ -940,6 +951,7 @@ ejectDisc(void)
SYSLOG(LOG_NOTICE, "CDROM_DRIVE_STATUS failed: %s\n", strerror(errno));
return -1;
}
+End Andy *****/
}
@@ -1002,8 +1014,8 @@ launchApp(int keycode)
#ifdef HAVE_LIBXOSD
if ( osd )
{
- xosd_display(osd, 0, XOSD_string, "Launching:");
- xosd_display(osd, 1, XOSD_string, getConfig(type));
+ xosd_display(osd, 0, XOSD_string, type);
+ xosd_display(osd, 1, XOSD_string, "");
}
#endif
}
@@ -1015,13 +1027,14 @@ launchApp(int keycode)
int
sleepState(int mode)
{
+/***** Andy: No APM support
#ifdef USE_APMD
switch (mode)
{
- case SUSPEND:
+ // case SUSPEND:
error = system("apm -s");
break;
- case STANDBY:
+ // case STANDBY:
error = system("apm -S");
break;
default:
@@ -1039,10 +1052,10 @@ sleepState(int mode)
}
switch (mode)
{
- case SUSPEND:
+ // case SUSPEND:
error = apm_suspend(fd);
break;
- case STANDBY:
+ // case STANDBY:
error = apm_standby(fd);
break;
default:
@@ -1050,7 +1063,9 @@ sleepState(int mode)
break;
}
apm_close(fd);
-#endif /* USE_APMD */
+#endif
+End Andy *****/
+/* USE_APMD */
}
@@ -1105,8 +1120,8 @@ lookupUserCmd(const int keycode)
#ifdef HAVE_LIBXOSD
if ( osd )
{
- xosd_display(osd, 0, XOSD_string, "Launching:");
- xosd_display(osd, 1, XOSD_string, kbd.customCmds[i].desc);
+ xosd_display(osd, 0, XOSD_string, kbd.customCmds[i].desc);
+ xosd_display(osd, 1, XOSD_string, "");
}
#endif
break; /* break the for loop */
@@ -1435,15 +1450,16 @@ initXOSD(void)
#ifdef HAVE_LIBXOSD
if ( osd )
{
- osd = xosd_init(xstrdup(getConfig("osd_font")),
- /* I dunno why, but you must call strdup here... */
- xstrdup(getConfig("osd_color")),
- atoi(getConfig("osd_timeout")),
- strncmp(getConfig("osd_position"),"top",3)?XOSD_bottom:XOSD_top,
- atoi(getConfig("osd_offset")),
- 3 /* shadow offset */,
- 3 /* number_lines */
- );
+ osd = xosd_create(3);
+ xosd_set_pos(osd, strncmp(getConfig("osd_position"),"top",3)?XOSD_bottom:XOSD_top);
+ xosd_set_bar_length(osd, atoi(getConfig("osd_bar_length")));
+ xosd_set_colour(osd, xstrdup(getConfig("osd_color")));
+ xosd_set_shadow_colour(osd, xstrdup(getConfig("osd_shadow_color")));
+ xosd_set_shadow_offset(osd, atoi(getConfig("osd_shadow_offset")));
+ xosd_set_horizontal_offset(osd, atoi(getConfig("osd_hoffset")));
+ xosd_set_vertical_offset(osd, atoi(getConfig("osd_voffset")));
+ xosd_set_font(osd, xstrdup(getConfig("osd_font")));
+ xosd_set_align(osd, strncmp(getConfig("osd_align"),"left",4)?((!strncmp(getConfig("osd_align"),"center",6))?XOSD_center:XOSD_right):XOSD_left);
}
#endif
}
@@ -1592,6 +1608,7 @@ main(int argc, char *argv[])
doMute();
} else
/* APM stuffs */
+/**** Andy: No APM support
if ( ev.message.keycode == (kbd.defCmds)[sleepKey].key ||
ev.message.keycode == (kbd.defCmds)[wakeupKey].key ) {
sleepState(STANDBY);
@@ -1601,14 +1618,15 @@ main(int argc, char *argv[])
}
else
{
+End Andy *****/
lookupUserCmd(ev.message.keycode); /* User-defined stuffs */
- }
+//Andy }
}
}
#ifdef HAVE_LIBXOSD
if (osd)
- xosd_uninit(osd);
+ xosd_destroy(osd);
#endif
XCloseDisplay(dpy);
closelog();
|