Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!usc!apple!hercules!aida From: aida@porthos (Hitoshi Aida) Newsgroups: gnu.ghostscript.bug Subject: Re: two windows is too many Message-ID: <11772@hercules.csl.sri.com> Date: 31 Jul 89 19:28:47 GMT References: <8907282004.AA02231@rothko.cray.com> Sender: usenet@csl.sri.com Reply-To: aida@porthos.UUCP (Hitoshi Aida) Distribution: gnu Organization: Computer Science Laboratory, SRI International, Menlo Park, CA USA Lines: 84 In article <8907282004.AA02231@rothko.cray.com> hrp@boring.cray.com (Hal Peterson) writes: >On startup under X, Ghostscript opens two windows; the first one stays >blank and the second one gets all of the graphics. This is happening >because the X device is being initialized twice, once from the C code >in gs_set_device and once from the Ghostscript setup code in ghost.ps. >This is a fix in multiple steps: > >1. since ghost.ps will initialize and set the real device, I modified > gs_state_alloc to initialize with the null device instead of with > a real one. > >2. ghost.ps now needs a way to get the real default device, so I > dropped defaultdevice into C code. > >3. and while I was at it I cleaned up a bunch of incorrect > declarations at the beginning of gsdevice.c (they were missing > ``private'' keywords and gcc yelled at me). > I had similar problem when I ported Ghostscript 1.3 to SunView environment. My fix was more simple: sticking to defaultdevice all the way. Doing this in X requires a little modification of X driver, i.e. initializing matrix within the driver. I've never used Ghostscript in X, but I think following patch would work. Hitoshi AIDA (aida@csl.sri.com) Computer Science Laboratory, SRI International ---------------- cut here ---------------- *** gdevx.c Tue Jun 20 08:43:55 1989 --- gdevx.c.new Tue Jul 25 12:49:06 1989 *************** *** 128,134 **** gx_device_X x_device = { sizeof(gx_device_X), &x_procs, ! identity_matrix_body, 640, 350, /* x and y extent */ /* Following parameters are initialized for monochrome */ 0, /* has color */ --- 128,134 ---- gx_device_X x_device = { sizeof(gx_device_X), &x_procs, ! 1.0,0, 0.0,0, 0.0,0, -1.0,0, 0.0,0, 350.0,0, /* initial matrix */ 640, 350, /* x and y extent */ /* Following parameters are initialized for monochrome */ 0, /* has color */ *************** *** 186,192 **** /* Leave some space for a window manager's title bar */ winH = HeightOfScreen(xdev->scr) - 15; winY = 0; ! xdev->height = winH; xdev->black = BlackPixelOfScreen(xdev->scr); xdev->white = WhitePixelOfScreen(xdev->scr); xdev->back_color = xdev->fore_color = -1; /* undefined */ --- 186,192 ---- /* Leave some space for a window manager's title bar */ winH = HeightOfScreen(xdev->scr) - 15; winY = 0; ! xdev->initial_matrix.ty = xdev->height = winH; xdev->black = BlackPixelOfScreen(xdev->scr); xdev->white = WhitePixelOfScreen(xdev->scr); xdev->back_color = xdev->fore_color = -1; /* undefined */ *** ghost.ps.org Tue Jun 20 04:31:52 1989 --- ghost.ps Thu Jul 13 16:46:12 1989 *************** *** 309,317 **** % Map the screen height to an 11" page. % This is not necessarily the best compromise. DISPLAYING ! { .device.height 72 11 mul div ! [1 index .aspect.ratio mul 0 0 4 index neg 0 .device.height] ! .device.width 8 idiv .device.height { } framedevice pop } { nulldevice } ifelse --- 309,315 ---- % Map the screen height to an 11" page. % This is not necessarily the best compromise. DISPLAYING ! { defaultdevice setdevice } { nulldevice } ifelse