[261749]: libs / gtdrag / gtdrag_lib_aros.c Maximize Restore History

Download this file

gtdrag_lib_aros.c    101 lines (72 with data), 1.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
/*
* Copyright Š1999-2008 pinc Software. All Rights Reserved.
* Licensed under the terms of the MIT License.
*/
//! Library part (AROS).
#include <aros/symbolsets.h>
#include "gtdrag_includes.h"
struct Library *GTDragBase;
void PRIVATE GTD_Exit(void)
{
if (dmport)
{
struct IntuiMessage *msg;
while((msg = (struct IntuiMessage*)GetMsg(dmport)) != 0)
FreeDropMessage(msg);
DeleteMsgPort(dmport);
}
}
int PRIVATE GTD_Init(void)
{
if ((dmport = CreateMsgPort()) != 0)
return TRUE;
return FALSE;
}
BOOL LibInit(struct Library *l)
{
if(SysBase->LibNode.lib_Version < 37)
return FALSE;
/** init global data **/
GTDragBase = l;
NewList((struct List *)&applist);
NewList((struct List *)&gadlist);
NewList((struct List *)&winlist);
mx = 0; my = 0;
gdo = NULL; dg = NULL;
fakemsg = FALSE; noreport = FALSE;
/** init hooks **/
SETHOOK(treeHook, TreeHook);
SETHOOK(renderHook, RenderHook);
SETHOOK(iffstreamHook, IFFStreamHook);
/** init semaphores **/
InitSemaphore(&ListSemaphore);
return TRUE;
}
BOOL LibOpen(struct Library *l)
{
if (!GTD_Init())
{
GTD_Exit();
return FALSE;
}
return TRUE;
}
void LibExpunge(struct Library *l)
{
struct DragApp *da;
struct Node *n;
while((n = RemHead((struct List *)&gadlist)))
FreeMem(n,sizeof(struct DragGadget));
while((n = RemHead((struct List *)&winlist)))
FreeMem(n,sizeof(struct DragWindow));
while((da = (struct DragApp *)RemHead((struct List *)&applist)))
FreeMem(da,sizeof(struct DragApp));
}
void LibClose(struct Library *l)
{
GTD_Exit();
}
ADD2INITLIB(LibInit, 0);
ADD2EXPUNGELIB(LibExpunge, 0);
ADD2OPENLIB(LibOpen, 0);
ADD2CLOSELIB(LibClose, 0);