PreviousUpNext

15.3.673  src/lib/x-kit/widget/old/basic/root-window-old.api

## root-window-old.api
#
# This widget represents the root window on an X screen
# -- the one on which the wallpaper is drawn.
#
# This widget also serves as the top-level representative
# of a running X server session.  For example, run_in_x_window_old in
#
#     src/lib/x-kit/widget/old/lib/run-in-x-window-old.pkg
#
# creates a Root_Window and passes it to the user-provided
# application function as the sole representative of the
# running X session.
#
# Other widgets use Root_Window instances to access display
# resources such as fonts; the Root_Window to use is usually
# supplied to them at creation time.

# Also, by X convention, various things get published by
# posting them as properties on the root window.

# Compiled by:
#     src/lib/x-kit/widget/xkit-widget.sublib


# Compiled by:
#     src/lib/x-kit/widget/xkit-widget.sublib

# This api is implemented in:
#
#     src/lib/x-kit/widget/old/basic/root-window-old.pkg
#
# Oddly enough, it is not referenced in the above file.
# It is however 'include'-ed in
#
#     src/lib/x-kit/widget/old/basic/widget.api

stipulate
    package xc  =  xclient;                                                     # xclient               is from   src/lib/x-kit/xclient/xclient.pkg
    package g2d =  geometry2d;                                                  # geometry2d            is from   src/lib/std/2d/geometry2d.pkg
    package si  =  shade_imp_old;                                               # shade _imp_old        is from   src/lib/x-kit/widget/old/lib/shade-imp-old.pkg
    package wb  =  widget_base;                                                 # widget_base           is from   src/lib/x-kit/widget/old/basic/widget-base.pkg
    package wy  =  widget_style_old;                                            # widget_style_old      is from   src/lib/x-kit/widget/old/lib/widget-style-old.pkg
herein

    api Root_Window_Old {
        #
        Root_Window =     { screen:             xc::Screen,
                            id:                 Ref( Void ),                    # Here we are just taking advantage of the fact that all REFs are distinct.
                            #                                                   # We should eventually convert this to a proper small-int id -- eventually
                            #                                                   # one wants to use the id as a key for lookup.  -- 2013-07-21 CrT
                            make_shade:         xc::Rgb -> si::Shades,
                            make_tile:          String -> xc::Ro_Pixmap,
                            #
                            style:              wy::Widget_Style,
                            next_widget_id:     Void -> Int
                          };

        make_root_window
            :
            ( String,                                                           # X server spec, typically taken from DISPLAY environment variable, e.g. ":0.0" or "foo.com:0.0" or such.
              Null_Or( xc::Xauthentication )                                    # See  Xauthentication comments in    src/lib/x-kit/xclient/xclient.api
            )
            ->
            Root_Window;

        delete_root_window:  Root_Window -> Void;
            #
            # Close the display connection.  This
            # deletes all windows associated with it
            # and releases all associated X server
            # resources such as fonts.


        same_root:       (Root_Window, Root_Window) -> Bool;

        xsession_of:      Root_Window -> xc::Xsession;
        screen_of:        Root_Window -> xc::Screen;
        shades:           Root_Window -> xc::Rgb -> wb::Shades;

        ro_pixmap:        Root_Window -> String -> xc::Ro_Pixmap;
        color_of:         Root_Window -> xc::Color_Spec -> xc::Rgb;
        open_font:        Root_Window -> String -> xc::Font;

        get_standard_xcursor:   Root_Window -> xc::Standard_Xcursor -> xc::Xcursor;

        ring_bell:            Root_Window -> Int -> Void;       # Generate beep. Int volume argument must be in range [-100,100].

        size_of_screen:    Root_Window -> g2d::Size;
        mm_size_of_screen: Root_Window -> g2d::Size;
        depth_of_screen:   Root_Window -> Int;

        is_monochrome:     Root_Window -> Bool;

        style_of:          Root_Window -> wy::Widget_Style;
        style_from_strings:  (Root_Window, List( String )) -> wy::Widget_Style;

        /* was/is included for testing purposes: disabled because can be unreliable.
        my stringsFromStyle:  Style -> List( String )
        */

        # merge_Styles (style1, style2): merge style1 with style2,
        # giving precedence first to tight namings, then to resources
        # of style1.
        #
        merge_styles:  (wy::Widget_Style, wy::Widget_Style) -> wy::Widget_Style;

        # styleFromXRDB: return a style created from the properties
        # loaded by xrdb into the X-server
        #
        style_from_xrdb:  Root_Window -> wy::Widget_Style;

        # Commandline option specification and parsing -- see 
        #
        #     src/lib/x-kit/style/widget-style-g.pkg
        #
        Opt_Name; 
        Arg_Name;
        Opt_Kind;
        Opt_Spec;
        Opt_Db;
        Value;

        # parse_command: given a root and
        # an option spec, create an option db
        # from command line arguments.
        #
        parse_command:  Opt_Spec -> List( String ) -> (Opt_Db, List( String ));

        # find_named_opt: given an option db and a named option (an option to
        # be used for purposes other than resource specification), return a 
        # list of attribute::attribute_values. This list is ordered such that the last
        # value to appear on the command line appears first in this list, so
        # that the application may choose to use the first value only, or it
        # may choose to use all values given.
        # Named options should be typically useful in obtaining input for 
        # processing by an application, as opposed to X resource specification
        # values. For example, "-filename foo" will probably be used by an
        # application in some process, while "-background bar" is an X resource
        # to be used in some graphical display.
        # For further details see src/lib/x-kit/style/styles-fn.pkg.
        #
        find_named_opt:  Opt_Db -> Opt_Name -> Root_Window -> List( Value );
        #
        find_named_opt_strings:  Opt_Db -> Opt_Name -> List( String );

        # style_from_opt_db: create a style from resource specifications in optDb.
        #
        style_from_opt_db:  (Root_Window, Opt_Db) -> wy::Widget_Style;

        # A utility function that returns a string
        # outlining the valid command line arguments
        # in opt_spec.
        #
        help_string_from_opt_spec:  Opt_Spec -> String;
    };

end;


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext