X11: Mouse wheel scrolling in menus
This commit is contained in:
@@ -222,6 +222,7 @@ Qt: entering extended commands, hide non-matching ones
|
||||
Qt: remember tile and font size
|
||||
X11: implement menucolors and allow menus to obey inverse attribute
|
||||
X11: make key translations work with menus on Linux
|
||||
X11: allow mouse wheel scrolling to work in menus by default
|
||||
|
||||
|
||||
General New Features
|
||||
|
||||
@@ -2472,19 +2472,12 @@ Cardinal *num_params;
|
||||
|
||||
direction = atoi(params[0]);
|
||||
|
||||
horiz_sb = XtNameToWidget(viewport, "*horizontal");
|
||||
vert_sb = XtNameToWidget(viewport, "*vertical");
|
||||
|
||||
if (!horiz_sb && !vert_sb) {
|
||||
/* Perhaps the widget enclosing this has scrollbars (could use while)
|
||||
*/
|
||||
Widget parent = XtParent(viewport);
|
||||
|
||||
if (parent) {
|
||||
horiz_sb = XtNameToWidget(parent, "horizontal");
|
||||
vert_sb = XtNameToWidget(parent, "vertical");
|
||||
}
|
||||
}
|
||||
Widget scrollw = viewport;
|
||||
do {
|
||||
horiz_sb = XtNameToWidget(scrollw, "*horizontal");
|
||||
vert_sb = XtNameToWidget(scrollw, "*vertical");
|
||||
scrollw = XtParent(scrollw);
|
||||
} while (!horiz_sb && !vert_sb && scrollw);
|
||||
|
||||
#define H_DELTA 0.25 /* distance of horiz shift */
|
||||
/* vert shift is half of curr distance */
|
||||
|
||||
@@ -67,8 +67,14 @@ static const char menu_translations[] = "#override\n\
|
||||
<Key>Right: scroll(6)\n\
|
||||
<Key>Up: scroll(8)\n\
|
||||
<Key>Down: scroll(2)\n\
|
||||
<Btn4Down>: scroll(8)\n\
|
||||
<Btn5Down>: scroll(2)\n\
|
||||
<Key>: menu_key()";
|
||||
|
||||
static const char menu_entry_translations[] = "#override\n\
|
||||
<Btn4Down>: scroll(8)\n\
|
||||
<Btn5Down>: scroll(2)";
|
||||
|
||||
/*
|
||||
* Menu callback.
|
||||
*/
|
||||
@@ -817,6 +823,9 @@ struct menu *curr_menu;
|
||||
XtSetArg(args[num_args], nhStr(XtNtop), XtChainTop); num_args++;
|
||||
}
|
||||
|
||||
XtSetArg(args[num_args], XtNtranslations,
|
||||
XtParseTranslationTable(menu_entry_translations)); num_args++;
|
||||
|
||||
menulineidx++;
|
||||
Sprintf(tmpbuf, "menuline_%s", (canpick) ? "command" : "label");
|
||||
curr->w = linewidget
|
||||
|
||||
Reference in New Issue
Block a user