2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
7 #include <proto/graphics.h>
8 #include <proto/utility.h>
9 #include "intuition_intern.h"
10 #include <intuition/pointerclass.h>
12 /*****************************************************************************
15 #include <proto/intuition.h>
17 AROS_LH2(void, SetWindowPointerA
,
20 AROS_LHA(struct Window
* , window
, A0
),
21 AROS_LHA(struct TagItem
*, taglist
, A1
),
24 struct IntuitionBase
*, IntuitionBase
, 136, Intuition
)
42 *****************************************************************************/
46 DEBUG_SETPOINTER(dprintf("SetWindowPointer: window 0x%lx\n", window
));
51 Object
*pointer
= (Object
*)GetTagData(WA_Pointer
, NULL
, taglist
);
52 BOOL busy
= (GetTagData(WA_BusyPointer
, FALSE
, taglist
) != 0) ? TRUE
: FALSE
;
54 DEBUG_SETPOINTER(dprintf("SetWindowPointer: pointer 0x%lx busy %d\n",
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;
86 struct SharedPointer
*shared_pointer
;
89 pointer
= GetPrivIBase(IntuitionBase
)->DefaultPointer
;
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
;
106 window
->XOffset
= shared_pointer
->xoffset
;
107 window
->YOffset
= shared_pointer
->yoffset
;
112 DEBUG_POINTER(dprintf("SetWindowPointer: can't set pointer.\n"));
117 DisposeObject(oldpointer
);
124 } /* SetWindowPointerA */