155
179
Inst->kss = xcb_key_symbols_alloc (Inst->conn);
157
181
/* Grab the XF86AudioRaiseVolume key */
158
Inst->keyRaise = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioRaiseVolume);
161
while (Inst->keyRaise[i] != XCB_NO_SYMBOL) {
162
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
163
mod, Inst->keyRaise[i],
164
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
165
error = xcb_request_check (Inst->conn, cookie);
167
fprintf (stderr, "XCB: Unable to bind RaiseVolume keycode=%d mod=0x%04x: %d\n",
168
Inst->keyRaise[i], mod, error->error_code);
171
g_print ("XCB: RaiseVolume ok, keycode=%d mod=0x%04x\n",
172
Inst->keyRaise[i], mod);
177
/* Grab the XF86AudioLowerVolume key */
178
Inst->keyLower = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioLowerVolume);
181
while (Inst->keyLower[i] != XCB_NO_SYMBOL) {
182
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
183
mod, Inst->keyLower[i],
184
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
185
error = xcb_request_check (Inst->conn, cookie);
187
fprintf (stderr, "XCB: Unable to bind LowerVolume keycode=%d mod=0x%04x: %d\n",
188
Inst->keyLower[i], mod, error->error_code);
191
g_print ("XCB: LowerVolume ok, keycode=%d mod=0x%04x\n",
192
Inst->keyLower[i], mod);
198
/* Grab the XF86AudioMute key */
199
Inst->keyMute = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioMute);
202
while (Inst->keyMute[i] != XCB_NO_SYMBOL) {
203
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
204
mod, Inst->keyMute[i],
205
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
206
error = xcb_request_check (Inst->conn, cookie);
208
fprintf (stderr, "XCB: Unable to bind Mute keycode=%d mod=0x%04x: %d\n",
209
Inst->keyMute[i], mod, error->error_code);
212
g_print ("XCB: Mute ok, keycode=%d mod=0x%04x\n",
213
Inst->keyMute[i], mod);
182
#ifndef LEGACY_XCBKEYSYMS
183
Inst->keyRaise = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioRaiseVolume);
185
if (Inst->keyRaise == NULL) {
186
g_debug ("There is no X86AudioRaiseVolume key on your system.\n");
190
while (Inst->keyRaise[i] != XCB_NO_SYMBOL) {
191
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
192
mod, Inst->keyRaise[i],
193
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
194
error = xcb_request_check (Inst->conn, cookie);
196
fprintf (stderr, "XCB: Unable to bind RaiseVolume keycode=%d mod=0x%04x: %d\n",
197
Inst->keyRaise[i], mod, error->error_code);
200
g_print ("XCB: RaiseVolume ok, keycode=%d mod=0x%04x\n",
201
Inst->keyRaise[i], mod);
207
/* Grab the XF86AudioLowerVolume key */
208
Inst->keyLower = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioLowerVolume);
210
if (Inst->keyLower == NULL) {
211
g_debug ("There is no X86AudioLowerVolume key on your system.\n");
215
while (Inst->keyLower[i] != XCB_NO_SYMBOL) {
216
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
217
mod, Inst->keyLower[i],
218
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
219
error = xcb_request_check (Inst->conn, cookie);
221
fprintf (stderr, "XCB: Unable to bind LowerVolume keycode=%d mod=0x%04x: %d\n",
222
Inst->keyLower[i], mod, error->error_code);
225
g_print ("XCB: LowerVolume ok, keycode=%d mod=0x%04x\n",
226
Inst->keyLower[i], mod);
232
/* Grab the XF86AudioMute key */
233
Inst->keyMute = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioMute);
235
if (Inst->keyMute == NULL) {
236
g_debug ("There is no X86AudioMute key on your system.\n");
240
while (Inst->keyMute[i] != XCB_NO_SYMBOL) {
241
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
242
mod, Inst->keyMute[i],
243
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
244
error = xcb_request_check (Inst->conn, cookie);
246
fprintf (stderr, "XCB: Unable to bind Mute keycode=%d mod=0x%04x: %d\n",
247
Inst->keyMute[i], mod, error->error_code);
250
g_print ("XCB: Mute ok, keycode=%d mod=0x%04x\n",
251
Inst->keyMute[i], mod);
259
Inst->keyRaise = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioRaiseVolume);
261
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
263
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
264
error = xcb_request_check (Inst->conn, cookie);
266
fprintf (stderr, "XCB: Unable to bind RaiseVolume keycode=%d mod=0x%04x: %d\n",
267
Inst->keyRaise, mod, error->error_code);
270
g_print ("XCB: RaiseVolume ok, keycode=%d mod=0x%04x\n",
271
Inst->keyRaise, mod);
274
/* Grab the XF86AudioLowerVolume key */
275
Inst->keyLower = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioLowerVolume);
277
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
279
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
280
error = xcb_request_check (Inst->conn, cookie);
282
fprintf (stderr, "XCB: Unable to bind LowerVolume keycode=%d mod=0x%04x: %d\n",
283
Inst->keyLower, mod, error->error_code);
286
g_print ("XCB: LowerVolume ok, keycode=%d mod=0x%04x\n",
287
Inst->keyLower, mod);
291
/* Grab the XF86AudioMute key */
292
Inst->keyMute = xcb_key_symbols_get_keycode (Inst->kss, XF86XK_AudioMute);
294
cookie = xcb_grab_key_checked (Inst->conn, TRUE, Inst->root_win,
296
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
297
error = xcb_request_check (Inst->conn, cookie);
299
fprintf (stderr, "XCB: Unable to bind Mute keycode=%d mod=0x%04x: %d\n",
300
Inst->keyMute, mod, error->error_code);
303
g_print ("XCB: Mute ok, keycode=%d mod=0x%04x\n",
218
308
GIOChannel *channel = g_io_channel_unix_new (xcb_get_file_descriptor (Inst->conn));
219
309
g_io_add_watch (channel, G_IO_IN|G_IO_HUP, _xvd_keys_handle_events, Inst);