2
2
* This file is part of audacious-hotkey plugin for audacious
3
3
*
4
4
* Copyright (c) 2007 - 2008 Sascha Hlusiak <[email protected] >
5
- * Name: plugin.c
6
- * Description: plugin.c
5
+ * Name: plugin.cc
6
+ * Description: plugin.cc
7
7
*
8
8
* Part of this code is from itouch-ctrl plugin.
9
9
* Authors of itouch-ctrl are listed below:
46
46
#include " api_hotkey.h"
47
47
#include " grab.h"
48
48
#include " gui.h"
49
- #include " plugin.h"
50
49
51
50
#ifdef BUILT_FROM_CMAKE
52
51
#include " ../../audacious-plugins_simpleAF/src/thirdparty/d_custom_logger.hpp"
53
52
#endif
54
53
54
+ extern bool system_up_and_running;
55
+
55
56
class GlobalHotkeys : public GeneralPlugin
56
57
{
57
58
public:
@@ -66,28 +67,24 @@ class GlobalHotkeys : public GeneralPlugin
66
67
void cleanup () override ;
67
68
};
68
69
69
- EXPORT GlobalHotkeys aud_plugin_instance;
70
-
71
- #ifndef _WIN32
72
70
/* global vars */
73
- static
74
- #else
75
- PluginConfig plugin_cfg;
76
- #endif
77
-
78
- const char GlobalHotkeys::about[] = N_(
79
- " Global Hotkey Plugin\n "
80
- " Control the player with global key combinations or multimedia "
81
- " keys.\n\n "
82
- " Copyright (C) 2007-2008 Sascha Hlusiak <[email protected] >\n\n "
83
- " Contributors include:\n "
84
- " Copyright (C) 2006-2007 Vladimir Paskov <[email protected] >\n "
85
- " Copyright (C) 2000-2002 Ville Syrjälä <[email protected] >,\n "
86
- " Bryn Davies <[email protected] >,\n "
87
- " Jonathan A. Davis <[email protected] >,\n "
88
- " Jeremy Tan <[email protected] >" );
89
-
90
- PluginConfig * get_config () { return &plugin_cfg; }
71
+ EXPORT GlobalHotkeys aud_plugin_instance;
72
+ PluginConfig plugin_cfg_gtk_global_hk;
73
+
74
+ const char GlobalHotkeys::about[] =
75
+ N_ (" Global Hotkey Plugin\n "
76
+ " Control the player with global key combinations or multimedia "
77
+ " keys.\n\n "
78
+ " Copyright (C) 2007-2008 Sascha Hlusiak <[email protected] >\n\n "
79
+ " Contributors include:\n "
80
+ " Copyright (C) 2020 Domen Mori <[email protected] >\n "
81
+ " Copyright (C) 2006-2007 Vladimir Paskov <[email protected] >\n "
82
+ " Copyright (C) 2000-2002 Ville Syrjälä <[email protected] >,\n "
83
+ " Bryn Davies <[email protected] >,\n "
84
+ " Jonathan A. Davis <[email protected] >,\n "
85
+ " Jeremy Tan <[email protected] >" );
86
+
87
+ PluginConfig * get_config () { return &plugin_cfg_gtk_global_hk; }
91
88
92
89
/*
93
90
* plugin activated
@@ -104,8 +101,9 @@ bool GlobalHotkeys::init()
104
101
}
105
102
#ifdef _WIN32
106
103
win_init ();
107
- #endif
104
+ #else
108
105
setup_filter ();
106
+ #endif
109
107
load_config ();
110
108
grab_keys ();
111
109
return true ;
@@ -296,10 +294,9 @@ gboolean handle_keyevent(EVENT event)
296
294
297
295
void load_defaults ()
298
296
{
299
- AUDDBG (" lHotkeyFlow:Entry, loading defaults." );
300
297
HotkeyConfiguration * hotkey;
301
298
302
- hotkey = &(plugin_cfg .first );
299
+ hotkey = &(plugin_cfg_gtk_global_hk .first );
303
300
304
301
Hotkey::add_hotkey (&hotkey, OS_KEY_AudioPrev, 0 , TYPE_KEY,
305
302
EVENT_PREV_TRACK);
@@ -329,7 +326,7 @@ void load_config()
329
326
HotkeyConfiguration * hotkey;
330
327
int i, max;
331
328
332
- hotkey = &(plugin_cfg .first );
329
+ hotkey = &(plugin_cfg_gtk_global_hk .first );
333
330
hotkey->next = nullptr ;
334
331
hotkey->key = 0 ;
335
332
hotkey->mask = 0 ;
@@ -378,7 +375,7 @@ void save_config()
378
375
int max;
379
376
HotkeyConfiguration * hotkey;
380
377
381
- hotkey = &(plugin_cfg .first );
378
+ hotkey = &(plugin_cfg_gtk_global_hk .first );
382
379
max = 0 ;
383
380
while (hotkey)
384
381
{
@@ -411,14 +408,17 @@ void save_config()
411
408
412
409
void GlobalHotkeys::cleanup ()
413
410
{
411
+ #ifdef _WIN32
412
+ system_up_and_running = false ;
413
+ #endif
414
414
#ifdef BUILT_FROM_CMAKE
415
+ AUDWARN (" Cleanup of globalHotkeys" );
415
416
audlog::unsubscribe (&DCustomLogger::go);
416
417
#endif
417
-
418
418
HotkeyConfiguration * hotkey;
419
419
ungrab_keys ();
420
420
release_filter ();
421
- hotkey = &(plugin_cfg .first );
421
+ hotkey = &(plugin_cfg_gtk_global_hk .first );
422
422
hotkey = hotkey->next ;
423
423
while (hotkey)
424
424
{
@@ -427,8 +427,8 @@ void GlobalHotkeys::cleanup()
427
427
hotkey = hotkey->next ;
428
428
g_free (old);
429
429
}
430
- plugin_cfg .first .next = nullptr ;
431
- plugin_cfg .first .key = 0 ;
432
- plugin_cfg .first .event = (EVENT)0 ;
433
- plugin_cfg .first .mask = 0 ;
430
+ plugin_cfg_gtk_global_hk .first .next = nullptr ;
431
+ plugin_cfg_gtk_global_hk .first .key = 0 ;
432
+ plugin_cfg_gtk_global_hk .first .event = (EVENT)0 ;
433
+ plugin_cfg_gtk_global_hk .first .mask = 0 ;
434
434
}
0 commit comments