mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +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:
committed by
Carlos R. Mafra
parent
0a55facac0
commit
9831e3f72a
@@ -1304,8 +1304,11 @@ void ScreenCapture(WScreen *scr, int mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
WWindow *wwin;
|
||||||
|
XImage *pimg;
|
||||||
|
|
||||||
case PRINT_WINDOW:
|
case PRINT_WINDOW:
|
||||||
WWindow *wwin = scr->focused_window;
|
wwin = scr->focused_window;
|
||||||
if (wwin && !wwin->flags.shaded) {
|
if (wwin && !wwin->flags.shaded) {
|
||||||
/*
|
/*
|
||||||
* check if hint WM_TAKE_FOCUS is set, if it's the case
|
* check if hint WM_TAKE_FOCUS is set, if it's the case
|
||||||
@@ -1316,7 +1319,6 @@ void ScreenCapture(WScreen *scr, int mode)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* we will only capture the visible window part */
|
/* we will only capture the visible window part */
|
||||||
XImage *pimg;
|
|
||||||
int x_crop = 0;
|
int x_crop = 0;
|
||||||
int y_crop = 0;
|
int y_crop = 0;
|
||||||
int w_crop = wwin->client.width;
|
int w_crop = wwin->client.width;
|
||||||
@@ -1345,8 +1347,6 @@ void ScreenCapture(WScreen *scr, int mode)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PRINT_PARTIAL:
|
case PRINT_PARTIAL:
|
||||||
XImage *pimg;
|
|
||||||
|
|
||||||
pimg = imageCaptureArea(scr);
|
pimg = imageCaptureArea(scr);
|
||||||
if (pimg) {
|
if (pimg) {
|
||||||
img = RCreateImageFromXImage(scr->rcontext, pimg, None);
|
img = RCreateImageFromXImage(scr->rcontext, pimg, None);
|
||||||
|
|||||||
@@ -492,6 +492,9 @@ static void handle_event(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
|
|||||||
modifiers = ev.xkey.state & w_global.shortcut.modifiers_mask;
|
modifiers = ev.xkey.state & w_global.shortcut.modifiers_mask;
|
||||||
|
|
||||||
switch (ev.type) {
|
switch (ev.type) {
|
||||||
|
WMScreen *wmscr;
|
||||||
|
WMColor *black;
|
||||||
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
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 &&
|
||||||
@@ -531,8 +534,8 @@ static void handle_event(WWorkspaceMap *wsmap, W_WorkspaceMap *wsmap_array)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FocusIn:
|
case FocusIn:
|
||||||
WMScreen *wmscr = wsmap->scr->wmscreen;
|
wmscr = wsmap->scr->wmscreen;
|
||||||
WMColor *black = WMBlackColor(wmscr);
|
black = WMBlackColor(wmscr);
|
||||||
const char *text = "?";
|
const char *text = "?";
|
||||||
WMFont *bold = WMBoldSystemFontOfSize(wmscr, wsmap->mini_workspace_width / 3);
|
WMFont *bold = WMBoldSystemFontOfSize(wmscr, wsmap->mini_workspace_width / 3);
|
||||||
int x = (wsmap->mini_workspace_width / 2) - (WMWidthOfString(bold, text, strlen(text)) / 2);
|
int x = (wsmap->mini_workspace_width / 2) - (WMWidthOfString(bold, text, strlen(text)) / 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user