## guiboss-to-guishim.pkg
#
# For the big picture see the imp dataflow diagrams in
src/lib/x-kit/widget/theme/guishim-imp.api#
#
src/lib/x-kit/xclient/src/window/xclient-ximps.pkg#
# This port passes requests from
#
#
src/lib/x-kit/widget/gui/guiboss-imp.pkg# to
#
src/lib/x-kit/widget/xkit/app/guishim-imp-for-x.pkg#
# See also:
#
src/lib/x-kit/widget/theme/app-to-guishim-xspecific.pkg# Compiled by:
#
src/lib/x-kit/widget/xkit-widget.sublibstipulate
include package threadkit; # threadkit is from
src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg #
package a2r = windowsystem_to_xevent_router; # windowsystem_to_xevent_router is from
src/lib/x-kit/xclient/src/window/windowsystem-to-xevent-router.pkg package gd = gui_displaylist; # gui_displaylist is from
src/lib/x-kit/widget/theme/gui-displaylist.pkg package mtx = rw_matrix; # rw_matrix is from
src/lib/std/src/rw-matrix.pkg package r8 = rgb8; # rgb8 is from
src/lib/x-kit/xclient/src/color/rgb8.pkg package w2x = windowsystem_to_xserver; # windowsystem_to_xserver is from
src/lib/x-kit/xclient/src/window/windowsystem-to-xserver.pkg package g2d = geometry2d; # geometry2d is from
src/lib/std/2d/geometry2d.pkg package g2p = gadget_to_pixmap; # gadget_to_pixmap is from
src/lib/x-kit/widget/theme/gadget-to-pixmap.pkg #
package evt = gui_event_types; # gui_event_types is from
src/lib/x-kit/widget/gui/gui-event-types.pkgherein
# This port is implemented in:
#
#
src/lib/x-kit/widget/xkit/app/guishim-imp-for-x.pkg #
# It gets passed as an import to
#
#
src/lib/x-kit/widget/gui/guiboss-imp.pkg #
package guiboss_to_guishim {
#
Guiboss_To_Hostwindow
=
{ id: Id, # Unique id to facilitate storing instances in indexed datastructures like red-black trees.
#
draw_displaylist: gd::Gui_Displaylist -> Void, # This call lets guiboss draw widgets. (subwindow_or_view.draw_displaylist lets it draw on the backing pixmap.)
get_font: List(String) -> evt::Font, # Arg is a list of font names to try in order; "fixed" will be appended (which is guaranteed present in X). Multiple round trips to the X server may be required to complete this call.
pass_font: List(String) -> Replyqueue -> (evt::Font -> Void) -> Void, # Nonblocking version of previous, for use in imps.
get_window_site: Void -> g2d::Window_Site,
pass_window_site: Replyqueue -> (g2d::Window_Site -> Void) -> Void,
subscribe_to_changes: # Lets guiboss subscribe to changes in window size/position.
( { # This record is guishim-imp-for-x.pkg: Windowsystem_Needs, but that name would produce a package cycle.
}
-> Void
)
-> Void,
#
exercise_appwindow: Void -> (Void -> Void), # Executing returned thunk will wait for completion of window exercise.
pass_appwindow_exercise_results: Replyqueue -> (Int -> Void) -> Void, #
# The following calls are intended for unit testing, in
# particular in
src/lib/x-kit/widget/widget-unit-test.pkg send_fake_key_press_event: (evt::Keycode, g2d::Point) -> Void, # Make 'window' receive a (faked) keyboard keypress at 'point'.
# ^ # 'point' should be the click point in that window's coordinate system.
#
|
#
# Keyboard key just pressed down. #
# NOTE! We send the event via the X server to provide full end-to-end testing;
# the resulting network round trip will be quite slow, making this call
# generally inappropriate for anything other than unit test code.
send_fake_key_release_event: (evt::Keycode, g2d::Point) -> Void, # Make 'window' receive a (faked) keyboard key release at 'point'.
# ^ # 'point' should be the click point in that window's coordinate system.
#
|
#
# Keyboard key just released. #
# NOTE! We send the event via the X server to provide full end-to-end testing;
# the resulting network round trip will be quite slow, making this call
# generally inappropriate for anything other than unit test code.
send_fake_mousebutton_press_event: (evt::Mousebutton, g2d::Point) -> Void, # Make 'window' receive a (faked) mousebutton click at 'point'.
# ^ # 'point' should be the click point in that window's coordinate system.
#
|
#
# Mouse button just clicked down. #
# NOTE! We send the event via the X server to provide full end-to-end testing;
# the resulting network round trip will be quite slow, making this call
# generally inappropriate for anything other than unit test code.
send_fake_mousebutton_release_event: (evt::Mousebutton, g2d::Point) -> Void, # Counterpart of previous: make 'window' receive a (faked) mousebutton release at 'point'.
# ^ # 'point' should be the button-release point in that window's coordinate system.
#
|
#
# Mouse button just released. #
# NOTE! We send the event via the X server to provide full end-to-end testing;
# the resulting network round trip will be quite slow, making this call
# generally inappropriate for anything other than unit test code.
#
send_fake_mouse_motion_event: (List(evt::Mousebutton), g2d::Point) -> Void, # This call may be used to simulate mouse "drag" operations in unit-test code.
# ^ # 'point' should be the supposed mouse-pointer location in that window's coordinate system.
#
|
#
# Mouse button(s) being dragged. #
# NOTE! We send the event via the X server to provide full end-to-end testing;
# the resulting network round trip will be quite slow, making this call
# generally inappropriate for anything other than unit test code.
send_fake_''mouse_enter''_event: (g2d::Point) -> Void, # The xkit buttons react not just to mouse-up and mouse-down events but also
# ^ # to mouse-enter and mouse-leave events, so to auto-test them properly we
#
|
# must synthesize those also.
# End-of-event coordinate, thus should be just inside window. #
send_fake_''mouse_leave''_event: (g2d::Point) -> Void, # The xkit buttons react not just to mouse-up and mouse-down events but also
# ^ # to mouse-enter and mouse-leave events, so to auto-test them properly we
#
|
# must synthesize those also.
# End-of-event coordinate, thus should be just outnside window. #
get_pixel_rectangle: g2d::Box -> mtx::Rw_Matrix( r8::Rgb8 ), # Arg is pixel rectangle to read, in window coordinates. Result is RGB values for those pixels. NB: Results are undefined if window is not fully visible.
#
pass_pixel_rectangle: g2d::Box -> Replyqueue # Nonblocking version of previous, for imps.
-> (mtx::Rw_Matrix(r8::Rgb8) -> Void)
-> Void,
subwindow_or_view: g2p::Gadget_To_Rw_Pixmap
};
Hostwindow_Hint
#
= SITE g2d::Window_Site # Requested size-in-pixels + position for hostwindow. (Window managers often ignore position part.)
| BACKGROUND_PIXEL r8::Rgb8
# Background color for hostwindow.
| BORDER_PIXEL r8::Rgb8
;
Hostwindow_Hints = List( Hostwindow_Hint );
Guiboss_To_Guishim
=
{ id: Id, # Unique id to facilitate storing appwindow instances in indexed datastructures like red-black trees.
#
make_hostwindow: (Hostwindow_Hints, (a2r::Envelope_Route, evt::x::Event) -> Void)
->
Guiboss_To_Hostwindow,
make_rw_pixmap: g2d::Size -> g2p::Gadget_To_Rw_Pixmap, # Create an off-screen pixmap on X server for application to save stuff in.
root_window_size: Void -> { root_window_size_in_pixels: g2d::Size, # So widget-unit-test.pkg etc can scale hostwindows to available screensize.
root_window_size_in_mm: g2d::Size
}
};
Windowsystem_Needs
=
{ # Currently nothing.
};
Windowsystem_Option
#
= MICROTHREAD_NAME String #
| ID Id
# Unique ID for imp, issued by issue_unique_id::issue_unique_id().
| CHANGE_CALLBACK Windowsystem_Needs -> Void
# We'll call each of these callbacks each time our value changes.
| WINDOWSYSTEM_CALLBACK Guiboss_To_Guishim -> Void
# Client code registers this callback to get a port to us once we start up.
;
Windowsystem_Arg = (Windowsystem_Needs, List(Windowsystem_Option));
}; # package appwindow;
end;