For menu items, set up pixmap and then manage
The widget is created with a label but not a pixmap, and then a pixmap is set up for display. If the label is already realized and managed, it will not resize when the pixmap is set up. This causes problems when the inventory window is updated: unlike other menus, the parent Form widget is already realized. The fix is to create the item widget in an unmanaged state (XtCreateWidget), set up the pixmap (X11_wrap_widget and X11_set_attrs), and then manage it (XtManageChild).
This commit is contained in:
committed by
Pasi Kallinen
parent
9179d5d960
commit
392142d322
+9
-5
@@ -1366,13 +1366,17 @@ menu_create_entries(struct xwindow *wp, struct menu *curr_menu)
|
||||
|
||||
menulineidx++;
|
||||
Sprintf(tmpbuf, "menuline_%s", (canpick) ? "command" : "label");
|
||||
curr->w = linewidget = XtCreateManagedWidget(tmpbuf,
|
||||
canpick
|
||||
? commandWidgetClass
|
||||
: labelWidgetClass,
|
||||
wp->w, args, num_args);
|
||||
/* Need to create the widget unmanaged, set up the pixmap, and then
|
||||
manage it, or else items in the inventory window get the wrong
|
||||
size */
|
||||
curr->w = linewidget = XtCreateWidget(tmpbuf,
|
||||
canpick
|
||||
? commandWidgetClass
|
||||
: labelWidgetClass,
|
||||
wp->w, args, num_args);
|
||||
X11_wrap_widget(curr->w, NHW_MENU);
|
||||
X11_set_attrs(curr->w, 0x1 << attr);
|
||||
XtManageChild(curr->w);
|
||||
|
||||
if (canpick)
|
||||
XtAddCallback(linewidget, XtNcallback, menu_select,
|
||||
|
||||
Reference in New Issue
Block a user