From 18059fb1c76ff5c06ebc9c471114953959558b1f Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Thu, 10 Oct 2013 23:55:55 +0200 Subject: [PATCH] wmaker: Moved definition of global variable 'wKeyBindings' to header Multiple declaration of global variables in local source files is a dangerous idea. --- src/cycling.c | 2 -- src/defaults.c | 2 -- src/event.c | 2 -- src/keybind.h | 6 ++++++ src/startup.c | 3 --- src/window.c | 2 -- src/winmenu.c | 3 --- src/workspace.c | 1 - 8 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/cycling.c b/src/cycling.c index a1816dd6..7a9afc95 100644 --- a/src/cycling.c +++ b/src/cycling.c @@ -38,8 +38,6 @@ #include "xinerama.h" #include "switchpanel.h" -/* Globals */ -extern WShortKey wKeyBindings[WKBD_LAST]; static void raiseWindow(WSwitchPanel * swpanel, WWindow * wwin) { diff --git a/src/defaults.c b/src/defaults.c index 1eaa3cf2..0fb2bbce 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -71,8 +71,6 @@ #define GLOBAL_DEFAULTS_SUBDIR "WindowMaker" #endif -/***** Global *****/ -extern WShortKey wKeyBindings[WKBD_LAST]; typedef struct _WDefaultEntry WDefaultEntry; typedef int (WDECallbackConvert) (WScreen *scr, WDefaultEntry *entry, WMPropList *plvalue, void *addr, void **tdata); diff --git a/src/event.c b/src/event.c index 31a82a30..6a34892b 100644 --- a/src/event.c +++ b/src/event.c @@ -76,8 +76,6 @@ #include "winmenu.h" #include "switchmenu.h" -/******** Global Variables **********/ -extern WShortKey wKeyBindings[WKBD_LAST]; #define MOD_MASK wPreferences.modifier_mask diff --git a/src/keybind.h b/src/keybind.h index bf02965c..6576a16e 100644 --- a/src/keybind.h +++ b/src/keybind.h @@ -128,6 +128,12 @@ typedef struct WShortKey { KeyCode keycode; } WShortKey; +/* ---[ Global Variables ]------------------------------------------------ */ + +extern WShortKey wKeyBindings[WKBD_LAST]; + +/* ---[ Functions ]------------------------------------------------------- */ + void wKeyboardInitialize(void); #endif /* WMKEYBIND_H */ diff --git a/src/startup.c b/src/startup.c index 915e0655..90154d82 100644 --- a/src/startup.c +++ b/src/startup.c @@ -84,9 +84,6 @@ # define SA_NODEFER 0 #endif -/****** Global Variables ******/ -extern WShortKey wKeyBindings[WKBD_LAST]; - /***** Local *****/ static WScreen **wScreen = NULL; static unsigned int _NumLockMask = 0; diff --git a/src/window.c b/src/window.c index 7b3cda2c..df7e6ca8 100644 --- a/src/window.c +++ b/src/window.c @@ -72,8 +72,6 @@ #define MOD_MASK wPreferences.modifier_mask -/****** Global Variables ******/ -extern WShortKey wKeyBindings[WKBD_LAST]; /***** Local Stuff *****/ static WWindowState *windowState = NULL; diff --git a/src/winmenu.c b/src/winmenu.c index b4773a69..82017477 100644 --- a/src/winmenu.c +++ b/src/winmenu.c @@ -68,9 +68,6 @@ #define WO_OMNIPRESENT 2 #define WO_ENTRIES 3 -/**** Global data ***/ -extern WShortKey wKeyBindings[WKBD_LAST]; - static void updateOptionsMenu(WMenu * menu, WWindow * wwin); diff --git a/src/workspace.c b/src/workspace.c index 9455691c..d02e9f7a 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -59,7 +59,6 @@ #define MAX_SHORTCUT_LENGTH 32 #define WORKSPACE_NAME_DISPLAY_PADDING 32 -extern WShortKey wKeyBindings[WKBD_LAST]; static WMPropList *dWorkspaces = NULL; static WMPropList *dClip, *dName; -- 2.11.4.GIT