Check for SYS/GL during library init. Reason is that
[AROS.git] / rom / intuition / setwindowpointera.c
blob5b7253402862d8ba7ad7f06d994c035ce12e9599
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include <proto/graphics.h>
8 #include <proto/utility.h>
9 #include "intuition_intern.h"
10 #include "monitorclass_private.h"
11 #include <intuition/pointerclass.h>
13 /*****************************************************************************
15 NAME */
16 #include <proto/intuition.h>
18 AROS_LH2(void, SetWindowPointerA,
20 /* SYNOPSIS */
21 AROS_LHA(struct Window * , window , A0),
22 AROS_LHA(struct TagItem *, taglist, A1),
24 /* LOCATION */
25 struct IntuitionBase *, IntuitionBase, 136, Intuition)
27 /* FUNCTION
29 INPUTS
31 RESULT
33 NOTES
35 EXAMPLE
37 BUGS
39 SEE ALSO
41 INTERNALS
43 *****************************************************************************/
45 AROS_LIBFUNC_INIT
47 struct Library *UtilityBase = GetPrivIBase(IntuitionBase)->UtilityBase;
48 DEBUG_SETPOINTER(dprintf("SetWindowPointer: window 0x%lx\n", window));
50 if (window)
52 ULONG lock;
53 Object *pointer = (Object *)GetTagData(WA_Pointer, 0, taglist);
54 BOOL busy = (GetTagData(WA_BusyPointer, FALSE, taglist) != 0) ? TRUE : FALSE;
56 DEBUG_SETPOINTER(dprintf("SetWindowPointer: pointer 0x%lx busy %d\n",
57 pointer, busy));
59 lock = LockIBase(0);
61 DEBUG_SETPOINTER(dprintf("SetWindowPointer: old pointer 0x%lx busy %d\n",
62 IW(window)->pointer, IW(window)->busy));
64 if (IW(window)->pointer != pointer || IW(window)->busy != busy)
66 Object *oldpointer = NULL;
68 if (IW(window)->free_pointer)
69 oldpointer = IW(window)->pointer;
71 IW(window)->pointer = pointer;
72 IW(window)->busy = busy;
73 IW(window)->free_pointer = FALSE;
74 window->Pointer = NULL;
76 if (window->Flags & WFLG_WINDOWACTIVE)
78 struct IntScreen *scr = GetPrivScreen(window->WScreen);
80 if (GetTagData(WA_PointerDelay, FALSE, taglist) &&
81 IntuitionBase->ActiveScreen == &scr->Screen)
83 DEBUG_SETPOINTER(dprintf("SetWindowPointer: delay change\n"));
84 GetPrivIBase(IntuitionBase)->PointerDelay = 5;
86 else
88 struct SharedPointer *shared_pointer;
90 if (pointer == NULL)
91 pointer = GetPrivIBase(IntuitionBase)->DefaultPointer;
92 if (busy)
93 pointer = GetPrivIBase(IntuitionBase)->BusyPointer;
95 GetAttr(POINTERA_SharedPointer, pointer, (IPTR *)&shared_pointer);
97 DEBUG_POINTER(dprintf("SetWindowPointer: scr 0x%lx pointer 0x%lx sprite 0x%lx\n",
98 scr, pointer, shared_pointer->sprite));
100 if (DoMethod(scr->IMonitorNode, MM_SetPointerShape, shared_pointer))
102 ObtainSharedPointer(shared_pointer, IntuitionBase);
103 ReleaseSharedPointer(scr->Pointer, IntuitionBase);
104 scr->Pointer = shared_pointer;
105 if (window)
107 window->XOffset = shared_pointer->xoffset;
108 window->YOffset = shared_pointer->yoffset;
111 else
113 DEBUG_POINTER(dprintf("SetWindowPointer: can't set pointer.\n"));
118 DisposeObject(oldpointer);
121 UnlockIBase(lock);
124 AROS_LIBFUNC_EXIT
125 } /* SetWindowPointerA */