mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-23 22:52:34 +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:
committed by
Carlos R. Mafra
parent
7a2eb68aa4
commit
2fec5f9f28
@@ -87,7 +87,7 @@ typedef struct {
|
|||||||
int key_no;
|
int key_no;
|
||||||
} WUserMenuData;
|
} WUserMenuData;
|
||||||
|
|
||||||
static void notifyClient(WMenu * menu, WMenuEntry * entry)
|
static void notifyClient(WMenu *menu, WMenuEntry *entry)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
WUserMenuData *data = entry->clientdata;
|
WUserMenuData *data = entry->clientdata;
|
||||||
@@ -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++) {
|
||||||
@@ -128,20 +130,19 @@ static void removeUserMenudata(void *menudata)
|
|||||||
wfree(data);
|
wfree(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
|
static WUserMenuData *convertShortcuts(WScreen *scr, WMPropList *shortcut)
|
||||||
{
|
{
|
||||||
WUserMenuData *data;
|
WUserMenuData *data;
|
||||||
KeySym ksym;
|
KeySym ksym;
|
||||||
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)
|
||||||
@@ -160,7 +161,7 @@ static WUserMenuData *convertShortcuts(WScreen * scr, WMPropList * shortcut)
|
|||||||
else
|
else
|
||||||
wstrlcpy(buf, WMGetFromPLString(shortcut), MAX_SHORTCUT_LENGTH);
|
wstrlcpy(buf, WMGetFromPLString(shortcut), MAX_SHORTCUT_LENGTH);
|
||||||
|
|
||||||
b = (char *)buf;
|
b = (char *) buf;
|
||||||
|
|
||||||
while ((k = strchr(b, '+')) != NULL) {
|
while ((k = strchr(b, '+')) != NULL) {
|
||||||
*k = 0;
|
*k = 0;
|
||||||
@@ -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,17 +189,18 @@ 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;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
|
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;
|
||||||
@@ -277,7 +277,7 @@ static WMenu *configureUserMenu(WScreen * scr, WMPropList * plum)
|
|||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wUserMenuRefreshInstances(WMenu * menu, WWindow * wwin)
|
void wUserMenuRefreshInstances(WMenu *menu, WWindow *wwin)
|
||||||
{
|
{
|
||||||
int i, j, count, paintflag;
|
int i, j, count, paintflag;
|
||||||
|
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user