bug: uses wrong list counter, which incurs an array overflow/undefined behaviour...
[AROS-Contrib.git] / libs / desktop / desktopclass.c
blobc8b311c9180b600ee3117900c553d50ac347671e
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #define DEBUG 1
9 #include <aros/debug.h>
11 #include <exec/types.h>
12 #include <intuition/classes.h>
13 #include <intuition/classusr.h>
14 #include <libraries/mui.h>
16 #include "support.h"
17 #include "worker.h"
18 #include "desktop_intern.h"
20 #include <proto/dos.h>
21 #include <proto/intuition.h>
22 #include <proto/utility.h>
24 #include "desktopclass.h"
26 #include "desktop_intern_protos.h"
28 IPTR desktopNew(Class * cl, Object * obj, struct opSet * msg)
30 IPTR retval = 0;
31 struct DesktopClassData *data;
32 //struct TagItem *tag;
34 retval = DoSuperMethodA(cl, obj, (Msg) msg);
35 if (retval)
37 obj = (Object *) retval;
38 data = INST_DATA(cl, obj);
41 return retval;
44 IPTR desktopSet(Class * cl, Object * obj, struct opSet * msg)
46 struct DesktopClassData *data;
47 IPTR retval = 1;
48 struct TagItem *tag,
49 *tstate = msg->ops_AttrList;
51 data = (struct DesktopClassData *) INST_DATA(cl, obj);
53 while ((tag = NextTagItem(&tstate)))
55 switch (tag->ti_Tag)
57 case DA_ActiveWindow:
58 data->activeWindow = (Object *) tag->ti_Data;
59 break;
60 default:
61 break;
65 retval = DoSuperMethodA(cl, obj, (Msg) msg);
67 return retval;
70 IPTR desktopGet(Class * cl, Object * obj, struct opGet * msg)
72 IPTR retval = 1;
73 struct DesktopClassData *data;
75 data = (struct DesktopClassData *) INST_DATA(cl, obj);
77 switch (msg->opg_AttrID)
79 case DA_ActiveWindow:
80 *msg->opg_Storage = (IPTR) data->activeWindow;
81 break;
82 default:
83 retval = DoSuperMethodA(cl, obj, (Msg) msg);
84 break;
87 return retval;
90 IPTR desktopDispose(Class * cl, Object * obj, Msg msg)
92 IPTR retval;
94 retval = DoSuperMethodA(cl, obj, msg);
96 return retval;
99 BOOPSI_DISPATCHER(IPTR, desktopDispatcher, cl, obj, msg)
101 ULONG retval = 0;
103 switch (msg->MethodID)
105 case OM_NEW:
106 retval = desktopNew(cl, obj, (struct opSet *) msg);
107 break;
108 case OM_SET:
109 retval = desktopSet(cl, obj, (struct opSet *) msg);
110 break;
111 case OM_GET:
112 retval = desktopGet(cl, obj, (struct opGet *) msg);
113 break;
114 case OM_DISPOSE:
115 retval = desktopDispose(cl, obj, msg);
116 break;
117 default:
118 retval = DoSuperMethodA(cl, obj, msg);
119 break;
122 return retval;
124 BOOPSI_DISPATCHER_END