[comp.windows.x] Running X11 under Sun Overview

katz@VENERA.ISI.EDU (Alan R. Katz) (02/09/89)

A real long time ago, someone posted a patch for X10R4 which allowed you to freeze
the X server and pop back up to suntools when you ran X10 under Sun's Overview
(by typing LEFT-L2).

Has anyone done this for X11?  

I have been trying to do this myself, and just about had it working
when I got a color Sun 3/110.  The server doesn't seem to run on that
machine under Overview (it starts up, but then the keyboard and mouse
are frozen and you have to kill suntools to fix things).

The server ran fine on my monochrome display.

We are running X11, release 2 (release 3 has not been installed yet, but we
have the tape).

				Alan (Katz@Isi.Edu)

turner@daisy.UUCP (D'arc Angel) (02/10/89)

We have it working here but be warned, its slow, it loses characters
(everything for X goes thru the selection_svc first), it's a memory
hog (on a 8Mbyte system, half the time is spent swapping) and on
and on. I wouldn't recommend it, but if people insist I'll check
to see if Daisy has any objections to me putting the sources into
the archives.

-- 
Don't take life too seriously, it ain't nohow permanent - Pogo
...{decwrl|ucbvax}!imagen!atari!daisy!turner (James M. Turner)

dana@dino.bellcore.com (Dana A. Chee) (02/10/89)

   A real long time ago, someone posted a patch for X10R4 which allowed you to freeze
   the X server and pop back up to suntools when you ran X10 under Sun's Overview
   (by typing LEFT-L2).

   Has anyone done this for X11?  

				   Alan (Katz@Isi.Edu)

Below are the R2 patches (should just be a slight offset for R3) to
restore that functionality.  You may not still need the changes to
xinit.c but the rest should still be fine.

====================
VERSION:
	X11 release 2

CLIENT MACHINE:
	Sun 3/75

CLIENT OPERATING SYSTEM:
	SunOS 3.2

DISPLAY:
	Sun

SYNOPSIS:
	Add Meta-L2 support for running X under Sunview.

DESCRIPTION:
	These diff add the Meta-L2 support present in X10R4 which
        allowed an X server running under Sunview to return to
	Sunview by typing Meta-L2.  When the overview icon was
	clicked, the X server was restarted.

	Affected files:
		clients/xinit/xinit.c
		server/ddx/sun/sunInit.c
		server/ddx/sun/sunKbd.c

FIX:
*** clients/xinit/xinit.c.orig	Thu Feb 25 23:53:54 1988
--- clients/xinit/xinit.c	Thu Apr 21 14:29:11 1988
***************
*** 148,156 ****
  #endif /* SYSV */
  	if ((serverpid = startServer(server)) > 0
  	 && (clientpid = startClient(client)) > 0) {
! 		pid = -1;
! 		while (pid != clientpid && pid != serverpid)
! 			pid = wait(NULL);
  	}
  	signal(SIGQUIT, SIG_IGN);
  	signal(SIGINT, SIG_IGN);
--- 148,173 ----
  #endif /* SYSV */
  	if ((serverpid = startServer(server)) > 0
  	 && (clientpid = startClient(client)) > 0) {
! 		while( 1 )
! 		{
! 			union wait	status;
! 
! 			do
! 			{
! 				pid = wait3(&status, WUNTRACED, NULL);
! 			} while (pid != clientpid && pid != serverpid);
! 
! 			if (pid == serverpid &&
! 			    (WIFSTOPPED(status)))
! 			{
! 				kill (getpid(), SIGSTOP);
! 				kill (serverpid, SIGCONT);
! 			}
! 			else
! 			{
! 				break;
! 			}
! 		}
  	}
  	signal(SIGQUIT, SIG_IGN);
  	signal(SIGINT, SIG_IGN);
***************
*** 222,227 ****
--- 239,245 ----
  			break;
  	}
  	laststring = string;
+ 	fprintf(stderr, "\n");
  	return( pid != pidfound );
  }
  
*** server/ddx/sun/sunInit.c.orig	Sat Jan 16 12:40:55 1988
--- server/ddx/sun/sunInit.c	Thu Apr 21 14:20:51 1988
***************
*** 63,68 ****
--- 63,69 ----
  extern void SetInputCheck();
  extern char *strncpy();
  extern GCPtr CreateScratchGC();
+ extern WindowRec WindowTable[];
  
  #define	XDEVICE	"XDEVICE"
  #define	PARENT	"WINDOW_GFX"
***************
*** 704,706 ****
--- 705,773 ----
  
      return (fd);
  }
+ 
+ /*
+  * stopme - stop window for suntools
+  */
+ #ifdef	SUN_WINDOWS
+ stopme()
+ {
+ 	DevicePtr	pKbd;
+ 	int		i;
+ 
+ 	if( !sunUseSunWindows())
+ 		return;
+ 
+ 	/*
+ 	 * on our way out -- shut down keyboard and mouse
+ 	 * and remove the window
+ 	 */
+ 	pKbd = LookupKeyboardDevice();
+ 	sunKbdProc(pKbd,  DEVICE_OFF);
+ 	sunMouseProc(pKbd, DEVICE_OFF);
+ 	win_remove(windowFd);
+ 	kill(0, SIGSTOP);
+ 
+ 	/*
+ 	 * we're back, restore the window, and turn on the
+ 	 * keyboard and mouse
+ 	 */
+ 	win_insert(windowFd);
+ 	sunMouseProc(pKbd, DEVICE_ON);
+ 	sunKbdProc(pKbd, DEVICE_ON);
+ 
+ 	/*
+ 	 * refresh all screens
+ 	 */
+ 	for( i = 0; i < screenInfo.numScreens; i++ )
+ 	{
+ 		ExposeEveryone(&WindowTable[i], &screenInfo.screen[i]);
+ 		HandleExposures(&WindowTable[i]);
+ 	}
+ }
+ 
+ static
+ ExposeEveryone(pWin, pScreen)
+ WindowPtr     pWin;
+ ScreenPtr     pScreen;
+ {
+ 	WindowPtr	pChild;
+ 
+ 	pChild = pWin;
+ 	while( pChild )
+ 	{
+ 		if( pChild->mapped )
+ 		{
+ 			(* pScreen->RegionCopy)(pChild->exposed, pChild->clipList);
+ 			(* pScreen->RegionCopy)(pChild->borderExposed, pChild->borderClip);
+ 			ExposeEveryone(pChild->firstChild, pScreen);
+ 		}
+ 		pChild = pChild->nextSib;
+ 	}
+ }
+ #endif	SUN_WINDOWS
+ 
+ 
+ 	
+ 
+ 
*** server/ddx/sun/sunKbd.c.orig	Tue Feb  9 17:19:51 1988
--- server/ddx/sun/sunKbd.c	Thu Apr 21 14:23:58 1988
***************
*** 734,744 ****
--- 734,763 ----
      register struct inputevent *se;
  {   
      Firm_event	fe;
+     int		loc;
+     static	Meta_On, Meta_hold;
  
      fe.time = event_time(se);
      fe.id = event_id(se);
      fe.value = (event_is_up(se) ? VKEY_UP : VKEY_DOWN);
  
+     loc = (fe.id - 1) * sunKeySyms[sysKbPriv.type].mapWidth;
+ 
+     if( sunKeySyms[sysKbPriv.type].map[loc] == XK_Meta_L ||
+        sunKeySyms[sysKbPriv.type].map[loc] == XK_Meta_R ) /* Meta */
+     {
+ 	    Meta_hold = fe.id;
+ 	    Meta_On = (fe.value == VKEY_DOWN);
+     }
+     if( sunKeySyms[sysKbPriv.type].map[loc] == XK_L2 ) /* L2 */
+     {
+ 	    if( fe.value == VKEY_DOWN && Meta_On )
+ 	    {
+ 		    stopme();
+ 		    fe.id = Meta_hold;
+ 		    fe.value = VKEY_UP;
+ 	    }
+     }
      sunKbdProcessEvent (pKeyboard, &fe);
  }
  #endif SUN_WINDOWS


--
+*************************************************************************+
*  Dana Chee				(201) 829-4488			  *
*  Bellcore								  *
*  Room 2Q-250								  *
*  445 South Street			ARPA: dana@bellcore.com		  *
*  Morristown,  NJ  07960-1910		UUCP: {gateways}!bellcore!dana	  *
+*************************************************************************+

aperez@cvbnet2.UUCP (Arturo Perez Ext.) (02/10/89)

From article <8902090237.AA15615@venera.isi.edu>, by katz@VENERA.ISI.EDU (Alan R. Katz):
> 
> A real long time ago, someone posted a patch for X10R4 which allowed you to freeze
> the X server and pop back up to suntools when you ran X10 under Sun's Overview
> (by typing LEFT-L2).
> 
> Has anyone done this for X11?  
> 
> I have been trying to do this myself, and just about had it working
> when I got a color Sun 3/110.  The server doesn't seem to run on that
> machine under Overview (it starts up, but then the keyboard and mouse
> are frozen and you have to kill suntools to fix things).
> 
> The server ran fine on my monochrome display.
> 
> We are running X11, release 2 (release 3 has not been installed yet, but we
> have the tape).
> 
> 				Alan (Katz@Isi.Edu)


I don't know if this is a related problem but...

On X11R2, there's a sun around here that does not behave like any of
the others.

When running X in "overview mode" (i.e. bring up suntools, then bring
up X in a shelltool) everything works fine except on this one machine.

What happens is the server starts up and grabs the display.  But, it does
not seem to be able to "access" the mouse so you end up not being able to
do anything with it.  If I recall correctly the console does not come up
either.  The only solution is to reboot the machine.

I'm not sure what the model number is.  It's one of the diskless nodes
and is probably a 3-60C.


Of course, since this is release 2 I don't expect anyone to go about
fixing it.

Arturo Perez

janssen@titan.sw.mcc.com (Bill Janssen) (02/14/89)

Actually, I find that when I run X11R3 over a SunView window, I can bring
up SunView tools just fine on top of X by freezing the X server and starting
the shelltool.  Try typing "shelltool" at an xterm.

Bill

rob@daisy.UUCP (Rob Posadas) (02/15/89)

In article <8902090237.AA15615@venera.isi.edu> katz@VENERA.ISI.EDU (Alan R. Katz) writes:
>
>I have been trying to do this myself, and just about had it working
>when I got a color Sun 3/110.  The server doesn't seem to run on that
>machine under Overview (it starts up, but then the keyboard and mouse
>are frozen and you have to kill suntools to fix things).
>

Did you compile the server with -DSUNWINDOWS?

If you did, this could be what is giving you problems,
the server should not be compiled with this option.

Also, did you run overview with the -W (or is it -w) option
to tell overview that the program you are running is another
windowing system?


To get full functionality, you will also have to hack either
xinit or the server, so that the server will know what to do
when stopped and restarted.

-- 
            Rob Posadas -- Daisy Systems Corp
            700 E. Middlefield Rd.
            Mt. View, CA 94039-7006
            ucbvax!imagen!atari!daisy!rob