1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-30 10:22:34 +01:00

Move declarations to beginning of switch statements

Several variable declarations were recently added immediately after
labels, but this causes compile errors in GCC versions prior to 11,
e.g.,

    wsmap.c: In function ‘handle_event’:
    wsmap.c:534:4: error: a label can only be part of a statement and a declaration is not a statement
      534 |    WMScreen *wmscr = wsmap->scr->wmscreen;
          |    ^~~~~~~~

We move these declarations to the top of the corresponding switch
statements so that Window Maker can compile on these older versions of
GCC.
This commit is contained in:
Doug Torrance
2023-03-13 10:49:36 -04:00
committed by Carlos R. Mafra
parent 0a55facac0
commit 9831e3f72a
2 changed files with 9 additions and 6 deletions

View File

@@ -492,6 +492,9 @@ static void handle_event(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
modifiers = ev.xkey.state & w_global.shortcut.modifiers_mask;
switch (ev.type) {
WMScreen *wmscr;
WMColor *black;
case KeyPress:
if (ev.xkey.keycode == escKey || (wKeyBindings[WKBD_WORKSPACEMAP].keycode != 0 &&
wKeyBindings[WKBD_WORKSPACEMAP].keycode == ev.xkey.keycode &&
@@ -531,8 +534,8 @@ static void handle_event(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
break;
case FocusIn:
WMScreen *wmscr = wsmap->scr->wmscreen;
WMColor *black = WMBlackColor(wmscr);
wmscr = wsmap->scr->wmscreen;
black = WMBlackColor(wmscr);
const char *text = "?";
WMFont *bold = WMBoldSystemFontOfSize(wmscr, wsmap->mini_workspace_width / 3);
int x = (wsmap->mini_workspace_width / 2) - (WMWidthOfString(bold, text, strlen(text)) / 2);