/* * Hide the window to make it and its children invisible on the screen. * This is a recursive routine which increments the unmapcount values for * this window and all of its children, and causes exposure events for * windows which are newly uncovered. */ void MwHideWindow(HWND hwnd,BOOL bChangeFocus, BOOL bSendMsg) { HWND wp = hwnd; HWND pwp; /* parent window */ HWND sibwp; /* sibling window */ HWND childwp; /* child window */ if (wp == rootwp) return; ++mwpaintNC; /* experimental NC paint handling*/ /* send hide message if currently visible*/ if(bSendMsg && wp->unmapcount == 0) SendMessage(wp, WM_SHOWWINDOW, FALSE, 0L); wp->unmapcount++; for (childwp = wp->children; childwp; childwp = childwp->siblings) MwHideWindow(childwp, bChangeFocus, bSendMsg); if (wp == mousewp) { MwCheckMouseWindow(); MwCheckCursor(); } if (bChangeFocus && wp == focuswp) SetFocus(rootwp->children? rootwp->children: rootwp); /* * If the parent window is still unmapped, then we are all done. */ if (wp->parent->unmapcount) return; /* * Clear the area in the parent for this window, causing an * exposure event for it. */ pwp = wp->parent; MwClearWindow(pwp, wp->winrect.left - pwp->winrect.left, wp->winrect.top - pwp->winrect.top, wp->winrect.right - wp->winrect.left, wp->winrect.bottom - wp->winrect.top, TRUE); /* * Finally clear and redraw all parts of our lower sibling * windows that were covered by this window. */ sibwp = wp; while (sibwp->siblings) { sibwp = sibwp->siblings; MwExposeArea(sibwp, wp->winrect.left, wp->winrect.top, wp->winrect.right - wp->winrect.left, wp->winrect.bottom - wp->winrect.top); } }
/* * Move the cursor to the specified absolute screen coordinates. * The coordinates are that of the defined hot spot of the cursor. * The cursor's appearance is changed to that defined for the window * in which the cursor is moved to. In addition, the window the * cursor is in is recalculated. */ void MwMoveCursor(MWCOORD x, MWCOORD y) { /* * Move the cursor only if necessary, offsetting it to * place the hot spot at the specified coordinates. */ if (x != cursorx || y != cursory) { if(curcursor) GdMoveCursor(x - curcursor->cursor.hotx, y - curcursor->cursor.hoty); cursorx = x; cursory = y; } /* * Now check to see which window the mouse is in and whether or * not the cursor shape should be changed. */ MwCheckMouseWindow(); MwCheckCursor(); }
/* * Map the window to possibly make it and its children visible on the screen. * This is a recursive routine which decrements the unmapcount values for * this window and all of its children, and causes exposure events for * those windows which become visible. */ void MwShowWindow(HWND hwnd, BOOL bSendMsg) { HWND wp = hwnd; if (wp == rootwp) return; ++mwpaintNC; /* experimental NC paint handling*/ if (wp->unmapcount) wp->unmapcount--; if (wp->unmapcount == 0) { SendMessage(wp, WM_SHOWWINDOW, TRUE, 0L); MwCheckMouseWindow(); MwCheckCursor(); } /* * If the window just became visible, * then draw its border, clear it to the background color, and * generate an exposure event. */ if (wp->unmapcount == 0) { /*MwDrawBorder(wp);*/ MwClearWindow(wp, 0, 0, wp->winrect.right - wp->winrect.left, wp->winrect.bottom - wp->winrect.top, TRUE); } /* * Do the same thing for the children. */ for (wp = wp->children; wp; wp = wp->siblings) MwShowWindow(wp, bSendMsg); }