Mercurial > audlegacy-plugins
annotate src/hotkey/plugin.c @ 2170:02cfac0efbdc
remove unnecessary code. (I can't recall why I used "uri", actually.)
author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
---|---|
date | Sun, 18 Nov 2007 15:24:22 +0900 |
parents | b8da6a0b0da2 |
children | f893d05f707b |
rev | line source |
---|---|
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1 /* -*- Mode: C; indent-tabs: t; c-basic-offset: 9; tab-width: 9 -*- */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
2 /* |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
3 * This file is part of audacious-hotkey plugin for audacious |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
4 * |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
5 * Copyright (c) 2007 Sascha Hlusiak <contact@saschahlusiak.de> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
6 * Name: plugin.c |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
7 * Description: plugin.c |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
8 * |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
9 * Part of this code is from itouch-ctrl plugin. |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
10 * Authors of itouch-ctrl are listed below: |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
11 * |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
12 * Copyright (c) 2006 - 2007 Vladimir Paskov <vlado.paskov@gmail.com> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
13 * |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
14 * Part of this code are from xmms-itouch plugin. |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
15 * Authors of xmms-itouch are listed below: |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
16 * |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
17 * Copyright (C) 2000-2002 Ville Syrjälä <syrjala@sci.fi> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
18 * Bryn Davies <curious@ihug.com.au> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
19 * Jonathan A. Davis <davis@jdhouse.org> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
20 * Jeremy Tan <nsx@nsx.homeip.net> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
21 * |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
22 * audacious-hotkey is free software; you can redistribute it and/or modify |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
23 * it under the terms of the GNU General Public License as published by |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
24 * the Free Software Foundation; either version 2 of the License, or |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
25 * (at your option) any later version. |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
26 * |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
27 * audacious-hotkey is distributed in the hope that it will be useful, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
30 * GNU General Public License for more details. |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
31 * |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
32 * You should have received a copy of the GNU General Public License |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
33 * along with audacious-hotkey; if not, write to the Free Software |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
34 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
35 */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
36 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
37 #include <config.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
38 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
39 #include <stdio.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
40 #include <stdlib.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
41 #include <X11/Xlib.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
42 #include <X11/keysym.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
43 #include <X11/XF86keysym.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
44 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
45 #include <gtk/gtk.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
46 #include <gdk/gdkx.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
47 #include <gdk/gdkkeysyms.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
48 #include <audacious/plugin.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
49 #include <audacious/auddrct.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
50 #include <audacious/configdb.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
51 |
1551
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
52 #include <audacious/i18n.h> |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
53 |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1658
diff
changeset
|
54 /* for audacious_info_dialog () */ |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
55 #include <audacious/util.h> |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
56 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
57 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
58 /* func defs */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
59 void x_display_init (void); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
60 static void get_offending_modifiers (Display * dpy); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
61 static void init (void); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
62 static void grab_keys (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
63 static void ungrab_keys (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
64 static gboolean handle_keyevent(int keycode, int state); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
65 static gboolean setup_filter(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
66 static void release_filter(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
67 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
68 static void load_config (void); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
69 static void save_config (void); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
70 static void configure (void); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
71 static void clear_keyboard (GtkWidget *widget, gpointer data); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
72 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
73 void cancel_callback (GtkWidget *widget, gpointer data); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
74 void ok_callback (GtkWidget *widget, gpointer data); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
75 static void about (void); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
76 static void cleanup (void); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
77 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
78 typedef struct { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
79 gint vol_increment; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
80 gint vol_decrement; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
81 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
82 /* keyboard */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
83 gint mute, mute_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
84 gint vol_down, vol_down_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
85 gint vol_up, vol_up_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
86 gint play, play_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
87 gint stop, stop_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
88 gint pause, pause_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
89 gint prev_track, prev_track_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
90 gint next_track, next_track_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
91 gint jump_to_file, jump_to_file_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
92 gint toggle_win, toggle_win_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
93 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
94 gint forward, forward_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
95 gint backward, backward_mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
96 } PluginConfig; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
97 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
98 PluginConfig plugin_cfg; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
99 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
100 static Display *xdisplay = NULL; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
101 static Window x_root_window = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
102 static gint grabbed = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
103 static gboolean loaded = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
104 static unsigned int numlock_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
105 static unsigned int scrolllock_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
106 static unsigned int capslock_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
107 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
108 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
109 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
110 typedef struct { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
111 GtkWidget *keytext; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
112 gint key, mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
113 } KeyControls; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
114 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
115 typedef struct { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
116 KeyControls play; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
117 KeyControls stop; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
118 KeyControls pause; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
119 KeyControls prev; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
120 KeyControls next; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
121 KeyControls up; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
122 KeyControls down; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
123 KeyControls mute; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
124 KeyControls jump_to_file; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
125 KeyControls forward; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
126 KeyControls backward; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
127 KeyControls toggle_win; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
128 } ConfigurationControls; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
129 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
130 static GeneralPlugin audacioushotkey = |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
131 { |
1658 | 132 .description = "Global Hotkey", |
133 .init = init, | |
134 .about = about, | |
135 .configure = configure, | |
136 .cleanup = cleanup | |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
137 }; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
138 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
139 GeneralPlugin *hotkey_gplist[] = { &audacioushotkey, NULL }; |
1658 | 140 SIMPLE_GENERAL_PLUGIN(hotkey, hotkey_gplist); |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
141 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
142 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
143 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
144 /* |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
145 * plugin activated |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
146 */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
147 static void init (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
148 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
149 x_display_init ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
150 setup_filter(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
151 load_config ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
152 grab_keys (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
153 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
154 loaded = TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
155 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
156 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
157 /* check X display */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
158 void x_display_init (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
159 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
160 if (xdisplay != NULL) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
161 xdisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
162 x_root_window = GDK_WINDOW_XID(gdk_get_default_root_window()); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
163 get_offending_modifiers(xdisplay); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
164 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
165 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
166 /* Taken from xbindkeys */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
167 static void get_offending_modifiers (Display * dpy) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
168 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
169 int i; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
170 XModifierKeymap *modmap; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
171 KeyCode nlock, slock; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
172 static int mask_table[8] = { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
173 ShiftMask, LockMask, ControlMask, Mod1Mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
174 Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
175 }; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
176 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
177 nlock = XKeysymToKeycode (dpy, XK_Num_Lock); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
178 slock = XKeysymToKeycode (dpy, XK_Scroll_Lock); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
179 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
180 /* |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
181 * Find out the masks for the NumLock and ScrollLock modifiers, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
182 * so that we can bind the grabs for when they are enabled too. |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
183 */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
184 modmap = XGetModifierMapping (dpy); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
185 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
186 if (modmap != NULL && modmap->max_keypermod > 0) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
187 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
188 for (i = 0; i < 8 * modmap->max_keypermod; i++) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
189 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
190 if (modmap->modifiermap[i] == nlock && nlock != 0) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
191 numlock_mask = mask_table[i / modmap->max_keypermod]; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
192 else if (modmap->modifiermap[i] == slock && slock != 0) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
193 scrolllock_mask = mask_table[i / modmap->max_keypermod]; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
194 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
195 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
196 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
197 capslock_mask = LockMask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
198 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
199 if (modmap) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
200 XFreeModifiermap (modmap); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
201 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
202 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
203 /* handle keys */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
204 static gboolean handle_keyevent (int keycode, int state) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
205 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
206 gint current_volume, old_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
207 static gint volume_static = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
208 gboolean play, mute; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
209 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
210 /* playing or not */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
211 play = audacious_drct_is_playing (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
212 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
213 /* get current volume */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
214 audacious_drct_get_volume_main (¤t_volume); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
215 old_volume = current_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
216 if (current_volume) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
217 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
218 /* volume is not mute */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
219 mute = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
220 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
221 /* volume is mute */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
222 mute = TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
223 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
224 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
225 state &= ~(scrolllock_mask | numlock_mask | capslock_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
226 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
227 /* mute the playback */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
228 if ((keycode == plugin_cfg.mute) && (state == plugin_cfg.mute_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
229 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
230 if (!mute) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
231 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
232 volume_static = current_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
233 audacious_drct_set_main_volume (0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
234 mute = TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
235 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
236 audacious_drct_set_main_volume (volume_static); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
237 mute = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
238 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
239 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
240 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
241 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
242 /* decreace volume */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
243 if ((keycode == plugin_cfg.vol_down) && (state == plugin_cfg.vol_down_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
244 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
245 if (mute) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
246 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
247 current_volume = old_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
248 old_volume = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
249 mute = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
250 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
251 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
252 if ((current_volume -= plugin_cfg.vol_decrement) < 0) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
253 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
254 current_volume = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
255 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
256 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
257 if (current_volume != old_volume) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
258 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
259 audacious_drct_set_main_volume (current_volume); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
260 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
261 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
262 old_volume = current_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
263 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
264 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
265 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
266 /* increase volume */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
267 if ((keycode == plugin_cfg.vol_up) && (state == plugin_cfg.vol_up_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
268 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
269 if (mute) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
270 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
271 current_volume = old_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
272 old_volume = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
273 mute = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
274 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
275 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
276 if ((current_volume += plugin_cfg.vol_increment) > 100) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
277 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
278 current_volume = 100; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
279 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
280 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
281 if (current_volume != old_volume) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
282 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
283 audacious_drct_set_main_volume (current_volume); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
284 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
285 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
286 old_volume = current_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
287 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
288 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
289 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
290 /* play */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
291 if ((keycode == plugin_cfg.play) && (state == plugin_cfg.play_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
292 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
293 if (!play) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
294 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
295 audacious_drct_play (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
296 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
297 audacious_drct_pause (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
298 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
299 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
300 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
301 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
302 /* pause */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
303 if ((keycode == plugin_cfg.pause) && (state == plugin_cfg.pause_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
304 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
305 if (!play) audacious_drct_play (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
306 else audacious_drct_pause (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
307 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
308 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
309 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
310 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
311 /* stop */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
312 if ((keycode == plugin_cfg.stop) && (state == plugin_cfg.stop_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
313 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
314 audacious_drct_stop (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
315 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
316 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
317 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
318 /* prev track */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
319 if ((keycode == plugin_cfg.prev_track) && (state == plugin_cfg.prev_track_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
320 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
321 audacious_drct_playlist_prev (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
322 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
323 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
324 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
325 /* next track */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
326 if ((keycode == plugin_cfg.next_track) && (state == plugin_cfg.next_track_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
327 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
328 audacious_drct_playlist_next (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
329 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
330 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
331 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
332 /* forward */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
333 if ((keycode == plugin_cfg.forward) && (state == plugin_cfg.forward_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
334 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
335 gint time = audacious_drct_get_output_time(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
336 time += 5000; /* Jump 5s into future */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
337 audacious_drct_jump_to_time(time); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
338 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
339 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
340 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
341 /* backward */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
342 if ((keycode == plugin_cfg.backward) && (state == plugin_cfg.backward_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
343 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
344 gint time = audacious_drct_get_output_time(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
345 if (time > 5000) time -= 5000; /* Jump 5s back */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
346 else time = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
347 audacious_drct_jump_to_time(time); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
348 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
349 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
350 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
351 /* Open Jump-To-File dialog */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
352 if ((keycode == plugin_cfg.jump_to_file) && (state == plugin_cfg.jump_to_file_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
353 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
354 audacious_drct_show_jtf_box(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
355 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
356 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
357 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
358 /* Toggle Windows */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
359 if ((keycode == plugin_cfg.toggle_win) && (state == plugin_cfg.toggle_win_mask)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
360 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
361 static gboolean is_main, is_eq, is_pl; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
362 is_main = audacious_drct_main_win_is_visible(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
363 if (is_main) { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
364 is_pl = audacious_drct_pl_win_is_visible(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
365 is_eq = audacious_drct_eq_win_is_visible(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
366 audacious_drct_main_win_toggle(FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
367 audacious_drct_pl_win_toggle(FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
368 audacious_drct_eq_win_toggle(FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
369 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
370 audacious_drct_main_win_toggle(TRUE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
371 audacious_drct_pl_win_toggle(is_pl); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
372 audacious_drct_eq_win_toggle(is_eq); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
373 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
374 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
375 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
376 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
377 return FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
378 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
379 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
380 static GdkFilterReturn |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
381 gdk_filter(GdkXEvent *xevent, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
382 GdkEvent *event, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
383 gpointer data) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
384 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
385 XKeyEvent *keyevent = (XKeyEvent*)xevent; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
386 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
387 if (((XEvent*)keyevent)->type != KeyPress) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
388 return -1; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
389 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
390 if (handle_keyevent(keyevent->keycode, keyevent->state)) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
391 return GDK_FILTER_REMOVE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
392 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
393 return GDK_FILTER_CONTINUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
394 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
395 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
396 static gboolean |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
397 setup_filter() |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
398 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
399 gdk_window_add_filter(gdk_get_default_root_window(), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
400 gdk_filter, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
401 NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
402 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
403 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
404 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
405 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
406 static void release_filter() |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
407 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
408 gdk_window_remove_filter(gdk_get_default_root_window(), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
409 gdk_filter, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
410 NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
411 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
412 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
413 /* load plugin configuration */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
414 static void load_config (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
415 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
416 ConfigDb *cfdb; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
417 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
418 if (xdisplay == NULL) x_display_init(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
419 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
420 /* default volume level */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
421 plugin_cfg.vol_increment = 4; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
422 plugin_cfg.vol_decrement = 4; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
423 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
424 plugin_cfg.mute = XKeysymToKeycode(xdisplay, XF86XK_AudioMute); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
425 plugin_cfg.mute_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
426 plugin_cfg.vol_down = XKeysymToKeycode(xdisplay, XF86XK_AudioLowerVolume); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
427 plugin_cfg.vol_down_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
428 plugin_cfg.vol_up = XKeysymToKeycode(xdisplay, XF86XK_AudioRaiseVolume); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
429 plugin_cfg.vol_up_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
430 plugin_cfg.play = XKeysymToKeycode(xdisplay, XF86XK_AudioPlay); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
431 plugin_cfg.play_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
432 plugin_cfg.pause = XKeysymToKeycode(xdisplay, XF86XK_AudioPause); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
433 plugin_cfg.pause_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
434 plugin_cfg.stop = XKeysymToKeycode(xdisplay, XF86XK_AudioStop); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
435 plugin_cfg.stop_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
436 plugin_cfg.prev_track = XKeysymToKeycode(xdisplay, XF86XK_AudioPrev); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
437 plugin_cfg.prev_track_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
438 plugin_cfg.next_track = XKeysymToKeycode(xdisplay, XF86XK_AudioNext); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
439 plugin_cfg.next_track_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
440 plugin_cfg.jump_to_file = XKeysymToKeycode(xdisplay, XF86XK_AudioMedia); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
441 plugin_cfg.jump_to_file_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
442 plugin_cfg.forward = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
443 plugin_cfg.forward_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
444 plugin_cfg.backward = XKeysymToKeycode(xdisplay, XF86XK_AudioRewind); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
445 plugin_cfg.backward_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
446 plugin_cfg.toggle_win = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
447 plugin_cfg.toggle_win_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
448 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
449 /* open configuration database */ |
2124 | 450 cfdb = aud_cfg_db_open ( ); |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
451 |
2124 | 452 aud_cfg_db_get_int (cfdb, "globalHotkey", "mute", &plugin_cfg.mute); |
453 aud_cfg_db_get_int (cfdb, "globalHotkey", "mute_mask", &plugin_cfg.mute_mask); | |
454 aud_cfg_db_get_int (cfdb, "globalHotkey", "vol_down", &plugin_cfg.vol_down); | |
455 aud_cfg_db_get_int (cfdb, "globalHotkey", "vol_down_mask", &plugin_cfg.vol_down_mask); | |
456 aud_cfg_db_get_int (cfdb, "globalHotkey", "vol_up", &plugin_cfg.vol_up); | |
457 aud_cfg_db_get_int (cfdb, "globalHotkey", "vol_up_mask", &plugin_cfg.vol_up_mask); | |
458 aud_cfg_db_get_int (cfdb, "globalHotkey", "play", &plugin_cfg.play); | |
459 aud_cfg_db_get_int (cfdb, "globalHotkey", "play_mask", &plugin_cfg.play_mask); | |
460 aud_cfg_db_get_int (cfdb, "globalHotkey", "pause", &plugin_cfg.pause); | |
461 aud_cfg_db_get_int (cfdb, "globalHotkey", "pause_mask", &plugin_cfg.pause_mask); | |
462 aud_cfg_db_get_int (cfdb, "globalHotkey", "stop", &plugin_cfg.stop); | |
463 aud_cfg_db_get_int (cfdb, "globalHotkey", "stop_mask", &plugin_cfg.stop_mask); | |
464 aud_cfg_db_get_int (cfdb, "globalHotkey", "prev_track", &plugin_cfg.prev_track); | |
465 aud_cfg_db_get_int (cfdb, "globalHotkey", "prev_track_mask", &plugin_cfg.prev_track_mask); | |
466 aud_cfg_db_get_int (cfdb, "globalHotkey", "next_track", &plugin_cfg.next_track); | |
467 aud_cfg_db_get_int (cfdb, "globalHotkey", "next_track_mask", &plugin_cfg.next_track_mask); | |
468 aud_cfg_db_get_int (cfdb, "globalHotkey", "jump_to_file", &plugin_cfg.jump_to_file); | |
469 aud_cfg_db_get_int (cfdb, "globalHotkey", "jump_to_file_mask", &plugin_cfg.jump_to_file_mask); | |
470 aud_cfg_db_get_int (cfdb, "globalHotkey", "forward", &plugin_cfg.forward); | |
471 aud_cfg_db_get_int (cfdb, "globalHotkey", "forward_mask", &plugin_cfg.forward_mask); | |
472 aud_cfg_db_get_int (cfdb, "globalHotkey", "backward", &plugin_cfg.backward); | |
473 aud_cfg_db_get_int (cfdb, "globalHotkey", "backward_mask", &plugin_cfg.backward_mask); | |
474 aud_cfg_db_get_int (cfdb, "globalHotkey", "toggle_win", &plugin_cfg.toggle_win); | |
475 aud_cfg_db_get_int (cfdb, "globalHotkey", "toggle_win_mask", &plugin_cfg.toggle_win_mask); | |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
476 |
2124 | 477 aud_cfg_db_close (cfdb); |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
478 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
479 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
480 /* save plugin configuration */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
481 static void save_config (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
482 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
483 ConfigDb *cfdb; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
484 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
485 /* open configuration database */ |
2124 | 486 cfdb = aud_cfg_db_open ( ); |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
487 |
2124 | 488 aud_cfg_db_set_int (cfdb, "globalHotkey", "mute", plugin_cfg.mute); |
489 aud_cfg_db_set_int (cfdb, "globalHotkey", "mute_mask", plugin_cfg.mute_mask); | |
490 aud_cfg_db_set_int (cfdb, "globalHotkey", "vol_up", plugin_cfg.vol_up); | |
491 aud_cfg_db_set_int (cfdb, "globalHotkey", "vol_up_mask", plugin_cfg.vol_up_mask); | |
492 aud_cfg_db_set_int (cfdb, "globalHotkey", "vol_down", plugin_cfg.vol_down); | |
493 aud_cfg_db_set_int (cfdb, "globalHotkey", "vol_down_mask", plugin_cfg.vol_down_mask); | |
494 aud_cfg_db_set_int (cfdb, "globalHotkey", "play", plugin_cfg.play); | |
495 aud_cfg_db_set_int (cfdb, "globalHotkey", "play_mask", plugin_cfg.play_mask); | |
496 aud_cfg_db_set_int (cfdb, "globalHotkey", "pause", plugin_cfg.pause); | |
497 aud_cfg_db_set_int (cfdb, "globalHotkey", "pause_mask", plugin_cfg.pause_mask); | |
498 aud_cfg_db_set_int (cfdb, "globalHotkey", "stop", plugin_cfg.stop); | |
499 aud_cfg_db_set_int (cfdb, "globalHotkey", "stop_mask", plugin_cfg.stop_mask); | |
500 aud_cfg_db_set_int (cfdb, "globalHotkey", "prev_track", plugin_cfg.prev_track); | |
501 aud_cfg_db_set_int (cfdb, "globalHotkey", "prev_track_mask", plugin_cfg.prev_track_mask); | |
502 aud_cfg_db_set_int (cfdb, "globalHotkey", "next_track", plugin_cfg.next_track); | |
503 aud_cfg_db_set_int (cfdb, "globalHotkey", "next_track_mask", plugin_cfg.next_track_mask); | |
504 aud_cfg_db_set_int (cfdb, "globalHotkey", "jump_to_file", plugin_cfg.jump_to_file); | |
505 aud_cfg_db_set_int (cfdb, "globalHotkey", "jump_to_file_mask", plugin_cfg.jump_to_file_mask); | |
506 aud_cfg_db_set_int (cfdb, "globalHotkey", "forward", plugin_cfg.forward); | |
507 aud_cfg_db_set_int (cfdb, "globalHotkey", "forward_mask", plugin_cfg.forward_mask); | |
508 aud_cfg_db_set_int (cfdb, "globalHotkey", "backward", plugin_cfg.backward); | |
509 aud_cfg_db_set_int (cfdb, "globalHotkey", "backward_mask", plugin_cfg.backward_mask); | |
510 aud_cfg_db_set_int (cfdb, "globalHotkey", "toggle_win", plugin_cfg.toggle_win); | |
511 aud_cfg_db_set_int (cfdb, "globalHotkey", "toggle_win_mask", plugin_cfg.toggle_win_mask); | |
512 aud_cfg_db_close (cfdb); | |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
513 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
514 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
515 static int x11_error_handler (Display *dpy, XErrorEvent *error) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
516 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
517 return 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
518 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
519 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
520 /* grab requied keys */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
521 static void grab_key(KeyCode keycode, unsigned int modifier) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
522 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
523 modifier &= ~(numlock_mask | capslock_mask | scrolllock_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
524 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
525 XGrabKey (xdisplay, keycode, modifier, x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
526 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
527 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
528 if (modifier == AnyModifier) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
529 return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
530 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
531 if (numlock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
532 XGrabKey (xdisplay, keycode, modifier | numlock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
533 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
534 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
535 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
536 if (capslock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
537 XGrabKey (xdisplay, keycode, modifier | capslock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
538 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
539 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
540 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
541 if (scrolllock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
542 XGrabKey (xdisplay, keycode, modifier | scrolllock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
543 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
544 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
545 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
546 if (numlock_mask && capslock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
547 XGrabKey (xdisplay, keycode, modifier | numlock_mask | capslock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
548 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
549 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
550 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
551 if (numlock_mask && scrolllock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
552 XGrabKey (xdisplay, keycode, modifier | numlock_mask | scrolllock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
553 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
554 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
555 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
556 if (capslock_mask && scrolllock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
557 XGrabKey (xdisplay, keycode, modifier | capslock_mask | scrolllock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
558 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
559 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
560 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
561 if (numlock_mask && capslock_mask && scrolllock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
562 XGrabKey (xdisplay, keycode, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
563 modifier | numlock_mask | capslock_mask | scrolllock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
564 x_root_window, False, GrabModeAsync, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
565 GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
566 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
567 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
568 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
569 static void grab_keys () |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
570 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
571 if (grabbed) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
572 if (xdisplay == NULL) x_display_init(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
573 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
574 XErrorHandler old_handler = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
575 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
576 XSync(xdisplay, False); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
577 old_handler = XSetErrorHandler (x11_error_handler); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
578 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
579 if (plugin_cfg.mute) grab_key(plugin_cfg.mute, plugin_cfg.mute_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
580 if (plugin_cfg.vol_up) grab_key(plugin_cfg.vol_up, plugin_cfg.vol_up_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
581 if (plugin_cfg.vol_down) grab_key(plugin_cfg.vol_down, plugin_cfg.vol_down_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
582 if (plugin_cfg.play) grab_key(plugin_cfg.play, plugin_cfg.play_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
583 if (plugin_cfg.pause) grab_key(plugin_cfg.pause, plugin_cfg.pause_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
584 if (plugin_cfg.stop) grab_key(plugin_cfg.stop, plugin_cfg.stop_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
585 if (plugin_cfg.prev_track) grab_key(plugin_cfg.prev_track, plugin_cfg.prev_track_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
586 if (plugin_cfg.next_track) grab_key(plugin_cfg.next_track, plugin_cfg.next_track_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
587 if (plugin_cfg.jump_to_file) grab_key(plugin_cfg.jump_to_file, plugin_cfg.jump_to_file_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
588 if (plugin_cfg.forward) grab_key(plugin_cfg.forward, plugin_cfg.forward_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
589 if (plugin_cfg.backward) grab_key(plugin_cfg.backward, plugin_cfg.backward_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
590 if (plugin_cfg.toggle_win) grab_key(plugin_cfg.toggle_win, plugin_cfg.toggle_win_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
591 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
592 XSync(xdisplay, False); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
593 XSetErrorHandler (old_handler); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
594 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
595 grabbed = 1; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
596 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
597 /* |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
598 * plugin init end |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
599 */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
600 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
601 static void set_keytext (GtkWidget *entry, gint key, gint mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
602 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
603 gchar *text = NULL; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
604 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
605 if (key == 0 && mask == 0) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
606 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
607 text = g_strdup(_("(none)")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
608 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
609 static char *modifier_string[] = { "Control", "Shift", "Alt", "Mod2", "Mod3", "Super", "Mod5" }; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
610 static unsigned int modifiers[] = { ControlMask, ShiftMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
611 gchar *strings[9]; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
612 gchar *keytext = NULL; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
613 int i, j; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
614 KeySym keysym; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
615 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
616 keysym = XKeycodeToKeysym(xdisplay, key, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
617 if (keysym == 0 || keysym == NoSymbol) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
618 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
619 keytext = g_strdup_printf("#%3d", key); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
620 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
621 keytext = g_strdup(XKeysymToString(keysym)); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
622 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
623 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
624 for (i = 0, j=0; j<7; j++) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
625 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
626 if (mask & modifiers[j]) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
627 strings[i++] = modifier_string[j]; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
628 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
629 if (key != 0) strings[i++] = keytext; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
630 strings[i] = NULL; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
631 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
632 text = g_strjoinv(" + ", strings); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
633 g_free(keytext); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
634 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
635 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
636 gtk_entry_set_text(GTK_ENTRY(entry), text); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
637 gtk_editable_set_position(GTK_EDITABLE(entry), -1); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
638 if (text) g_free(text); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
639 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
640 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
641 static gboolean |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
642 on_entry_key_press_event(GtkWidget * widget, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
643 GdkEventKey * event, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
644 gpointer user_data) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
645 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
646 KeyControls *controls = (KeyControls*) user_data; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
647 int is_mod; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
648 int mod; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
649 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
650 if (event->keyval == GDK_Tab) return FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
651 mod = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
652 is_mod = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
653 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
654 if ((event->state & GDK_CONTROL_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_Control_L || event->keyval == GDK_Control_R)))) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
655 mod |= ControlMask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
656 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
657 if ((event->state & GDK_MOD1_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_Alt_L || event->keyval == GDK_Alt_R)))) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
658 mod |= Mod1Mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
659 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
660 if ((event->state & GDK_SHIFT_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_Shift_L || event->keyval == GDK_Shift_R)))) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
661 mod |= ShiftMask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
662 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
663 if ((event->state & GDK_MOD5_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_ISO_Level3_Shift)))) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
664 mod |= Mod5Mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
665 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
666 if ((event->state & GDK_MOD4_MASK) | (!is_mod && (is_mod = (event->keyval == GDK_Super_L || event->keyval == GDK_Super_R)))) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
667 mod |= Mod4Mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
668 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
669 if (!is_mod) { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
670 controls->key = event->hardware_keycode; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
671 controls->mask = mod; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
672 } else controls->key = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
673 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
674 set_keytext(controls->keytext, is_mod ? 0 : event->hardware_keycode, mod); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
675 return FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
676 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
677 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
678 static gboolean |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
679 on_entry_key_release_event(GtkWidget * widget, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
680 GdkEventKey * event, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
681 gpointer user_data) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
682 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
683 KeyControls *controls = (KeyControls*) user_data; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
684 if (controls->key == 0) { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
685 controls->mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
686 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
687 set_keytext(controls->keytext, controls->key, controls->mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
688 return FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
689 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
690 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
691 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
692 static void add_event_controls(GtkWidget *table, KeyControls *controls, int row, char* descr, gint key, gint mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
693 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
694 GtkWidget *label; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
695 GtkWidget *button; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
696 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
697 controls->key = key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
698 controls->mask = mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
699 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
700 label = gtk_label_new (_(descr)); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
701 gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
702 (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
703 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
704 gtk_misc_set_padding (GTK_MISC (label), 3, 3); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
705 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
706 controls->keytext = gtk_entry_new (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
707 gtk_table_attach (GTK_TABLE (table), controls->keytext, 1, 2, row, row+1, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
708 (GtkAttachOptions) (GTK_FILL|GTK_EXPAND), (GtkAttachOptions) (GTK_EXPAND), 0, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
709 gtk_entry_set_editable (GTK_ENTRY (controls->keytext), FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
710 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
711 set_keytext(controls->keytext, key, mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
712 g_signal_connect((gpointer)controls->keytext, "key_press_event", |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
713 G_CALLBACK(on_entry_key_press_event), controls); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
714 g_signal_connect((gpointer)controls->keytext, "key_release_event", |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
715 G_CALLBACK(on_entry_key_release_event), controls); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
716 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
717 button = gtk_button_new_with_label (_("None")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
718 gtk_table_attach (GTK_TABLE (table), button, 2, 3, row, row+1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
719 g_signal_connect (G_OBJECT (button), "clicked", |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
720 G_CALLBACK (clear_keyboard), controls); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
721 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
722 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
723 /* configuration window */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
724 static void configure (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
725 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
726 ConfigurationControls *controls; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
727 GtkWidget *window; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
728 GtkWidget *main_vbox, *vbox; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
729 GtkWidget *hbox; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
730 GtkWidget *alignment; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
731 GtkWidget *frame; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
732 GtkWidget *label; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
733 GtkWidget *image; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
734 GtkWidget *table; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
735 GtkWidget *button_box, *button; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
736 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
737 if (!xdisplay) x_display_init(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
738 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
739 load_config ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
740 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
741 ungrab_keys(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
742 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
743 controls = (ConfigurationControls*)g_malloc(sizeof(ConfigurationControls)); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
744 if (!controls) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
745 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
746 printf ("Faild to allocate memory for ConfigurationControls structure!\n" |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
747 "Aborting!"); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
748 return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
749 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
750 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
751 window = gtk_window_new (GTK_WINDOW_TOPLEVEL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
752 gtk_window_set_title (GTK_WINDOW (window), _("Global Hotkey Plugin Configuration")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
753 gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER_ALWAYS); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
754 gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DIALOG); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
755 gtk_window_set_resizable (GTK_WINDOW (window), FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
756 gtk_container_set_border_width (GTK_CONTAINER (window), 5); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
757 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
758 main_vbox = gtk_vbox_new (FALSE, 4); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
759 gtk_container_add (GTK_CONTAINER (window), main_vbox); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
760 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
761 alignment = gtk_alignment_new (0.5, 0.5, 1, 1); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
762 gtk_box_pack_start (GTK_BOX (main_vbox), alignment, FALSE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
763 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 4, 0, 0, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
764 hbox = gtk_hbox_new (FALSE, 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
765 gtk_container_add (GTK_CONTAINER (alignment), hbox); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
766 image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
767 gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
768 label = gtk_label_new (_("Press a key combination inside a text field.")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
769 gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
770 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
771 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
772 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
773 gtk_label_set_markup (GTK_LABEL (label), _("<b>Playback:</b>")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
774 frame = gtk_frame_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
775 gtk_frame_set_label_widget (GTK_FRAME (frame), label); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
776 gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
777 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
778 alignment = gtk_alignment_new (0.5, 0.5, 1, 1); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
779 gtk_container_add (GTK_CONTAINER (frame), alignment); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
780 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 3, 3, 3, 3); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
781 vbox = gtk_vbox_new (FALSE, 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
782 gtk_container_add (GTK_CONTAINER (alignment), vbox); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
783 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
784 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
785 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
786 gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
787 gtk_label_set_markup (GTK_LABEL (label), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
788 _("<i>Configure keys which controls Audacious playback.</i>")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
789 table = gtk_table_new (4, 3, FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
790 gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
791 gtk_table_set_col_spacings (GTK_TABLE (table), 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
792 gtk_table_set_row_spacings (GTK_TABLE (table), 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
793 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
794 /* prev track */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
795 add_event_controls(table, &controls->prev, 0, _("Previous Track:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
796 plugin_cfg.prev_track, plugin_cfg.prev_track_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
797 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
798 add_event_controls(table, &controls->play, 1, _("Play/Pause:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
799 plugin_cfg.play, plugin_cfg.play_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
800 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
801 add_event_controls(table, &controls->pause, 2, _("Pause:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
802 plugin_cfg.pause, plugin_cfg.pause_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
803 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
804 add_event_controls(table, &controls->stop, 3, _("Stop:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
805 plugin_cfg.stop, plugin_cfg.stop_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
806 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
807 add_event_controls(table, &controls->next, 4, _("Next Track:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
808 plugin_cfg.next_track, plugin_cfg.next_track_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
809 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
810 add_event_controls(table, &controls->forward, 5, _("Forward 5 sec.:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
811 plugin_cfg.forward, plugin_cfg.forward_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
812 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
813 add_event_controls(table, &controls->backward, 6, _("Rewind 5 sec.:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
814 plugin_cfg.backward, plugin_cfg.backward_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
815 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
816 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
817 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
818 gtk_label_set_markup (GTK_LABEL (label), _("<b>Volume Control:</b>")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
819 frame = gtk_frame_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
820 gtk_frame_set_label_widget (GTK_FRAME (frame), label); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
821 gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
822 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
823 alignment = gtk_alignment_new (0.5, 0.5, 1, 1); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
824 gtk_container_add (GTK_CONTAINER (frame), alignment); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
825 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 3, 3, 3, 3); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
826 vbox = gtk_vbox_new (FALSE, 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
827 gtk_container_add (GTK_CONTAINER (alignment), vbox); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
828 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
829 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
830 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
831 gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
832 gtk_label_set_markup (GTK_LABEL (label), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
833 _("<i>Configure keys which controls music volume.</i>")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
834 table = gtk_table_new (3, 3, FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
835 gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
836 gtk_table_set_col_spacings (GTK_TABLE (table), 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
837 gtk_table_set_row_spacings (GTK_TABLE (table), 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
838 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
839 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
840 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
841 add_event_controls(table, &controls->mute, 0, _("Mute:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
842 plugin_cfg.mute, plugin_cfg.mute_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
843 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
844 add_event_controls(table, &controls->up, 1, _("Volume Up:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
845 plugin_cfg.vol_up, plugin_cfg.vol_up_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
846 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
847 add_event_controls(table, &controls->down, 2, _("Volume Down:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
848 plugin_cfg.vol_down, plugin_cfg.vol_down_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
849 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
850 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
851 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
852 gtk_label_set_markup (GTK_LABEL (label), _("<b>Player:</b>")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
853 frame = gtk_frame_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
854 gtk_frame_set_label_widget (GTK_FRAME (frame), label); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
855 gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
856 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
857 alignment = gtk_alignment_new (0.5, 0.5, 1, 1); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
858 gtk_container_add (GTK_CONTAINER (frame), alignment); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
859 gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 3, 3, 3, 3); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
860 vbox = gtk_vbox_new (FALSE, 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
861 gtk_container_add (GTK_CONTAINER (alignment), vbox); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
862 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
863 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
864 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
865 gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
866 gtk_label_set_markup (GTK_LABEL (label), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
867 _("<i>Configure keys which control the player.</i>")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
868 table = gtk_table_new (3, 2, FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
869 gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
870 gtk_table_set_col_spacings (GTK_TABLE (table), 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
871 gtk_table_set_row_spacings (GTK_TABLE (table), 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
872 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
873 add_event_controls(table, &controls->jump_to_file, 0, _("Jump to File:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
874 plugin_cfg.jump_to_file, plugin_cfg.jump_to_file_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
875 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
876 add_event_controls(table, &controls->toggle_win, 1, _("Toggle Player Windows:"), |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
877 plugin_cfg.toggle_win, plugin_cfg.toggle_win_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
878 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
879 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
880 button_box = gtk_hbutton_box_new ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
881 gtk_box_pack_start (GTK_BOX (main_vbox), button_box, FALSE, TRUE, 6); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
882 gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_END); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
883 gtk_box_set_spacing (GTK_BOX (button_box), 4); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
884 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
885 button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
886 gtk_container_add (GTK_CONTAINER (button_box), button); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
887 g_signal_connect (G_OBJECT (button), "clicked", |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
888 G_CALLBACK (cancel_callback), controls); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
889 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
890 button = gtk_button_new_from_stock (GTK_STOCK_OK); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
891 gtk_container_add (GTK_CONTAINER (button_box), button); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
892 g_signal_connect (G_OBJECT (button), "clicked", |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
893 G_CALLBACK (ok_callback), controls); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
894 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
895 gtk_widget_show_all (GTK_WIDGET (window)); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
896 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
897 /* configuration window end */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
898 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
899 static void about (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
900 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
901 static GtkWidget *dialog; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
902 |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1658
diff
changeset
|
903 dialog = audacious_info_dialog (_("About Global Hotkey Plugin"), |
1551
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
904 _("Global Hotkey Plugin\n" |
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
905 "Control the player with global key combinations or multimedia keys.\n\n" |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
906 "Copyright (C) 2007 Sascha Hlusiak <contact@saschahlusiak.de>\n\n" |
1551
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
907 "Contributers include:\n" |
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
908 "Copyright (C) 2006 - 2007 Vladimir Paskov <vlado.paskov@gmail.com>\n" |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
909 "Copyright (C) 2000-2002 Ville Syrjälä <syrjala@sci.fi>\n" |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
910 " Bryn Davies <curious@ihug.com.au>\n" |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
911 " Jonathan A. Davis <davis@jdhouse.org>\n" |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
912 " Jeremy Tan <nsx@nsx.homeip.net>\n\n" |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
913 ), |
1551
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
914 _("OK"), TRUE, NULL, NULL); |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
915 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
916 gtk_signal_connect(GTK_OBJECT(dialog), "destroy", |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
917 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
918 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
919 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
920 /* Clear keys */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
921 static void clear_keyboard (GtkWidget *widget, gpointer data) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
922 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
923 KeyControls *spins = (KeyControls*)data; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
924 spins->key = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
925 spins->mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
926 set_keytext(spins->keytext, 0, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
927 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
928 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
929 void cancel_callback (GtkWidget *widget, gpointer data) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
930 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
931 if (loaded) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
932 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
933 grab_keys (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
934 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
935 if (data) g_free(data); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
936 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
937 gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (widget))); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
938 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
939 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
940 void ok_callback (GtkWidget *widget, gpointer data) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
941 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
942 ConfigurationControls *controls= (ConfigurationControls*)data; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
943 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
944 plugin_cfg.play = controls->play.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
945 plugin_cfg.play_mask = controls->play.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
946 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
947 plugin_cfg.pause = controls->pause.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
948 plugin_cfg.pause_mask = controls->pause.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
949 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
950 plugin_cfg.stop = controls->stop.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
951 plugin_cfg.stop_mask = controls->stop.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
952 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
953 plugin_cfg.prev_track = controls->prev.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
954 plugin_cfg.prev_track_mask = controls->prev.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
955 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
956 plugin_cfg.next_track = controls->next.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
957 plugin_cfg.next_track_mask = controls->next.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
958 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
959 plugin_cfg.forward = controls->forward.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
960 plugin_cfg.forward_mask = controls->forward.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
961 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
962 plugin_cfg.backward = controls->backward.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
963 plugin_cfg.backward_mask = controls->backward.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
964 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
965 plugin_cfg.vol_up = controls->up.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
966 plugin_cfg.vol_up_mask = controls->up.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
967 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
968 plugin_cfg.vol_down = controls->down.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
969 plugin_cfg.vol_down_mask = controls->down.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
970 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
971 plugin_cfg.mute = controls->mute.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
972 plugin_cfg.mute_mask = controls->mute.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
973 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
974 plugin_cfg.jump_to_file = controls->jump_to_file.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
975 plugin_cfg.jump_to_file_mask = controls->jump_to_file.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
976 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
977 plugin_cfg.toggle_win= controls->toggle_win.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
978 plugin_cfg.toggle_win_mask = controls->toggle_win.mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
979 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
980 save_config ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
981 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
982 if (loaded) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
983 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
984 grab_keys (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
985 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
986 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
987 if (data) g_free(data); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
988 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
989 gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (widget))); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
990 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
991 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
992 /* |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
993 * plugin cleanup |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
994 */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
995 static void cleanup (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
996 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
997 if (!loaded) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
998 ungrab_keys (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
999 release_filter(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1000 loaded = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1001 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1002 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1003 static void ungrab_keys () |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1004 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1005 if (!grabbed) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1006 if (!xdisplay) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1007 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1008 XUngrabKey (xdisplay, AnyKey, AnyModifier, x_root_window); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1009 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1010 grabbed = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1011 } |