PreviousUpNext

15.3.805  src/lib/x-kit/xclient/src/wire/wire-to-value.api

## wire-to-value.api
#
# Routines to decode binary bytestring format
# reply, error and event messages received via
# socket from the X server into corresponding
# Mythryl values.
#
# The converse transformation is done by:
#     src/lib/x-kit/xclient/src/wire/value-to-wire.pkg
#
# The work of actually sending and recieving
# these bytestrings via socket is handled by
#     src/lib/x-kit/xclient/src/wire/xsocket-old.pkg
#
# The X11R6 wire protocol is documented here:
#     http://mythryl.org/pub/exene/X-protocol.pdf
#

# Compiled by:
#     src/lib/x-kit/xclient/xclient-internals.sublib

stipulate
    package g2d =  geometry2d;                                  # geometry2d                            is from   src/lib/std/2d/geometry2d.pkg
    package v8  =  vector_of_one_byte_unts;                     # vector_of_one_byte_unts               is from   src/lib/std/src/vector-of-one-byte-unts.pkg
    package v8s =  vector_slice_of_one_byte_unts;               # vector_slice_of_one_byte_unts         is from   src/lib/std/src/vector-slice-of-one-byte-unts.pkg
    package xt  =  xtypes;                                      # xtypes                                is from   src/lib/x-kit/xclient/src/wire/xtypes.pkg
herein

    api Wire_To_Value {
        #
        decode_alloc_color_cells_reply:  X -> { err: Y };
        decode_alloc_color_planes_reply: X -> { err: Y };

        decode_alloc_color_reply:       v8::Vector -> { pixel:     rgb8::Rgb8,                   visual_rgb: rgb::Rgb };
        decode_alloc_named_color_reply: v8::Vector -> { exact_rgb: rgb::Rgb,  pixel: rgb8::Rgb8, visual_rgb: rgb::Rgb };

        decode_connect_request_reply
            :
            ( v8::Vector,
              v8::Vector
            )
            ->
            xt::Xserver_Info;

        decode_error:                 v8::Vector -> xerrors::Xerror;
        decode_get_atom_name_reply:   v8::Vector -> String;
        decode_get_font_path_reply:   v8::Vector -> List(String);

        decode_get_geometry_reply:    v8::Vector -> { depth: Int,             geometry:  g2d::Window_Site, root:     xt::Xid };
        decode_get_image_reply:       v8::Vector -> { data:  v8s::Vector,     depth:     Int,                 visualid: Null_Or(xt::Visual_Id) };
        decode_get_input_focus_reply: v8::Vector -> { focus: xt::Input_Focus, revert_to: xt::Focus_Revert };

        decode_get_keyboard_control_reply: v8::Vector
                                           ->
                                           { auto_repeats:     v8s::Vector,
                                             #
                                             bell_duration:    Int,
                                             bell_pct:         Int,
                                             bell_pitch:       Int, 
                                             #
                                             glob_auto_repeat: Bool,
                                             key_click_pct:    Int, 
                                             led_mask:         one_word_unt::Unt
                                           };

        decode_get_keyboard_mapping_reply: v8::Vector -> List(List(xt::Keysym));

        decode_get_modifier_mapping_reply: v8::Vector
                                           ->
                                           { cntl_keycodes:  List(xt::Keycode),
                                             lock_keycodes:  List(xt::Keycode),
                                             #
                                             mod1_keycodes:  List(xt::Keycode),
                                             mod2_keycodes:  List(xt::Keycode),
                                             mod3_keycodes:  List(xt::Keycode),
                                             mod4_keycodes:  List(xt::Keycode),
                                             mod5_keycodes:  List(xt::Keycode),
                                             #
                                             shift_keycodes: List(xt::Keycode)
                                           };

        decode_get_motion_events_reply: v8::Vector
                                        ->
                                        List( { coord:     g2d::Point,
                                                timestamp: xt::Timestamp
                                              }
                                            );

        decode_get_pointer_control_reply: v8::Vector
                                          ->
                                          { acceleration_denominator: one_word_unt::Unt, 
                                            acceleration_numerator:   one_word_unt::Unt, 
                                            threshold:                one_word_unt::Unt
                                          };

        decode_get_pointer_mapping_reply: X -> { err: Y };

        decode_get_property_reply: v8::Vector
                                   ->
                                   Null_Or( { bytes_after: Int,  type: xt::Atom, value: xt::Raw_Data } );

        decode_get_screen_saver_reply: v8::Vector
                                       ->
                                       { allow_exposures: Bool,
                                         interval:        one_word_unt::Unt, 
                                         prefer_blanking: Bool,
                                         timeout:         one_word_unt::Unt
                                       };

        decode_get_selection_owner_reply: v8::Vector -> Null_Or(xt::Xid);

        decode_get_window_attributes_reply: v8::Vector
                                            ->
                                            { all_event_mask:    xt::Event_Mask, 
                                              #
                                              backing_pixel:     rgb8::Rgb8, 
                                              backing_planes:    xt::Plane_Mask, 
                                              backing_store:     xt::Backing_Store, 
                                              #
                                              bit_gravity:       xt::Gravity, 
                                              colormap:  Null_Or(xt::Xid), 
                                              #
                                              do_not_propagate:  xt::Event_Mask, 
                                              event_mask:        xt::Event_Mask,
                                              #
                                              input_only:        Bool, 
                                              map_is_installed:  Bool,
                                              #
                                              map_state:         xt::Map_State, 
                                              #
                                              override_redirect: Bool,
                                              save_under:        Bool, 
                                              #
                                              visual:            xt::Visual_Id, 
                                              window_gravity:    xt::Gravity
                                            };

        decode_grab_keyboard_reply:             v8::Vector -> xt::Grab_Status;
        decode_grab_pointer_reply:              v8::Vector -> xt::Grab_Status;

        decode_graphics_expose:                 v8::Vector -> xevent_types::x::Event;
        decode_intern_atom_reply:               v8::Vector -> xt::Atom;

        decode_list_extensions_reply:           v8::Vector -> List(String);
        decode_list_fonts_reply:                v8::Vector -> List(String);
        decode_list_hosts_reply:                v8::Vector -> { enabled: Bool,  hosts: List(xt::Xhost) };

        decode_list_installed_colormaps_reply:  v8::Vector -> List(xt::Xid);
        decode_list_properties_reply:           v8::Vector -> List(xt::Atom);

        decode_lookup_color_reply:              v8::Vector -> { exact_rgb: rgb::Rgb,  visual_rgb: rgb::Rgb };
        decode_no_expose:                       v8::Vector -> xevent_types::x::Event;

        decode_query_best_size_reply:           v8::Vector -> { high: Int,  wide: Int };
        decode_query_colors_reply:              v8::Vector -> List(rgb::Rgb);

        decode_query_extension_reply: X -> { err: Y };

        Font_Query_Reply =    { all_chars_exist:  Bool, 
                                char_infos:       List(xt::Char_Info), 
                                default_char:     Int,
                                draw_dir:         xt::Font_Drawing_Direction, 
                                #
                                font_ascent:      Int,
                                font_descent:     Int, 
                                #
                                max_bounds:  xt::Char_Info,
                                min_bounds:  xt::Char_Info,
                                #
                                max_byte1:   Int, 
                                min_byte1:   Int,
                                #
                                min_char:    Int, 
                                max_char:    Int,
                                #
                                properties: List(xt::Font_Prop)
                              };

        decode_query_font_reply: v8::Vector ->  Font_Query_Reply;

        decode_query_keymap_reply: X -> { err: Y };

        decode_query_pointer_reply: v8::Vector
                                    ->
                                    { child:       Null_Or(xt::Xid),
                                      #
                                      mousebuttons_state:  xt::Mousebuttons_State, 
                                      modifier_keys_state:   xt::Modifier_Keys_State, 
                                      #
                                      root:        xt::Xid,
                                      #
                                      root_point:     g2d::Point,
                                      window_point:   g2d::Point,
                                      #
                                      same_screen: Bool
                                    };

        decode_query_text_extents_reply: v8::Vector
                                         ->
                                         { draw_direction:  xt::Font_Drawing_Direction,
                                           #
                                           font_ascent:     one_word_unt::Unt,
                                           font_descent:    one_word_unt::Unt, 
                                           #
                                           overall_ascent:  one_word_unt::Unt, 
                                           overall_descent: one_word_unt::Unt,
                                           #
                                           overall_left:    one_word_unt::Unt, 
                                           overall_right:   one_word_unt::Unt,
                                           #
                                           overall_width:   one_word_unt::Unt
                                         };

        decode_query_tree_reply: v8::Vector
                                 ->
                                 { children: List(xt::Xid), 
                                   parent: Null_Or(xt::Xid),
                                   root: xt::Xid
                                 };

        decode_set_modifier_mapping_reply:  v8::Vector -> xt::Mapping_Status;
        decode_set_pointer_mapping_reply:   v8::Vector -> xt::Mapping_Status;

        decode_translate_coordinates_reply
            :
            v8::Vector
            ->
            { child:     Null_Or(xt::Xid), 
              to_point:  g2d::Point
            };

        decode_xpacket
            :
            ( one_byte_unt::Unt,        # Type byte -- byte 0 of next.
              v8::Vector                # The encoded X event in verbatim wire format as received from X server socket.
            )
            ->
            ( Bool,                     # If FALSE, event was generated via SendEvent rather than via normal mechanisms such as user input.
              xevent_types::x::Event    # Decoded X event.
            );
    };
end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext