XMCOMMAND(3)

πŸ“¦
version 2.5.2 Β· 2 versions
, in alpine 3.24, arch rolling, centos-stream 9, epel 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– XmCommand πŸ’–

okay so bestie, gather round β€” this is the manual page for XmCommand, straight out of the library call section of the manual (yes, that XmCommand(library call) header you saw at the top, that's this). It's a whole widget class and she is iconic. Let's get into it πŸŽ€


✨ NAME ✨

XmCommand β€” the Command widget class. that's it, that's the name, she's that girl πŸ’…


🌸 SYNOPSIS 🌸

#include <Xm/Command.h>

that's literally the whole vibe check. include the header and you're in πŸ¦‹


πŸ’« DESCRIPTION πŸ’«

okay so here's the tea: Command is a special-purpose composite widget for command entry, and she comes with a built-in command-history mechanism. no cap. she's not just a text box, she's a whole experience. ✨

Command includes, all in one gorgeous package:

  • a command-line text-input field πŸ“
  • a command-line prompt πŸ’¬
  • and a command-history list region πŸ“œ

One additional WorkArea child may be added to the Command after creation. just the one. she has boundaries, and honestly? respect. πŸ’…

Whenever a command is entered, it is automatically added to the end of the command-history list and made visible. πŸ”₯ This does not change the selected item in the list, if there is one. so if you had something highlighted, she's not gonna yank that from you, she's polite like that 🫢

Also, quick heads-up bestie: many of the new resources specified for Command are actually SelectionBox resources that have been renamed for clarity and ease of use. so if something feels familiar... it is. she just got a glow-up and a new name 😌

🌈 Descendants 🌈

Command automatically creates the descendants shown in the following list. An application can use XtNameToWidget to gain access to the named descendant. In addition, a user or an application can use the named descendant when specifying resource values. 🧚

  • ItemsList β€” class XmList β€” the command-history list region πŸ“œ
  • ItemsListSW β€” class XmScrolledWindow β€” the ScrolledWindow parent of ItemsList πŸͺŸ
  • Selection β€” class XmLabelGadget β€” the command-line prompt πŸ’¬
  • Text β€” class XmTextField β€” the command-line text-input field ✍️

πŸ‘‘ Classes πŸ‘‘

Command inherits behavior, resources, and traits from Core, Composite, Constraint, XmManager, XmBulletinBoard, and XmSelectionBox. yeah, she comes from a long line of legends, main character energy runs in the family πŸ‘‘

The class pointer is xmCommandWidgetClass.

The class name is XmCommand.

🌸 New Resources 🌸

The following list defines a set of widget resources used by the programmer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To reference a resource by name or by class in a .Xdefaults file, remove the XmN or XmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lowercase or uppercase, but include any underscores between words). πŸ”€

The codes in the access column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A).

  • XmNcommand β€” class XmCTextString, type XmString, default "", access CSG
  • XmNcommandChangedCallback β€” class XmCCallback, type XtCallbackList, default NULL, access C
  • XmNcommandEnteredCallback β€” class XmCCallback, type XtCallbackList, default NULL, access C
  • XmNhistoryItems β€” class XmCItems, type XmStringTable, default NULL, access CSG
  • XmNhistoryItemCount β€” class XmCItemCount, type int, default 0, access CSG
  • XmNhistoryMaxItems β€” class XmCMaxItems, type int, default 100, access CSG
  • XmNhistoryVisibleItemCount β€” class XmCVisibleItemCount, type int, default dynamic, access CSG
  • XmNpromptString β€” class XmCPromptString, type XmString, default dynamic, access CSG

now let's break each one down, bestie, because the details matter πŸ’–

XmNcommand Contains the current command-line text. This is the XmNtextString resource in SelectionBox, renamed for Command. This resource can also be modified with XmCommandSetValue and XmCommandAppendValue functions. The command area is a Text widget. ✍️

XmNcommandChangedCallback Specifies the list of callbacks that is called after each time the value of the command changes. The callback reason is XmCR_COMMAND_CHANGED. This is equivalent to the XmNvalueChangedCallback of the Text widget, except that a pointer to an XmCommandCallbackStructure is passed, and the structure's value member contains the XmString. πŸ””

XmNcommandEnteredCallback Specifies the list of callbacks that is called when a command is entered in the Command. The callback reason is XmCR_COMMAND_ENTERED. A pointer to an XmCommandCallback structure is passed. πŸš€

XmNhistoryItems Lists XmString items that make up the contents of the history list. This is the XmNlistItems resource in SelectionBox, renamed for Command.

⚠️ okay important: XtGetValues for this resource returns the list items themselves, not a copy of the list items. The application must not free the returned items. don't do it bestie, she will notice πŸ’€

XmNhistoryItemCount Specifies the number of XmStrings in XmNhistoryItems. This is the XmNlistItemCount resource in SelectionBox, renamed for Command.

The value must not be negative. 🚫

XmNhistoryMaxItems Specifies the maximum number of items allowed in the history list. Once this number is reached, an existing list item must be removed before a new item can be added to the list. For each command entered, the first list item is removed from the list, so the new command can be added to the list.

The value must be greater than 0 (zero). 🚫

XmNhistoryVisibleItemCount Specifies the number of items in the history list that should be visible at one time. In effect, it sets the height (in lines) of the history list window. This is the XmNlistVisibleItemCount resource in SelectionBox, renamed for Command.

The value must be greater than 0 (zero). The default is dynamic, based on the height of the list. 🌊

XmNpromptString Specifies a prompt for the command line. This is the XmNselectionLabelString resource in SelectionBox, renamed for Command. The default may vary depending on the value of the XmNlayoutDirection resource and the locale. In the C locale the default is > (right angle bracket). πŸ’¬

Okay so real talk, bestie β€” now that some default localized label strings are being handed out through message catalogs for the children of composite widgets, you cannot set the labelString resources on the child through default resource files anymore. Nope. Not happening. πŸ™…β€β™€οΈ Instead, you have to use the resource that's provided at the parent level. That's the move. That's the whole vibe. πŸ’…


✨ Inherited Resources ✨

Command inherits behavior and resources from the superclasses listed in the tables below. For a complete description of each resource, go read the reference page for that superclass β€” it's giving ✨required reading✨, iykyk.

🌸 XmSelectionBox Resource Set 🌸

Every row is <pink>Name</pink> β†’ <purple>Class</purple> β†’ <cyan>Type</cyan> β†’ <mint>Default</mint> β†’ <peach>Access</peach>, in that order. No skipping, no cap. πŸ‘‘

  • XmNapplyCallback β€” class XmCCallback, type XtCallbackList, default NULL, access N/A
  • XmNapplyLabelString β€” class XmCApplyLabelString, type XmString, default dynamic, access N/A
  • XmNcancelCallback β€” class XmCCallback, type XtCallbackList, default NULL, access N/A
  • XmNcancelLabelString β€” class XmCCancelLabelString, type XmString, default dynamic, access N/A
  • XmNchildPlacement β€” class XmCChildPlacement, type unsigned char, default XmPLACE_ABOVE_SELECTION, access CSG
  • XmNdialogType β€” class XmCDialogType, type unsigned char, default XmDIALOG_COMMAND, access G
  • XmNhelpLabelString β€” class XmCHelpLabelString, type XmString, default dynamic, access N/A
  • XmNlistItemCount β€” class XmCItemCount, type int, default 0, access CSG
  • XmNlistItems β€” class XmCItems, type XmStringTable, default NULL, access CSG
  • XmNlistLabelString β€” class XmCListLabelString, type XmString, default NULL, access N/A
  • XmNlistVisibleItemCount β€” class XmCVisibleItemCount, type int, default dynamic, access CSG
  • XmNminimizeButtons β€” class XmCMinimizeButtons, type Boolean, default False, access N/A
  • XmNmustMatch β€” class XmCMustMatch, type Boolean, default False, access N/A
  • XmNnoMatchCallback β€” class XmCCallback, type XtCallbackList, default NULL, access N/A
  • XmNokCallback β€” class XmCCallback, type XtCallbackList, default NULL, access N/A
  • XmNokLabelString β€” class XmCOkLabelString, type XmString, default dynamic, access N/A
  • XmNselectionLabelString β€” class XmCSelectionLabelString, type XmString, default dynamic, access CSG
  • XmNtextAccelerators β€” class XmCTextAccelerators, type XtAccelerators, default default, access C
  • XmNtextColumns β€” class XmCColumns, type short, default dynamic, access CSG
  • XmNtextString β€” class XmCTextString, type XmString, default "", access CSG
🫢 Pro bestie tip: those dynamic defaults are literally just doing the most, so don't hardcode assumptions about them, okay? Read the superclass page. ✨

✨ XmBulletinBoard Resource Set ✨

okay bestie, welcome to the resource set for XmBulletinBoard πŸ’– this is literally the master list of every property you can set on a bulletin board widget, and it's giving very organized. the columns are Name, Class, Type, Default, and Access β€” no cap. here's every single one, in order, so you don't miss a thing:

  • XmNallowOverlap β€” Class: XmCAllowOverlap, Type: Boolean, Default: True, Access: CSG ✨
  • XmNautoUnmanage β€” Class: XmCAutoUnmanage, Type: Boolean, Default: False, Access: N/A πŸŽ€
  • XmNbuttonFontList β€” Class: XmCButtonFontList, Type: XmFontList, Default: dynamic, Access: N/A πŸ’…
  • XmNbuttonRenderTable β€” Class: XmCButtonRenderTable, Type: XmRenderTable, Default: dynamic, Access: CSG πŸ¦‹
  • XmNcancelButton β€” Class: XmCWidget, Type: Widget, Default: NULL, Access: N/A 🌸
  • XmNdefaultButton β€” Class: XmCWidget, Type: Widget, Default: NULL, Access: N/A 🌈
  • XmNdefaultPosition β€” Class: XmCDefaultPosition, Type: Boolean, Default: False, Access: CSG ⭐
  • XmNdialogStyle β€” Class: XmCDialogStyle, Type: unsigned char, Default: dynamic, Access: CSG πŸ‘‘
  • XmNdialogTitle β€” Class: XmCDialogTitle, Type: XmString, Default: NULL, Access: CSG πŸ’œ
  • XmNfocusCallback β€” Class: XmCCallback, Type: XtCallbackList, Default: NULL, Access: C πŸ”₯
  • XmNlabelFontList β€” Class: XmCLabelFontList, Type: XmFontList, Default: dynamic, Access: CSG πŸ“
  • XmNlabelRenderTable β€” Class: XmCLabelRenderTable, Type: XmRenderTable, Default: dynamic, Access: CSG 🧚
  • XmNmapCallback β€” Class: XmCCallback, Type: XtCallbackList, Default: NULL, Access: C πŸ’€
  • XmNmarginHeight β€” Class: XmCMarginHeight, Type: Dimension, Default: 10, Access: CSG 🫢
  • XmNmarginWidth β€” Class: XmCMarginWidth, Type: Dimension, Default: 10, Access: CSG πŸ™ˆ
  • XmNnoResize β€” Class: XmCNoResize, Type: Boolean, Default: False, Access: CSG 😭
  • XmNresizePolicy β€” Class: XmCResizePolicy, Type: unsigned char, Default: XmRESIZE_NONE, Access: CSG πŸ”₯
  • XmNshadowType β€” Class: XmCShadowType, Type: unsigned char, Default: XmSHADOW_OUT, Access: CSG ✨
  • XmNtextFontList β€” Class: XmCTextFontList, Type: XmFontList, Default: dynamic, Access: CSG πŸ’–
  • XmNtextRenderTable β€” Class: XmCTextRenderTable, Type: XmRenderTable, Default: dynamic, Access: CSG πŸŽ€
  • XmNtextTranslations β€” Class: XmCTranslations, Type: XtTranslations, Default: NULL, Access: C πŸ’…
  • XmNunmapCallback β€” Class: XmCCallback, Type: XtCallbackList, Default: NULL, Access: C πŸ¦‹

🫢 The XmManager Resource Set 🫢

okay bestie, here's the whole menu of resources that XmManager brings to the table, no cap. name, class, type, default, access β€” all of it, exactly as it is:

  • XmNbottomShadowColor β€” class XmCBottomShadowColor, type Pixel, default dynamic, access CSG πŸŽ€
  • XmNbottomShadowPixmap β€” class XmCBottomShadowPixmap, type Pixmap, default XmUNSPECIFIED_PIXMAP, access CSG ✨
  • XmNforeground β€” class XmCForeground, type Pixel, default dynamic, access CSG πŸ’…
  • XmNhelpCallback β€” class XmCCallback, type XtCallbackList, default NULL, access C 🌸
  • XmNhighlightColor β€” class XmCHighlightColor, type Pixel, default dynamic, access CSG πŸ¦‹
  • XmNhighlightPixmap β€” class XmCHighlightPixmap, type Pixmap, default dynamic, access CSG 🫢
  • XmNinitialFocus β€” class XmCInitialFocus, type Widget, default dynamic, access CSG ⭐
  • XmNlayoutDirection β€” class XmCLayoutDirection, type XmDirection, default dynamic, access CG πŸ’œ
  • XmNnavigationType β€” class XmCNavigationType, type XmNavigationType, default XmTAB_GROUP, access CSG πŸ”₯
  • XmNpopupHandlerCallback β€” class XmCCallback, type XtCallbackList, default NULL, access C πŸ‘‘
  • XmNshadowThickness β€” class XmCShadowThickness, type Dimension, default dynamic, access CSG 🌈
  • XmNstringDirection β€” class XmCStringDirection, type XmStringDirection, default dynamic, access CG πŸŽ€
  • XmNtopShadowColor β€” class XmCTopShadowColor, type Pixel, default dynamic, access CSG ✨
  • XmNtopShadowPixmap β€” class XmCTopShadowPixmap, type Pixmap, default dynamic, access CSG πŸ’–
  • XmNtraversalOn β€” class XmCTraversalOn, type Boolean, default True, access CSG πŸ¦‹
  • XmNunitType β€” class XmCUnitType, type unsigned char, default dynamic, access CSG 🌸
  • XmNuserData β€” class XmCUserData, type XtPointer, default NULL, access CSG πŸ’…

🌟 The Composite Resource Set 🌟

and then Composite rolls up with its own lil trio of resources, periodt:

  • XmNchildren β€” class XmCReadOnly, type WidgetList, default NULL, access G 🫢
  • XmNinsertPosition β€” class XmCInsertPosition, type XtOrderProc, default NULL, access CSG ⭐
  • XmNnumChildren β€” class XmCReadOnly, type Cardinal, default 0, access G πŸ’œ
  • XmNaccelerators β€” class XmCAccelerators, type XtAccelerators, default dynamic, access N/A ✨
  • XmNancestorSensitive β€” class XmCSensitive, type Boolean, default dynamic, access G
  • XmNbackground β€” class XmCBackground, type Pixel, default dynamic, access CSG
  • XmNbackgroundPixmap β€” class XmCPixmap, type Pixmap, default XmUNSPECIFIED_PIXMAP, access CSG πŸŽ€
  • XmNborderColor β€” class XmCBorderColor, type Pixel, default XtDefaultForeground, access CSG
  • XmNborderPixmap β€” class XmCPixmap, type Pixmap, default XmUNSPECIFIED_PIXMAP, access CSG
  • XmNborderWidth β€” class XmCBorderWidth, type Dimension, default 0, access CSG
  • XmNcolormap β€” class XmCColormap, type Colormap, default dynamic, access CG 🌈
  • XmNdepth β€” class XmCDepth, type int, default dynamic, access CG
  • XmNdestroyCallback β€” class XmCCallback, type XtCallbackList, default NULL, access C πŸ’€
  • XmNheight β€” class XmCHeight, type Dimension, default dynamic, access CSG
  • XmNinitialResourcesPersistent β€” class XmCInitialResourcesPersistent, type Boolean, default True, access C
  • XmNmappedWhenManaged β€” class XmCMappedWhenManaged, type Boolean, default True, access CSG
  • XmNscreen β€” class XmCScreen, type Screen *, default dynamic, access CG πŸ¦‹
  • XmNsensitive β€” class XmCSensitive, type Boolean, default True, access CSG
  • XmNtranslations β€” class XmCTranslations, type XtTranslations, default dynamic, access CSG
  • XmNwidth β€” class XmCWidth, type Dimension, default dynamic, access CSG
  • XmNx β€” class XmCPosition, type Position, default 0, access CSG
  • XmNy β€” class XmCPosition, type Position, default 0, access CSG πŸ’–

🫢 Callback Information 🫢

bestie a pointer to the following structure gets handed to every single callback, no exceptions:

typedef struct
{
        int reason;
        XEvent * event;
        XmString value;
        int length;
} XmCommandCallbackStruct;
  • reason β€” tells you why the callback got invoked, like the lore drop of the moment πŸ’…
  • event β€” points to the XEvent that triggered the callback, the whole origin story fr
  • value β€” the XmString sitting in the CommandArea, i.e. the actual text
  • length β€” the size in bytes of the XmString value. and listen, this member is obsolete β€” it's just hanging around for compatibility with earlier releases, like a legacy fit we keep in the back of the closet πŸ™ˆ

🌸 Translations 🌸

XmCommand inherits translations from XmSelectionBox. it's giving family resemblance, it's giving inherited genes πŸ’œ


⭐ Accelerators ⭐

The XmNtextAccelerators from XmSelectionBox are added to the Text descendant of XmCommand. so the Text widget down the family tree gets them too, iconic behaviour honestly


πŸ‘‘ Action Routines πŸ‘‘

the XmCommand action routines are, drumroll please:

  • SelectionBoxUpOrDown(Previous|Next|First|Last) β€” the main character of this section, and here's exactly what it does:
    • When called with an argument of Previous, or 0 (zero) for compatibility, it selects the previous item in the history list and replaces the text with that item. lowkey time travel, going back a step πŸ•°οΈ
    • When called with an argument of Next, or 1 for compatibility, it selects the next item in the history list and replaces the text with that item. forward momentum, slay πŸ”₯

okay bestie, picking up right where we left off in the action list πŸ’…

  • when you call it with an argument of First, or 2 for compatibility, it selects the first item in the history list and replaces the text with that item. periodt.
  • when you call it with an argument of Last, or 3 for compatibility, it selects the last item in the history list and replaces the text with that item. she’s consistent.
  • calls the callbacks for XmNcommandChangedCallback. not me being the messenger of callback tea ✨

Additional Behavior πŸŽ€

the Command widget also has this extra behavior, no cap:

  • <Key><osfCancel> β€” if the parent of the Command is a manager, the event is passed to the parent. lowkey passing the vibe along.
  • <Key><osfActivate> in Text β€” calls the Text widget's XmNactivateCallback callbacks. if the text is empty, this action then returns. otherwise, if the history list has XmNhistoryMaxItems items, it removes the first item in the list. it adds the text to the history list as the last item, clears the text, and calls the XmNcommandEnteredCallback callbacks. iconic behavior fr fr.
  • <Key> in Text β€” when any change is made to the text edit widget, this action calls the callbacks for XmNcommandChangedCallback. it's literally always watching πŸ‘€.
  • <BtnDown>(2+) or <Key><osfActivate> in List β€” calls the List widget's XmNdefaultActionCallback callbacks. if the history list has XmNhistoryMaxItems items, this action removes the first item in the list. it adds the selected List item to the history list as the last item, clears the text, and calls the XmNcommandEnteredCallback callbacks. slay.
  • <FocusIn> β€” calls the callbacks for XmNfocusCallback. focus queen πŸ‘‘.
  • <MapWindow> β€” when a Command that is the child of a DialogShell is mapped, this action calls the callbacks for XmNmapCallback. mapping = main character energy.
  • <UnmapWindow> β€” when a Command that is the child of a DialogShell is unmapped, this action calls the callbacks for XmNunmapCallback. unmapped but still valid πŸ’….

Virtual Bindings πŸ¦‹

the bindings for virtual keys are vendor specific. for information about bindings for virtual buttons and keys, see VirtualBindings(3). iykyk.



kisses, this was the XmCommand(library call) manual page, no date because she’s timeless πŸ’‹