diff options
author | ch1p <ch1p@ch1p.com> | 2014-11-19 11:33:04 +0300 |
---|---|---|
committer | ch1p <ch1p@ch1p.com> | 2014-11-19 11:33:04 +0300 |
commit | 2c2744db268f54d301c88963c9d227a3c7c49ac8 (patch) | |
tree | 2e7ab3f216ec8aa2dd292d9b3bf2027a2667bcc4 /desktop/main.c | |
parent | bdc7ff9d08b2f4030e0c27c7752c4bdf2fed6172 (diff) |
Diffstat (limited to 'desktop/main.c')
-rw-r--r-- | desktop/main.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/desktop/main.c b/desktop/main.c index 8703991..f67ad41 100644 --- a/desktop/main.c +++ b/desktop/main.c @@ -11,12 +11,9 @@ static GtkStatusIcon *tray_icon; static GtkWidget *menu; -enum server_last_cmd_enum server_last_cmd = NONE; static pthread_t grab_thread; static pthread_t server_thread; -pthread_mutex_t server_last_cmd_mutex; - void tray_icon_on_click(GtkStatusIcon *status_icon, gpointer user_data) { // left-click } @@ -47,7 +44,6 @@ void menu_about(GtkWidget *widget, gpointer data) { } void menu_quit(GtkWidget *widget, gpointer data) { - // quit app exit(0); } @@ -84,28 +80,30 @@ void create_menu() { } void handle_hotkeys(enum HotkeyEvent e) { - pthread_mutex_lock(&server_last_cmd_mutex); + printf("[handle_hotkeys] e: %d\n", e); + + pthread_mutex_lock(&server_command_mutex); switch (e) { case HK_PLAY: - server_last_cmd = PLAY; + server_command = PLAY; break; case HK_PAUSE: - server_last_cmd = PAUSE; + server_command = PAUSE; break; case HK_NEXT: - server_last_cmd = NEXT; + server_command = NEXT; break; case HK_PREV: - server_last_cmd = PREV; + server_command = PREV; break; default: break; } - pthread_mutex_unlock(&server_last_cmd_mutex); + pthread_mutex_unlock(&server_command_mutex); } void start_grab() { @@ -125,7 +123,7 @@ void start_server() { } int main(int argc, char **argv) { - pthread_mutex_init(&server_last_cmd_mutex, NULL); + pthread_mutex_init(&server_command_mutex, NULL); start_grab(); start_server(); |