[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Dec 13 10:26:12 1993 
Subject:getting a handle on a SCREENPTR for Poplog X facilities. 
From:"A.Sloman" 
Volume-ID:931214.01 

There are several procedures in the Poplog+X package that need
a SCREENPTR, such as

XWidthOfScreen(SCREENPTR) -> INT                             [procedure]
XHeightOfScreen(SCREENPTR) -> INT                            [procedure]
XWidthMMOfScreen(SCREENPTR) -> INT                           [procedure]
XHeightMMOfScreen(SCREENPTR) -> INT                          [procedure]
etc.
See REF XT_LIBS

I found it extraordinarily difficult to find out how to get hold of
a SCREENPTR, but eventually came up with this hack:
-----------------------------------------------------------------------
uses xlib;
uses xpt_screeninfo;

;;; This holds the default screenptr
lvars screenptr = false;

define active default_screen_ptr() -> ptr;
    ;;; guaranteed to return a reasonable SCREENPTR
    lvars ptr;
    if screenptr then
        screenptr -> ptr
    else
        XptDefaultSetup();
        XtScreen($-propsheet_utils$-create_shell()) ->> ptr
            -> screenptr
    endif;
enddefine;
-----------------------------------------------------------------------

The active variable default_screen_ptr can be used as argument to the
above procedures (if you are dealing with only one screen). If anyone
has found a better solution, please let me know. This one works from
pop11, but not from basepop11, as it uses a propsheet utility.

Thanks.
Aaron