PreviousUpNext

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

## value-to-wire.api
#
# Generate binary-bytestring format
# X11 protocol requests suitable for
# writing to the X server socket.

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

# This api is implemented in:
#     src/lib/x-kit/xclient/src/wire/value-to-wire.pkg

stipulate
    package ge  =  geometry2d;                  # geometry2d    is from   src/lib/std/2d/geometry2d.pkg
    package rwv =  rw_vector;                   # rw_vector     is from   src/lib/std/src/rw-vector.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 xt  =  xtypes;                      # xtypes        is from   src/lib/x-kit/xclient/src/wire/xtypes.pkg
herein
    api Value_To_Wire {

        graph_op_to_wire:        xt::Graphics_Op -> Unt;
        gravity_to_wire:         xt::Gravity     -> Unt;
        bool_to_wire:            Bool            -> Unt;
        stack_mode_to_wire:      xt::Stack_Mode  -> Unt;

        do_val_list
            :  Int
            -> (rwv::Rw_Vector( Null_Or(Unt) ) -> X -> Void)
            -> List(X)
            -> xt::Value_List
            ;

        encode_alloc_color:       { cmap: xt::Xid,  color: rgb::Rgb }            -> v8::Vector;
        encode_alloc_named_color: { cmap: xt::Xid,  name: String }               -> v8::Vector;
        encode_allow_events:      { mode: xt::Event_Mode,  time: xt::Timestamp } -> v8::Vector;

        encode_bell: { percent: Int } -> v8::Vector;

        encode_change_active_pointer_grab: { cursor:      Null_Or(xt::Xid), 
                                             event_mask:  xt::Event_Mask, 
                                             time:        xt::Timestamp
                                           }
                                           -> v8::Vector;

        encode_change_gc:               { gc_id: xt::Xid,    vals: xt::Value_List } -> v8::Vector;
        encode_change_hosts:            { host:  xt::Xhost,  remove: Bool         } -> v8::Vector;
        encode_change_keyboard_control: { vals:  xt::Value_List                   } -> v8::Vector;

        encode_change_pointer_control: { acceleration:  Null_Or( { denominator: Int,  numerator: Int } ), 
                                         threshold:     Null_Or( Int )
                                       }
                                       -> v8::Vector;

        encode_change_property: { window_id: xt::Xid,
                                  mode:      xt::Change_Property_Mode, 
                                  name:      xt::Atom,
                                  property:  xt::Property_Value
                                  
                                }
                                -> v8::Vector;

        encode_change_save_set
            :
            { window_id:  xt::Xid,
              insert:     Bool
            }
            ->
            v8::Vector;

        encode_change_window_attributes
            :
            { window_id:   xt::Xid,
              attributes:  List( xt::a::Window_Attribute )
            }
            ->
            v8::Vector;

        encode_circulate_window
            :
            { window_id:  xt::Xid,
              parent_id:  xt::Xid,
              place:      xt::Stack_Pos
              
            }
            ->
            v8::Vector;

        encode_clear_area:       { box: ge::Box,  exposures: Bool, window_id: xt::Xid }      -> v8::Vector;
        encode_close_font:       { font: xt::Xid }                                           -> v8::Vector;
        encode_configure_window: { vals: xt::Value_List,  window_id: xt::Xid }               -> v8::Vector;

        encode_xserver_connection_request
            :
            { xauthentication:   Null_Or( xt::Xauthentication ),
              minor_version:     Int
            }
            ->
            v8::Vector;

        encode_convert_selection: { property:  Null_Or(xt::Atom), 
                                    requestor: xt::Xid,
                                    selection: xt::Atom, 
                                    target:    xt::Atom,
                                    timestamp: xt::Timestamp
                                  }
                                  -> v8::Vector;

        encode_copy_area: { from:       xt::Xid,
                            to:         xt::Xid,
                            #
                            from_point: ge::Point, 
                            to_point:   ge::Point,
                            #
                            gc_id:      xt::Xid,
                            size:       ge::Size
                          }
                          -> v8::Vector;

        encode_copy_colormap_and_free: { from: xt::Xid,  to: xt::Xid }                      -> v8::Vector;

        encode_copy_gc: { from: xt::Xid,
                          to:   xt::Xid,
                          mask: xt::Value_Mask
                        }
                        -> v8::Vector;

        encode_copy_plane: { from: xt::Xid,  from_point: ge::Point, 
                             to:   xt::Xid,  to_point:   ge::Point,
                             #
                             gc_id: xt::Xid,
                             plane: Int,
                             size:  ge::Size
                           }
                           -> v8::Vector;

        encode_create_colormap: { all_writable: Bool,
                                  cmap:         xt::Xid, 
                                  visual:       xt::Xid,
                                  window_id:    xt::Xid
                                }
                                -> v8::Vector;

        encode_create_cursor: { background_rgb: rgb::Rgb,
                                foreground_rgb: rgb::Rgb,
                                cursor:         xt::Xid, 
                                from:           xt::Xid, 
                                hot_spot:       ge::Point, 
                                mask:           Null_Or(xt::Xid)
                              }
                              -> v8::Vector;

        encode_create_gc: { drawable: xt::Xid,
                            gc_id:    xt::Xid, 
                            vals:     xt::Value_List
                          }
                          -> v8::Vector;

        encode_create_glyph_cursor: { background_rgb: rgb::Rgb,
                                      foreground_rgb: rgb::Rgb,
                                      #
                                      mask_chr:       Int, 
                                      src_chr:        Int, 
                                      #
                                      src_font:               xt::Xid,
                                      mask_font:      Null_Or(xt::Xid),
                                      cursor:                 xt::Xid
                                    }
                                    -> v8::Vector;

        encode_create_pixmap: { depth:          Int,
                                drawable_id:    xt::Xid, 
                                pixmap_id:      xt::Xid,
                                size:           ge::Size
                              }
                              -> v8::Vector;

        encode_create_window: { window_id:              xt::Xid,
                                parent_window_id:       xt::Xid, 
                                #
                                visual_id:  xt::Visual_Id_Choice,
                                depth:      Int,
                                site:       ge::Window_Site, 
                                io_class:   xt::Io_Class,
                                attributes: List( xt::a::Window_Attribute )
                              }
                              -> v8::Vector;

        encode_delete_property:    { window_id: xt::Xid, property: xt::Atom } -> v8::Vector;
        encode_destroy_subwindows: { window_id: xt::Xid                     } -> v8::Vector;
        encode_destroy_window:     { window_id: xt::Xid                     } -> v8::Vector;

        encode_fill_poly: { drawable:  xt::Xid,
                            gc_id:     xt::Xid, 
                            points:    List(ge::Point),
                            relative:  Bool, 
                            shape:     xt::Shape
                          }
                          -> v8::Vector;

        encode_force_screen_saver: { activate: Bool    }  -> v8::Vector;
        encode_free_colormap:      { cmap:     xt::Xid }  -> v8::Vector;

        encode_free_colors: { cmap:        xt::Xid,
                              pixels:      List(rgb8::Rgb8), 
                              plane_mask:  xt::Plane_Mask
                            }
                            -> v8::Vector;

        encode_free_cursor:   { cursor:   xt::Xid  } -> v8::Vector;
        encode_free_gc:       { gc_id:    xt::Xid  } -> v8::Vector;
        encode_free_pixmap:   { pixmap:   xt::Xid  } -> v8::Vector;
     
        encode_get_atom_name: { atom:     xt::Atom } -> v8::Vector;
        encode_get_geometry:  { drawable: xt::Xid  } -> v8::Vector;

        encode_get_image: { box:        ge::Box,
                            drawable:   xt::Xid, 
                            format:     xt::Image_Format, 
                            plane_mask: xt::Plane_Mask
                          }
                          -> v8::Vector;

        encode_get_keyboard_mapping: { count: Int,  first: xt::Keycode } -> v8::Vector;

        encode_get_motion_events: { window_id:  xt::Xid,
                                    start:      xt::Timestamp,
                                    stop:       xt::Timestamp
                                    
                                  }
                                  ->
                                  v8::Vector;

        encode_get_property: { window_id:  xt::Xid,
                               delete:     Bool,
                               len:        Int,
                               offset:     Int, 
                               property:   xt::Atom,
                               type:       Null_Or(xt::Atom)
                               
                             }
                             -> v8::Vector;

        encode_get_selection_owner:   { selection: xt::Atom } -> v8::Vector;
        encode_get_window_attributes: { window_id: xt::Xid  } -> v8::Vector;

        encode_grab_button: { button:       Null_Or(xt::Mousebutton), 
                              window_id:    xt::Xid,
                              confine_to:   Null_Or(xt::Xid), 
                              cursor:       Null_Or(xt::Xid),
                              #
                              event_mask:   xt::Event_Mask, 
                              kbd_mode:     xt::Grab_Mode, 
                              #
                              modifiers:    List(xt::Modifier_Key), 
                              owner_events: Bool,
                              #
                              ptr_mode:     xt::Grab_Mode
                            }
                            -> v8::Vector;

        encode_grab_key: { kbd_mode:     xt::Grab_Mode,
                           key:          xt::Keycode, 
                           modifiers:    List(xt::Modifier_Key), 
                           owner_events: Bool,
                           ptr_mode:     xt::Grab_Mode, 
                           window_id:    xt::Xid
                         }
                         -> v8::Vector;

        encode_grab_keyboard: { kbd_mode:      xt::Grab_Mode,
                                owner_events:  Bool, 
                                ptr_mode:      xt::Grab_Mode,
                                time:          xt::Timestamp, 
                                window_id:     xt::Xid
                              }
                              -> v8::Vector;

        encode_grab_pointer: { confine_to:    Null_Or(xt::Xid), 
                               cursor:        Null_Or(xt::Xid), 
                               #
                               event_mask:    xt::Event_Mask, 
                               kbd_mode:      xt::Grab_Mode,
                               #
                               owner_events:  Bool, 
                               ptr_mode:      xt::Grab_Mode,
                               time:          xt::Timestamp, 
                               window_id:     xt::Xid
                             }
                             -> v8::Vector;

        encode_image_text16: { drawable: xt::Xid,
                               gc_id:    xt::Xid, 
                               point:    ge::Point,
                               string:   String
                             }
                             -> v8::Vector;

        encode_image_text8: { drawable: xt::Xid,
                              gc_id:    xt::Xid, 
                              point:    ge::Point,
                              string:   String
                            }
                            -> v8::Vector;

        encode_install_colormap: { cmap: xt::Xid } -> v8::Vector;

        encode_intern_atom: { name: String,
                              only_if_exists: Bool
                            }
                            ->
                            v8::Vector;

        encode_kill_client:              { resource: Null_Or(xt::Xid) }        -> v8::Vector;
        encode_list_fonts:               { max: Int,  pattern: String }        -> v8::Vector;
        encode_list_fonts_with_info:     { max: Int,  pattern: String }        -> v8::Vector;

        encode_list_installed_colormaps: { window_id: xt::Xid }                -> v8::Vector;
        encode_list_properties:          { window_id: xt::Xid }                -> v8::Vector;
        encode_lookup_color:             { cmap:      xt::Xid,  name: String } -> v8::Vector;

        encode_map_subwindows:           { window_id: xt::Xid }                -> v8::Vector;
        encode_map_window:               { window_id: xt::Xid }                -> v8::Vector;
        encode_open_font:                { font:      xt::Xid, name: String }  -> v8::Vector;

        encode_poly_arc: { drawable: xt::Xid,
                           gc_id:    xt::Xid, 
                           items:    List(ge::Arc64)
                         }
                         -> v8::Vector;

        encode_poly_box: { drawable: xt::Xid,
                           gc_id:    xt::Xid, 
                           items:    List(ge::Box)
                         }
                         -> v8::Vector;

        encode_poly_fill_arc: { drawable: xt::Xid,
                                gc_id:    xt::Xid, 
                                items:    List(ge::Arc64)
                              }
                              -> v8::Vector;

        encode_poly_fill_box: { drawable: xt::Xid,
                                gc_id:    xt::Xid, 
                                items:    List(ge::Box)
                              }
                              -> v8::Vector;

        encode_poly_line:  { drawable: xt::Xid,
                             gc_id:    xt::Xid, 
                             items:    List(ge::Point),
                             relative: Bool
                           }
                           -> v8::Vector;

        encode_poly_point: { drawable: xt::Xid,
                             gc_id:    xt::Xid, 
                             items:    List(ge::Point),
                             relative: Bool
                           }
                           -> v8::Vector;

        encode_poly_segment: { drawable: xt::Xid,
                               gc_id:    xt::Xid, 
                               items:    List(ge::Line)
                             }
                             -> v8::Vector;

        encode_poly_text16:  { drawable: xt::Xid,
                               gc_id:    xt::Xid, 
                               items:    List(xt::Text_Font),
                               point:    ge::Point
                             }
                             -> v8::Vector;

        encode_poly_text8: { drawable: xt::Xid,
                             gc_id:    xt::Xid, 
                             items:    List(xt::Text_Font),
                             point:    ge::Point
                           }
                           -> v8::Vector;

        encode_push_event: { event_mask:      xt::Event_Mask,
                             propagate:       Bool, 
                             send_event_to:   xt::Send_Event_To
                           }
                           -> v8::Vector;

        encode_put_image: { data:     v8::Vector,
                            depth:    Int, 
                            drawable: xt::Xid,
                            format:   xt::Image_Format, 
                            gc_id:    xt::Xid,
                            lpad:     Int,
                            size:     ge::Size, 
                            to:       ge::Point
                          }
                          -> v8::Vector;

        encode_query_best_size: { drawable: xt::Xid,
                                  ilk:      xt::Best_Size_Ilk, 
                                  size:     ge::Size
                                }
                                -> v8::Vector;

        encode_query_colors:    { cmap: xt::Xid,  pixels: List(rgb8::Rgb8) } -> v8::Vector;

        encode_query_extension: String                    -> v8::Vector;
        encode_query_font:      { font:         xt::Xid } -> v8::Vector;
        encode_query_pointer:   { window_id:    xt::Xid } -> v8::Vector;

        encode_query_text_extents: { font:      xt::Xid,  string: String } -> v8::Vector;
        encode_query_tree:         { window_id: xt::Xid }                  -> v8::Vector;

        encode_recolor_cursor:  { background_color: rgb::Rgb,
                                  foreground_color: rgb::Rgb,
                                  cursor:           xt::Xid
                                }
                                -> v8::Vector;

        encode_reparent_window: { parent_id:  xt::Xid,
                                  window_id:  xt::Xid,
                                  pos:        ge::Point
                                }
                                -> v8::Vector;

        encode_rotate_properties: { delta:       Int,
                                    properties:  List(xt::Atom), 
                                    window_id:   xt::Xid
                                  }
                                  -> v8::Vector;

        encode_set_access_control: { enable: Bool } -> v8::Vector;

        encode_set_clip_boxes:  { boxes:       List(ge::Box), 
                                  clip_origin: ge::Point,
                                  gc_id:       xt::Xid, 
                                  ordering:    xt::Box_Order
                                }
                                -> v8::Vector;

        encode_set_close_down_mode: { mode: xt::Close_Down_Mode } -> v8::Vector;

        encode_set_dashes: { dash_offset:  Int,
                             dashes:       List(Int), 
                             gc_id:        xt::Xid
                           }
                           -> v8::Vector;

        encode_set_font_path: { path: List(String) } -> v8::Vector;

        encode_set_input_focus: { focus:     xt::Input_Focus, 
                                  revert_to: xt::Focus_Revert, 
                                  timestamp: xt::Timestamp
                                }
                                -> v8::Vector;

        encode_set_screen_saver: { allow_exposures: Null_Or(Bool),
                                   prefer_blanking: Null_Or(Bool),
                                   #
                                   interval: Int, 
                                   timeout:  Int
                                 }
                                 -> v8::Vector;

        encode_set_selection_owner: { selection:   xt::Atom, 
                                      timestamp:   xt::Timestamp, 
                                      # 
                                      window_id:   Null_Or(xt::Xid)
                                    }
                                    -> v8::Vector;

        encode_store_colors: { cmap:  xt::Xid,
                               items: List(xt::Color_Item)
                             }
                             ->
                             v8::Vector;

        encode_store_named_color: { cmap:     xt::Xid,
                                    #
                                    do_blue:  Bool,
                                    do_green: Bool, 
                                    do_red:   Bool,
                                    #
                                    name:     String,
                                    pixel:    rgb8::Rgb8
                                  }
                                  -> v8::Vector;

        encode_translate_coordinates
            :
            { from_point:  ge::Point, 
              from_window: xt::Xid,
              to_window:   xt::Xid
            }
            -> v8::Vector;

        encode_ungrab_button: { button:     Null_Or(xt::Mousebutton), 
                                modifiers:  List(xt::Modifier_Key), 
                                window_id:  xt::Xid
                              }
                              -> v8::Vector;

        encode_ungrab_key: { key:        xt::Keycode, 
                             window_id:  xt::Xid,
                             modifiers:  List(xt::Modifier_Key)
                           }
                           -> v8::Vector;

        encode_ungrab_keyboard:    { time:       xt::Timestamp } -> v8::Vector;
        encode_ungrab_pointer:     { time:       xt::Timestamp } -> v8::Vector;

        encode_uninstall_colormap: { cmap:       xt::Xid }       -> v8::Vector;
        encode_unmap_subwindows:   { window_id:  xt::Xid }       -> v8::Vector;
        encode_unmap_window:       { window_id:  xt::Xid }       -> v8::Vector;

        encode_warp_pointer                                     # See p 35 (39)  http://mythryl.org/pub/exene/X-protocol-R6.pdf
            :
            { from:     Null_Or(xt::Xid),
              to:       Null_Or(xt::Xid), 
              #
              from_box: ge::Box,
              to_point: ge::Point
            }
            ->
            v8::Vector;

        request_get_font_path:         v8::Vector;
        request_get_input_focus:       v8::Vector;
        request_get_keyboard_control:  v8::Vector;
        request_get_modifier_mapping:  v8::Vector;
        request_get_pointer_control:   v8::Vector;
        request_get_screen_saver:      v8::Vector;
        request_grab_server:           v8::Vector;
        request_list_extensions:       v8::Vector;
        request_list_hosts:            v8::Vector;
        request_no_operation:          v8::Vector;
        request_query_keymap:          v8::Vector;
        request_ungrab_server:         v8::Vector;
    };
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.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext