Skip to content

Commit

Permalink
fixed ESC key
Browse files Browse the repository at this point in the history
  • Loading branch information
phillbush committed Jan 9, 2021
1 parent e14d88b commit 06d6acd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CHANGELOG

4.5.4 (2021-01-09)
• Fixed ESC key.

4.5.3 (2021-01-09)
• Fixed missing lines in xmenu.c.

Expand Down
24 changes: 11 additions & 13 deletions xmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1315,37 +1315,37 @@ run(struct Menu *currmenu)
ksym = XK_ISO_Left_Tab;

/* cycle through menu */
item = NULL;
select = NULL;
ksym = normalizeksym(ksym);
switch (ksym) {
case XK_Home:
item = itemcycle(currmenu, ITEMFIRST);
select = itemcycle(currmenu, ITEMFIRST);
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break;
case XK_End:
item = itemcycle(currmenu, ITEMLAST);
select = itemcycle(currmenu, ITEMLAST);
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break;
case XK_ISO_Left_Tab:
if (*text) {
item = matchitem(currmenu, text, -1);
select = matchitem(currmenu, text, -1);
action = ACTION_SELECT | ACTION_DRAW;
break;
}
/* FALLTHROUGH */
case XK_Up:
item = itemcycle(currmenu, ITEMPREV);
select = itemcycle(currmenu, ITEMPREV);
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break;
case XK_Tab:
if (*text) {
item = matchitem(currmenu, text, 1);
select = matchitem(currmenu, text, 1);
action = ACTION_SELECT | ACTION_DRAW;
break;
}
/* FALLTHROUGH */
case XK_Down:
item = itemcycle(currmenu, ITEMNEXT);
select = itemcycle(currmenu, ITEMNEXT);
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break;
case XK_1: case XK_2: case XK_3: case XK_4: case XK_5: case XK_6: case XK_7: case XK_8: case XK_9:
Expand All @@ -1355,22 +1355,21 @@ run(struct Menu *currmenu)
currmenu->selected = item;
item = itemcycle(currmenu, ITEMNEXT);
}
select = item;
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break;
case XK_Return: case XK_Right:
if (currmenu->selected) {
item = currmenu->selected;
goto enteritem;
}
action = ACTION_SELECT | ACTION_DRAW;
break;
case XK_Escape: case XK_Left:
if (currmenu->parent) {
item = currmenu->parent->selected;
select = currmenu->parent->selected;
currmenu = currmenu->parent;
action = ACTION_CLEAR | ACTION_MAP;
action = ACTION_CLEAR | ACTION_MAP | ACTION_SELECT | ACTION_DRAW;
}
action = ACTION_SELECT | ACTION_DRAW;
break;
case XK_BackSpace: case XK_Clear: case XK_Delete:
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
Expand All @@ -1381,14 +1380,13 @@ run(struct Menu *currmenu)
break;
for (i = 0; i < 2; i++) {
append(text, buf, sizeof text, len);
if ((item = matchitem(currmenu, text, 0)))
if ((select = matchitem(currmenu, text, 0)))
break;
text[0] = '\0';
}
action = ACTION_SELECT | ACTION_DRAW;
break;
}
select = item;
break;
case LeaveNotify:
previtem = NULL;
Expand Down

0 comments on commit 06d6acd

Please sign in to comment.