Mercurial > audlegacy-plugins
annotate src/hotkey/plugin.c @ 1584:a6115d004ec3
Adapted plugins for internationalisation, update-po, German translation
author | mf0102 <0102@gmx.at> |
---|---|
date | Mon, 03 Sep 2007 23:43:38 +0200 |
parents | a9af4f1aede9 |
children | 5538324eb069 |
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 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
54 /* for xmms_show_message () */ |
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 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
132 NULL, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
133 NULL, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
134 "Global Hotkey", |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
135 init, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
136 about, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
137 configure, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
138 cleanup |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
139 }; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
140 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
141 GeneralPlugin *hotkey_gplist[] = { &audacioushotkey, NULL }; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
142 DECLARE_PLUGIN(hotkey, NULL, NULL, NULL, NULL, NULL, hotkey_gplist, NULL, NULL); |
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 |
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 * plugin activated |
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 static void init (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
150 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
151 x_display_init ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
152 setup_filter(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
153 load_config ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
154 grab_keys (); |
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 loaded = TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
157 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
158 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
159 /* check X display */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
160 void x_display_init (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
161 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
162 if (xdisplay != NULL) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
163 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
|
164 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
|
165 get_offending_modifiers(xdisplay); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
166 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
167 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
168 /* Taken from xbindkeys */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
169 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
|
170 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
171 int i; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
172 XModifierKeymap *modmap; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
173 KeyCode nlock, slock; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
174 static int mask_table[8] = { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
175 ShiftMask, LockMask, ControlMask, Mod1Mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
176 Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
177 }; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
178 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
179 nlock = XKeysymToKeycode (dpy, XK_Num_Lock); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
180 slock = XKeysymToKeycode (dpy, XK_Scroll_Lock); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
181 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
182 /* |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
183 * 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
|
184 * 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
|
185 */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
186 modmap = XGetModifierMapping (dpy); |
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 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
|
189 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
190 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
|
191 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
192 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
|
193 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
|
194 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
|
195 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
|
196 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
197 } |
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 capslock_mask = LockMask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
200 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
201 if (modmap) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
202 XFreeModifiermap (modmap); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
203 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
204 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
205 /* handle keys */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
206 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
|
207 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
208 gint current_volume, old_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
209 static gint volume_static = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
210 gboolean play, mute; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
211 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
212 /* playing or not */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
213 play = audacious_drct_is_playing (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
214 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
215 /* get current volume */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
216 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
|
217 old_volume = current_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
218 if (current_volume) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
219 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
220 /* volume is not mute */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
221 mute = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
222 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
223 /* volume is mute */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
224 mute = TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
225 } |
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 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
|
228 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
229 /* mute the playback */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
230 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
|
231 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
232 if (!mute) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
233 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
234 volume_static = current_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
235 audacious_drct_set_main_volume (0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
236 mute = TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
237 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
238 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
|
239 mute = FALSE; |
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 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
242 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
243 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
244 /* decreace volume */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
245 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
|
246 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
247 if (mute) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
248 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
249 current_volume = old_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
250 old_volume = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
251 mute = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
252 } |
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 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
|
255 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
256 current_volume = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
257 } |
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 if (current_volume != old_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 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
|
262 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
263 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
264 old_volume = current_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
265 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
266 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
267 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
268 /* increase volume */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
269 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
|
270 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
271 if (mute) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
272 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
273 current_volume = old_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
274 old_volume = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
275 mute = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
276 } |
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 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
|
279 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
280 current_volume = 100; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
281 } |
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 if (current_volume != old_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 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
|
286 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
287 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
288 old_volume = current_volume; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
289 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
290 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
291 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
292 /* play */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
293 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
|
294 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
295 if (!play) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
296 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
297 audacious_drct_play (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
298 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
299 audacious_drct_pause (); |
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 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
302 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
303 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
304 /* pause */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
305 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
|
306 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
307 if (!play) audacious_drct_play (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
308 else audacious_drct_pause (); |
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 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
311 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
312 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
313 /* stop */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
314 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
|
315 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
316 audacious_drct_stop (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
317 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
318 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
319 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
320 /* prev track */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
321 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
|
322 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
323 audacious_drct_playlist_prev (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
324 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
325 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
326 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
327 /* next track */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
328 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
|
329 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
330 audacious_drct_playlist_next (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
331 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
332 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
333 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
334 /* forward */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
335 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
|
336 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
337 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
|
338 time += 5000; /* Jump 5s into future */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
339 audacious_drct_jump_to_time(time); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
340 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
341 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
342 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
343 /* backward */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
344 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
|
345 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
346 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
|
347 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
|
348 else time = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
349 audacious_drct_jump_to_time(time); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
350 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
351 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
352 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
353 /* Open Jump-To-File dialog */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
354 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
|
355 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
356 audacious_drct_show_jtf_box(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
357 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
358 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
359 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
360 /* Toggle Windows */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
361 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
|
362 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
363 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
|
364 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
|
365 if (is_main) { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
366 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
|
367 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
|
368 audacious_drct_main_win_toggle(FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
369 audacious_drct_pl_win_toggle(FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
370 audacious_drct_eq_win_toggle(FALSE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
371 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
372 audacious_drct_main_win_toggle(TRUE); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
373 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
|
374 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
|
375 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
376 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
377 } |
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 return FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
380 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
381 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
382 static GdkFilterReturn |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
383 gdk_filter(GdkXEvent *xevent, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
384 GdkEvent *event, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
385 gpointer data) |
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 XKeyEvent *keyevent = (XKeyEvent*)xevent; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
388 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
389 if (((XEvent*)keyevent)->type != KeyPress) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
390 return -1; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
391 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
392 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
|
393 return GDK_FILTER_REMOVE; |
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 return GDK_FILTER_CONTINUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
396 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
397 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
398 static gboolean |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
399 setup_filter() |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
400 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
401 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
|
402 gdk_filter, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
403 NULL); |
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 return TRUE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
406 } |
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 static void release_filter() |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
409 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
410 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
|
411 gdk_filter, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
412 NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
413 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
414 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
415 /* load plugin configuration */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
416 static void load_config (void) |
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 ConfigDb *cfdb; |
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 if (xdisplay == NULL) x_display_init(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
421 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
422 /* default volume level */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
423 plugin_cfg.vol_increment = 4; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
424 plugin_cfg.vol_decrement = 4; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
425 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
426 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
|
427 plugin_cfg.mute_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
428 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
|
429 plugin_cfg.vol_down_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
430 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
|
431 plugin_cfg.vol_up_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
432 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
|
433 plugin_cfg.play_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
434 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
|
435 plugin_cfg.pause_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
436 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
|
437 plugin_cfg.stop_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
438 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
|
439 plugin_cfg.prev_track_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
440 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
|
441 plugin_cfg.next_track_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
442 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
|
443 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
|
444 plugin_cfg.forward = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
445 plugin_cfg.forward_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
446 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
|
447 plugin_cfg.backward_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
448 plugin_cfg.toggle_win = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
449 plugin_cfg.toggle_win_mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
450 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
451 /* open configuration database */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
452 cfdb = bmp_cfg_db_open ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
453 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
454 bmp_cfg_db_get_int (cfdb, "globalHotkey", "mute", &plugin_cfg.mute); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
455 bmp_cfg_db_get_int (cfdb, "globalHotkey", "mute_mask", &plugin_cfg.mute_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
456 bmp_cfg_db_get_int (cfdb, "globalHotkey", "vol_down", &plugin_cfg.vol_down); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
457 bmp_cfg_db_get_int (cfdb, "globalHotkey", "vol_down_mask", &plugin_cfg.vol_down_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
458 bmp_cfg_db_get_int (cfdb, "globalHotkey", "vol_up", &plugin_cfg.vol_up); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
459 bmp_cfg_db_get_int (cfdb, "globalHotkey", "vol_up_mask", &plugin_cfg.vol_up_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
460 bmp_cfg_db_get_int (cfdb, "globalHotkey", "play", &plugin_cfg.play); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
461 bmp_cfg_db_get_int (cfdb, "globalHotkey", "play_mask", &plugin_cfg.play_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
462 bmp_cfg_db_get_int (cfdb, "globalHotkey", "pause", &plugin_cfg.pause); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
463 bmp_cfg_db_get_int (cfdb, "globalHotkey", "pause_mask", &plugin_cfg.pause_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
464 bmp_cfg_db_get_int (cfdb, "globalHotkey", "stop", &plugin_cfg.stop); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
465 bmp_cfg_db_get_int (cfdb, "globalHotkey", "stop_mask", &plugin_cfg.stop_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
466 bmp_cfg_db_get_int (cfdb, "globalHotkey", "prev_track", &plugin_cfg.prev_track); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
467 bmp_cfg_db_get_int (cfdb, "globalHotkey", "prev_track_mask", &plugin_cfg.prev_track_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
468 bmp_cfg_db_get_int (cfdb, "globalHotkey", "next_track", &plugin_cfg.next_track); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
469 bmp_cfg_db_get_int (cfdb, "globalHotkey", "next_track_mask", &plugin_cfg.next_track_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
470 bmp_cfg_db_get_int (cfdb, "globalHotkey", "jump_to_file", &plugin_cfg.jump_to_file); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
471 bmp_cfg_db_get_int (cfdb, "globalHotkey", "jump_to_file_mask", &plugin_cfg.jump_to_file_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
472 bmp_cfg_db_get_int (cfdb, "globalHotkey", "forward", &plugin_cfg.forward); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
473 bmp_cfg_db_get_int (cfdb, "globalHotkey", "forward_mask", &plugin_cfg.forward_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
474 bmp_cfg_db_get_int (cfdb, "globalHotkey", "backward", &plugin_cfg.backward); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
475 bmp_cfg_db_get_int (cfdb, "globalHotkey", "backward_mask", &plugin_cfg.backward_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
476 bmp_cfg_db_get_int (cfdb, "globalHotkey", "toggle_win", &plugin_cfg.toggle_win); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
477 bmp_cfg_db_get_int (cfdb, "globalHotkey", "toggle_win_mask", &plugin_cfg.toggle_win_mask); |
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 bmp_cfg_db_close (cfdb); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
480 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
481 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
482 /* save plugin configuration */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
483 static void save_config (void) |
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 ConfigDb *cfdb; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
486 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
487 /* open configuration database */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
488 cfdb = bmp_cfg_db_open ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
489 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
490 bmp_cfg_db_set_int (cfdb, "globalHotkey", "mute", plugin_cfg.mute); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
491 bmp_cfg_db_set_int (cfdb, "globalHotkey", "mute_mask", plugin_cfg.mute_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
492 bmp_cfg_db_set_int (cfdb, "globalHotkey", "vol_up", plugin_cfg.vol_up); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
493 bmp_cfg_db_set_int (cfdb, "globalHotkey", "vol_up_mask", plugin_cfg.vol_up_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
494 bmp_cfg_db_set_int (cfdb, "globalHotkey", "vol_down", plugin_cfg.vol_down); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
495 bmp_cfg_db_set_int (cfdb, "globalHotkey", "vol_down_mask", plugin_cfg.vol_down_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
496 bmp_cfg_db_set_int (cfdb, "globalHotkey", "play", plugin_cfg.play); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
497 bmp_cfg_db_set_int (cfdb, "globalHotkey", "play_mask", plugin_cfg.play_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
498 bmp_cfg_db_set_int (cfdb, "globalHotkey", "pause", plugin_cfg.pause); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
499 bmp_cfg_db_set_int (cfdb, "globalHotkey", "pause_mask", plugin_cfg.pause_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
500 bmp_cfg_db_set_int (cfdb, "globalHotkey", "stop", plugin_cfg.stop); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
501 bmp_cfg_db_set_int (cfdb, "globalHotkey", "stop_mask", plugin_cfg.stop_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
502 bmp_cfg_db_set_int (cfdb, "globalHotkey", "prev_track", plugin_cfg.prev_track); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
503 bmp_cfg_db_set_int (cfdb, "globalHotkey", "prev_track_mask", plugin_cfg.prev_track_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
504 bmp_cfg_db_set_int (cfdb, "globalHotkey", "next_track", plugin_cfg.next_track); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
505 bmp_cfg_db_set_int (cfdb, "globalHotkey", "next_track_mask", plugin_cfg.next_track_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
506 bmp_cfg_db_set_int (cfdb, "globalHotkey", "jump_to_file", plugin_cfg.jump_to_file); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
507 bmp_cfg_db_set_int (cfdb, "globalHotkey", "jump_to_file_mask", plugin_cfg.jump_to_file_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
508 bmp_cfg_db_set_int (cfdb, "globalHotkey", "forward", plugin_cfg.forward); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
509 bmp_cfg_db_set_int (cfdb, "globalHotkey", "forward_mask", plugin_cfg.forward_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
510 bmp_cfg_db_set_int (cfdb, "globalHotkey", "backward", plugin_cfg.backward); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
511 bmp_cfg_db_set_int (cfdb, "globalHotkey", "backward_mask", plugin_cfg.backward_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
512 bmp_cfg_db_set_int (cfdb, "globalHotkey", "toggle_win", plugin_cfg.toggle_win); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
513 bmp_cfg_db_set_int (cfdb, "globalHotkey", "toggle_win_mask", plugin_cfg.toggle_win_mask); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
514 bmp_cfg_db_close (cfdb); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
515 } |
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 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
|
518 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
519 return 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
520 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
521 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
522 /* grab requied keys */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
523 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
|
524 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
525 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
|
526 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
527 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
|
528 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
529 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
530 if (modifier == AnyModifier) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
531 return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
532 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
533 if (numlock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
534 XGrabKey (xdisplay, keycode, modifier | numlock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
535 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
536 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
537 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
538 if (capslock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
539 XGrabKey (xdisplay, keycode, modifier | capslock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
540 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
541 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
542 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
543 if (scrolllock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
544 XGrabKey (xdisplay, keycode, modifier | scrolllock_mask, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
545 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
546 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
547 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
548 if (numlock_mask && capslock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
549 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
|
550 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
551 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
552 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
553 if (numlock_mask && scrolllock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
554 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
|
555 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
556 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
557 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
558 if (capslock_mask && scrolllock_mask) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
559 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
|
560 x_root_window, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
561 False, GrabModeAsync, GrabModeAsync); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
562 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
563 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
|
564 XGrabKey (xdisplay, keycode, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
565 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
|
566 x_root_window, False, GrabModeAsync, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
567 GrabModeAsync); |
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 |
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 static void grab_keys () |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
572 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
573 if (grabbed) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
574 if (xdisplay == NULL) x_display_init(); |
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 XErrorHandler old_handler = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
577 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
578 XSync(xdisplay, False); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
579 old_handler = XSetErrorHandler (x11_error_handler); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
580 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
581 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
|
582 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
|
583 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
|
584 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
|
585 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
|
586 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
|
587 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
|
588 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
|
589 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
|
590 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
|
591 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
|
592 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
|
593 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
594 XSync(xdisplay, False); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
595 XSetErrorHandler (old_handler); |
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 grabbed = 1; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
598 } |
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 * plugin init end |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
601 */ |
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 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
|
604 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
605 gchar *text = NULL; |
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 if (key == 0 && mask == 0) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
608 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
609 text = g_strdup(_("(none)")); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
610 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
611 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
|
612 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
|
613 gchar *strings[9]; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
614 gchar *keytext = NULL; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
615 int i, j; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
616 KeySym keysym; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
617 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
618 keysym = XKeycodeToKeysym(xdisplay, key, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
619 if (keysym == 0 || keysym == NoSymbol) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
620 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
621 keytext = g_strdup_printf("#%3d", key); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
622 } else { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
623 keytext = g_strdup(XKeysymToString(keysym)); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
624 } |
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 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
|
627 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
628 if (mask & modifiers[j]) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
629 strings[i++] = modifier_string[j]; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
630 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
631 if (key != 0) strings[i++] = keytext; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
632 strings[i] = NULL; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
633 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
634 text = g_strjoinv(" + ", strings); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
635 g_free(keytext); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
636 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
637 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
638 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
|
639 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
|
640 if (text) g_free(text); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
641 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
642 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
643 static gboolean |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
644 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
|
645 GdkEventKey * event, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
646 gpointer user_data) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
647 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
648 KeyControls *controls = (KeyControls*) user_data; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
649 int is_mod; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
650 int mod; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
651 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
652 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
|
653 mod = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
654 is_mod = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
655 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
656 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
|
657 mod |= ControlMask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
658 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
659 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
|
660 mod |= Mod1Mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
661 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
662 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
|
663 mod |= ShiftMask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
664 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
665 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
|
666 mod |= Mod5Mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
667 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
668 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
|
669 mod |= Mod4Mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
670 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
671 if (!is_mod) { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
672 controls->key = event->hardware_keycode; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
673 controls->mask = mod; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
674 } else controls->key = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
675 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
676 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
|
677 return FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
678 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
679 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
680 static gboolean |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
681 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
|
682 GdkEventKey * event, |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
683 gpointer user_data) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
684 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
685 KeyControls *controls = (KeyControls*) user_data; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
686 if (controls->key == 0) { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
687 controls->mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
688 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
689 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
|
690 return FALSE; |
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 |
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 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
|
695 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
696 GtkWidget *label; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
697 GtkWidget *button; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
698 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
699 controls->key = key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
700 controls->mask = mask; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
701 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
702 label = gtk_label_new (_(descr)); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
703 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
|
704 (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
|
705 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
|
706 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
|
707 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
708 controls->keytext = gtk_entry_new (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
709 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
|
710 (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
|
711 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
|
712 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
713 set_keytext(controls->keytext, key, mask); |
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_press_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_press_event), controls); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
716 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
|
717 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
|
718 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
719 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
|
720 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
|
721 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
|
722 G_CALLBACK (clear_keyboard), controls); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
723 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
724 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
725 /* configuration window */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
726 static void configure (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
727 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
728 ConfigurationControls *controls; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
729 GtkWidget *window; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
730 GtkWidget *main_vbox, *vbox; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
731 GtkWidget *hbox; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
732 GtkWidget *alignment; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
733 GtkWidget *frame; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
734 GtkWidget *label; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
735 GtkWidget *image; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
736 GtkWidget *table; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
737 GtkWidget *button_box, *button; |
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 if (!xdisplay) x_display_init(); |
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 load_config ( ); |
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 ungrab_keys(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
744 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
745 controls = (ConfigurationControls*)g_malloc(sizeof(ConfigurationControls)); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
746 if (!controls) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
747 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
748 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
|
749 "Aborting!"); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
750 return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
751 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
752 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
753 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
|
754 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
|
755 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
|
756 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
|
757 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
|
758 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
|
759 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
760 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
|
761 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
|
762 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
763 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
|
764 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
|
765 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
|
766 hbox = gtk_hbox_new (FALSE, 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
767 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
|
768 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
|
769 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
|
770 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
|
771 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
|
772 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
|
773 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
774 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
775 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
|
776 frame = gtk_frame_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
777 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
|
778 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
|
779 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
|
780 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
|
781 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
|
782 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
|
783 vbox = gtk_vbox_new (FALSE, 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
784 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
|
785 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
786 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
|
787 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
|
788 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
|
789 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
|
790 _("<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
|
791 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
|
792 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
|
793 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
|
794 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
|
795 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
796 /* prev track */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
797 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
|
798 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
|
799 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
800 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
|
801 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
|
802 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
803 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
|
804 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
|
805 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
806 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
|
807 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
|
808 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
809 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
|
810 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
|
811 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
812 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
|
813 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
|
814 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
815 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
|
816 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
|
817 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
818 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
819 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
820 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
|
821 frame = gtk_frame_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
822 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
|
823 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
|
824 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
|
825 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
|
826 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
|
827 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
|
828 vbox = gtk_vbox_new (FALSE, 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
829 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
|
830 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
831 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
|
832 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
|
833 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
|
834 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
|
835 _("<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
|
836 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
|
837 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
|
838 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
|
839 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
|
840 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
841 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
842 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
843 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
|
844 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
|
845 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
846 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
|
847 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
|
848 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
849 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
|
850 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
|
851 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
852 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
853 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
854 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
|
855 frame = gtk_frame_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
856 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
|
857 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
|
858 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
|
859 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
|
860 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
|
861 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
|
862 vbox = gtk_vbox_new (FALSE, 2); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
863 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
|
864 label = gtk_label_new (NULL); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
865 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
|
866 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
|
867 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
|
868 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
|
869 _("<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
|
870 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
|
871 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
|
872 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
|
873 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
|
874 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
875 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
|
876 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
|
877 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
878 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
|
879 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
|
880 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
881 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
882 button_box = gtk_hbutton_box_new ( ); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
883 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
|
884 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
|
885 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
|
886 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
887 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
|
888 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
|
889 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
|
890 G_CALLBACK (cancel_callback), controls); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
891 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
892 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
|
893 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
|
894 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
|
895 G_CALLBACK (ok_callback), controls); |
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 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
|
898 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
899 /* configuration window end */ |
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 void about (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
902 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
903 static GtkWidget *dialog; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
904 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
905 dialog = xmms_show_message (_("About Global Hotkey Plugin"), |
1551
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
906 _("Global Hotkey Plugin\n" |
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
907 "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
|
908 "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
|
909 "Contributers include:\n" |
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
910 "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
|
911 "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
|
912 " 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
|
913 " 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
|
914 " 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
|
915 ), |
1551
a9af4f1aede9
hotkey plugin: stripped unneeded #ifdefs from standalone version
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
1543
diff
changeset
|
916 _("OK"), TRUE, NULL, NULL); |
1543
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
917 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
918 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
|
919 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
|
920 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
921 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
922 /* Clear keys */ |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
923 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
|
924 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
925 KeyControls *spins = (KeyControls*)data; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
926 spins->key = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
927 spins->mask = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
928 set_keytext(spins->keytext, 0, 0); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
929 } |
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 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
|
932 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
933 if (loaded) |
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 grab_keys (); |
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 if (data) g_free(data); |
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 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
|
940 } |
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 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
|
943 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
944 ConfigurationControls *controls= (ConfigurationControls*)data; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
945 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
946 plugin_cfg.play = controls->play.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
947 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
|
948 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
949 plugin_cfg.pause = controls->pause.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
950 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
|
951 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
952 plugin_cfg.stop = controls->stop.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
953 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
|
954 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
955 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
|
956 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
|
957 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
958 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
|
959 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
|
960 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
961 plugin_cfg.forward = controls->forward.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
962 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
|
963 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
964 plugin_cfg.backward = controls->backward.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
965 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
|
966 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
967 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
|
968 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
|
969 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
970 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
|
971 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
|
972 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
973 plugin_cfg.mute = controls->mute.key; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
974 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
|
975 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
976 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
|
977 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
|
978 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
979 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
|
980 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
|
981 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
982 save_config ( ); |
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 if (loaded) |
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 grab_keys (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
987 } |
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 if (data) g_free(data); |
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 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
|
992 } |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
993 |
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 * plugin cleanup |
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 static void cleanup (void) |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
998 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
999 if (!loaded) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1000 ungrab_keys (); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1001 release_filter(); |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1002 loaded = FALSE; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1003 } |
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 static void ungrab_keys () |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1006 { |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1007 if (!grabbed) return; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1008 if (!xdisplay) return; |
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 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
|
1011 |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1012 grabbed = 0; |
ec4e8ec829b1
Include global hotkey plugin in build system (src/hotkey)
Sascha Hlusiak <contact@saschahlusiak.de>
parents:
diff
changeset
|
1013 } |