From d584d04691dd5442f665f809bef3ed48671a5943 Mon Sep 17 00:00:00 2001 From: o9000 Date: Wed, 28 Jan 2015 15:13:56 +0000 Subject: [PATCH] Remove global variables from header files git-svn-id: http://tint2.googlecode.com/svn/trunk@671 121b4492-b84c-0410-8b4c-0d4edfb3f3cc --- CMakeLists.txt | 2 +- src/config.c | 11 +++++++++-- src/server.c | 7 ++++++- src/server.h | 2 +- src/tint.c | 14 ++++---------- src/util/window.c | 5 ----- src/util/window.h | 1 - 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82cb8eb..e6da4a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,7 @@ target_link_libraries( tint2 m ) add_dependencies( tint2 version ) set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -pthread" ) -set_target_properties(tint2 PROPERTIES LINK_FLAGS "-pthread" ) +set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread" ) install( TARGETS tint2 DESTINATION bin ) install( FILES sample/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 ) diff --git a/src/config.c b/src/config.c index b73e0a0..2efaf77 100644 --- a/src/config.c +++ b/src/config.c @@ -35,6 +35,10 @@ #include #include +#include "config.h" + +#ifndef TINT2CONF + #include "common.h" #include "server.h" #include "panel.h" @@ -44,7 +48,6 @@ #include "systraybar.h" #include "launcher.h" #include "clock.h" -#include "config.h" #include "window.h" #include "tooltip.h" #include "timer.h" @@ -53,10 +56,14 @@ #include "battery.h" #endif +#endif + // global path char *config_path; char *snapshot_path; +#ifndef TINT2CONF + // -------------------------------------------------- // backward compatibility // detect if it's an old config file (==1) @@ -780,5 +787,5 @@ int config_read_file (const char *path) return 1; } - +#endif diff --git a/src/server.c b/src/server.c index b859155..d227421 100644 --- a/src/server.c +++ b/src/server.c @@ -28,9 +28,10 @@ #include "server.h" #include "config.h" -#include "task.h" #include "window.h" +Server_global server; + void server_catch_error (Display *d, XErrorEvent *ev){} void server_init_atoms () @@ -350,6 +351,10 @@ next: } } +int server_get_number_of_desktop () +{ + return get_property32(server.root_win, server.atom._NET_NUMBER_OF_DESKTOPS, XA_CARDINAL); +} void get_desktops() { diff --git a/src/server.h b/src/server.h index 07876c6..e330846 100644 --- a/src/server.h +++ b/src/server.h @@ -130,7 +130,7 @@ typedef struct } Server_global; -Server_global server; +extern Server_global server; // freed memory diff --git a/src/tint.c b/src/tint.c index b3fd157..a238cf6 100644 --- a/src/tint.c +++ b/src/tint.c @@ -128,19 +128,14 @@ void init (int argc, char *argv[]) #ifdef HAVE_SN static int error_trap_depth = 0; -static void -error_trap_push (SnDisplay *display, - Display *xdisplay) +static void error_trap_push(SnDisplay *display, Display *xdisplay) { ++error_trap_depth; } -static void -error_trap_pop (SnDisplay *display, - Display *xdisplay) +static void error_trap_pop(SnDisplay *display, Display *xdisplay) { - if (error_trap_depth == 0) - { + if (error_trap_depth == 0) { fprintf(stderr, "Error trap underflow!\n"); return; } @@ -157,8 +152,7 @@ static void sigchld_handler(int sig) { ctx = (SnLauncherContext *) g_tree_lookup (server.pids, GINT_TO_POINTER (pid)); if (ctx == NULL) { fprintf(stderr, "Unknown child %d terminated!\n", pid); - } - else { + } else { g_tree_remove (server.pids, GINT_TO_POINTER (pid)); sn_launcher_context_complete (ctx); sn_launcher_context_unref (ctx); diff --git a/src/util/window.c b/src/util/window.c index ac2b400..eb686d9 100644 --- a/src/util/window.c +++ b/src/util/window.c @@ -197,11 +197,6 @@ int window_is_skip_taskbar (Window win) } -int server_get_number_of_desktop () -{ - return get_property32(server.root_win, server.atom._NET_NUMBER_OF_DESKTOPS, XA_CARDINAL); -} - GSList *server_get_name_of_desktop () { diff --git a/src/util/window.h b/src/util/window.h index fcf666f..0b4ded4 100644 --- a/src/util/window.h +++ b/src/util/window.h @@ -17,7 +17,6 @@ void set_active (Window win); void set_desktop (int desktop); void set_close (Window win); int server_get_current_desktop (); -int server_get_number_of_desktop (); GSList *server_get_name_of_desktop (); int window_is_iconified (Window win); int window_is_urgent (Window win);