Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!caen!uwm.edu!linac!att!princeton!phoenix.Princeton.EDU!dmlaur From: dmlaur@phoenix.Princeton.EDU (David M. Laur) Newsgroups: comp.sys.sgi Subject: Re: changing window size under PROGRAM control Summary: here's some working code Keywords: GL SGI resize Message-ID: <11022@idunno.Princeton.EDU> Date: 21 Jun 91 18:06:49 GMT References: <9106202215.AA06603@nrc3d.nrc.uab.edu> Sender: news@idunno.Princeton.EDU Organization: Princeton University Lines: 58 Nntp-Posting-Host: phoenix.princeton.edu In article <9106202215.AA06603@nrc3d.nrc.uab.edu> jpg@NRC3D.NRC.UAB.EDU (Jill Gemmill) writes: > My reading of the documentation was that prefsize should be called >before winopen() - which disallows any resizing; OR that prefsize should be >called after the winopen(), followed by winconstraints(). That approach >does not seem to work. > Can anyone think of way to do this without closing the window >down and opening another one of a different fixed size? > voici ... /* -------------------------------------------------------- */ /* * resize a GL window * (if the window manager takes the hint) * to the specified new size (in pixels) * * note: * * - this routine assumes you want the lower-left corner of * the window to stay where it is, other logic is possible * * - windows may not be bigger than the screen (WxH), * although they may extend off the screen. * * - if your image is bigger than the screen (WxH) * you'll have to use a modified arg to lrectwrite; * this is trivial on a VGX using pixmode to set a stride, * but exceedingly painful on other IRIS's * * - for some applications this routine builds a window * which one pixel too big in x and y * * - resizing the window generates a REDRAW event * * * example call (request a 100x100 window): * * winresize( winget(), 100, 100); */ void winresize ( int wid, int width, int height ) { long x,y,w,h, XM, YM; XM = getgdesc(GD_XPMAX); YM = getgdesc(GD_YPMAX); w = (width > XM) ? XM : width; h = (height > YM) ? YM : height; getorigin(&x, &y); winposition(x, x+w, y, y+h); prefsize(w, h); /* re-disallow resize by user */ winconstraints(); /* warning: this will generate a REDRAW event for this window */ } /* -------------------------------------------------------- */