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

wmaker: removed variable 'done' to prepare return status in 'wNETWMProcessClientMessage'

Using a variable to store the return value that will be used later is not a
good idea, because it forces to track everywhere in the function when
needing to work on the function.

This patch removes the variables and places explicit return if each case,
so on first look it is clear where the code stops.

It also fixes a bug where the function would handle an event but still
returns False (meaning the event was not treated), whose root cause was
coming from the complexity brought by the variable.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-11-29 16:35:26 +01:00
committed by Carlos R. Mafra
parent 243a1924fa
commit 3dea732ccb

View File

@@ -1472,7 +1472,6 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
{
WScreen *scr;
WWindow *wwin;
Bool done = True;
#ifdef DEBUG_WMSPEC
wmessage("processClientMessage type %s", XGetAtomName(dpy, event->message_type));
@@ -1483,6 +1482,8 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
/* generic client messages */
if (event->message_type == net_current_desktop) {
wWorkspaceChange(scr, event->data.l[0]);
return True;
} else if (event->message_type == net_number_of_desktops) {
long value;
@@ -1503,17 +1504,17 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
if (rebuild)
updateWorkspaceCount(scr);
}
return True;
} else if (event->message_type == net_showing_desktop) {
wNETWMShowingDesktop(scr, event->data.l[0]);
return True;
} else if (event->message_type == net_desktop_names) {
handleDesktopNames(scr);
} else {
done = False;
}
if (done)
return True;
}
}
/* window specific client messages */
@@ -1535,12 +1536,16 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
wNETWMShowingDesktop(scr, False);
wMakeWindowVisible(wwin);
}
return True;
} else if (event->message_type == net_close_window) {
if (!WFLAGP(wwin, no_closable)) {
if (wwin->protocols.DELETE_WINDOW)
wClientSendProtocol(wwin, w_global.atom.wm.delete_window,
w_global.timestamp.last_event);
}
return True;
} else if (event->message_type == net_wm_state) {
int maximized = wwin->flags.maximized;
long set = event->data.l[0];
@@ -1563,10 +1568,15 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
}
}
updateStateHint(wwin, False, False);
return True;
} else if (event->message_type == net_wm_handled_icons || event->message_type == net_wm_icon_geometry) {
updateNetIconInfo(wwin);
return True;
} else if (event->message_type == net_wm_desktop) {
long desktop = event->data.l[0];
if (desktop == -1) {
wWindowSetOmnipresent(wwin, True);
} else {
@@ -1574,11 +1584,10 @@ Bool wNETWMProcessClientMessage(XClientMessageEvent *event)
wWindowSetOmnipresent(wwin, False);
wWindowChangeWorkspace(wwin, desktop);
}
} else {
done = False;
return True;
}
return done;
return False;
}
void wNETWMCheckClientHintChange(WWindow *wwin, XPropertyEvent *event)