Skip to content

Commit

Permalink
Correcting the issues on Linux target
Browse files Browse the repository at this point in the history
  • Loading branch information
dmikushin committed Feb 19, 2022
1 parent c3c7cb2 commit 7dd6cb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ else()
ADD_DEFINITIONS(${APPINDICATOR_CFLAGS})
LINK_DIRECTORIES(${APPINDICATOR_LIBRARY_DIRS})
add_compile_definitions(TRAY_APPINDICATOR=1)
list(APPEND src ${CMAKE_CURRENT_SOURCE_DIR}/tray_windows.c)
list(APPEND src ${CMAKE_CURRENT_SOURCE_DIR}/tray_linux.c)
endif()
endif()
endif()
Expand Down
9 changes: 5 additions & 4 deletions tray_linux.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <gtk/gtk.h>
#include <libappindicator/app-indicator.h>
#include "tray.h"

#define TRAY_APPINDICATOR_ID "tray-id"

Expand Down Expand Up @@ -40,7 +41,7 @@ static GtkMenuShell *_tray_menu(struct tray_menu *m) {
return menu;
}

static int tray_init(struct tray *tray) {
int tray_init(struct tray *tray) {
if (gtk_init_check(0, NULL) == FALSE) {
return -1;
}
Expand All @@ -51,17 +52,17 @@ static int tray_init(struct tray *tray) {
return 0;
}

static int tray_loop(int blocking) {
int tray_loop(int blocking) {
gtk_main_iteration_do(blocking);
return loop_result;
}

static void tray_update(struct tray *tray) {
void tray_update(struct tray *tray) {
app_indicator_set_icon(indicator, tray->icon);
// GTK is all about reference counting, so previous menu should be destroyed
// here
app_indicator_set_menu(indicator, GTK_MENU(_tray_menu(tray->menu)));
}

static void tray_exit() { loop_result = -1; }
void tray_exit() { loop_result = -1; }

0 comments on commit 7dd6cb9

Please sign in to comment.