home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / win / tkWinWindow.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-15  |  18.0 KB  |  797 lines  |  [TEXT/CWIE]

  1. /* 
  2.  * tkWinWindow.c --
  3.  *
  4.  *    Xlib emulation routines for Windows related to creating,
  5.  *    displaying and destroying windows.
  6.  *
  7.  * Copyright (c) 1995 Sun Microsystems, Inc.
  8.  *
  9.  * See the file "license.terms" for information on usage and redistribution
  10.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11.  *
  12.  * SCCS: @(#) tkWinWindow.c 1.23 97/07/01 18:14:13
  13.  */
  14.  
  15. #include "tkWinInt.h"
  16.  
  17. /*
  18.  * The windowTable maps from HWND to Tk_Window handles.
  19.  */
  20.  
  21. static Tcl_HashTable windowTable;
  22.  
  23. /*
  24.  * Have statics in this module been initialized?
  25.  */
  26.  
  27. static int initialized = 0;
  28.  
  29. /*
  30.  * Forward declarations for procedures defined in this file:
  31.  */
  32.  
  33. static void        NotifyVisibility _ANSI_ARGS_((XEvent *eventPtr,
  34.                 TkWindow *winPtr));
  35. static void         StackWindow _ANSI_ARGS_((Window w, Window sibling,
  36.                 int stack_mode));
  37.  
  38. /*
  39.  *----------------------------------------------------------------------
  40.  *
  41.  * Tk_AttachHWND --
  42.  *
  43.  *    This function binds an HWND and a reflection procedure to
  44.  *    the specified Tk_Window. 
  45.  *
  46.  * Results:
  47.  *    Returns an X Window that encapsulates the HWND.
  48.  *
  49.  * Side effects:
  50.  *    May allocate a new X Window.  Also enters the HWND into the
  51.  *    global window table.
  52.  *
  53.  *----------------------------------------------------------------------
  54.  */
  55.  
  56. Window
  57. Tk_AttachHWND(tkwin, hwnd)
  58.     Tk_Window tkwin;
  59.     HWND hwnd;
  60. {
  61.     int new;
  62.     Tcl_HashEntry *entryPtr;
  63.     TkWinDrawable *twdPtr = (TkWinDrawable *) Tk_WindowId(tkwin);
  64.  
  65.     if (!initialized) {
  66.     Tcl_InitHashTable(&windowTable, TCL_ONE_WORD_KEYS);
  67.     initialized = 1;
  68.     }
  69.  
  70.     /*
  71.      * Allocate a new drawable if necessary.  Otherwise, remove the
  72.      * previous HWND from from the window table.
  73.      */
  74.  
  75.     if (twdPtr == NULL) {
  76.     twdPtr = (TkWinDrawable*) ckalloc(sizeof(TkWinDrawable));
  77.     twdPtr->type = TWD_WINDOW;
  78.     twdPtr->window.winPtr = (TkWindow *) tkwin;
  79.     } else if (twdPtr->window.handle != NULL) {
  80.     entryPtr = Tcl_FindHashEntry(&windowTable,
  81.         (char *)twdPtr->window.handle);
  82.     Tcl_DeleteHashEntry(entryPtr);
  83.     }
  84.  
  85.     /*
  86.      * Insert the new HWND into the window table.
  87.      */
  88.  
  89.     twdPtr->window.handle = hwnd;
  90.     entryPtr = Tcl_CreateHashEntry(&windowTable, (char *)hwnd, &new);
  91.     Tcl_SetHashValue(entryPtr, (ClientData)tkwin);
  92.  
  93.     return (Window)twdPtr;
  94. }
  95.  
  96. /*
  97.  *----------------------------------------------------------------------
  98.  *
  99.  * Tk_HWNDToWindow --
  100.  *
  101.  *    This function retrieves a Tk_Window from the window table
  102.  *    given an HWND.
  103.  *
  104.  * Results:
  105.  *    Returns the matching Tk_Window.
  106.  *
  107.  * Side effects:
  108.  *    None.
  109.  *
  110.  *----------------------------------------------------------------------
  111.  */
  112.  
  113. Tk_Window
  114. Tk_HWNDToWindow(hwnd)
  115.     HWND hwnd;
  116. {
  117.     Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&windowTable, (char*)hwnd);
  118.     if (entryPtr != NULL) {
  119.     return (Tk_Window) Tcl_GetHashValue(entryPtr);
  120.     }
  121.     return NULL;
  122. }
  123.  
  124. /*
  125.  *----------------------------------------------------------------------
  126.  *
  127.  * Tk_GetHWND --
  128.  *
  129.  *    This function extracts the HWND from an X Window.
  130.  *
  131.  * Results:
  132.  *    Returns the HWND associated with the Window.
  133.  *
  134.  * Side effects:
  135.  *    None.
  136.  *
  137.  *----------------------------------------------------------------------
  138.  */
  139.  
  140. HWND
  141. Tk_GetHWND(window)
  142.     Window window;
  143. {
  144.     TkWinDrawable *twdPtr = (TkWinDrawable *) window;
  145.     return twdPtr->window.handle;
  146. }
  147.  
  148. /*
  149.  *----------------------------------------------------------------------
  150.  *
  151.  * TkpPrintWindowId --
  152.  *
  153.  *    This routine stores the string representation of the
  154.  *    platform dependent window handle for an X Window in the
  155.  *    given buffer.
  156.  *
  157.  * Results:
  158.  *    Returns the result in the specified buffer.
  159.  *
  160.  * Side effects:
  161.  *    None.
  162.  *
  163.  *----------------------------------------------------------------------
  164.  */
  165.  
  166. void
  167. TkpPrintWindowId(buf, window)
  168.     char *buf;            /* Pointer to string large enough to hold
  169.                  * the hex representation of a pointer. */
  170.     Window window;        /* Window to be printed into buffer. */
  171. {
  172.     HWND hwnd = (window) ? Tk_GetHWND(window) : 0;
  173.     sprintf(buf, "0x%x", (unsigned int) hwnd);
  174. }
  175.  
  176. /*
  177.  *----------------------------------------------------------------------
  178.  *
  179.  * TkpScanWindowId --
  180.  *
  181.  *    Given a string which represents the platform dependent window
  182.  *    handle, produce the X Window id for the window.
  183.  *
  184.  * Results:
  185.  *    The return value is normally TCL_OK;  in this case *idPtr
  186.  *    will be set to the X Window id equivalent to string.  If
  187.  *    string is improperly formed then TCL_ERROR is returned and
  188.  *    an error message will be left in interp->result.  If the
  189.  *    number does not correspond to a Tk Window, then *idPtr will
  190.  *    be set to None.
  191.  *
  192.  * Side effects:
  193.  *    None.
  194.  *
  195.  *----------------------------------------------------------------------
  196.  */
  197.  
  198. int
  199. TkpScanWindowId(interp, string, idPtr)
  200.     Tcl_Interp *interp;        /* Interpreter to use for error reporting. */
  201.     char *string;        /* String containing a (possibly signed)
  202.                  * integer in a form acceptable to strtol. */
  203.     int *idPtr;            /* Place to store converted result. */
  204. {
  205.     int number;
  206.     Tk_Window tkwin;
  207.  
  208.     if (Tcl_GetInt(interp, string, &number) != TCL_OK) {
  209.     return TCL_ERROR;
  210.     }
  211.     tkwin = Tk_HWNDToWindow((HWND)number);
  212.     if (tkwin) {
  213.     *idPtr = Tk_WindowId(tkwin);
  214.     } else {
  215.     *idPtr = None;
  216.     }
  217.     return TCL_OK;
  218. }
  219.  
  220. /*
  221.  *----------------------------------------------------------------------
  222.  *
  223.  * TkpMakeWindow --
  224.  *
  225.  *    Creates a Windows window object based on the current attributes
  226.  *    of the specified TkWindow.
  227.  *
  228.  * Results:
  229.  *    Returns a pointer to a new TkWinDrawable cast to a Window.
  230.  *
  231.  * Side effects:
  232.  *    Creates a new window.
  233.  *
  234.  *----------------------------------------------------------------------
  235.  */
  236.  
  237. Window
  238. TkpMakeWindow(winPtr, parent)
  239.     TkWindow *winPtr;
  240.     Window parent;
  241. {
  242.     HWND parentWin;
  243.     int style;
  244.     HWND hwnd;
  245.     
  246.     if (parent != None) {
  247.     parentWin = Tk_GetHWND(parent);
  248.     style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
  249.     } else {
  250.     parentWin = NULL;
  251.     style = WS_POPUP | WS_CLIPCHILDREN;
  252.     }
  253.  
  254.     /*
  255.      * Create the window, then ensure that it is at the top of the
  256.      * stacking order.
  257.      */
  258.  
  259.     hwnd = CreateWindow(TK_WIN_CHILD_CLASS_NAME, NULL, style,
  260.         Tk_X(winPtr), Tk_Y(winPtr), Tk_Width(winPtr), Tk_Height(winPtr),
  261.         parentWin, NULL, Tk_GetHINSTANCE(), NULL);
  262.     SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0,
  263.             SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
  264.     return Tk_AttachHWND((Tk_Window)winPtr, hwnd);
  265. }
  266.  
  267. /*
  268.  *----------------------------------------------------------------------
  269.  *
  270.  * XDestroyWindow --
  271.  *
  272.  *    Destroys the given window.
  273.  *
  274.  * Results:
  275.  *    None.
  276.  *
  277.  * Side effects:
  278.  *    Sends the WM_DESTROY message to the window and then destroys
  279.  *    it the Win32 resources associated with the window.
  280.  *
  281.  *----------------------------------------------------------------------
  282.  */
  283.  
  284. void
  285. XDestroyWindow(display, w)
  286.     Display* display;
  287.     Window w;
  288. {
  289.     Tcl_HashEntry *entryPtr;
  290.     TkWinDrawable *twdPtr = (TkWinDrawable *)w;
  291.     TkWindow *winPtr = TkWinGetWinPtr(w);
  292.     HWND hwnd = Tk_GetHWND(w);
  293.  
  294.     display->request++;
  295.  
  296.     /*
  297.      * Remove references to the window in the pointer module then
  298.      * release the drawable.
  299.      */
  300.  
  301.     TkPointerDeadWindow(winPtr);
  302.  
  303.     entryPtr = Tcl_FindHashEntry(&windowTable, (char*)hwnd);
  304.     if (entryPtr != NULL) {
  305.     Tcl_DeleteHashEntry(entryPtr);
  306.     }
  307.  
  308.     ckfree((char *)twdPtr);
  309.  
  310.     /*
  311.      * Don't bother destroying the window if we are going to destroy
  312.      * the parent later.
  313.      */
  314.  
  315.     if (hwnd != NULL && !(winPtr->flags & TK_DONT_DESTROY_WINDOW)) {
  316.     DestroyWindow(hwnd);
  317.     }
  318. }
  319.  
  320. /*
  321.  *----------------------------------------------------------------------
  322.  *
  323.  * XMapWindow --
  324.  *
  325.  *    Cause the given window to become visible.
  326.  *
  327.  * Results:
  328.  *    None
  329.  *
  330.  * Side effects:
  331.  *    Causes the window state to change, and generates a MapNotify
  332.  *    event.
  333.  *
  334.  *----------------------------------------------------------------------
  335.  */
  336.  
  337. void
  338. XMapWindow(display, w)
  339.     Display* display;
  340.     Window w;
  341. {
  342.     XEvent event;
  343.     TkWindow *parentPtr;
  344.     TkWindow *winPtr = TkWinGetWinPtr(w);
  345.  
  346.     display->request++;
  347.  
  348.     ShowWindow(TkWinGetHWND(w), SW_SHOWNORMAL);
  349.     winPtr->flags |= TK_MAPPED;
  350.  
  351.     /*
  352.      * Check to see if this window is visible now.  If all of the parent
  353.      * windows up to the first toplevel are mapped, then this window and
  354.      * its mapped children have just become visible.
  355.      */
  356.  
  357.     if (!(winPtr->flags & TK_TOP_LEVEL)) {
  358.     for (parentPtr = winPtr->parentPtr; ;
  359.             parentPtr = parentPtr->parentPtr) {
  360.         if ((parentPtr == NULL) || !(parentPtr->flags & TK_MAPPED)) {
  361.         return;
  362.         }
  363.         if (parentPtr->flags & TK_TOP_LEVEL) {
  364.         break;
  365.         }
  366.     }
  367.     } else {
  368.     event.type = MapNotify;
  369.     event.xmap.serial = display->request;
  370.     event.xmap.send_event = False;
  371.     event.xmap.display = display;
  372.     event.xmap.event = winPtr->window;
  373.     event.xmap.window = winPtr->window;
  374.     event.xmap.override_redirect = winPtr->atts.override_redirect;
  375.     Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
  376.     }
  377.     
  378.     /*
  379.      * Generate VisibilityNotify events for this window and its mapped
  380.      * children.
  381.      */
  382.  
  383.     event.type = VisibilityNotify;
  384.     event.xvisibility.serial = display->request;
  385.     event.xvisibility.send_event = False;
  386.     event.xvisibility.display = display;
  387.     event.xvisibility.window = winPtr->window;
  388.     event.xvisibility.state = VisibilityUnobscured;
  389.     NotifyVisibility(&event, winPtr);
  390. }
  391.  
  392. /*
  393.  *----------------------------------------------------------------------
  394.  *
  395.  * NotifyVisibility --
  396.  *
  397.  *    This function recursively notifies the mapped children of the
  398.  *    specified window of a change in visibility.  Note that we don't
  399.  *    properly report the visibility state, since Windows does not
  400.  *    provide that info.  The eventPtr argument must point to an event
  401.  *    that has been completely initialized except for the window slot.
  402.  *
  403.  * Results:
  404.  *    None.
  405.  *
  406.  * Side effects:
  407.  *    Generates lots of events.
  408.  *
  409.  *----------------------------------------------------------------------
  410.  */
  411.  
  412. static void
  413. NotifyVisibility(eventPtr, winPtr)
  414.     XEvent *eventPtr;        /* Initialized VisibilityNotify event. */
  415.     TkWindow *winPtr;        /* Window to notify. */
  416. {
  417.     if (winPtr->atts.event_mask & VisibilityChangeMask) {
  418.     eventPtr->xvisibility.window = winPtr->window;
  419.     Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_TAIL);
  420.     }
  421.     for (winPtr = winPtr->childList; winPtr != NULL; 
  422.         winPtr = winPtr->nextPtr) {
  423.     if (winPtr->flags & TK_MAPPED) {
  424.         NotifyVisibility(eventPtr, winPtr);
  425.     }
  426.     }
  427. }
  428.  
  429. /*
  430.  *----------------------------------------------------------------------
  431.  *
  432.  * XUnmapWindow --
  433.  *
  434.  *    Cause the given window to become invisible.
  435.  *
  436.  * Results:
  437.  *    None
  438.  *
  439.  * Side effects:
  440.  *    Causes the window state to change, and generates an UnmapNotify
  441.  *    event.
  442.  *
  443.  *----------------------------------------------------------------------
  444.  */
  445.  
  446. void
  447. XUnmapWindow(display, w)
  448.     Display* display;
  449.     Window w;
  450. {
  451.     XEvent event;
  452.     TkWindow *winPtr = TkWinGetWinPtr(w);
  453.  
  454.     display->request++;
  455.  
  456.     /*
  457.      * Bug fix: Don't short circuit this routine based on TK_MAPPED because
  458.      * it will be cleared before XUnmapWindow is called.
  459.      */
  460.  
  461.     ShowWindow(TkWinGetHWND(w), SW_HIDE);
  462.     winPtr->flags &= ~TK_MAPPED;
  463.  
  464.     if (winPtr->flags & TK_TOP_LEVEL) {
  465.     event.type = UnmapNotify;
  466.     event.xunmap.serial = display->request;
  467.     event.xunmap.send_event = False;
  468.     event.xunmap.display = display;
  469.     event.xunmap.event = winPtr->window;
  470.     event.xunmap.window = winPtr->window;
  471.     event.xunmap.from_configure = False;
  472.     Tk_HandleEvent(&event);
  473.     }
  474. }
  475.  
  476. /*
  477.  *----------------------------------------------------------------------
  478.  *
  479.  * XMoveResizeWindow --
  480.  *
  481.  *    Move and resize a window relative to its parent.
  482.  *
  483.  * Results:
  484.  *    None.
  485.  *
  486.  * Side effects:
  487.  *    Repositions and resizes the specified window.
  488.  *
  489.  *----------------------------------------------------------------------
  490.  */
  491.  
  492. void
  493. XMoveResizeWindow(display, w, x, y, width, height)
  494.     Display* display;
  495.     Window w;
  496.     int x;            /* Position relative to parent. */
  497.     int y;
  498.     unsigned int width;
  499.     unsigned int height;
  500. {
  501.     display->request++;
  502.     MoveWindow(TkWinGetHWND(w), x, y, width, height, TRUE);
  503. }
  504.  
  505. /*
  506.  *----------------------------------------------------------------------
  507.  *
  508.  * XMoveWindow --
  509.  *
  510.  *    Move a window relative to its parent.
  511.  *
  512.  * Results:
  513.  *    None.
  514.  *
  515.  * Side effects:
  516.  *    Repositions the specified window.
  517.  *
  518.  *----------------------------------------------------------------------
  519.  */
  520.  
  521. void
  522. XMoveWindow(display, w, x, y)
  523.     Display* display;
  524.     Window w;
  525.     int x;
  526.     int y;
  527. {
  528.     TkWindow *winPtr = TkWinGetWinPtr(w);
  529.  
  530.     display->request++;
  531.  
  532.     MoveWindow(TkWinGetHWND(w), x, y, winPtr->changes.width,
  533.         winPtr->changes.height, TRUE);
  534. }
  535.  
  536. /*
  537.  *----------------------------------------------------------------------
  538.  *
  539.  * XResizeWindow --
  540.  *
  541.  *    Resize a window.
  542.  *
  543.  * Results:
  544.  *    None.
  545.  *
  546.  * Side effects:
  547.  *    Resizes the specified window.
  548.  *
  549.  *----------------------------------------------------------------------
  550.  */
  551.  
  552. void
  553. XResizeWindow(display, w, width, height)
  554.     Display* display;
  555.     Window w;
  556.     unsigned int width;
  557.     unsigned int height;
  558. {
  559.     TkWindow *winPtr = TkWinGetWinPtr(w);
  560.  
  561.     display->request++;
  562.  
  563.     MoveWindow(TkWinGetHWND(w), winPtr->changes.x, winPtr->changes.y, width,
  564.         height, TRUE);
  565. }
  566.  
  567. /*
  568.  *----------------------------------------------------------------------
  569.  *
  570.  * XRaiseWindow --
  571.  *
  572.  *    Change the stacking order of a window.
  573.  *
  574.  * Results:
  575.  *    None.
  576.  *
  577.  * Side effects:
  578.  *    Changes the stacking order of the specified window.
  579.  *
  580.  *----------------------------------------------------------------------
  581.  */
  582.  
  583. void
  584. XRaiseWindow(display, w)
  585.     Display* display;
  586.     Window w;
  587. {
  588.     HWND window = TkWinGetHWND(w);
  589.  
  590.     display->request++;
  591.     SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
  592.         SWP_NOMOVE | SWP_NOSIZE);
  593. }
  594.  
  595. /*
  596.  *----------------------------------------------------------------------
  597.  *
  598.  * XConfigureWindow --
  599.  *
  600.  *    Change the size, position, stacking, or border of the specified
  601.  *    window.
  602.  *
  603.  * Results:
  604.  *    None.
  605.  *
  606.  * Side effects:
  607.  *    Changes the attributes of the specified window.  Note that we
  608.  *    ignore the passed in values and use the values stored in the
  609.  *    TkWindow data structure.
  610.  *
  611.  *----------------------------------------------------------------------
  612.  */
  613.  
  614. void
  615. XConfigureWindow(display, w, value_mask, values)
  616.     Display* display;
  617.     Window w;
  618.     unsigned int value_mask;
  619.     XWindowChanges* values;
  620. {
  621.     TkWindow *winPtr = TkWinGetWinPtr(w);
  622.     HWND hwnd = TkWinGetHWND(w);
  623.  
  624.     display->request++;
  625.  
  626.     /*
  627.      * Change the shape and/or position of the window.
  628.      */
  629.  
  630.     if (value_mask & (CWX|CWY|CWWidth|CWHeight)) {
  631.     MoveWindow(hwnd, winPtr->changes.x, winPtr->changes.y,
  632.         winPtr->changes.width, winPtr->changes.height, TRUE);
  633.     }
  634.  
  635.     /*
  636.      * Change the stacking order of the window.
  637.      */
  638.  
  639.     if (value_mask & CWStackMode) {
  640.     HWND sibling;
  641.     if ((value_mask & CWSibling) && (values->sibling != None)) {
  642.         sibling = Tk_GetHWND(values->sibling);
  643.     } else {
  644.         sibling = NULL;
  645.     }
  646.     TkWinSetWindowPos(hwnd, sibling, values->stack_mode);
  647.     }
  648. }
  649.  
  650. /*
  651.  *----------------------------------------------------------------------
  652.  *
  653.  * XClearWindow --
  654.  *
  655.  *    Clears the entire window to the current background color.
  656.  *
  657.  * Results:
  658.  *    None.
  659.  *
  660.  * Side effects:
  661.  *    Erases the current contents of the window.
  662.  *
  663.  *----------------------------------------------------------------------
  664.  */
  665.  
  666. void
  667. XClearWindow(display, w)
  668.     Display* display;
  669.     Window w;
  670. {
  671.     RECT rc;
  672.     HBRUSH brush;
  673.     HPALETTE oldPalette, palette;
  674.     TkWindow *winPtr;
  675.     HWND hwnd = TkWinGetHWND(w);
  676.     HDC dc = GetDC(hwnd);
  677.  
  678.     palette = TkWinGetPalette(display->screens[0].cmap);
  679.     oldPalette = SelectPalette(dc, palette, FALSE);
  680.  
  681.     display->request++;
  682.  
  683.     winPtr = TkWinGetWinPtr(w);
  684.     brush = CreateSolidBrush(winPtr->atts.background_pixel);
  685.     GetWindowRect(hwnd, &rc);
  686.     rc.right = rc.right - rc.left;
  687.     rc.bottom = rc.bottom - rc.top;
  688.     rc.left = rc.top = 0;
  689.     FillRect(dc, &rc, brush);
  690.  
  691.     DeleteObject(brush);
  692.     SelectPalette(dc, oldPalette, TRUE);
  693.     ReleaseDC(hwnd, dc);
  694. }
  695.  
  696. /*
  697.  *----------------------------------------------------------------------
  698.  *
  699.  * XChangeWindowAttributes --
  700.  *
  701.  *    This function is called when the attributes on a window are
  702.  *    updated.  Since Tk maintains all of the window state, the only
  703.  *    relevant value is the cursor.
  704.  *
  705.  * Results:
  706.  *    None.
  707.  *
  708.  * Side effects:
  709.  *    May cause the mouse position to be updated.
  710.  *
  711.  *----------------------------------------------------------------------
  712.  */
  713.  
  714. void
  715. XChangeWindowAttributes(display, w, valueMask, attributes)
  716.     Display* display;
  717.     Window w;
  718.     unsigned long valueMask;
  719.     XSetWindowAttributes* attributes;
  720. {
  721.     if (valueMask & CWCursor) {
  722.     XDefineCursor(display, w, attributes->cursor);
  723.     }
  724. }
  725.  
  726. /*
  727.  *----------------------------------------------------------------------
  728.  *
  729.  * TkWinSetWindowPos --
  730.  *
  731.  *    Adjust the stacking order of a window relative to a second
  732.  *    window (or NULL).
  733.  *
  734.  * Results:
  735.  *    None.
  736.  *
  737.  * Side effects:
  738.  *    Moves the specified window in the stacking order.
  739.  *
  740.  *----------------------------------------------------------------------
  741.  */
  742.  
  743. void
  744. TkWinSetWindowPos(hwnd, siblingHwnd, pos)
  745.     HWND hwnd;            /* Window to restack. */
  746.     HWND siblingHwnd;        /* Sibling window. */
  747.     int pos;            /* One of Above or Below. */
  748. {
  749.     HWND temp;
  750.  
  751.     /*
  752.      * Since Windows does not support Above mode, we place the
  753.      * specified window below the sibling and then swap them.
  754.      */
  755.  
  756.     if (siblingHwnd) {
  757.     if (pos == Above) {
  758.         SetWindowPos(hwnd, siblingHwnd, 0, 0, 0, 0,
  759.             SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
  760.         temp = hwnd;
  761.         hwnd = siblingHwnd;
  762.         siblingHwnd = temp;
  763.     }
  764.     } else {
  765.     siblingHwnd = (pos == Above) ? HWND_TOP : HWND_BOTTOM;
  766.     }
  767.  
  768.     SetWindowPos(hwnd, siblingHwnd, 0, 0, 0, 0,
  769.         SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
  770. }
  771.  
  772. /*
  773.  *----------------------------------------------------------------------
  774.  *
  775.  * TkpWindowWasRecentlyDeleted --
  776.  *
  777.  *    Determines whether we know if the window given as argument was
  778.  *    recently deleted. Called by the generic code error handler to
  779.  *    handle BadWindow events.
  780.  *
  781.  * Results:
  782.  *    Always 0. We do not keep this information on Windows.
  783.  *
  784.  * Side effects:
  785.  *    None.
  786.  *
  787.  *----------------------------------------------------------------------
  788.  */
  789.  
  790. int
  791. TkpWindowWasRecentlyDeleted(win, dispPtr)
  792.     Window win;
  793.     TkDisplay *dispPtr;
  794. {
  795.     return 0;
  796. }
  797.