1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-05 13:24:14 +01:00

usermenu.c Avoid compiler warnings

This patch includes some changes to avoid compiler warnings and
some code style.

Compiler warnings are:

- notifyClient, do not uses the menu argument. Including (void) menu.
- WUserMenuData, keyover: label is not used.
- configureUserMenu, params is not initialized.
- configureUserMenu, mentry is not initialized.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
This commit is contained in:
Rodolfo García Peñas (kix)
2015-08-25 09:41:52 +02:00
committed by Carlos R. Mafra
parent 7a2eb68aa4
commit 2fec5f9f28

View File

@@ -95,6 +95,8 @@ static void notifyClient(WMenu * menu, WMenuEntry * entry)
Window window; Window window;
int i; int i;
(void) menu;
window = scr->focused_window->client_win; window = scr->focused_window->client_win;
for (i = 0; i < data->key_no; i++) { for (i = 0; i < data->key_no; i++) {
@@ -135,13 +137,12 @@ static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
char *k, buf[MAX_SHORTCUT_LENGTH], *b; char *k, buf[MAX_SHORTCUT_LENGTH], *b;
int keycount, i, j, mod; int keycount, i, j, mod;
if (WMIsPLString(shortcut)) { if (WMIsPLString(shortcut))
keycount = 1; keycount = 1;
} else if (WMIsPLArray(shortcut)) { else if (WMIsPLArray(shortcut))
keycount = WMGetPropListItemCount(shortcut); keycount = WMGetPropListItemCount(shortcut);
} else { else
return NULL; return NULL;
}
data = wmalloc(sizeof(WUserMenuData)); data = wmalloc(sizeof(WUserMenuData));
if (!data) if (!data)
@@ -181,8 +182,6 @@ static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
j++; j++;
} }
keyover:
/* get key */ /* get key */
if (!j) { if (!j) {
puts("fatal j"); puts("fatal j");
@@ -190,6 +189,7 @@ static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
wfree(data); wfree(data);
return NULL; return NULL;
} }
data->key_no = j; data->key_no = j;
data->screen = scr; data->screen = scr;
@@ -200,7 +200,7 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
{ {
char *mtitle; char *mtitle;
WMenu *menu = NULL; WMenu *menu = NULL;
WMPropList *elem, *title, *command, *params; WMPropList *elem, *title, *command, *params = NULL;
int count, i; int count, i;
WUserMenuData *data; WUserMenuData *data;
@@ -219,18 +219,18 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
return NULL; return NULL;
mtitle = WMGetFromPLString(elem); mtitle = WMGetFromPLString(elem);
menu = wMenuCreateForApp(scr, mtitle, True); menu = wMenuCreateForApp(scr, mtitle, True);
for (i = 1; i < count; i++) { for (i = 1; i < count; i++) {
elem = WMGetFromPLArray(plum, i); elem = WMGetFromPLArray(plum, i);
if (WMIsPLArray(WMGetFromPLArray(elem, 1))) { if (WMIsPLArray(WMGetFromPLArray(elem, 1))) {
WMenu *submenu; WMenu *submenu;
WMenuEntry *mentry; WMenuEntry *mentry = NULL;
submenu = configureUserMenu(scr, elem); submenu = configureUserMenu(scr, elem);
if (submenu) if (submenu)
mentry = wMenuAddCallback(menu, submenu->frame->title, NULL, NULL); mentry = wMenuAddCallback(menu, submenu->frame->title, NULL, NULL);
wMenuEntrySetCascade(menu, mentry, submenu); wMenuEntrySetCascade(menu, mentry, submenu);
} else { } else {
int idx = 0; int idx = 0;
@@ -301,10 +301,12 @@ void wUserMenuRefreshInstances(WMenu * menu, WWindow * wwin)
break; break;
} }
} }
if (oldflag != menu->entries[i]->flags.enabled) if (oldflag != menu->entries[i]->flags.enabled)
paintflag = 1; paintflag = 1;
} }
} }
for (i = 0; i < menu->cascade_no; i++) { for (i = 0; i < menu->cascade_no; i++) {
if (!menu->cascades[i]->flags.brother) if (!menu->cascades[i]->flags.brother)
wUserMenuRefreshInstances(menu->cascades[i], wwin); wUserMenuRefreshInstances(menu->cascades[i], wwin);
@@ -326,14 +328,15 @@ static WMenu *readUserMenuFile(WScreen *scr, const char *file_name)
menu = configureUserMenu(scr, plum); menu = configureUserMenu(scr, plum);
WMReleasePropList(plum); WMReleasePropList(plum);
} }
return menu; return menu;
} }
WMenu *wUserMenuGet(WScreen *scr, WWindow *wwin) WMenu *wUserMenuGet(WScreen *scr, WWindow *wwin)
{ {
WMenu *menu = NULL; WMenu *menu = NULL;
char *path = NULL; char *tmp, *path = NULL;
char *tmp;
if (wwin && wwin->wm_instance && wwin->wm_class) { if (wwin && wwin->wm_instance && wwin->wm_class) {
int len = strlen(wwin->wm_instance) + strlen(wwin->wm_class) + 7; int len = strlen(wwin->wm_instance) + strlen(wwin->wm_class) + 7;
tmp = wmalloc(len); tmp = wmalloc(len);
@@ -347,6 +350,7 @@ WMenu *wUserMenuGet(WScreen * scr, WWindow * wwin)
menu = readUserMenuFile(scr, path); menu = readUserMenuFile(scr, path);
wfree(path); wfree(path);
} }
return menu; return menu;
} }