1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-21 05:18:06 +01:00

wmaker: moved the variable 'process_workspacemap_event' to the global namespace

The definition in the local header was not correct; it works because gcc is
tolerant to this kind of errors but other compilers are not. The
declaration was creating a local variable in each file that call header,
and because it is not static gcc's linker will merge them. Other compilers
will at best complain for duplicate symbol, and at worst silently duplicate
the variable so it will not work as expected.

The variable is now moved to the existing structure meant for global
variables, so now the code is really clear about using a global variable
instead of a static/local one.

Took opportunity to add some missing 'static' attributes to some variables.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-12-07 17:10:15 +01:00
committed by Carlos R. Mafra
parent 41745d98d4
commit ad84a2dc8f
4 changed files with 15 additions and 10 deletions

View File

@@ -522,6 +522,13 @@ extern struct wmaker_global_variables {
*/ */
Bool ignore_workspace_change; Bool ignore_workspace_change;
/*
* Process WorkspaceMap Event:
* this variable is set when the Workspace Map window is being displayed,
* it is mainly used to avoid re-opening another one at the same time
*/
Bool process_workspacemap_event;
#ifdef HAVE_INOTIFY #ifdef HAVE_INOTIFY
struct { struct {
int fd_event_queue; /* Inotify's queue file descriptor */ int fd_event_queue; /* Inotify's queue file descriptor */

View File

@@ -476,7 +476,7 @@ void wWorkspaceForceChange(WScreen * scr, int workspace)
if (workspace >= MAX_WORKSPACES || workspace < 0) if (workspace >= MAX_WORKSPACES || workspace < 0)
return; return;
if (!wPreferences.disable_workspace_pager && !process_workspacemap_event) if (!wPreferences.disable_workspace_pager && !w_global.process_workspacemap_event)
wWorkspaceMapUpdate(scr); wWorkspaceMapUpdate(scr);
SendHelperMessage(scr, 'C', workspace + 1, NULL); SendHelperMessage(scr, 'C', workspace + 1, NULL);

View File

@@ -46,9 +46,9 @@ static const int mini_workspace_per_line = 5;
* will be 0 for workspaces number 0 to 9 * will be 0 for workspaces number 0 to 9
* 1 for workspaces number 10 -> 19 * 1 for workspaces number 10 -> 19
*/ */
int wsmap_bulk_index; static int wsmap_bulk_index;
WMPixmap *frame_bg_focused; static WMPixmap *frame_bg_focused;
WMPixmap *frame_bg_unfocused; static WMPixmap *frame_bg_unfocused;
typedef struct { typedef struct {
WScreen *scr; WScreen *scr;
@@ -147,7 +147,7 @@ static void selected_workspace_callback(WMWidget *w, void *data)
int workspace_id = atoi(WMGetButtonText(click_button)); int workspace_id = atoi(WMGetButtonText(click_button));
wWorkspaceChange(wsmap->scr, workspace_id); wWorkspaceChange(wsmap->scr, workspace_id);
process_workspacemap_event = False; w_global.process_workspacemap_event = False;
} }
} }
@@ -482,8 +482,8 @@ static void handle_event(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
ButtonMotionMask | ButtonReleaseMask | ButtonPressMask, ButtonMotionMask | ButtonReleaseMask | ButtonPressMask,
GrabModeAsync, GrabModeAsync, WMWidgetXID(wsmap->win), None, CurrentTime); GrabModeAsync, GrabModeAsync, WMWidgetXID(wsmap->win), None, CurrentTime);
process_workspacemap_event = True; w_global.process_workspacemap_event = True;
while (process_workspacemap_event) { while (w_global.process_workspacemap_event) {
WMMaskEvent(dpy, KeyPressMask | KeyReleaseMask | ExposureMask WMMaskEvent(dpy, KeyPressMask | KeyReleaseMask | ExposureMask
| PointerMotionMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask, &ev); | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask, &ev);
@@ -496,7 +496,7 @@ static void handle_event(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
if (ev.xkey.keycode == escKey || (wKeyBindings[WKBD_WORKSPACEMAP].keycode != 0 && if (ev.xkey.keycode == escKey || (wKeyBindings[WKBD_WORKSPACEMAP].keycode != 0 &&
wKeyBindings[WKBD_WORKSPACEMAP].keycode == ev.xkey.keycode && wKeyBindings[WKBD_WORKSPACEMAP].keycode == ev.xkey.keycode &&
wKeyBindings[WKBD_WORKSPACEMAP].modifier == modifiers)) { wKeyBindings[WKBD_WORKSPACEMAP].modifier == modifiers)) {
process_workspacemap_event = False; w_global.process_workspacemap_event = False;
} else { } else {
KeySym ks; KeySym ks;
int bulk_id; int bulk_id;

View File

@@ -20,8 +20,6 @@
#ifndef WSMAP_H #ifndef WSMAP_H
#define WSMAP_H #define WSMAP_H
Bool process_workspacemap_event;
void wWorkspaceMapUpdate(WScreen *scr); void wWorkspaceMapUpdate(WScreen *scr);
void StartWorkspaceMap(WScreen *scr); void StartWorkspaceMap(WScreen *scr);