XMDRAWINGAREA(3)
β¨ XmDrawingArea β¨
okay so bestie, welcome to the XmDrawingArea(library call) page β literally the whole widget class, and I'm gonna walk you through every single crumb of it. grab a snack. π
π NAME π
XmDrawingArea β The DrawingArea widget class
πΈ SYNOPSIS πΈ
#include <Xm/DrawingA.h>
π¦ DESCRIPTION π¦
okay so picture this: DrawingArea is an empty widget, and that's the whole point β it's a blank canvas that's easily adaptable to a variety of purposes. it does no drawing and defines no behavior except for one thing and one thing only: invoking callbacks. that's it. that's the job. π
those callbacks are how it notifies your application when graphics need to be drawn (that's exposure events or a widget resize) and when the widget receives input from the keyboard or mouse. π±οΈβ¨οΈ
and applications are responsible for defining appearance and behavior as needed in response to DrawingArea callbacks. so like β the widget is the empty stage, you are the whole production. main character energy, fr fr. π
also important: DrawingArea is a composite widget and a subclass of XmManager that supports minimal geometry management for multiple widget or gadget children.
DrawingArea uses the XmNinitialFocus resource of XmManager to define whether or not DrawingArea will receive focus when it is traversed to, even if it has traversable children. here's the breakdown, no cap:
- If
XmNinitialFocusisNULL,DrawingAreareceives focus only if it does not have any traversable children. - If
XmNinitialFocusis notNULL, thenDrawingAreareceives focus when traversed to.
in that second case, the application first needs to be able to realize that the DrawingArea will receive focus, then, as appropriate, needs to either call the XmProcessTraversal function for the desired child, or to navigate across the private DrawingArea graphics objects.
β οΈ heads up bestie β the following resources are not currently used by theDrawingAreawidget:XmNshadowThickness,XmNtopShadowPixmap,XmNbottomShadowPixmap,XmNtopShadowColor, andXmNbottomShadowColor. they're just... there. chilling. not invited to the function. π
π Data Transfer Behavior π
DrawingArea has no widget class conversion or destination procedure.
- Subclasses and the
XmNconvertCallbackprocedures are responsible for any conversion of selections. - Subclasses and the
XmNdestinationCallbackprocedures are responsible for any data transfers to the widget.
so like, it's not doing the transfer for you. you're the transfer. π«Ά
π Classes π
DrawingArea inherits behavior and resources from the Core, Composite, Constraint, and XmManager classes.
- The class pointer is
xmDrawingAreaWidgetClass. - The class name is
XmDrawingArea.
π New Resources π
the following set of widget resources is what you, the programmer, use to specify data. you can also set the resource values for the inherited classes to set attributes for this widget. and here's the .Xdefaults hack that everybody needs to know:
- 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, but include any underscores between words).
and the access codes, because the alphabet soup is real:
Cβ can be set at creation timeSβ set by usingXtSetValuesGβ retrieved by usingXtGetValuesN/Aβ not applicable
here's the whole XmDrawingArea Resource Set, every single one, exactly as written: β¨
XmNconvertCallbackβ Class:XmCCallbackβ Type:XtCallbackListβ Default:NULLβ Access:CXmNdestinationCallbackβ Class:XmCCallbackβ Type:XtCallbackListβ Default:NULLβ Access:CXmNexposeCallbackβ Class:XmCCallbackβ Type:XtCallbackListβ Default:NULLβ Access:CXmNinputCallbackβ Class:XmCCallbackβ Type:XtCallbackListβ Default:NULLβ Access:CXmNmarginHeightβ Class:XmCMarginHeightβ Type:Dimensionβ Default:10β Access:CSGXmNmarginWidthβ Class:XmCMarginWidthβ Type:Dimensionβ Default:10β Access:CSGXmNresizeCallbackβ Class:XmCCallbackβ Type:XtCallbackListβ Default:NULLβ Access:CXmNresizePolicyβ Class:XmCResizePolicyβ Type:unsigned charβ Default:XmRESIZE_ANYβ Access:CSG
and now the tea on each one, one by one, no skipping: π
XmNconvertCallbackβ specifies a list of callbacks called when theDrawingAreais asked to convert a selection. the type of the structure whose address is passed to these callbacks isXmConvertCallbackStruct. the reason isXmCR_OK.XmNdestinationCallbackβ specifies a list of callbacks called when theDrawingAreais the destination of a transfer operation. the type of the structure whose address is passed to these callbacks isXmDestinationCallbackStruct. the reason isXmCR_OK.XmNexposeCallbackβ specifies the list of callbacks that is called whenDrawingAreareceives an exposure event. the callback reason isXmCR_EXPOSE. the callback structure also includes the exposure event.
π¨ lowkey important: the default bit gravity forManagerwindows isNorthWestGravity. this may cause theXmNexposeCallbackprocedures not to be invoked when theDrawingAreawindow is made smaller. so if you're shrinking and nothing's firing, that's why bestie. π
XmNinputCallbackβ specifies the list of callbacks that is called when theDrawingAreareceives a keyboard or mouse event (key or button, up or down). the callback reason isXmCR_INPUT. the callback structure also includes the input event.XmNmarginHeightβ specifies the minimum spacing in pixels between the top or bottom edge ofDrawingAreaand any child widget.XmNmarginWidthβ specifies the minimum spacing in pixels between the left or right edge ofDrawingAreaand any child widget.XmNresizeCallbackβ specifies the list of callbacks that is called when theDrawingAreais resized. the callback reason isXmCR_RESIZE.XmNresizePolicyβ controls the policy for resizingDrawingAreawidgets. possible values include:XmRESIZE_NONEβ fixed sizeXmRESIZE_ANYβ shrink or grow as neededXmRESIZE_GROWβ grow only
π§ Inherited Resources π§
DrawingArea inherits behavior and resources from the following superclasses. for a complete description of each resource, refer to the reference page for that superclass.
β¦and that's where this part stops, bestie β the inherited resource tables are coming up next, so don't go anywhere. π«Ά
πΈ XmManager Resource Set πΈ
okay so before we even look at what XmDrawingArea brings to the table, bestie, we have to give it up for everything it inherits from XmManager β because every single one of these is riding along with your widget whether you asked or not π
. Full list, no skips, no cap:
XmNbottomShadowColorβ classXmCBottomShadowColor, typePixel, default is dynamic, accessCSG. yes the default literally saysdynamic, it's not a typo, it's just the vibe β¨XmNbottomShadowPixmapβ classXmCBottomShadowPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNforegroundβ classXmCForeground, typePixel, default is dynamic, accessCSGXmNhelpCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNhighlightColorβ classXmCHighlightColor, typePixel, default dynamic, accessCSGXmNhighlightPixmapβ classXmCHighlightPixmap, typePixmap, default dynamic, accessCSGXmNinitialFocusβ classXmCInitialFocus, typeWidget, defaultNULL, accessCSGXmNlayoutDirectionβ classXmCLayoutDirection, typeXmDirection, default dynamic, accessCGXmNnavigationTypeβ classXmCNavigationType, typeXmNavigationType, defaultXmTAB_GROUP, accessCSG. she's got a default default and honestly? iconic πXmNpopupHandlerCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNshadowThicknessβ classXmCShadowThickness, typeDimension, default0, accessCSGXmNstringDirectionβ classXmCStringDirection, typeXmStringDirection, default dynamic, accessCGXmNtopShadowColorβ classXmCTopShadowColor, typePixel, default dynamic, accessCSGXmNtopShadowPixmapβ classXmCTopShadowPixmap, typePixmap, default dynamic, accessCSGXmNtraversalOnβ classXmCTraversalOn, typeBoolean, defaultTrue, accessCSGXmNunitTypeβ classXmCUnitType, typeunsigned char, default dynamic, accessCSGXmNuserDataβ classXmCUserData, typeXtPointer, defaultNULL, accessCSG
seventeen whole resources, all of them yours by birthright, fr fr π«Ά
π¦ Composite Resource Set π¦
and then there's the Composite set, which is shorter but like⦠main character energy nonetheless. three of them, that's it, that's the whole squad:
XmNchildrenβ classXmCReadOnly, typeWidgetList, defaultNULL, accessGXmNinsertPositionβ classXmCInsertPosition, typeXtOrderProc, defaultNULL, accessCSGXmNnumChildrenβ classXmCReadOnly, typeCardinal, default0, accessG
okay real talk, bestie: see howXmNchildrenandXmNnumChildrenare both markedGin that access column? that's get-only energy. you read them, you don't write them. don't come for me when it doesn't stick π
and yes, that's genuinely the entire Composite set. short king behavior. we love that for it π
β¨ Core Resource Set β¨
bestie, this is the whole entire Core Resource Set and I am not skipping a single one, because you deserve the full picture π every line has its name, class, type, default and access. read it like a menu. slay responsibly.
XmNacceleratorsβ classXmCAccelerators, typeXtAccelerators, defaultdynamic, accessCSGXmNancestorSensitiveβ classXmCSensitive, typeBoolean, defaultdynamic, accessGXmNbackgroundβ classXmCBackground, typePixel, defaultdynamic, accessCSGXmNbackgroundPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNborderColorβ classXmCBorderColor, typePixel, defaultXtDefaultForeground, accessCSGXmNborderPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNborderWidthβ classXmCBorderWidth, typeDimension, default0, accessCSGXmNcolormapβ classXmCColormap, typeColormap, defaultdynamic, accessCGXmNdepthβ classXmCDepth, typeint, defaultdynamic, accessCGXmNdestroyCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNheightβ classXmCHeight, typeDimension, defaultdynamic, accessCSGXmNinitialResourcesPersistentβ classXmCInitialResourcesPersistent, typeBoolean, defaultTrue, accessCXmNmappedWhenManagedβ classXmCMappedWhenManaged, typeBoolean, defaultTrue, accessCSGXmNscreenβ classXmCScreen, typeScreen *, defaultdynamic, accessCGXmNsensitiveβ classXmCSensitive, typeBoolean, defaultTrue, accessCSGXmNtranslationsβ classXmCTranslations, typeXtTranslations, defaultdynamic, accessCSGXmNwidthβ classXmCWidth, typeDimension, defaultdynamic, accessCSGXmNxβ classXmCPosition, typePosition, default0, accessCSGXmNyβ classXmCPosition, typePosition, default0, accessCSG
π¦ Callback Information π¦
okay so a pointer to the following structure gets passed to the XmNexposeCallback, XmNinputCallback, and XmNresizeCallback procedures. look at her π
typedef struct
{
int reason;
XEvent * event;
Window window;
} XmDrawingAreaCallbackStruct;
reasonβ tells you why the callback got invoked. the whole lore, basically.eventβ points at theXEventthat triggered the callback. heads up: this one isNULLfor theXmNresizeCallbackπ«₯windowβ is set to the widget window. that's the whole job.
and then a pointer to this next structure gets passed to the XmNconvertCallback procedures. different struct, same energy β¨
typedef struct
{
int reason;
XEvent *event;
Atom selection;
Atom target;
XtPointer source_data;
XtPointer location_data;
int flags;
XtPointer parm;
int parm_format;
unsigned long parm_length;
int status;
XtPointer value;
Atom type;
int format;
unsigned long length;
} XmConvertCallbackStruct;
reasonβ tells you why the callback got invoked. iconic of her honestly.eventβ points at theXEventthat triggered the callback. it can beNULL, so pls check before you go dereferencing, no cap π
selectionβ the selection we're converting, bestie. Possible values areCLIPBOARD,PRIMARY,SECONDARY, and_MOTIF_DROP. πtargetβ the conversion target. Periodt.source_dataβ info about the selection source. When the selection is_MOTIF_DROP,source_datais theDragContext. Otherwise, it'sNULL.location_dataβ info about where the data to be converted lives. If the value isNULL, the data to be transferred consists of the widget's current selection.flagsβ the status of the conversion. Possible values are:XmCONVERTING_NONEβ this flag is currently unused. (placeholder era π)XmCONVERTING_PARTIALβ the target widget was able to be converted, but some data was lost. πXmCONVERTING_SAMEβ the conversion target is the source of the data to be transferred. iconic.XmCONVERTING_TRANSACTβ this flag is currently unused. another unused baddie.
parmβ contains parameter data for this target. If no parameter data exists, the value isNULL.
When selection is CLIPBOARD and target is _MOTIF_CLIPBOARD_TARGETS or _MOTIF_DEFERRED_CLIPBOARD_TARGETS, the value is the requested operation (XmCOPY, XmMOVE, or XmLINK). π«Ά
parm_formatβ specifies whether the data inparmshould be viewed as a list ofchar,short, orlongquantities. Possible values are0(whenparmisNULL),8(when the data inparmshould be viewed as a list of chars),16(when the data inparmshould be viewed as a list of shorts), or32(when the data inparmshould be viewed as a list of longs). Note thatparm_formatsymbolizes a data type, not the number of bits in each list element. For example, on some machines, aparm_formatof32means that the data inparmshould be viewed as a list of 64-bit quantities, not 32-bit quantities. yes, she's tricky like that.parm_lengthβ specifies the number of elements of data inparm, where each element has the size specified byparm_format. WhenparmisNULL, the value is0.statusβ anIN/OUTmember that specifies the status of the conversion. The initial value isXmCONVERT_DEFAULT. The callback procedure can set this member to one of the following values:XmCONVERT_DEFAULTβ this value means that the widget class conversion procedure, if any, is called after the callback procedures return. If the widget class conversion procedure produces any data, it overwrites the data provided by the callback procedures in thevaluemember.XmCONVERT_MERGEβ this value means that the widget class conversion procedure, if any, is called after the callback procedures return. If the widget class conversion procedure produces any data, it appends its data to the data provided by the callback procedures in thevaluemember. This value is intended for use with targets that result in lists of data, such asTARGETS.XmCONVERT_DONEβ this value means that the callback procedure has successfully finished the conversion. The widget class conversion procedure, if any, is not called after the callback procedures return.XmCONVERT_REFUSEβ this value means that the callback procedure has terminated the conversion process without completing the requested conversion. The widget class conversion procedure, if any, is not called after the callback procedures return.
valueβ anIN/OUTparameter that contains any data that the callback procedure produces as a result of the conversion. The initial value isNULL. If the callback procedure sets this member, it must ensure that thetype,format, andlengthmembers correspond to the data invalue. The callback procedure is responsible for allocating, but not for freeing, memory when it sets this member.typeβ anIN/OUTparameter that indicates the type of the data in thevaluemember. The initial value isINTEGER.formatβ anIN/OUTparameter that specifies whether the data invalueshould be viewed as a list ofchar,short, orlongquantities. The initial value is8. The callback procedure can set this member to8(for a list ofchar),16(for a list ofshort), or32(for a list oflong).lengthβ anIN/OUTmember that specifies the number of elements of data invalue, where each element has the size symbolized byformat. The initial value is0.
A pointer to the following callback structure is passed to the XmNdestinationCallback procedures:
typedef struct
{
int reason;
XEvent *event;
Atom selection;
XtEnum operation;
int flags;
XtPointer transfer_id;
XtPointer destination_data;
XtPointer location_data;
Time time;
} XmDestinationCallbackStruct;
reasonβ indicates why the callback was invoked.eventβ points to theXEventthat triggered the callback. It can beNULL.selectionβ indicates the selection for which data transfer is being requested. Possible values areCLIPBOARD,PRIMARY,SECONDARY, and_MOTIF_DROP.operationβ indicates the type of transfer operation requested.- When the selection is
PRIMARY, possible values areXmMOVE,XmCOPY, andXmLINK. - When the selection is
SECONDARYorCLIPBOARD, possible values areXmCOPYandXmLINK. - When the selection is
_MOTIF_DROP, possible values areXmMOVE,XmCOPY,XmLINK, andXmOTHER. A value ofXmOTHERmeans that the callback procedure must get further information from theXmDropProcCallbackStructin thedestination_datamember.
- When the selection is
flagsβ indicates whether or not the destination widget is also the source of the data to be transferred. Possible values are:XmCONVERTING_NONEβ the destination widget is not the source of the data to be transferred.XmCONVERTING_SAMEβ the destination widget is the source of the data to be transferred.
transfer_idβ serves as a unique ID to identify the transfer transaction. πdestination_dataβ contains information about the destination. When the selection is_MOTIF_DROP, the callback procedures are called by the drop site'sXmNdropProc, anddestination_datais a pointer to theXmDropProcCallbackStructpassed to theXmNdropProcprocedure. When the selection isSECONDARY,destination_datais anAtomrepresenting a target recommmended by the selection owner for use in converting the selection. Otherwise,destination_dataisNULL.location_dataβ contains information about the location where data is to be transferred. The value is alwaysNULLwhen the selection isSECONDARYorCLIPBOARD. If the value isNULL, the data is to be inserted at the widget's cursor position.location_datais only valid for the duration of a transfer. OnceXmTransferDoneprocedures start to be called,location_datawill no longer be stable. so don't hold onto it, bestie. πtimeβ indicates the time when the transfer operation began. β°
Translations β¨
XmDrawingArea inherits translations from XmManager. Before calling the XmManager actions, all events in the inherited translations except <BtnMotion>, <EnterWindow>, <LeaveWindow>, <FocusIn>, and <FocusOut> also call the DrawingAreaInput() action.
XmDrawingArea has the following additional translations. The following key names are listed in the X standard key event translation table syntax. This format is the one used by Motif to specify the widget actions corresponding to a given key. A brief overview of the format is provided under VirtualBindings(3). For a complete description of the format, please refer to the X Toolkit Instrinsics Documentation.
<BtnDown>:DrawingAreaInput()<BtnUp>:DrawingAreaInput()<KeyDown>:DrawingAreaInput() ManagerGadgetKeyInput()<KeyUp>:DrawingAreaInput()
Action Routines β¨
The XmDrawingArea action routines are
DrawingAreaInput(): Unless the event takes place in a gadget, calls the callbacks forXmNinputCallbackManagerGadgetKeyInput(): Causes the current gadget to process a keyboard event
Additional Behavior β¨
The XmDrawingArea widget has the following additional behavior:
<Expose>: Calls the callbacks forXmNexposeCallback<Widget Resize>: Calls the callbacks forXmNresizeCallback
Virtual Bindings β¨
The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings(3).
RELATED β¨
Composite(3), Constraint(3), Core(3), XmCreateDrawingArea(3), XmManager(3), XmVaCreateDrawingArea(3), and XmVaCreateManagedDrawingArea(3).
that's the whole vibe, bestie π signed off by XmDrawingArea(library call) β and the date? not shown in this footer, but it's giving timeless icon energy β¨
π¦ where this page comes from
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- epel 10: motif-devel 2.3.8-2.el10_2 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- 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 on : a language model's rewrite of the original, under its terms