void XMapWindow( Display* display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; XEvent event; CGrafPtr destPort; /* * Under certain situations it's possible for this function to be * called before the toplevel window it's associated with has actually * been mapped. In that case we need to create the real Macintosh * window now as this function as well as other X functions assume that * the portPtr is valid. */ if (!TkMacOSXHostToplevelExists(macWin->toplevel->winPtr)) { TkMacOSXMakeRealWindowExist(macWin->toplevel->winPtr); } destPort = TkMacOSXGetDrawablePort (window); display->request++; macWin->winPtr->flags |= TK_MAPPED; if (Tk_IsTopLevel(macWin->winPtr)) { if (!Tk_IsEmbedded(macWin->winPtr)) { ShowWindow(GetWindowFromPort(destPort)); } /* * We only need to send the MapNotify event * for toplevel windows. */ event.xany.serial = display->request; event.xany.send_event = False; event.xany.display = display; event.xmap.window = window; event.xmap.type = MapNotify; event.xmap.event = window; event.xmap.override_redirect = macWin->winPtr->atts.override_redirect; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } else { TkMacOSXInvalClipRgns(macWin->winPtr->parentPtr); } /* * Generate damage for that area of the window */ SetGWorld (destPort, NULL); TkMacOSXUpdateClipRgn(macWin->winPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); }
static void BringWindowForward( WindowRef wRef, int isFrontProcess, int frontWindowOnly) { if (wRef && !TkpIsWindowFloating(wRef) && IsValidWindowPtr(wRef)) { WindowRef frontWindow = FrontNonFloatingWindow(); WindowModality frontWindowModality = kWindowModalityNone; if (frontWindow && frontWindow != wRef) { ChkErr(GetWindowModality, frontWindow, &frontWindowModality, NULL); } if (frontWindowModality != kWindowModalityAppModal) { Window window = TkMacOSXGetXWindow(wRef); if (window != None) { TkDisplay *dispPtr = TkGetDisplayList(); TkWindow * winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display, window); if (winPtr && winPtr->wmInfoPtr && winPtr->wmInfoPtr->master != None) { TkWindow *masterWinPtr = (TkWindow *)Tk_IdToWindow( dispPtr->display, winPtr->wmInfoPtr->master); if (masterWinPtr && masterWinPtr->window != None && TkMacOSXHostToplevelExists(masterWinPtr)) { WindowRef masterMacWin = TkMacOSXDrawableWindow(masterWinPtr->window); if (masterMacWin) { BringToFront(masterMacWin); } } } } SelectWindow(wRef); } else { frontWindowOnly = 0; } } if (!isFrontProcess) { ProcessSerialNumber ourPsn = {0, kCurrentProcess}; ChkErr(SetFrontProcessWithOptions, &ourPsn, frontWindowOnly ? kSetFrontProcessFrontWindowOnly : 0); } }
void XMapWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; XEvent event; /* * Under certain situations it's possible for this function to be called * before the toplevel window it's associated with has actually been * mapped. In that case we need to create the real Macintosh window now as * this function as well as other X functions assume that the portPtr is * valid. */ if (!TkMacOSXHostToplevelExists(macWin->toplevel->winPtr)) { TkMacOSXMakeRealWindowExist(macWin->toplevel->winPtr); } display->request++; macWin->winPtr->flags |= TK_MAPPED; if (Tk_IsTopLevel(macWin->winPtr)) { if (!Tk_IsEmbedded(macWin->winPtr)) { /* * XXX This should be ShowSheetWindow for kSheetWindowClass * XXX windows that have a wmPtr->master parent set. */ WindowRef wRef = TkMacOSXDrawableWindow(window); if ((macWin->winPtr->wmInfoPtr->macClass == kSheetWindowClass) && (macWin->winPtr->wmInfoPtr->master != None)) { ShowSheetWindow(wRef, TkMacOSXDrawableWindow( macWin->winPtr->wmInfoPtr->master)); } else { ShowWindow(wRef); } } TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr); /* * We only need to send the MapNotify event for toplevel windows. */ event.xany.serial = display->request; event.xany.send_event = False; event.xany.display = display; event.xmap.window = window; event.xmap.type = MapNotify; event.xmap.event = window; event.xmap.override_redirect = macWin->winPtr->atts.override_redirect; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } else { /* * Generate damage for that area of the window. */ TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } /* * Generate VisibilityNotify events for window and all mapped children. */ event.xany.send_event = False; event.xany.display = display; event.xvisibility.type = VisibilityNotify; event.xvisibility.state = VisibilityUnobscured; NotifyVisibility(macWin->winPtr, &event); }