#if __ORCAC__ #pragma lint -1 #pragma noroot segment "VNCview GS"; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "vncsession.h" #include "vncview.h" #include "vncdisplay.h" #include "colortables.h" #include "menus.h" #include "clipboard.h" #include "desktopsize.h" #include "mouse.h" #include "keyboard.h" #include "copyrect.h" #include "raw.h" #include "hextile.h" /* This prototype should be in but is bogusly commented out there */ extern pascal void SetContentOrigin2(Word, Word, Word, GrafPortPtr) inline(0x570E,dispatcher); void DoDesktopSize (void) { #define screenTooBigError 2010 Origin contentOrigin; unsigned int newX, newY; Boolean changeOrigin = FALSE; unsigned int oldWinHeight, oldWinWidth; fbWidth = rectWidth; fbHeight = rectHeight; if ((fbWidth > 16384) || (fbHeight > 16384)) { AlertWindow(awResource, NULL, screenTooBigError); DoClose(vncWindow); } oldWinHeight = winHeight; oldWinWidth = winWidth; winHeight = WIN_HEIGHT; winWidth = (hRez == 640) ? WIN_WIDTH_640 : WIN_WIDTH_320; if (fbWidth < winWidth) winWidth = fbWidth; if (fbHeight < winHeight) winHeight = fbHeight; if (oldWinHeight != winHeight || oldWinWidth != winWidth) SizeWindow(winWidth, winHeight, vncWindow); /* Scroll if area displayed is going away */ contentOrigin.l = GetContentOrigin(vncWindow); newX = contentOrigin.pt.h; newY = contentOrigin.pt.v; if (contentOrigin.pt.h + winWidth > fbWidth) { newX = fbWidth - winWidth; changeOrigin = TRUE; } if (contentOrigin.pt.v + winHeight > fbHeight) { newY = fbHeight - winHeight; changeOrigin = TRUE; } SetContentOrigin2(1, newX, newY, vncWindow); SetDataSize(fbWidth, fbHeight, vncWindow); DrawControls(vncWindow); NextRect(); /* Prepare for next rect */ }