


## 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'. 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/basic/topwindow.api# src/lib/x-kit/xclient/pkg/window/ro-pixmap.api# src/lib/x-kit/xclient/pkg/window/cs-pixmap.pkg# src/lib/x-kit/xclient/pkg/window/rw-pixmap.pkg# Compiled by:
# src/lib/x-kit/xclient/xclient-internals.sublib# This api is implemented in:
# src/lib/x-kit/xclient/pkg/window/window.pkgstipulate
include threadkit; # threadkit is from src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg #
package dt = draw_types; # draw_types is from src/lib/x-kit/xclient/pkg/window/draw-types.pkg package xt = xtypes; # xtypes is from src/lib/x-kit/xclient/pkg/wire/xtypes.pkg package xg = xgeometry; # xgeometry is from src/lib/std/2d/xgeometry.pkg package xr = cursors; # cursors is from src/lib/x-kit/xclient/pkg/window/cursors.pkg package sn = xsession; # xsession is from src/lib/x-kit/xclient/pkg/window/xsession.pkg package ip = iccc_property; # iccc_property is from src/lib/x-kit/xclient/pkg/iccc/iccc-property.pkg package wc = widget_cable; # widget_cable is from src/lib/x-kit/xclient/pkg/window/widget-cable.pkg package wh = window_manager_hint; # window_manager_hint is from src/lib/x-kit/xclient/pkg/iccc/window-manager-hint.pkg package et = event_types; # event_types is from src/lib/x-kit/xclient/pkg/wire/event-types.pkgherein
api Window {
Window = dt::Window;
# User-level window attributes:
#
package a: api {
Window_Attribute
#
= BACKGROUND_NONE
| BACKGROUND_PARENT_RELATIVE
| BACKGROUND_RW_PIXMAP dt::Rw_Pixmap
| BACKGROUND_RO_PIXMAP dt::Ro_Pixmap
| BACKGROUND_COLOR rgb::Rgb
#
| BORDER_COPY_FROM_PARENT
| BORDER_RW_PIXMAP dt::Rw_Pixmap
| BORDER_RO_PIXMAP dt::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 xg::Point
| SIZE xg::Size
| BORDER_WID Int
| STACK_MODE xt::Stack_Mode
| REL_STACK_MODE (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/basic/topwindow.api #
make_simple_top_window
:
sn::Screen
->
{ site: xg::Window_Site,
border_color: rgb::Rgb,
background_color: rgb8::Rgb8
}
->
( Window,
wc::Kidplug,
Mailslot( Void )
);
make_simple_subwindow
:
Window
->
{ site: xg::Window_Site,
border_color: Null_Or( rgb::Rgb ),
background_color: Null_Or( rgb8::Rgb8 )
}
->
Window;
make_transient_window
:
Window
->
{ site: xg::Window_Site,
border_color: rgb::Rgb,
background_color: rgb8::Rgb8
}
->
(Window, wc::Kidplug);
make_simple_popup_window
:
sn::Screen
->
{ site: xg::Window_Site,
border_color: rgb::Rgb,
background_color: rgb8::Rgb8
}
->
(Window, wc::Kidplug);
make_input_only_window
:
Window -> xg::Box -> Window;
# We raise this exception on operations such as drawing
# that are illegal for InputOnly windows:
#
exception OP_UNSUPPORTED_ON_INPUT_ONLY_WINDOWS;
# iccc_property is from src/lib/x-kit/xclient/pkg/iccc/iccc-property.pkg # 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
:
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: Window -> List( xt::Atom ) -> Bool;
# Various routines to reconfigure window layout
#
configure_window: Window -> List(c::Window_Config) -> Void;
#
move_window: Window -> xg::Point -> Void;
resize_window: Window -> xg::Size -> Void;
move_and_resize_window: Window -> xg::Box -> Void;
# Map a point in the window's coordinate system
# to the screen's coordinate system
#
window_point_to_screen_point: Window -> xg::Point -> xg::Point;
set_cursor: Window -> Null_Or( xr::Xcursor ) -> Void;
set_background_color: 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: Window -> List( a::Window_Attribute ) -> Void;
#
# Set various window attributes.
show_window: Window -> Void; # Show ("map") window. Won't actually show unless all ancestors show.
hide_window: Window -> Void; # Opposide of show.
withdraw_window: Window -> Void; # Sends UnmapNotify to root window of window. I don't get this one yet.
destroy_window: Window -> Void; # In X, destroying a window destroys all its subwindows also, recursively.
screen_of_window: Window -> sn::Screen;
xsession_of_window: Window -> sn::Xsession;
grab_keyboard: Window -> Int;
ungrab_keyboard: Window -> Int;
standard_xevent_mask: xt::Event_Mask;
rgb8_of: rgb::Rgb -> rgb8::Rgb8;
get_window_site: Window -> xg::Box;
#
# Get size of window plus its location
# relative to parent.
note_''seen_first_expose''_oneshot: Window -> Oneshot_Maildrop(Void) -> Void;
#
# Infrastructure -- see comments in src/lib/x-kit/xclient/pkg/window/window.pkg get_''seen_first_expose''_oneshot_of: Window -> Null_Or(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/pkg/window/xsession.pkg :
Window -> Oneshot_Maildrop(Void); # See comments in src/lib/x-kit/xclient/pkg/window/xsocket-to-topwindow-router.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_keyboard_key_press_xevent
:
{ window: Window, # Window handling the keyboard key press event.
keycode: xt::Keycode, # Keyboard key just clicked down.
point: xg::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_keyboard_key_release_xevent
:
{ window: Window, # Window handling the keyboard key press event.
keycode: xt::Keycode, # Keyboard key just clicked down.
point: xg::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_mousebutton_press_xevent
:
{ window: Window, # Window handling the mouse-button click event.
button: xt::Mousebutton, # Mouse button just clicked down.
point: xg::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_mousebutton_release_xevent
:
{ window: Window, # Window handling the mouse-button release event.
button: xt::Mousebutton, # Mouse button just released.
point: xg::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_mouse_motion_xevent
:
{ window: Window, # Window handling the mouse-button release event.
buttons: List(xt::Mousebutton), # Mouse button(s) being dragged.
point: xg::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_''mouse_enter''_xevent
:
{ window: Window, # Window handling the event.
point: xg::Point # End-of-event coordinate, thus should be just inside window.
}
->
Void
;
#
send_''mouse_leave''_xevent
:
{ window: Window, # Window handling the event.
point: xg::Point # End-of-event coordinate, thus should be just outside window.
}
->
Void
;
};
end;
## COPYRIGHT (c) 1990, 1991 by John H. Reppy. See COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


