XMDISPLAY(3)
π
XmDisplay β from the library call manual π
okay so bestie, buckle up, because we're talking about XmDisplay, the Display widget class, and honestly? it's kind of the main character of your whole Motif app. let's get into it π«Ά
β¨ NAME β¨
XmDisplay β literally the Display widget class. that's it, that's the name, slay.
π SYNOPSIS π
#include <Xm/Display.h>
yes bestie, that's the whole synopsis. we love a low-effort icon π
πΈ DESCRIPTION πΈ
so here's the vibe: the XmDisplay object is what all the Motif widgets use to stash information that's specific to a display. it also lets the toolkit peek at certain info about widget hierarchies that would otherwise be, like, completely unavailable to it. and every client gets one XmDisplay object for each display it accesses β one per display, no sharing, no cap π¦
here's the part that's giving convenience: an XmDisplay object gets created automatically when the application creates the first shell on a display. (usually that happens through a call to XtAppInitialize or XtAppCreateShell.) so like β do not go off and try to create an XmDisplay object by any other means. it's not necessary, bestie, please don't. instead, if an app wants the widget ID of the XmDisplay object for a given display, it can just call the function XmGetXmDisplay. easy π
and now the annoying-but-important bit: an application cannot supply initial values for XmDisplay resources as arguments to any function that creates widgets. nope. not happening. what the application or the user can do is supply initial values in a resource file. then, after creating the first shell on the display, the application can use XmGetXmDisplay to grab the widget ID of the XmDisplay object and then call XtSetValues to set the XmDisplay resources. that's the whole workflow, periodt β¨
now, the juicy part β drag and drop π. XmDisplay resources specify the drag protocol style for a client that's participating in drag and drop transactions. there are two basic protocol types: preregister and dynamic.
π₯ the two protocol types π₯
- preregister β when a preregister protocol is used, the toolkit handles any communication between the initiator and receiver clients, and it displays the appropriate drag-over and drag-under visual effects. a client registers its drop sites in advance, and that information gets stored in a property for each top-level window. then when the drag pointer enters a top-level window, the initiator reads the drop site information. very "we planned ahead, we're organized" energy π
- dynamic β a dynamic protocol lets the source and destination clients dynamically communicate drag and drop state information between each other, and update their respective visuals accordingly. the toolkit provides drop site information as the pointer passes over any given drop site. and in this mode? a receiver can supply a procedure to generate its own drag-under effects. very DIY, very customizable, we love to see it π
π¦ Classes π¦
Display inherits behavior and resources from Core, Composite, Shell, WMShell, VendorShell, TopLevelShell, and ApplicationShell classes. it's giving nepo baby but make it inheritance hierarchy, honestly π
- the class pointer is
xmDisplayClass. - the class name is
XmDisplay.
π New Resources π
okay so this next bit is the resource table (coming at you next), but first the important context, bestie β¨
the following table defines a set of widget resources that the programmer uses to specify data. and β key detail β the programmer can also set the resource values for the inherited classes to set attributes for this widget. inheritance! it's everywhere! π
now, referencing them in a .Xdefaults file, because iykyk:
- to reference a resource by name or by class in a
.Xdefaultsfile, remove theXmNorXmCprefix and use the remaining letters. - to specify one of the defined values for a resource in a
.Xdefaultsfile, remove theXmprefix and use the remaining letters (in either lowercase or uppercase β your call β but include any underscores between words). π«Ά
and the access column codes in the table? they tell you whether 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
that's the legend, bestie, memorize it. the table itself is up next π
Okay so before we get into the individual resources, here's the whole XmDisplay resource set laid out for you, bestie β name, class, type, default, and access, all of it, nothing skipped π
XmNdefaultButtonEmphasisβ classXmCDefaultButtonEmphasis, typeXtEnum, defaultXmEXTERNAL_HIGHLIGHT, accessCXmNdefaultVirtualBindingsβ classXmCDefaultVirtualBindings, typeString, defaultdynamic, accessCXmNdragInitiatorProtocolStyleβ classXmCDragInitiatorProtocolStyle, typeunsigned char, defaultXmDRAG_PREFER_RECEIVER, accessCGXmNdragReceiverProtocolStyleβ classXmCDragReceiverProtocolStyle, typeunsigned char, defaultXmDRAG_PREFER_DYNAMIC, accessCGXmNdragStartCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNenableBtn1Transferβ classXmCEnableBtn1Transfer, typeXtEnum, defaultXmOFF, accessCXmNenableButtonTabβ classXmCEnableButtonTab, typeBoolean, defaultFalse, accessCXmNenableDragIconβ classXmCEnableDragIcon, typeBoolean, defaultFalse, accessCXmNenableEtchedInMenuβ classXmCEnableEtchedInMenu, typeBoolean, defaultFalse, accessCXmNenableToggleColorβ classXmCEnableToggleColor, typeBoolean, defaultFalse, accessCXmNenableToggleVisualβ classXmCEnableToggleVisual, typeBoolean, defaultFalse, accessCXmNenableUnselectableDragβ classXmCEnableUnselectableDrag, typeBoolean, defaultTrue, accessCXmNenableWarpβ classXmCEnableWarp, typeXtEnum, defaultTrue, accessCSGXmNmotifVersionβ classXmCMotifVersion, typeint, defaultXmVERSION, accessCSGXmNnoFontCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNnoRenditionCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNuserDataβ classXmCUserData, typeXtPointer, defaultNULL, accessCSG
π¦ The resources, one by one π¦
πΈ XmNdefaultButtonEmphasis
This one's the glow-up switch for your PushButton widgets and gadgets that have XmNshowAsDefault set β it decides whether their whole look gets changed up or not β¨
So when the PushButton is the default, it gets an etched-out button that's, like, enclosed inside another etched-in border. Cute, but where does the location cursor go?? That's the whole question this resource answers. XmNdefaultButtonEmphasis has these possible values, and yeah, they affect the location cursor:
XmINTERNAL_HIGHLIGHTβ the location cursor shows up in between the two etched borders, which keeps the space it needs as smol as possible πXmEXTERNAL_HIGHLIGHTβ the PushButton draws the location cursor outside the second border instead.
π§ XmNdefaultVirtualBindings
This is where you tell the display what its default virtual bindings are, bestie. And here's a whole actual example of how you'd spec the defaultVirtualBindings resource in a resource file β copy it exactly, no freestyling:
*defaultVirtualBindings: \
osfBackSpace: <Key>BackSpace \n\
osfInsert: <Key>InsertChar \n\
osfDelete: <Key>DeleteChar \n\
...
osfLeft: <Key>left, Ctrl<Key>H
Not me pointing out the ... in there β yes, it's literally in the spec. Your resource file needs the rest of the bindings, the example just trails off π
π₯ XmNdragInitiatorProtocolStyle
Real talk: this one says what drag-and-drop protocol this client requires or prefers when it's the initiator. The possible values are:
XmDRAG_PREREGISTERβ as an initiator, this client doesn't do the dynamic protocol at all, so it can only arrange visual effects with receivers that hand over preregistered information πXmDRAG_DYNAMICβ as an initiator, this client straight-up doesn't use any of the preregistered drop site info that other clients make available, so it can only arrange visual effects with receivers that are on the dynamic protocol πXmDRAG_NONEβ drag and drop is disabled for this client. Thatβs the whole vibe, bestie. πXmDRAG_DROP_ONLYβ as an initiator, this client does not use either the preregistered drop site information or the dynamic protocol. It supports dragging, and any time the cursor is over a client that supports drag and drop, valid feedback is provided. There are no other visual effects. Ngl, itβs giving βjust the basics.β β¨XmDRAG_PREFER_DYNAMICβ as an initiator, this client can support both the preregister and dynamic protocols, but prefers to use dynamic protocols whenever possible in order to provide high-quality drag-under feedback. Highkey the drama is worth it for the feedback. π¦XmDRAG_PREFER_PREREGISTERβ as an initiator, this client can support both the preregister and dynamic protocols, but prefers to use the preregister protocol whenever possible in order to accommodate performance needs or to provide consistent drag-over feedback. Performance queen behavior. πXmDRAG_PREFER_RECEIVERβ indicates that this client can support both preregister and dynamic protocols, but will defer to the preference of the receiver client. This value is valid only for theXmNdragInitiatorProtocolStyleresource, and is its default value. Itβs literally the βyou pick, bestieβ option. π«Ά
XmNdragReceiverProtocolStyle
Specifies the drag and drop protocol requirements or preference when this client is a receiver. The values are:
XmDRAG_PREREGISTERβ as a receiver, this client preregisters drop site information and does not use the dynamic protocol. It can only arrange visual effects with initiators who make use of the preregistered information. Preregister girlies, stand up. πXmDRAG_DYNAMICβ as a receiver, this client uses the dynamic protocol and does not preregister drop site information. It can only arrange visual effects with initiators who use the dynamic protocol. Dynamic only, no cap. πXmDRAG_NONEβ drag and drop is disabled for this client. Same energy as above: not today. πXmDRAG_DROP_ONLYβ as a receiver, this client neither uses the dynamic protocol nor preregisters drop site information. It supports dropping, and when dragging over this client, valid feedback is always provided, but there are no other visual effects. Drop-only icon behavior. πXmDRAG_PREFER_DYNAMICβ as a receiver, this client can support both the preregister and dynamic protocols, but prefers to use the dynamic protocol whenever possible in order to provide high-quality drag-under feedback. Obsessed with the quality. β¨XmDRAG_PREFER_PREREGISTERβ as a receiver, this client can support both the preregister and dynamic protocols, but prefers to use the preregister protocol whenever possible in order to accommodate performance needs. Performance needs stay winning. π₯
The default value of this resource is dependent on the capabilities of the display. If the display supports the shape extension, allowing the dynamic protocol to use arbitrarily sized drag cursors, the default of this resource is XmDRAG_PREFER_DYNAMIC; otherwise the default is XmDRAG_PREFER_PREREGISTER. Vibe check says: shape extension = dynamic default. π
The actual protocol used between an initiator and a receiver is based on the protocol style of the receiver and initiator. The decision matrix is described in the following table in the original page, with the columns Drag Initiator and Drag Receiver Protocol Style. (Yes, itβs a lookup table; read it across and down, iykyk.) The value XmDRAG_NONE does not appear in the matrix. When specified for either the initiator or receiver side, XmDRAG_NONE implies that drag and drop transactions are not supported. A value of XmDRAG_DROP_ONLY (Drop Only) results when an initiator and receiver cannot compromise protocol styles, that is, one client requires dynamic mode while the other can only support preregister mode, or if either explicitly has specified XmDRAG_DROP_ONLY. Thatβs the whole tea. β
XmNdragStartCallback
Specifies the list of callbacks that are invoked when the XmDragStart function is called. The type of structure whose address is passed to this callback is XmDragStartCallbackStruct. The callback reason is XmCR_DRAG_START. Slay. π
XmNenableBtn1Transfer
Specifies if selection and transfer actions are integrated on Btn1 and extend actions are activated on Btn2. This resource can take the following values:
XmOFFβ disables integration and selection activation on Btn1. Itβs giving βnope, not integrated.β πXmBUTTON2_TRANSFERβ enables integration and selection activation on Btn1 and transfer on Btn2. Button 2 gets the transfer job. π¦XmBUTTON2_ADJUSTβ enables integration and selection activation on Btn1 and adjust on Btn2. Button 2 gets the adjust job. π
This resource affects the actions of Text, TextField, List, and Container. Those four are literally the main characters here. π
XmNenableButtonTab
Specifies if the action for the Tab key (KNextField and KPrevField actions) is to be modified. A value of True modifies the key to move as an arrow key until the boundary of a tab group is reached. Then, at the boundary of the tab group, KNextField and KPrevField will move to the next or previous tab group, respectively. A value of False does not cause modification. So itβs either tab-group parkour or no parkour. π§
XmNenableDragIcon
Specifies which set of icons are to be used for system default cursors during drag and drop operations. A value of False specifies that earlier versions of Motif release icons are used; a value of True specifies that alternate icons are used. This resource affects both the 16x16 and the 32x32 icons that the system defaults for each of the Screen objects associated with this display. Icon glow-up, your choice. β¨
XmNenableEtchedInMenu
Specifies the shadowing of the button widgets and gadgets in menus when the control is activated. A value of True causes the selected menu to be drawn with the shadow etched in; this shadow style is consistent with the selected appearance of other button widgets outside of menus. A value of False causes the selected menu to be drawn with the shadow etched out. This resource affects the actions of PushButton, ToggleButton, and CascadeButton widgets and gadgets when they are children of Menu. Etched-in is the inside-glow of menu buttons, basically. π
When this resource is set, the background of a button in a menu uses the XmNselectColor (derived from the XmNselectPixel) when armed as a default. A PushButton uses the XmNarmColor if it is defined. A ToggleButton uses the XmNselectColor if XmNindicatorOn is False and XmNfillOnSelect is True. This is the exact recipe, donβt improvise. π
XmNenableToggleColor
Specifies how to determine the default value of the XmNselectColor resource of ToggleButton and ToggleButtonGadget. A value of True causes the default value of XmNselectColor to be set to the value of XmNhighlightColor. A value of False causes the default value of XmNselectColor to be set to the value of XmNbackground. This resource only affects the appearance of ToggleButton widgets and gadgets that are in XmONE_OF_MANY or XmONE_OF_MANY_ROUND mode. In addition, XmNenableToggleColor only influences the default value of XmNselectColor. That is, if the user or application sets a value for XmNselectColor, then XmNenableToggleColor is ignored. So itβs a default-setter, not a fighter. π
XmNenableToggleVisual
Specifies the visual appearance of the ToggleButton widget and/or gadget. This resource affects the default value of the ToggleButton[Gadget] XmNindicatorType and XmNindicatorOn resources. When the ToggleButton is in a RadioBox, a value of True causes the XmONE_OF_MANY_ROUND (a shadowed circle) to be the default. Otherwise, when this resource is True, the ToggleButton XmNindicatorOn resource causes a default of XmN_OF_MANY, which will be a shadowed square with a check mark (check box). Visual queen behavior. π
A value of False causes the following:
XmONE_OF_MANYβ is a shadowed diamond. πXmN_OF_MANYβ is a shadowed square. πXmNenableUnselectableDragβ tells the app whether you're allowed to drag stuff off of aLabeland aScale. Set it toTrueand dragging is on π , set it toFalseand it's a hard no π ββοΈ.XmNenableWarpβ controls whether an application is allowed to warp the pointer out from under the user.True= yes warping,False= no warping, hands off the mouse bestie π±οΈβ¨.XmNmotifVersionβ the version of Motif that the current implementation is supposed to behave like. By default this resource gets its value from release values inXm.hπ.XmNnoFontCallbackβ this callback fires whenever a rendition tries to load a font or fontset and fails π. It can happen at creation time if the font is specified asXmLOAD_IMMEDIATE, or when something tries to render anXmStringusing a font specified asXmLOAD_DEFERRED. An application can use this callback to try to fix the whole situation by callingXmRenditionUpdateon the input rendition and handing the widget a font to use π«Ά. You can do that either by providing an alternative font name to be loaded via theXmNfontNameandXmNfontTyperesources, or with an already loaded font via theXmNfontresource. The callback reason isXmCR_NO_FONT, and this callback uses theXmDisplayCallbackStructstructure.XmNnoRenditionCallbackβ this callback fires whenever something tries to render a segment with aRENDITIONtag that doesn't match any renditions in a given render table π¬. The callback reason isXmCR_NO_RENDITION, and this callback uses theXmDisplayCallbackStructstructure.
An application can have this callback try to fix the problem by creating a new rendition with the given tag and adding it to render_table β¨.
TheXmNnoRenditionCallbackshould deallocate the render table passed in in therender_tablefield of the callback structure. Note that the table will automatically be deallocated if theXmRenderTableAddRenditionsfunction is called on it. The callback should NOT deallocate the modified render table that is passed back to Motif in therender_tablefield. If the application wants to manipulate this render table further, it should make a copy with theXmRenderTableCopyfunction before returning from the callback. Read that twice bestie, this is the part that bites people π
XmNuserDataβ a client data pointer for applications. An internally unused resource π.
π¦ Inherited Resources π¦
All of the superclass resources inherited by XmDisplay are designated N/A (not applicable). Like, all of them. Nothing to see here, moving on π
π Callback Information π
A pointer to the following structure is passed to the XmNdragStartCallback callback:
typedef struct
{
int reason;
XEvent *event;
Widget timeStamp;
Boolean doit;
}XmDragStartCallbackStruct;
reasonβ indicates why the callback was invokedeventβ points to theXEventthat triggered the callbackwidgetβ indicates the ID of the widget from which the drag was initiateddoitβ is an IN/OUT member that lets the callback decide whether to continue with the drag or cancel it. SettingdoittoFalsewill cancel the drag. The default value isNULL.
(yes, the struct member is literally spelled timeStamp while the description calls it widget β not me, that's just how the page is, iykyk π)
A pointer to the following structure is passed to the XmNnoFontCallback and XmNnoRenditionCallback callbacks:
typedef struct
{
int reason;
XEvent *event;
XmRendition rendition;
char *font_name;
XmRenderTable render_table;
XmStringTag tag;
}XmDisplayCallbackStruct;
reasonβ indicates why the callback was invokedeventβ points to theXEventthat triggered the callback. It can beNULL.renditionβ specifies the rendition with the missing fontfont_nameβ specifies the name of the font or font set which could not be loadedrender_tableβ specifies the render table with the missing renditiontagβ specifies the tag of the missing rendition
So which fields actually mean anything? Depends on the reason, bestie β here's the tea β:
- Reason
XmCR_NO_FONTβ the valid fields arerenditionandfont_name - Reason
XmCR_NO_RENDITIONβ the valid fields arerender_tableandtag
π RELATED π
Go read these next, they're all lowkey part of the same universe π
ApplicationShell(3)Composite(3)Core(3)TopLevelShell(3)VendorShell(3)WMShell(3)XmGetXmDisplay(3)XmScreen(3)
That's the whole page, you made it to the end ππ«Άπ This one's the XmDisplay(library call) page from the Motif library docs β go drink some water and go call XmGetXmDisplay on something, you absolute icon β¨ππ
π¦ where this page comes from
- alpine 3.24: motif-doc 2.5.2-r0 Β· LGPL-2.1-or-later
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- nixos 26.05: motif 2.3.8
- nixpkgs unstable: motif 2.3.8
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms