## window.api
#
# The three kinds of X server rectangular arrays of pixels
# supported by x-kit are window, rw_pixmap and ro_pixmap.
#
# o 'window': are on-screen and on the X-server.
# o 'rw_pixmap': are off-screen and on the X-server.
# o 'ro_pixmap': offscreeen, immutable and on the X-server.
#
# These all have 'depth' (bits per pixel) and
# 'size' (in pixel rows and cols) information.
# Windows have in addition 'upperleft' position
# (relative to parent window) and border width in pixels.
#
# (A fourth kind of rectangular array of pixels is the
# client-side 'cs_pixmap_old'. These are not 'drawable', but
# pixels can be bitblt-ed between them and server-side
# windows and pixmaps.)
#
# See also:
#
src/lib/x-kit/widget/old/basic/hostwindow.api#
src/lib/x-kit/xclient/src/window/ro-pixmap-old.api#
src/lib/x-kit/xclient/src/window/cs-pixmap-old.pkg#
src/lib/x-kit/xclient/src/window/rw-pixmap-old.pkg# 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 xt = xtypes; # xtypes is from
src/lib/x-kit/xclient/src/wire/xtypes.pkg package g2d = geometry2d; # geometry2d is from
src/lib/std/2d/geometry2d.pkg# package xet = xevent_types; # xevent_types is from
src/lib/x-kit/xclient/src/wire/xevent-types.pkg #
# package dt = draw_types; # draw_types is from
src/lib/x-kit/xclient/src/window/draw-types.pkg package xr = cursors; # cursors is from
src/lib/x-kit/xclient/src/window/cursors.pkg package sn = xsession_junk; # xsession_junk is from
src/lib/x-kit/xclient/src/window/xsession-junk.pkg package ip = iccc_property; # iccc_property is from
src/lib/x-kit/xclient/src/iccc/iccc-property.pkg package wc = widget_cable; # widget_cable is from
src/lib/x-kit/xclient/src/window/widget-cable.pkg package wh = window_manager_hint; # window_manager_hint is from
src/lib/x-kit/xclient/src/iccc/window-manager-hint.pkgherein
# This api is implemented in:
#
src/lib/x-kit/xclient/src/window/window.pkg api Window {
#
# Window = dt::Window;
# User-level window attributes:
#
package a: api {
Window_Attribute
#
= BACKGROUND_NONE
| BACKGROUND_PARENT_RELATIVE
| BACKGROUND_RW_PIXMAP sn::Rw_Pixmap
| BACKGROUND_RO_PIXMAP sn::Ro_Pixmap
| BACKGROUND_COLOR rgb::Rgb
#
| BORDER_COPY_FROM_PARENT
| BORDER_RW_PIXMAP sn::Rw_Pixmap
| BORDER_RO_PIXMAP sn::Ro_Pixmap
| BORDER_COLOR rgb::Rgb
#
| BIT_GRAVITY xt::Gravity
| WINDOW_GRAVITY xt::Gravity
#
| CURSOR_NONE
| CURSOR xr::Xcursor
;
};
# Window configuration values:
#
package c: api {
Window_Config
#
= ORIGIN g2d::Point
| SIZE g2d::Size
| BORDER_WID Int
| STACK_MODE xt::Stack_Mode
| REL_STACK_MODE (sn::Window, xt::Stack_Mode)
;
};
exception BAD_WINDOW_SITE;
# Window location is relative to parent and
# does not take border width into account.
#
# For higher-level toplevel-window functionality see:
#
src/lib/x-kit/widget/old/basic/hostwindow.api #
# make_simple_top_window
# :
# sn::Screen
# ->
# { site: g2d::Window_Site,
# border_color: rgb::Rgb,
# background_color: rgb8::Rgb8
# }
# ->
# ( sn::Window,
# wc::Kidplug,
# Mailslot( Void )
# );
#
# make_simple_subwindow
# :
# sn::Window
# ->
# { site: g2d::Window_Site,
# border_color: Null_Or( rgb::Rgb ),
# background_color: Null_Or( rgb8::Rgb8 )
# }
# ->
# sn::Window;
#
# make_transient_window
# :
# sn::Window
# ->
# { site: g2d::Window_Site,
# border_color: rgb::Rgb,
# background_color: rgb8::Rgb8
# }
# ->
# (sn::Window, wc::Kidplug);
#
# make_simple_popup_window
# :
# sn::Screen
# ->
# { site: g2d::Window_Site,
# border_color: rgb::Rgb,
# background_color: rgb8::Rgb8
# }
# ->
# (sn::Window, wc::Kidplug);
#
# make_input_only_window
# :
# sn::Window -> g2d::Box -> sn::Window;
# We raise this exception on operations such as drawing
# that are illegal for InputOnly windows:
#
exception OP_UNSUPPORTED_ON_INPUT_ONLY_WINDOWS;
# commandline is from
src/lib/std/commandline.pkg # Set the properties of a top-level window.
#
# This should be done before showing (mapping)
# the window:
#
set_window_manager_properties
:
sn::Window
->
{
window_name: Null_Or( String ),
icon_name: Null_Or( String ),
#
commandline_arguments: List( String ), # Typically from: commandline::get_arguments ().
size_hints: List( wh::Window_Manager_Size_Hint ),
nonsize_hints: List( wh::Window_Manager_Nonsize_Hint ),
#
class_hints: Null_Or { resource_class: String,
resource_name: String
}
}
->
Void;
# Set window's window-manager protocols:
#
set_window_manager_protocols: sn::Window -> List( xt::Atom ) -> Bool;
# Various routines to reconfigure window layout
#
configure_window: sn::Window -> List(c::Window_Config) -> Void;
#
move_window: sn::Window -> g2d::Point -> Void;
resize_window: sn::Window -> g2d::Size -> Void;
move_and_resize_window: sn::Window -> g2d::Box -> Void;
# Map a point in the window's coordinate system
# to the screen's coordinate system
#
window_point_to_screen_point: sn::Window -> g2d::Point -> g2d::Point;
set_cursor: sn::Window -> Null_Or( xr::Xcursor ) -> Void;
set_background_color: sn::Window -> Null_Or( rgb::Rgb ) -> Void;
#
# Set the background color attribute of the window.
# This does not have an immediate effect on the
# window's contents but if it is done before the
# window is shown (mapped) the window will come up
# with the right color.
change_window_attributes: sn::Window -> List( a::Window_Attribute ) -> Void;
#
# Set various window attributes.
show_window: sn::Window -> Void; # Show ("map") window. Won't actually show unless all ancestors show.
hide_window: sn::Window -> Void; # Opposide of show.
withdraw_window: sn::Window -> Void; # Sends UnmapNotify to root window of window. I don't get this one yet.
destroy_window: sn::Window -> Void; # In X, destroying a window destroys all its subwindows also, recursively.
screen_of_window: sn::Window -> sn::Screen;
xsession_of_window: sn::Window -> sn::Xsession;
grab_keyboard: sn::Window -> Int;
ungrab_keyboard: sn::Window -> Int;
standard_xevent_mask: xt::Event_Mask;
rgb8_of: rgb::Rgb -> rgb8::Rgb8;
get_window_site: sn::Window -> g2d::Box;
#
# Get size of window plus its location
# relative to parent.
# note_''seen_first_expose''_oneshot: sn::Window -> Oneshot_Maildrop(Void) -> Void;
#
# Infrastructure -- see comments in
src/lib/x-kit/xclient/src/window/window-old.pkg get_''seen_first_expose''_oneshot_of: sn::Window -> Oneshot_Maildrop(Void);
#
# This function makes the above oneshot
# available to clients with access to
# the Window but not the Widget. Clients
# with access to the Widget should use the
#
# widget::seen_first_redraw_oneshot_of
#
# call because it is guaranteed to return
# the required oneshot; the above call may
# return NULL, in which case the client thread
# will have to sleep a bit and then retry.
get_''gui_startup_complete''_oneshot_of # get_''gui_startup_complete''_oneshot_of def in
src/lib/x-kit/xclient/src/window/xsession-old.pkg :
sn::Window -> Oneshot_Maildrop(Void); # See comments in
src/lib/x-kit/xclient/src/window/xsocket-to-hostwindow-router-old.api # Make 'window' receive a (faked) keyboard keypress at 'point'.
# 'window' should be the sub/window actually holding the widget to be activate.
# 'point' should be the click point in that window's coordinate system.
#
# 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_press_xevent
:
{ window: sn::Window, # Window handling the keyboard key press event.
keycode: xt::Keycode, # Keyboard key just clicked down.
point: g2d::Point
}
->
Void
;
# Make 'window' receive a (faked) keyboard key release at 'point'.
# 'window' should be the sub/window actually holding the widget to be activate.
# 'point' should be the click point in that window's coordinate system.
#
# 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_xevent
:
{ window: sn::Window, # Window handling the keyboard key press event.
keycode: xt::Keycode, # Keyboard key just clicked down.
point: g2d::Point
}
->
Void
;
# Make 'window' receive a (faked) mousebutton click at 'point'.
# 'window' should be the sub/window actually holding the widget to be activate.
# 'point' should be the click point in that window's coordinate system.
#
# 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_xevent
:
{ window: sn::Window, # Window handling the mouse-button click event.
button: xt::Mousebutton, # Mouse button just clicked down.
point: g2d::Point
}
->
Void
;
# Counterpart of previous: make 'window' receive a (faked) mousebutton release at 'point'.
# 'window' should be the sub/window actually holding the widget to be activate.
# 'point' should be the button-release point in that window's coordinate system.
#
#
# 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_xevent
:
{ window: sn::Window, # Window handling the mouse-button release event.
button: xt::Mousebutton, # Mouse button just released.
point: g2d::Point
}
->
Void
;
# This call may be used to simulate mouse "drag" operations in unit-test code.
# 'window' should be the sub/window actually holding the widget to be activate.
# 'point' should be the supposed mouse-pointer location in that window's coordinate system.
#
# 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_xevent
:
{ window: sn::Window, # Window handling the mouse-button release event.
buttons: List(xt::Mousebutton), # Mouse button(s) being dragged.
point: 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 propertly we
# must synthesize those also:
#
send_fake_''mouse_enter''_xevent
:
{ window: sn::Window, # Window handling the event.
point: g2d::Point # End-of-event coordinate, thus should be just inside window.
}
->
Void
;
#
send_fake_''mouse_leave''_xevent
:
{ window: sn::Window, # Window handling the event.
point: g2d::Point # End-of-event coordinate, thus should be just outside window.
}
->
Void
;
};
end;
## COPYRIGHT (c) 1990, 1991 by John H. Reppy. See SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.