PreviousUpNext

15.4.1647  src/lib/x-kit/xclient/src/window/selection.pkg

## selection.pkg
#
# A window-level view of the low-level selection operations.
#
# See also:
#     src/lib/x-kit/xclient/src/window/selection-imp-old.pkg

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






###              "If there is a problem you can't solve, then
###               there is an easier problem you can solve: find it."
###
###                                 -- George Polya


# This stuff is likely based on Dusty Deboer's
# thesis work: See Chapter 5 (pp46) in:
#     http://mythryl.org/pub/exene/dusty-thesis.pdf

stipulate
    package xt  =  xtypes;                      # xtypes                is from   src/lib/x-kit/xclient/src/wire/xtypes.pkg
    package ts  =  xserver_timestamp;           # xserver_timestamp     is from   src/lib/x-kit/xclient/src/wire/xserver-timestamp.pkg
    #
    package xj  =  xsession_junk;               # xsession_junk         is from   src/lib/x-kit/xclient/src/window/xsession-junk.pkg
#   package dt  =  draw_types;                  # draw_types            is from   src/lib/x-kit/xclient/src/window/draw-types.pkg
    package si  =  selection_ximp;              # selection_ximp        is from   src/lib/x-kit/xclient/src/window/selection-ximp.pkg
    package sep =  client_to_selection;         # client_to_selection   is from   src/lib/x-kit/xclient/src/window/client-to-selection.pkg
herein


    package   selection
    : (weak)  Selection                         # Selection             is from   src/lib/x-kit/xclient/src/window/selection.api
    {
        Selection_Handle = sep::Selection_Handle;
        #
        Atom = xt::Atom;

        Xserver_Timestamp = ts::Xserver_Timestamp;

        fun selection_port_of_screen ( { xsession=> (x: xj::Xsession), ... }: xj::Screen )
            =
            x.client_to_selection;

        fun acquire_selection ({ window_id, screen, ... }: xj::Window, selection, time, handler)
            =
            {   client_to_selection =  selection_port_of_screen  screen;
                #
                client_to_selection.acquire_selection  (window_id, selection, time, handler);
            };

#       selection_req_mailop = si::plea_mailop;
#       fun plea_mailop          (sep::SELECTION_HANDLE { plea',     ... } ) =   plea';

        fun release_selection    (h: sep::Selection_Handle) =   h.release ();
        fun selection_of         (h: sep::Selection_Handle) =   h.selection;
        fun timestamp_of         (h: sep::Selection_Handle) =   h.timestamp;
        fun selection_rel_mailop (h: sep::Selection_Handle) =   h.release';


        fun request_selection
            {
              window => { window_id, screen, ... }: xj::Window,
              selection,
              target,
              property,
              timestamp
            }
            =
            {   client_to_selection =  selection_port_of_screen  screen;
                #
                client_to_selection.request_selection
                  {
                    window  => window_id,
                    selection,
                    target,
                    property,
                    timestamp
                  };
            };
    };

end;


## COPYRIGHT (c) 1994 by AT&T Bell Laboratories.  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