home *** CD-ROM | disk | FTP | other *** search
- /*
- winsetp.c 3/15/88
-
- % window moving routines.
- by Ted.
-
- OWL 1.1
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 3/22/88 Ted Installed linked windows handling
- 8/15/88 jmd Added win_GetPosition
- 10/19/88 Ted Extracted win_Top to wintop.c
- 10/19/88 Ted Extracted win_Get(Pix)PositionTop to wingetp.c
- 10/31/88 Ted: Removed linking.
- 12/09/88 ted: Added ddisp_Cache/Flush calls for mouse.
- 12/11/88 ted: Added dhard_Claim/Release calls for reentrancy.
- 5/01/89 ted Added wmgr_SetNewCurrentFlag call to fix mouse support.
- 7/07/89 gam Changed NULL to FNULL where necessary
- 8/08/89 jmd Added win_Really funcs.
- 8/10/89 ted added allowances for shadows.
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- /* -------------------------------------------------------------------------- */
-
- void win_SetPixPosition(win, xpos, ypos)
- win_type win;
- opcoord xpos;
- opcoord ypos;
- /*
- Change the position of window.
-
- Sends a WINM_SETPOS message to the window class which, in turn,
- call win_ReallySetPixPosition
- */
- {
- opoint pnt;
-
- pnt.x = xpos;
- pnt.y = ypos;
-
- win_Do(win, WINM_SETPOS, &pnt, NULL);
- }
- /* -------------------------------------------------------------------------- */
-
- void win_ReallySetPixPosition(win, xpos, ypos)
- win_type win;
- opcoord xpos;
- opcoord ypos;
- /*
- Really Change the position of window.
- */
- {
- int xdisp, ydisp;
- opbox partbox;
- opbox pbox;
-
- if (win == NULL) {
- return;
- }
- if (!disp_TextFree()) {
- opcoord_GridRound(&xpos, &ypos, win_GetFont(win));
- }
- hard_Claim(); /* Here for re-entrancy protection */
-
- /* remember x and y displacements */
- xdisp = xpos - win_GetXmin(win);
- ydisp = ypos - win_GetYmin(win);
-
- /* quit if no work to do */
- if (xdisp == 0 && ydisp == 0) {
- hard_Release();
- return;
- }
-
- if (!win_IsEmployed(win)) {
- opbox_trans(win_pixboxp(win), xdisp, ydisp);
- }
- else { /* redisplay window */
- disp_Cache();
-
- /* Save in win from part that might get obscured in its new home */
- /* (i.e. everything that's showing.) */
- win_getwinbox(win, &pbox);
- wmgr_SavePixBox(win, &pbox);
-
- /* Save in box from windows below where win is going */
- win_getshadowbox(win, &pbox); /* pbox gets old location */
- opbox_copy(&partbox, &pbox);
- opbox_trans(&partbox, xdisp, ydisp); /* partbox gets new location */
- opbox_uncover(&pbox, &partbox); /* partbox now gets diff box */
- wmgr_SavePixBox(win_GetBelow(win), &partbox);
-
- /* Move the window box */
- opbox_trans(win_pixboxp(win), xdisp, ydisp);
-
- /* Paint in box from windows below where win was */
- opbox_copy(&partbox, &pbox); /* partbox gets old location */
- win_getshadowbox(win, &pbox); /* pbox gets new location */
- opbox_uncover(&pbox, &partbox); /* partbox now gets diff box */
- wmgr_PaintPixBox(win_GetBelow(win), &partbox);
-
- /* Paint in box from window in its new location */
- /* (i.e. everything that's showing.) */
- win_getshadowbox(win, &pbox);
- wmgr_PaintPixBox(win, &pbox);
-
- /* Set flag for kb_Read/Check to wrap up mouse msgs for new mouse win */
- if (wmgr_SMMptr() != FNULL) {
- wmgr_SetNewCurrentFlag(TRUE);
- }
- disp_Flush();
- hard_Release();
- }
- }
- /* -------------------------------------------------------------------------- */
-