Merge branch 'NetHack-3.6.2'
This commit is contained in:
@@ -220,6 +220,11 @@ Qt: add Qt5 specific hints file for linux and Mac OS X (Ray Chason)
|
||||
Qt: enable compiling Qt5 on Windows (Ray Chason)
|
||||
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
|
||||
X11: handle paged menu control keys
|
||||
X11: remember perm_invent window geometry
|
||||
|
||||
|
||||
General New Features
|
||||
|
||||
@@ -135,6 +135,8 @@ typedef struct x11_mi {
|
||||
boolean preselected; /* in advance? */
|
||||
char selector; /* Char used to select this entry. */
|
||||
char gselector; /* Group selector. */
|
||||
Widget w;
|
||||
int window;
|
||||
} x11_menu_item;
|
||||
|
||||
struct menu {
|
||||
@@ -143,8 +145,6 @@ struct menu {
|
||||
const char *query; /* Query string. */
|
||||
const char *gacc; /* Group accelerators. */
|
||||
int count; /* Number of strings. */
|
||||
String *list_pointer; /* String list. */
|
||||
Boolean *sensitive; /* Active list. */
|
||||
char curr_selector; /* Next keyboard accelerator to assign, */
|
||||
/* if 0, then we're out. */
|
||||
};
|
||||
@@ -153,18 +153,24 @@ struct menu_info_t {
|
||||
struct menu curr_menu; /* Menu being displayed. */
|
||||
struct menu new_menu; /* New menu being built. */
|
||||
|
||||
boolean nh_colors_inited;
|
||||
XColor nh_colors[CLR_MAX];
|
||||
|
||||
XFontStruct *fs; /* Font for the window. */
|
||||
long menu_count; /* number entered by user */
|
||||
Dimension line_height; /* Total height of a line of text. */
|
||||
Dimension internal_height; /* Internal height between widget & border */
|
||||
Dimension internal_width; /* Internal width between widget & border */
|
||||
short how; /* Menu mode PICK_NONE, PICK_ONE, PICK_ANY */
|
||||
boolean valid_widgets; /* TRUE if widgets have been created. */
|
||||
boolean is_menu; /* Has been confirmed to being a menu window. */
|
||||
boolean is_active; /* TRUE when waiting for user input. */
|
||||
boolean is_up; /* TRUE when window is popped-up. */
|
||||
boolean cancelled; /* Menu has been explicitly cancelled. */
|
||||
boolean counting; /* true when menu_count has a valid value */
|
||||
boolean permi;
|
||||
|
||||
int permi_x, permi_y; /* perm_invent window x,y */
|
||||
int permi_w, permi_h; /* perm_invent window wid, hei */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -290,6 +296,7 @@ E void FDECL(positionpopup, (Widget, BOOLEAN_P));
|
||||
/* ### winX.c ### */
|
||||
E struct xwindow *FDECL(find_widget, (Widget));
|
||||
E Boolean FDECL(nhApproxColor, (Screen *, Colormap, char *, XColor *));
|
||||
E void FDECL(get_widget_window_geometry, (Widget, int *, int *, int *, int *));
|
||||
E Dimension FDECL(nhFontHeight, (Widget));
|
||||
E char FDECL(key_event_to_char, (XKeyEvent *));
|
||||
E void FDECL(msgkey, (Widget, XtPointer, XEvent *));
|
||||
|
||||
@@ -587,7 +587,7 @@ NetHackQtMainWindow::NetHackQtMainWindow(NetHackQtKeyBuffer& ks) :
|
||||
{ magic, "Offer", 3, dosacrifice},
|
||||
{ magic, "Pray", 3, dopray},
|
||||
{ magic, 0, 3},
|
||||
{ magic, "Teleport", 3, dotele},
|
||||
{ magic, "Teleport", 3, dotelecmd},
|
||||
{ magic, "Monster action", 3, domonability},
|
||||
{ magic, "Turn undead", 3, doturn},
|
||||
|
||||
|
||||
@@ -432,6 +432,58 @@ XtPointer *closure_ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Ask the WM for window frame size */
|
||||
void
|
||||
get_window_frame_extents(w, top, bottom, left, right)
|
||||
Widget w;
|
||||
long *top, *bottom, *left, *right;
|
||||
{
|
||||
XEvent event;
|
||||
Display *dpy = XtDisplay(w);
|
||||
Window win = XtWindow(w);
|
||||
Atom prop, retprop;
|
||||
int retfmt;
|
||||
unsigned long nitems;
|
||||
unsigned long nbytes;
|
||||
unsigned char *data = 0;
|
||||
long *extents;
|
||||
|
||||
prop = XInternAtom(dpy, "_NET_FRAME_EXTENTS", True);
|
||||
|
||||
while (XGetWindowProperty(dpy, win, prop,
|
||||
0, 4, False, AnyPropertyType,
|
||||
&retprop, &retfmt,
|
||||
&nitems, &nbytes, &data) != Success
|
||||
|| nitems != 4 || nbytes != 0)
|
||||
{
|
||||
XNextEvent(dpy, &event);
|
||||
}
|
||||
|
||||
extents = (long *) data;
|
||||
|
||||
*left = extents[0];
|
||||
*right = extents[1];
|
||||
*top = extents[2];
|
||||
*bottom = extents[3];
|
||||
}
|
||||
|
||||
void
|
||||
get_widget_window_geometry(w, x,y, width, height)
|
||||
Widget w;
|
||||
int *x, *y, *width, *height;
|
||||
{
|
||||
long top, bottom, left, right;
|
||||
Arg args[5];
|
||||
XtSetArg(args[0], nhStr(XtNx), x);
|
||||
XtSetArg(args[1], nhStr(XtNy), y);
|
||||
XtSetArg(args[2], nhStr(XtNwidth), width);
|
||||
XtSetArg(args[3], nhStr(XtNheight), height);
|
||||
XtGetValues(w, args, 4);
|
||||
get_window_frame_extents(w, &top, &bottom, &left, &right);
|
||||
*x -= left;
|
||||
*y -= top;
|
||||
}
|
||||
|
||||
#ifdef TEXTCOLOR
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
@@ -2472,19 +2524,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 */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user