Update to lasso handling. Adjust scroll amount based on difference between mouse...
[AROS.git] / rom / intuition / setwindowpointera.c
blobf5b5f98015c9d68b0c40d578cec91d56df71d89c
1 /*
2 Copyright © 1995-2007, 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 <intuition/pointerclass.h>
12 /*****************************************************************************
14 NAME */
15 #include <proto/intuition.h>
17 AROS_LH2(void, SetWindowPointerA,
19 /* SYNOPSIS */
20 AROS_LHA(struct Window * , window , A0),
21 AROS_LHA(struct TagItem *, taglist, A1),
23 /* LOCATION */
24 struct IntuitionBase *, IntuitionBase, 136, Intuition)
26 /* FUNCTION
28 INPUTS
30 RESULT
32 NOTES
34 EXAMPLE
36 BUGS
38 SEE ALSO
40 INTERNALS
42 *****************************************************************************/
44 AROS_LIBFUNC_INIT
46 DEBUG_SETPOINTER(dprintf("SetWindowPointer: window 0x%lx\n", window));
48 if (window)
50 ULONG lock;
51 Object *pointer = (Object *)GetTagData(WA_Pointer, 0, taglist);
52 BOOL busy = (GetTagData(WA_BusyPointer, FALSE, taglist) != 0) ? TRUE : FALSE;
54 DEBUG_SETPOINTER(dprintf("SetWindowPointer: pointer 0x%lx busy %d\n",
55 pointer, busy));
57 lock = LockIBase(0);
59 DEBUG_SETPOINTER(dprintf("SetWindowPointer: old pointer 0x%lx busy %d\n",
60 IW(window)->pointer, IW(window)->busy));
62 if (IW(window)->pointer != pointer || IW(window)->busy != busy)
64 Object *oldpointer = NULL;
66 if (IW(window)->free_pointer)
67 oldpointer = IW(window)->pointer;
69 IW(window)->pointer = pointer;
70 IW(window)->busy = busy;
71 IW(window)->free_pointer = FALSE;
72 window->Pointer = NULL;
74 if (window->Flags & WFLG_WINDOWACTIVE)
76 struct IntScreen *scr = GetPrivScreen(window->WScreen);
78 if (GetTagData(WA_PointerDelay, FALSE, taglist) &&
79 IntuitionBase->ActiveScreen == &scr->Screen)
81 DEBUG_SETPOINTER(dprintf("SetWindowPointer: delay change\n"));
82 GetPrivIBase(IntuitionBase)->PointerDelay = 5;
84 else
86 struct SharedPointer *shared_pointer;
88 if (pointer == NULL)
89 pointer = GetPrivIBase(IntuitionBase)->DefaultPointer;
90 if (busy)
91 pointer = GetPrivIBase(IntuitionBase)->BusyPointer;
93 GetAttr(POINTERA_SharedPointer, pointer, (IPTR *)&shared_pointer);
95 DEBUG_POINTER(dprintf("SetWindowPointer: scr 0x%lx pointer 0x%lx sprite 0x%lx\n",
96 scr, pointer, shared_pointer->sprite));
98 if (ChangeExtSpriteA(&scr->Screen.ViewPort,
99 scr->Pointer->sprite, shared_pointer->sprite, NULL))
101 ObtainSharedPointer(shared_pointer, IntuitionBase);
102 ReleaseSharedPointer(scr->Pointer, IntuitionBase);
103 scr->Pointer = shared_pointer;
104 if (window)
106 window->XOffset = shared_pointer->xoffset;
107 window->YOffset = shared_pointer->yoffset;
110 else
112 DEBUG_POINTER(dprintf("SetWindowPointer: can't set pointer.\n"));
117 DisposeObject(oldpointer);
120 UnlockIBase(lock);
123 AROS_LIBFUNC_EXIT
124 } /* SetWindowPointerA */