## xclient-ximps.pkg
#
# This package has the highest-level responsibility for
# managing all the state and operations relating to
# communication with a given X server.
#
#
# Architecture
# ------------
#
# Nomenclature: An 'imp' is a server microthread.
# (Like a daemon but smaller!)
#
# A 'ximp' is an X-specific imp.
#
# An xsocket is built of four imps.
# An xsession adds three more imps to make seven imps total.
# An xclient adds two more imps to make nine imps total.
# An X application adds an unbounded number of additional widget imps.
#
# Adapting from the page 8 diagram in
# http://mythryl.org/pub/exene/1991-ml-workshop.pdf
# our dataflow network for xsession looks like:
#
#
#
# ----------------------
#
| X server process |
# ----------------------
# ^
|
#
| v
# -------<network socket>------------- network and process boundary.
# ^
|xpackets
#
|xpackets v --- --- ---
# --------------- --------------- . . . # outbuf_ximp is from
src/lib/x-kit/xclient/src/wire/outbuf-ximp.pkg#
| outbuf_ximp | | inbuf_ximp | . . .
#
# --------------- --------------- . . . # inbuf_ximp is from
src/lib/x-kit/xclient/src/wire/inbuf-ximp.pkg# ^
| xpackets . . .
#
#
| xpackets v . . .
#
# -------------------------------------- ... xsocket . . # xsocket_ximps is from
src/lib/x-kit/xclient/src/wire/xsocket-ximps.pkg#
| xsequencer_ximp |--> (error handler) . ximps . .
# xsequencer_ximp is from
src/lib/x-kit/xclient/src/wire/xsequencer-ximp.pkg# -------------------------------------- . . . #
# ^
| xpackets . . .
#
#
| v . ... xsession .
# xsession_ximps is from
src/lib/x-kit/xclient/src/window/xsession-ximps.pkg#
| ------------------------- . . ximps .
#
#
| | decode_xpackets_ximp | . . .
# decode_xpackets_ximp is from
src/lib/x-kit/xclient/src/wire/decode-xpackets-ximp.pkg#
| ------------------------- . . .
#
#
| | xevents --- . .... xclient
# xclient_ximps is from
src/lib/x-kit/xclient/src/window/xclient-ximps.pkg#
| v . . ximps
#
#
| ---------------------- --------------- . .
# xevent_router_ximp is from
src/lib/x-kit/xclient/src/window/xevent-router-ximp.pkg#
| | xevent_router_ximp |--> | keymap_ximp | . .
#
#
| ---------------------- --------------- . .
# keymap_ximp is from
src/lib/x-kit/xclient/src/window/keymap-ximp.pkg#
| | xevents ^ ^ . .
#
#
| | | | . .
#
#
| | | | . .
#
#
| | | | --- .
#
# ------------------------
| | | .
#
#
| xserver_ximp | | | | .
# xserver_ximp is from
src/lib/x-kit/xclient/src/window/xserver-ximp.pkg# ------------------------
| | | .
#
# ^
| |get_window_site | .
#
#
|draw ops etc | xevents |note_new_hostwindow |keycode_to_keysym ---
#
#
| v | v
#
# (.................................to/from widget threads......................................) --- #
# ^
| ^ | .
#
#
|xrequests | xevents |xrequests | xevents .
#
#
| v | v .
#
# ------------------------- ------------------------- . #
#
| xevent_to_widget_ximp | | xevent_to_widget_ximp | ... (all hostwindows for app) .
# xevent_router_ximp is from
src/lib/x-kit/xclient/src/window/xevent-router-ximp.pkg# ------------------------- ------------------------- .... widget ximps #
# / \ / \ . #
# / widget \ / widget \ . #
# / tree \ / tree \ . #
# / \ / \ . #
# / ... \ / ... \ . #
# --- #
#
# o The "xsocket ximps" are started up by:
src/lib/x-kit/xclient/src/wire/xsocket-ximps.pkg# The (remaining) "xsession ximps" are started up by:
src/lib/x-kit/xclient/src/window/xsession-ximps.pkg# The (remaining) "xclient ximps" are started up here:
src/lib/x-kit/xclient/src/window/xclient-ximps.pkg# The "widget ximps" are started up by:
src/lib/x-kit/widget/gui/guiboss-imp.pkg#
#
#
# To fit a more complete graph of the GUI/X imps on one screenful we switch
# to a variant of the "cartographic" graph layout described in
# "Seeing and Redrafting Large Networks in Security and Biology"
# http://arxiv.org/abs/1405.5523">How to Draw Graphs:
#
# X-packets
# :X-packets
# :: Xsequencer_To_Outbuf: X-packets
src/lib/x-kit/xclient/src/wire/xsequencer-to-outbuf.pkg# :: . Xpacket_Sink: X-packets
src/lib/x-kit/xclient/src/wire/xpacket-sink.pkg# :: . : Xclient_To_Sequencer: Draw ops etc
src/lib/x-kit/xclient/src/wire/xclient-to-sequencer.pkg# :: . : : Xpacket_Sink: X-packets
src/lib/x-kit/xclient/src/wire/xpacket-sink.pkg# :: . : : .Xevent_Sink: X-events
src/lib/x-kit/xclient/src/wire/xevent-sink.pkg# :: . : : .: Windowsystem_To_Xevent_Router: note_new_hostwindow, get_window_site
src/lib/x-kit/xclient/src/window/windowsystem-to-xevent-router.pkg# :: . : : .: : Xevent_Router_To_Keymap: keycode_to_keysym()
src/lib/x-kit/xclient/src/window/xevent-router-to-keymap.pkg# :: . : : .: : . Windowsystem_To_Xserver: draw_ops. [1]
src/lib/x-kit/xclient/src/window/windowsystem-to-xserver.pkg# :: . : : .: : . : Window_Map_Event_Sink: track when a hostwindow is un/mapped
src/lib/x-kit/xclient/src/window/window-map-event-sink.pkg# :: . : : .: : . : :Xevent_Sink: Window property notifies
src/lib/x-kit/xclient/src/wire/xevent-sink.pkg# :: . : : .: : . : :. Client_To_Window_Watcher: watch_property, unused_property.
src/lib/x-kit/xclient/src/window/client-to-window-watcher.pkg# :: . : : .: : . : :. : Xevent_Sink: Selection xevents
src/lib/x-kit/xclient/src/wire/xevent-sink.pkg# :: . : : .: : . : :. : : Client_To_Atom: make_atom, find_atom, atom_to_string.
src/lib/x-kit/xclient/src/iccc/client-to-atom.pkg# :: . : : .: : . : :. : : .Client_To_Selection: acquire_selection, request_selection
src/lib/x-kit/xclient/src/window/client-to-selection.pkg# :: . : : .: : . : :. : : .: X-events. This link is set up by note_new_hostwindow().
# :: . : : .: : . : :. : : .: :
# OV . : : .: : . : :. : : .: : [ X server process ]
#
|O . V : .: : . : :. : : .: : inbuf_ximp
src/lib/x-kit/xclient/src/wire/inbuf-ximp.pkg# ^ O
| : .: : . : :. : : .: : outbuf_ximp
src/lib/x-kit/xclient/src/wire/outbuf-ximp.pkg# ^ O O V: : . : :. : : .: : xsequencer_ximp
src/lib/x-kit/xclient/src/wire/xsequencer-ximp.pkg#
| OV : . : :. : : .: : decode_xpackets_ximp
src/lib/x-kit/xclient/src/wire/decode-xpackets-ximp.pkg#
| O O V : :V : V .: V xevent_router_ximp
src/lib/x-kit/xclient/src/window/xevent-router-ximp.pkg#
| | O : :| : | .: | keymap_ximp
src/lib/x-kit/xclient/src/window/keymap-ximp.pkg# ^
| ^ O O| : | .: | xserver_ximp
src/lib/x-kit/xclient/src/window/xserver-ximp.pkg#
| | | |O O | v: | window_watcher_ximp
src/lib/x-kit/xclient/src/window/window-watcher-ximp.pkg#
| | | | | | O: | atom_ximp
src/lib/x-kit/xclient/src/iccc/atom-ximp.pkg# ^
| | | | O O | selection_ximp
src/lib/x-kit/xclient/src/window/selection-ximp.pkg#
| | ^ | | | *** xevent_to_widget_ximp NOT YET HOOKED UP!!! ***
src/lib/x-kit/xclient/src/window/xevent-to-widget-ximp.pkg#
| | | ^ | selection (not an imp -- unused iccc lib)
src/lib/x-kit/xclient/src/window/selection.pkg#
| | ^ | window_property (not an imp -- unused iccc lib) X-Specific
src/lib/x-kit/xclient/src/iccc/window-property.pkg# ============ ^ = ^ ========= O === guishim_imp_for_x ================================ Great Divide =================
src/lib/x-kit/widget/xkit/app/guishim-imp-for-x.pkg# The -state-imps and -look-imps mostly don't exist any more, replaced by
#
src/lib/x-kit/widget/xkit/theme/widget/default/look/widget-imp.pkg#
src/lib/x-kit/widget/xkit/theme/widget/default/look/sprite-imp.pkg#
src/lib/x-kit/widget/xkit/theme/widget/default/look/object-imp.pkg# so the below needs to be redone. -- 2014-07-22 CrT
# ball_state_imp
| O V X-Agnostic src /lib/x-kit/widget/space/sprite/ball/ball-state-imp.pkg <- Nonexistent!
# node_state_imp
| |O V src /lib/x-kit/widget/space/object/node/node-state-imp.pkg <- Nonexistent!
# bool_state_imp
| ||O V src /lib/x-kit/widget/space/widget/bool-state-imp.pkg <- Nonexistent!
# exception_state_imp
| |||O V src /lib/x-kit/widget/space/widget/exception-state-imp.pkg <- Nonexistent!
# float_state_imp
| ||||O V src /lib/x-kit/widget/space/widget/float-state-imp.pkg <- Nonexistent!
# image_state_imp
| |||||O - V src /lib/x-kit/widget/space/widget/image-state-imp.pkg <- Nonexistent!
# int_state_imp
| ||||||O V src /lib/x-kit/widget/space/widget/int-state-imp.pkg <- Nonexistent!
# string_state_imp
| |||||||O V src /lib/x-kit/widget/space/widget/string-state-imp.pkg <- Nonexistent!
#
| |||||||| |
# ball_look_imp
| |||||||| OO O V src /lib/x-kit/widget/xkit/theme/sprite/default/look/ball-look-imp.pkg
# node_look_imp
| |||||||| OO |O V src /lib/x-kit/widget/xkit/theme/object/default/look/node-look-imp.pkg
# exception_look_imp
| |||||||| OO ||O V src /lib/x-kit/widget/xkit/theme/widget/default/look/exception-look-imp.pkg
# bool_look_imp
| |||||||| OO ||O V src /lib/x-kit/widget/xkit/theme/widget/default/look/bool-look-imp.pkg
# float_look_imp
| |||||||| OO ||O V src /lib/x-kit/widget/xkit/theme/widget/default/look/float-look-imp.pkg
# image_look_imp
| |||||||| OO ||O V src /lib/x-kit/widget/xkit/theme/widget/default/look/image-look-imp.pkg
# int_look_imp
| |||||||| OO ||O V src /lib/x-kit/widget/xkit/theme/widget/default/look/int-look-imp.pkg
# string_look_imp
| |||||||| OO ||O V src /lib/x-kit/widget/xkit/theme/widget/default/look/string-look-imp.pkg
#
| |||||||| :| ||| |
# spritespace_imp
| |||||||| :| ^||O V|
src/lib/x-kit/widget/space/sprite/spritespace-imp.pkg# objectspace_imp
| |||||||| :| :^||O V|
src/lib/x-kit/widget/space/object/objectspace-imp.pkg# widgetspace_imp
| |||||||| :| ::^||O V|
src/lib/x-kit/widget/space/widget/widgetspace-imp.pkg#
| |||||||| :| :::||| ||
# sprite_theme
| |||||||| :| :::||| O ||
src/lib/x-kit/widget/xkit/theme/sprite/default/sprite-theme-imp.pkg# object_theme
| |||||||| :| :::||| |O ||
src/lib/x-kit/widget/xkit/theme/object/default/object-theme-imp.pkg# widget_theme
| |||||||| :| :::||| ||O||
src/lib/x-kit/widget/xkit/theme/widget/default/widget-theme-imp.pkg#
| |||||||| :| :::||| || ||
# guiboss_imp ^ ^^^^^^^^ :^ :::^^^ ^^^OOO
src/lib/x-kit/widget/gui/guiboss-imp.pkg# widget_unit_test : :::..::: :: :::::: :::::^
src/lib/x-kit/widget/widget-unit-test.pkg# : :::..::: :: :::::: ::::::
# : :::..::: :: :::::: :::::Client_To_Guiboss: make_hostwindow, start_gui ...
src/lib/x-kit/widget/gui/guiboss-types.pkg# : :::..::: :: :::::: ::::Gadget_To_Guiboss: note_changed_gadget_foreground, ...
src/lib/x-kit/widget/gui/guiboss-types.pkg# : :::..::: :: :::::: :::Space_To_Gui: note_widget_site
src/lib/x-kit/widget/gui/guiboss-types.pkg# : :::..::: :: :::::: ::Widget_Theme: make_float_widget_state_imp_egg, ... make_checkbox_widget, ...
src/lib/x-kit/widget/theme/widget/widget-theme.pkg# : :::..::: :: :::::: :Gui_To_Object_Theme:
src/lib/x-kit/widget/theme/object/gui-to-object-theme.pkg# : :::..::: :: :::::: Gui_To_Sprite_Theme:
src/lib/x-kit/widget/theme/sprite/gui-to-sprite-theme.pkg# : :::..::: :: :::::Guiboss_To_Widgetspace: pass_re_siting_done_flag
src/lib/x-kit/widget/gui/guiboss-types.pkg# : :::..::: :: ::::Guiboss_To_Objectspace:
src/lib/x-kit/widget/gui/guiboss-types.pkg# : :::..::: :: :::Guiboss_To_Spritespace:
src/lib/x-kit/widget/gui/guiboss-types.pkg# : :::..::: :: ::Guiboss_To_Widget: pass_draw_done_flag
src/lib/x-kit/widget/gui/guiboss-types.pkg# : :::..::: :: :Objectspace_To_Object: pass_draw_done_flag
src/lib/x-kit/widget/space/object/objectspace-to-object.pkg# : :::..::: :: Spritespace_To_Sprite: pass_draw_done_flag
src/lib/x-kit/widget/space/sprite/spritespace-to-sprite.pkg# : :::..::: :Guiboss_To_Gadget: redraw_gadget_request
src/lib/x-kit/widget/gui/guiboss-types.pkg# : :::..::: *::Value -> Void: notifications from state-imps to look-imps of state changes
# : :::..::String_State: set_state, subscribe_to_changes
# : :::..:Int_State: set_state, subscribe_to_changes
# : :::..Image_State: set_state, subscribe_to_changes
# : :::.Float_State: set_state, subscribe_to_changes
# : :::Exception_State: set_state, subscribe_to_changes
# : ::Bool_State: set_state, subscribe_to_changes
# : :Node_State: set_state, subscribe_to_changes src /lib/x-kit/widget/space/object/node/node-state.pkg
# : Ball_State: set_state, subscribe_to_changes src /lib/x-kit/widget/space/sprite/ball/ball-state.pkg
# Guiboss_To_Guishim: make_hostwindow(), draw_displaylist().
src/lib/x-kit/widget/theme/guiboss-to-guishim.pkg#
# Legend:
# O Implements this interface.
# ^V Calls this interface.
#
# Notes:
# [1] These links are set up by guishim_imp_for_x::make_hostwindow calls(),
# basically by xserver = xsession.default_screen.per_depth_imps.depth.
#
# o All communication between the X-Specific and X-Agnostic
# worlds should pass through guishim_imp_for_x: This
# is necessary if we are to be able to replace the
# X-Specific layer with (say) a Windows-Specific or
# Mac-Specific layer on a plug-and-play basis.
#
# Dramatis Personae:
#
# o The xsequencer_ximp matches replies to requests.
# All traffic to/from the X server goes through it.
# Implemented in:
src/lib/x-kit/xclient/src/wire/xsequencer-ximp.pkg#
# o The outbuf_ximp optimizes network usage by
# combining multiple requests per network packet.
# Implemented in:
src/lib/x-kit/xclient/src/wire/outbuf-ximp.pkg#
# o The inbuf_ximp breaks the incoming bytestream
# into individual replies and forwards them individually
# to xsequencer_ximp.
# Implemented in:
src/lib/x-kit/xclient/src/wire/inbuf-ximp.pkg#
# o The decode_xpackets_ximp cracks raw wire-format bytestrings into
# xevent_types::x::Event values and combines multiple related Expose
# events into a single logical Expose event for ease of downstream
# processing.
# Implemented in:
src/lib/x-kit/xclient/src/wire/decode-xpackets-ximp.pkg#
# o The xevent_router_ximp imp receives all X events
# (e.g. keystrokes and mouseclicks) and feeds each one to the
# appropriate toplevel window, or more precisely to the
# hostwindow_to_widget_router at the root of the widgettree for
# ("xevent_to_widget_ximp" might be a better name)
# that window, there to trickle down the widgettree to its ultimate
# target widget.
#
# To do this, xevent_router_ximp
# tracks all X windows created by the application,
# keyed by their X IDs. (Toplevel X windows are
# registered at creation by the window-old.pkg functions;
# subwindows are registered when their X notify event
# comes through.)
#
# Implemented in:
src/lib/x-kit/xclient/src/window/xevent-router-ximp.pkg# See also:
src/lib/x-kit/xclient/src/window/hostwindow-to-widget-router-old.pkg#
# o The font_index ...
# Implemented in:
src/lib/x-kit/xclient/src/window/font-index.pkg#
# o The keymap_ximp ...
# Implemented in:
src/lib/x-kit/xclient/src/window/keymap-ximp.pkg#
#
# o The xserver_ximp buffers draw commands and combines # xserver_ximp is from
src/lib/x-kit/xclient/src/window/xserver-ximp.pkg# them into subsequences which can share a single 2014-05-03 CrT: I believe the buffering has now been eliminated to reduce latency -- clients are now responsible for grouping draw commands.
# X server graphics context, in order to minimize
# the number of graphics context switches required.
# It works closely with the pen-to-gcontext-imp. 2014-05-03 CrT: pen-to-gcontext-imp has been replaced by
src/lib/x-kit/xclient/src/window/pen-cache.pkg# Implemented in:
#
# # (Detail: There is actually one xserver_ximp running
# # per visual, because the X protocol has a different
# # protocol namespace per depth etc. But in practice
# # all our GUI hostwindows will be the same depth on
# # the same X "screen" so we'll be doing all drawing
# # via one xserver_imp. There is also a separate
# # 'global' xserver_ximp shared by atom_ximp and # atom_ximp is from
src/lib/x-kit/xclient/src/iccc/atom-ximp.pkg# # selection_ximp. All of these xserver_ximps send # selection-ximp is from
src/lib/x-kit/xclient/src/window/selection-ximp.pkg# # to a single shared xsequencer_ximp.
#
#
#
# o We map between the immutable "pens" we provide to the application
# programmer and the mutable graphics contexts actually supported by
# the X server with the help of pen_cache which tracks available
# graphics contexts. Given a pen, we returns a matching graphics context,
# using an existing one unchanged if possible, else modifying an
# existing one appropropriately.
# pen_cache is implemented in:
src/lib/x-kit/xclient/src/window/pen-cache.pkg#
#
# All mouse and keyboard events flow down through the
# inbuf, sequencer, decoder and xevent-to-window ximps
# and thence down through the widget hierarchy
# associated with the relevant hostwindow.
#
# Client xserver requests and responses are sent
# directly to the sequencer imp, with the exception
# of font requests and responses, which run through
# the font imp.
#
# Keysym translations are handled by keymap_ximp.
#
# xclient-ximps wraps up the ximps
#
# inbuf_ximp; # inbuf_ximp is from
src/lib/x-kit/xclient/src/wire/inbuf-ximp.pkg# outbuf_ximp; # outbuf_ximp is from
src/lib/x-kit/xclient/src/wire/outbuf-ximp.pkg# xsequencer_ximp; # xsequencer_ximp is from
src/lib/x-kit/xclient/src/wire/xsequencer-ximp.pkg# decode_xpackets_ximp; # decode_xpackets_ximp is from
src/lib/x-kit/xclient/src/wire/decode-xpackets-ximp.pkg#
# to look like a single logical ximp to the rest of
# the system.
# Compiled by:
#
src/lib/x-kit/xclient/xclient-internals.sublibstipulate
include package threadkit; # threadkit is from
src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg #
#
package un = unt; # unt is from
src/lib/std/unt.pkg package v1u = vector_of_one_byte_unts; # vector_of_one_byte_unts is from
src/lib/std/src/vector-of-one-byte-unts.pkg package w2v = wire_to_value; # wire_to_value is from
src/lib/x-kit/xclient/src/wire/wire-to-value.pkg package g2d = geometry2d; # geometry2d is from
src/lib/std/2d/geometry2d.pkg package xtr = xlogger; # xlogger is from
src/lib/x-kit/xclient/src/stuff/xlogger.pkg package sok = socket__premicrothread; # socket__premicrothread is from
src/lib/std/socket--premicrothread.pkg package w2x = windowsystem_to_xserver; # windowsystem_to_xserver is from
src/lib/x-kit/xclient/src/window/windowsystem-to-xserver.pkg package exx = xserver_ximp; # xserver_ximp is from
src/lib/x-kit/xclient/src/window/xserver-ximp.pkg package r2k = xevent_router_to_keymap; # xevent_router_to_keymap is from
src/lib/x-kit/xclient/src/window/xevent-router-to-keymap.pkg package sex = xsession_ximps; # xsession_ximps is from
src/lib/x-kit/xclient/src/window/xsession-ximps.pkg package xwp = windowsystem_to_xevent_router; # windowsystem_to_xevent_router is from
src/lib/x-kit/xclient/src/window/windowsystem-to-xevent-router.pkg package x2s = xclient_to_sequencer; # xclient_to_sequencer is from
src/lib/x-kit/xclient/src/wire/xclient-to-sequencer.pkg package xes = xevent_sink; # xevent_sink is from
src/lib/x-kit/xclient/src/wire/xevent-sink.pkg package xew = xerror_well; # xerror_well is from
src/lib/x-kit/xclient/src/wire/xerror-well.pkg package xt = xtypes; # xtypes is from
src/lib/x-kit/xclient/src/wire/xtypes.pkg# package xet = xevent_types; # xevent_types is from
src/lib/x-kit/xclient/src/wire/xevent-types.pkg package ix = inbuf_ximp; # inbuf_ximp is from
src/lib/x-kit/xclient/src/wire/inbuf-ximp.pkg package ox = outbuf_ximp; # outbuf_ximp is from
src/lib/x-kit/xclient/src/wire/outbuf-ximp.pkg package sx = xsequencer_ximp; # xsequencer_ximp is from
src/lib/x-kit/xclient/src/wire/xsequencer-ximp.pkg package dxx = decode_xpackets_ximp; # decode_xpackets_ximp is from
src/lib/x-kit/xclient/src/wire/decode-xpackets-ximp.pkg package dy = display; # display is from
src/lib/x-kit/xclient/src/wire/display.pkg # These are purely temporary debug kludges to force these to compile:
#
Xserver_Ximp_Exports
= xserver_ximp::Exports; # xserver_ximp is from
src/lib/x-kit/xclient/src/window/xserver-ximp.pkgherein
# This impset is typically instantiated by:
#
#
src/lib/x-kit/xclient/src/window/xsession-junk.pkg package xclient_ximps
: Xclient_Ximps # Xclient_Ximps is from
src/lib/x-kit/xclient/src/window/xclient-ximps.api {
Imports = { # Ports we use, provided by other imps.
window_property_xevent_sink: xes::Xevent_Sink, # We'll forward X server PropertyNotify events to this sink.
selection_xevent_sink: xes::Xevent_Sink # We'll forward X server SelectionNotify, SelectionRequest and SelectionClear events to this sink.
};
Exports = { # Ports we provide for use by other imps.
windowsystem_to_xserver: w2x::Windowsystem_To_Xserver,
xevent_router_to_keymap: r2k::Xevent_Router_To_Keymap,
windowsystem_to_xevent_router: xwp::Windowsystem_To_Xevent_Router, # Provides note_new_hostwindow() and get_window_site().
xclient_to_sequencer: x2s::Xclient_To_Sequencer,
xerror_well: xew::Xerror_Well
};
Option = MICROTHREAD_NAME String; #
Xclient_Ximps_Egg = Void -> (Exports, (Imports, Run_Gun, End_Gun) -> Void);
fun process_options (options: List(Option), { name })
=
{ my_name = REF name;
#
apply do_option options
where
fun do_option (MICROTHREAD_NAME n) = my_name := n;
end;
{ name => *my_name };
};
##########################################################################################
# PUBLIC.
#
fun make_xclient_ximps_egg # PUBLIC. PHASE 1: Construct our state and initialize from 'options'.
(
socket: sok::Socket (X, sok::Stream(sok::Active)), # Socket to use.
xdisplay: dy::Xdisplay,
drawable: xt::Drawable_Id,
options: List(Option)
)
=
{ (process_options (options, { name => "tmp" }))
->
{ name };
me = { xserver_ximp_egg => exx::make_xserver_egg (xdisplay, drawable, []),
xsession_ximps_egg => sex::make_xsession_ximps_egg (socket, xdisplay, [])
};
\\ () = { # PUBLIC. PHASE 2: Start our microthread and return our Exports to caller.
(me.xserver_ximp_egg ()) -> (xserver_ximp_exports, xserver_ximp_egg' );
#
(me.xsession_ximps_egg ()) -> (xsession_ximps_exports, xsession_ximps_egg' );
xserver_ximp_exports -> { windowsystem_to_xserver, window_map_event_sink }; # window_map_event_sink is currently unused.
xsession_ximps_exports -> { xclient_to_sequencer, xerror_well, xevent_router_to_keymap, windowsystem_to_xevent_router };
fun phase3 # PUBLIC. PHASE 3: Accept our Imports, then wait for Run_Gun to fire.
(
imports: Imports,
run_gun': Run_Gun,
end_gun': End_Gun
)
=
{ imports -> { window_property_xevent_sink, selection_xevent_sink };
#
xserver_ximp_egg' ({ windowsystem_to_xevent_router, xclient_to_sequencer }, run_gun', end_gun');
xsession_ximps_egg' ({ window_property_xevent_sink, selection_xevent_sink }, run_gun', end_gun');
();
};
({ windowsystem_to_xserver, xevent_router_to_keymap, windowsystem_to_xevent_router, xclient_to_sequencer, xerror_well }, phase3);
};
};
}; # package xclient_ximps
end;