World(3I)

πŸ’– World(3I) πŸ’–

okay bestie, buckle up, we're reading the InterViews Reference Manual page for World and honestly? it's giving vintage. let's get into it 🫢


✨ NAME ✨

World β€” control a display 🌈


πŸŽ€ SYNOPSIS πŸŽ€

#include <InterViews/world.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, a world was an application's connection to one specific display. that's it, that's the whole vibe. πŸ’…

lowkey important: it is currently provided for backward compatibility. it's the OG, it's iconic, but it's a legacy situation, no cap.

πŸ‘‘ PUBLIC OPERATIONS πŸ‘‘

World(

World(
    const char* classname, int& argc, char** argv
    OptionDesc* = nil, PropertyData* = nil
)

Construct the world object for a display, slay. here's how the instance name gets picked, in order:

  • the -name option, if it was given β€” main character gets first dibs ✨
  • otherwise the environment variable RESOURCE_NAME, if it is nonnil
  • and if the name still hasn't been defined? then argv[0] is used, with all leading directories stripped. bye path, we only want the name πŸŽ€

these arguments get interpreted automatically and are removed from argv:

  • -background β€” next argument sets the background color
  • -bg β€” same as -background
  • -display β€” next argument specifies the target workstation display
  • -foreground β€” next argument sets the foreground color
  • -fg β€” same as -foreground
  • -fn β€” same as -font
  • -font β€” next argument sets the text font
  • -geometry β€” next argument sets the first top-level interactor's position and size
  • -iconic β€” starts up the first top-level interactor in iconic form
  • -name β€” next argument sets the instance name of all top-level interactors that don't have their own instance names
  • -reverse β€” swaps default foreground and background colors
  • -rv β€” same as -reverse
  • -synchronous β€” force synchronous operation with the window system
  • -title β€” next argument sets the first top-level interactor's title bar name
  • -xrm β€” next argument sets an ``attribute: value'' property

the geometry specification has the form ``=WxH+XOFF+YOFF''. and this part is important bestie: a negative XOFF (YOFF) specifies the offset of the interactor's right (bottom) edge from the right (bottom) side of the screen. not left/top. right/bottom. don't get it twisted πŸ’€

the constructor sets argc to the number of uninterpreted arguments that remain.


if it's non-nil, the OptionDesc* parameter is an array of option descriptors used to parse application-specific attributes. and OptionDesc contains four fields:

  1. a name used on the command line
  2. a path specifying the attribute
  3. a style specifying where the value is
  4. a default value

valid styles are:

  • OptionPropertyNext β€” use next argument as an attribute:value pair, not just the value
  • OptionValueNext β€” use next argument as value
  • OptionValueImplicit β€” use default value
  • OptionValueIsArg β€” use argument as value
  • OptionValueAfter β€” use remainder of argument as value

if it's non-nil, the PropertyData* parameter is an array of structures that each contain three string fields:

  1. a path specifying the attribute
  2. a value specifying the value
  3. a type specifying the type name

and here's the ✨ precedence lore ✨ β€” attributes are entered in the following order:

  1. first any application defaults (specified by the PropertyData array)
  2. then application defaults from /usr/lib/X11/app-defaults/classname
  3. then user defaults (usually in $HOME/.Xdefaults)
  4. and finally command-line arguments

so like, command-line arguments override user defaults, and both override application defaults. the command line is the final boss, periodt πŸ‘‘


const char* name()

Return the instance name associated with the world.

const char* classname()

Return the class name associated with the world.

int argc()

Return the number of arguments passed to the world β€” and no, we're not counting the ones that were interpreted by the constructor, they already left the group chat πŸ™ˆ

char** argv()

Return the argument vector passed to the world.

Font* font()

Return the default font associated with the display. if a value for ``font'' is defined at the top-level of the property sheet, then it is used. otherwise, a system default is used.

Color* foreground()

Return the default foreground color associated with the display. if a value for ``foreground'' is defined at the top-level of the property sheet, then it is used. otherwise, a system default is used.

Color* background()

Return the default background color associated with the display. if a value for ``background'' is defined at the top-level of the property sheet, then it is used. otherwise, a system default is used.

boolean shaped_windows()

Return whether the display supports non-rectangular windows. (yes, weird little windows, we love them πŸ¦‹)

boolean double_buffered()

Return whether windows on the display should by default be double-buffered.

virtual void flush()

Repair all damaged windows on the display and then send any pending requests to the window system.

virtual void sync()

Repair all damaged windows on the display, send any pending requests to the window system, and wait for an acknowledgement from the window system. it's flush but with commitment issues resolved 🫢

Coord width()

Return the width in coordinates of the current screen associated with the display.

Coord height()

Return the height in coordinates of the current screen associated with the display.

virtual void run()

Read events from the display, handling them as they arrive, and stopping when quit is called.

virtual void quit()

Terminate the run loop. bye bestie πŸ‘‹

virtual boolean pending()

Return whether any events are waiting to be read.

virtual void read(Event&)

Read the next event from the world associated with the event.

virtual boolean read(long sec, long usec, Event&)

Read the next event from the world associated with the event, but do not wait more than sec seconds and usec microseconds. return whether an event was found in the given time. patience has a limit and it's measured in microseconds πŸ’…

virtual void unread(Event&)

Put the event back on the input queue for the world associated with the event. (yes, we're un-sending it, iconic behaviour)

virtual void poll(Event&)

Set the event to an artificial motion event based on the current pointer position and the state of the buttons and meta-keys.

virtual void SetScreen(int s)

Set the current screen to s.

static World* current()

Return the current world. the current world is set when a world is created or an event is received for the display associated with a world.


heads up: the original page jams SetScreen right onto the end of the poll description with no line break β€” i've split them apart here so you can actually read them, but they're both public operations, fr fr.

🌸 SEE ALSO 🌸

nothing else listed on this page, bestie. it's a solo act. πŸ’œ


and that's the whole thing! this page is from InterViews, dated 7 Mar 1989 β€” yes, 1989, ancient, vintage, a historical artifact, and we respect her πŸŽ€ go forth and control a display, you've got this βœ¨πŸ’–πŸŒˆ