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

Made ARROWLESS_KBD a preference.

Replace the ARROWLESS_KBD #define with the ViKeyMenus preference.

When ViKeyMenus is TRUE, users can type h/j/k/l to scroll around menus.

Since ARROWLESS_KBD was previously undefined by default, ViKeyMenus is
FALSE by default.
This commit is contained in:
Iain Patterson
2012-02-10 11:02:25 +00:00
committed by Carlos R. Mafra
parent 8f724f65aa
commit 8d7c725b7b
5 changed files with 34 additions and 18 deletions

View File

@@ -41,6 +41,7 @@ typedef struct _Panel {
WMFrame *optF;
WMButton *autoB;
WMButton *autoC;
WMButton *wrapB;
} _Panel;
@@ -64,6 +65,8 @@ static void showData(_Panel * panel)
WMSetButtonSelected(panel->wrapB, GetBoolForKey("WrapMenus"));
WMSetButtonSelected(panel->autoB, GetBoolForKey("ScrollableMenus"));
WMSetButtonSelected(panel->autoC, GetBoolForKey("ViKeyMenus"));
}
static void storeData(_Panel * panel)
@@ -80,6 +83,7 @@ static void storeData(_Panel * panel)
SetBoolForKey(WMGetButtonSelected(panel->wrapB), "WrapMenus");
SetBoolForKey(WMGetButtonSelected(panel->autoB), "ScrollableMenus");
SetBoolForKey(WMGetButtonSelected(panel->autoC), "ViKeyMenus");
}
static void createPanel(Panel * p)
@@ -184,8 +188,8 @@ static void createPanel(Panel * p)
/***************** Options ****************/
panel->optF = WMCreateFrame(panel->box);
WMResizeWidget(panel->optF, 475, 80);
WMMoveWidget(panel->optF, 25, 130);
WMResizeWidget(panel->optF, 475, 96);
WMMoveWidget(panel->optF, 25, 120);
panel->wrapB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->wrapB, 440, 32);
@@ -196,8 +200,12 @@ static void createPanel(Panel * p)
panel->autoB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->autoB, 440, 32);
WMMoveWidget(panel->autoB, 25, 45);
WMMoveWidget(panel->autoB, 25, 34);
WMSetButtonText(panel->autoB, _("Scroll off-screen menus when pointer is moved over them."));
panel->autoC = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->autoC, 440, 32);
WMMoveWidget(panel->autoC, 25, 58);
WMSetButtonText(panel->autoC, _("Use h/j/k/l keys to select menu options."));
WMMapSubwidgets(panel->optF);

View File

@@ -324,6 +324,7 @@ typedef struct WPreferences {
char opaque_move_resize_keyboard; /* update window position during move,resize with keyboard */
char wrap_menus; /* wrap menus at edge of screen */
char scrollable_menus; /* let them be scrolled */
char vi_key_menus; /* use h/j/k/l to select */
char align_menus; /* align menu with their parents */
char use_saveunders; /* turn on SaveUnders for menus, icons etc. */
char no_window_over_dock;

View File

@@ -391,6 +391,8 @@ WDefaultEntry optionList[] = {
&wPreferences.dblclick_time, getInt, setDoubleClick, NULL, NULL},
{"AlignSubmenus", "NO", NULL,
&wPreferences.align_menus, getBool, NULL, NULL, NULL},
{"ViKeyMenus", "NO", NULL,
&wPreferences.vi_key_menus, getBool, NULL, NULL, NULL},
{"OpenTransientOnOwnerWorkspace", "NO", NULL,
&wPreferences.open_transients_with_parent, getBool, NULL, NULL, NULL},
{"WindowPlacement", "auto", sePlacements,

View File

@@ -892,6 +892,26 @@ static int keyboardMenu(WMenu * menu)
switch (event.type) {
case KeyPress:
ksym = XLookupKeysym(&event.xkey, 0);
if (wPreferences.vi_key_menus) {
switch (ksym) {
case XK_h:
ksym = XK_Left;
break;
case XK_j:
ksym = XK_Down;
break;
case XK_k:
ksym = XK_Up;
break;
case XK_l:
ksym = XK_Right;
break;
}
}
switch (ksym) {
case XK_Escape:
done = 1;
@@ -914,9 +934,6 @@ static int keyboardMenu(WMenu * menu)
break;
case XK_Up:
#ifdef ARROWLESS_KBD
case XK_k:
#endif
#ifdef XK_KP_Up
case XK_KP_Up:
#endif
@@ -928,9 +945,6 @@ static int keyboardMenu(WMenu * menu)
break;
case XK_Down:
#ifdef ARROWLESS_KBD
case XK_j:
#endif
#ifdef XK_KP_Down
case XK_KP_Down:
#endif
@@ -944,9 +958,6 @@ static int keyboardMenu(WMenu * menu)
break;
case XK_Right:
#ifdef ARROWLESS_KBD
case XK_l:
#endif
#ifdef XK_KP_Right
case XK_KP_Right:
#endif
@@ -970,9 +981,6 @@ static int keyboardMenu(WMenu * menu)
break;
case XK_Left:
#ifdef ARROWLESS_KBD
case XK_h:
#endif
#ifdef XK_KP_Left
case XK_KP_Left:
#endif

View File

@@ -348,9 +348,6 @@
#define KEY_CONTROL_WINDOW_WEIGHT 1
/* if your keyboard don't have arrow keys */
#undef ARROWLESS_KBD
/* don't put titles in miniwindows */
#undef NO_MINIWINDOW_TITLES