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

wmaker: reorganisation of the control flow of the function 'findDock'

Changed the code to return as soon as the result is known because it makes
the code simpler to understand, which is good for maintainability.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-05-08 13:19:05 +02:00
committed by Carlos R. Mafra
parent 1c1909d5fe
commit 8fa16bef00

View File

@@ -2042,29 +2042,29 @@ static WDock *findDock(WScreen *scr, XEvent *event, int *icon_pos)
WDock *dock;
int i;
*icon_pos = -1;
dock = scr->dock;
if (dock != NULL) {
for (i = 0; i < dock->max_icons; i++) {
if (dock->icon_array[i]
&& dock->icon_array[i]->icon->core->window == event->xclient.window) {
if (dock->icon_array[i] &&
dock->icon_array[i]->icon->core->window == event->xclient.window) {
*icon_pos = i;
break;
return dock;
}
}
}
if (*icon_pos < 0 && (dock = scr->workspaces[scr->current_workspace]->clip) != NULL) {
dock = scr->workspaces[scr->current_workspace]->clip;
if (dock != NULL) {
for (i = 0; i < dock->max_icons; i++) {
if (dock->icon_array[i]
&& dock->icon_array[i]->icon->core->window == event->xclient.window) {
if (dock->icon_array[i] &&
dock->icon_array[i]->icon->core->window == event->xclient.window) {
*icon_pos = i;
break;
return dock;
}
}
}
if (*icon_pos >= 0)
return dock;
*icon_pos = -1;
return NULL;
}