home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d9xx / d913 / stickit.lha / StickIt / Source / Source.lha / commodore.c < prev    next >
C/C++ Source or Header  |  1993-06-01  |  1KB  |  63 lines

  1. /*********************************************/
  2. /**************   commodore.c   **************/
  3. /*********************************************/
  4.  
  5. #include <stdio.h>
  6.  
  7. #ifdef AMIGA
  8. #include <clib/intuition_protos.h>
  9. #include <clib/exec_protos.h>
  10. #include <clib/dos_protos.h>
  11. #include <clib/graphics_protos.h>
  12. #include <clib/layers_protos.h>
  13.  
  14. #include <exec/types.h>
  15. #include <exec/nodes.h>
  16. #include <exec/lists.h>
  17. #include <exec/ports.h>
  18.  
  19. #include <intuition/intuition.h>
  20. #include <intuition/intuitionbase.h>
  21. #include <graphics/displayinfo.h>
  22. #include <graphics/gfxbase.h>
  23.  
  24. #endif
  25.  
  26. #include "consts.h"
  27. #include "structs.h"
  28. #include "prototype.h"
  29.  
  30. void CloseWindowSafely(struct Window *win)
  31.    {
  32.    Forbid();
  33.  
  34.    StripIntuiMessages(win->UserPort,win);
  35.  
  36.    win->UserPort = NULL;
  37.  
  38.    ModifyIDCMP(win,0L);
  39.  
  40.    Permit();
  41.  
  42.    CloseWindow(win);
  43.    }
  44.  
  45. void StripIntuiMessages(struct MsgPort *mp, struct Window *win)
  46.    {
  47.    struct IntuiMessage *msg;
  48.    struct Node *succ;
  49.  
  50.    msg = (struct IntuiMessage *)mp->mp_MsgList.lh_Head;
  51.  
  52.    while (succ = msg->ExecMessage.mn_Node.ln_Succ)
  53.       {
  54.       if (msg->IDCMPWindow == win)
  55.          {
  56.          Remove((struct Node *)msg);
  57.          ReplyMsg((struct Message *)msg);
  58.          }
  59.       msg = (struct IntuiMessage *)succ;
  60.       }
  61.    }
  62.  
  63.