From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 29-JUN-1994 17:15:21.40
To:	EVERHART
CC:	
Subj:	Re: XAUTOLOCK question

From: PATRICK@ESS2 (Patrick@ess2.dnet.nasa.gov (Patrick Meyer))
X-Newsgroups: comp.os.vms
Subject: Re: XAUTOLOCK question
Date: 29 Jun 1994 19:20:30 GMT
Organization: NASA MSFC
Lines: 117
Distribution: world
Message-ID: <2ushhu$jmq@hammer.msfc.nasa.gov>
NNTP-Posting-Host: mpd2.msfc.nasa.gov
X-News-Reader: VMS NEWS 1.24
In-Reply-To: koffley@nrlvx1.nrl.navy.mil's message of 29 Jun 94 07:36:51 -0400
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET

In <1994Jun29.073651.1372@nrlvx1.nrl.navy.mil> koffley@nrlvx1.nrl.navy.mil writes:

> Has anyone used XAUTOLOCK with anything differently than the default
> DECWindows pause screen ? I'd like to be able to display a GIF or JPG of
> my choice using XV. In my hacking around the code to XAUTOLOCK (and not
> being an ace C or Xlib programmer), it would appear that without major
> surgery this is not too easily done. Any other opinions or advice ?
> 
> ---
> \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
> < Joe Koffley                        KOFFLEY@NRLVAX.NRL.NAVY.MIL             >
> < Naval Research Laboratory                                                  >
> < Code 8101                          KOFFLEY@NRLVX6.NRL.NAVY.MIL             >
> < Space Systems Division             AT&T  :  202-767-0894                   >
> \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

First, from my experience with XAutolock, it does not actually pause the
screen.  It executes SYS$SYSTEM:DECW$PAUSESESSION.EXE.  I know a few options
that might acheive what you want. 

1. Once you have spawned DECW$PAUSESSESION you can retrieve the X Window
   ID of the pause window and draw directly on the pause window.  I have
   done this by just drawing simple bitmaps... not GIF's.  However, once
   you have the window ID, you could use the GIF code hanging around in 
   DECW$EXAMPLES.

2. You could write your own PAUSE window program or use XLock as a basis.
   XLock (somewhere out on the net) has a few options where it draws silly
   things on the screen while it is paused.  We don't use this because it
   eats CPU for remote users.  With Xlock you could add the same GIF code
   mentioned above to display a GIF.  Otherwise, you are writing a 
   Pause screen from scratch. 

I recommend doing option 1.  The code to get the pause window is below.

============================================================================
/* SMPAUSEWINDOW.C - Routine to find the Session Manager pause window for   */
/*                   DECwindows MOTIF on VMS.                               */
#include <signal.h>
#include <stdio.h>
#include <stdlib.h> 
#include <string.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
 
static int SmPauseHandler(dpy, e)
    Display *dpy;
    XErrorEvent *e;
{
    /* ignore errors from GetWindowProperty */
    
    return 0;
}
 
 
Window SmPauseWindow(dpy, root)
    Display *dpy;
    Window root;
{
    char *pause_window = "_DEC_SM_PAUSE_WINDOW";
    Atom pause_window_atom; 
    Window *wid;
    Window retval;
    Atom type_returned;
    int format_returned, status;
    unsigned long num_items_returned, bytes_remaining;
 
    /* enable handler to trap errors (especially BadAtom) */
    
    XSetErrorHandler(&SmPauseHandler);
 
    pause_window_atom = XInternAtom (dpy, pause_window, True);
 
    status = XGetWindowProperty (dpy, root, pause_window_atom, 0, 1, False,
				 XA_WINDOW, &type_returned, &format_returned,
				 &num_items_returned, &bytes_remaining, &wid);
 
    /* disable the handler */
    
    XSetErrorHandler(0);
 
    if ((status != 0) || (type_returned == None))
	return 0;	/* XGetWindowProperty failed */
 
    retval = *wid;
    XFree(wid);
    return retval;	/* Success */
}
 
int main(int argc, char *argv[]) {
   Display *dpy;
   Window  window, pause;
  
   textname = "d46a:[patrick]pause.txt";
   displayname = NULL;


   if (!(dpy = XOpenDisplay(displayname))) {
      perror("Can't open display\n");
      exit(EXIT_FAILURE);
   }

   window = XRootWindow(dpy,0);
   while ((pause = SmPauseWindow(dpy, window))==0)
      sleep(3);

   /* Draw on 'pause' here */

   XCloseDisplay(dpy);
}



___________________________________________________________________________
Patrick E. Meyer (205) 544-2265                   Mission Planning Division
Email: Patrick.Meyer@msfc.nasa.gov                Planning Systems Branch

