## xsession-ximps.pkg
#
# For the big picture see the imp dataflow diagrams in
#
#
src/lib/x-kit/xclient/src/window/xclient-ximps.pkg#
# xsession-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 op = xsequencer_to_outbuf; # xsequencer_to_outbuf is from
src/lib/x-kit/xclient/src/wire/xsequencer-to-outbuf.pkg package xew = xerror_well; # xerror_well is from
src/lib/x-kit/xclient/src/wire/xerror-well.pkg package x2s = xclient_to_sequencer; # xclient_to_sequencer is from
src/lib/x-kit/xclient/src/wire/xclient-to-sequencer.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 xes = xevent_sink; # xevent_sink is from
src/lib/x-kit/xclient/src/wire/xevent-sink.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 fx = font_index; # font_index is from
src/lib/x-kit/xclient/src/window/font-index.pkg package kx = keymap_ximp; # keymap_ximp is from
src/lib/x-kit/xclient/src/window/keymap-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 xwx = xevent_router_ximp; # xevent_router_ximp is from
src/lib/x-kit/xclient/src/window/xevent-router-ximp.pkg package sox = xsocket_ximps; # xsocket_ximps is from
src/lib/x-kit/xclient/src/wire/xsocket-ximps.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:
#
Keymap_Ximp_Exports = keymap_ximp::Exports;
Xevent_Router_Ximp_Exports
=
xevent_router_ximp::Exports; # xevent_router_ximp is from
src/lib/x-kit/xclient/src/window/xevent-router-ximp.pkgherein
# This impset is typically instantiated by:
#
#
src/lib/x-kit/xclient/src/window/xclient-ximps.pkg package xsession_ximps
: Xsession_Ximps # Xsession_Ximps is from
src/lib/x-kit/xclient/src/window/xsession-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.
xclient_to_sequencer: x2s::Xclient_To_Sequencer, # Requests from widget/application code.
xerror_well: xew::Xerror_Well, # Errors from the X server.
xevent_router_to_keymap: r2k::Xevent_Router_To_Keymap, # Requests from widget/application code.
windowsystem_to_xevent_router: xwp::Windowsystem_To_Xevent_Router #
};
Option = MICROTHREAD_NAME String; #
Xsession_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_xsession_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,
options: List(Option)
)
=
{ (process_options (options, { name => "tmp" }))
->
{ name };
me = { keymap_egg => kx::make_keymap_egg (xdisplay, []),
xevent_router_egg => xwx::make_xevent_router_egg [],
xsocket_ximps_egg => sox::make_xsocket_ximps_egg (socket, [])
};
\\ () = { # PUBLIC. PHASE 2: Start our microthread and return our Exports to caller.
(me.keymap_egg ()) -> (keymap_exports, keymap_egg' );
(me.xevent_router_egg ()) -> (xevent_to_window_exports, xevent_router_egg' );
(me.xsocket_ximps_egg ()) -> (xsocket_ximps_exports, xsocket_ximps_egg' );
xevent_router_to_keymap = keymap_exports.xevent_router_to_keymap;
xclient_to_sequencer = xsocket_ximps_exports.xclient_to_sequencer;
xerror_well = xsocket_ximps_exports.xerror_well;
windowsystem_to_xevent_router = xevent_to_window_exports.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
)
=
{
xclient_to_sequencer = xsocket_ximps_exports.xclient_to_sequencer;
xevent_router_to_keymap = keymap_exports.xevent_router_to_keymap;
xevent_sink = xevent_to_window_exports.xevent_sink;
window_property_xevent_sink = imports.window_property_xevent_sink;
selection_xevent_sink = imports.selection_xevent_sink;
keymap_egg' ( { xclient_to_sequencer },
run_gun', end_gun'
);
xevent_router_egg' ( { xevent_router_to_keymap,
window_property_xevent_sink,
selection_xevent_sink
},
run_gun', end_gun'
);
xsocket_ximps_egg' ( { xevent_sink },
run_gun', end_gun'
);
();
};
({ xclient_to_sequencer, xerror_well, xevent_router_to_keymap, windowsystem_to_xevent_router }, phase3);
};
};
}; # package xsession_ximps
end;