2 Copyright © 1995-2013, 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 "monitorclass_private.h"
11 #include <intuition/pointerclass.h>
13 /*****************************************************************************
16 #include <proto/intuition.h>
18 AROS_LH2(void, SetWindowPointerA
,
21 AROS_LHA(struct Window
* , window
, A0
),
22 AROS_LHA(struct TagItem
*, taglist
, A1
),
25 struct IntuitionBase
*, IntuitionBase
, 136, Intuition
)
43 *****************************************************************************/
47 struct Library
*UtilityBase
= GetPrivIBase(IntuitionBase
)->UtilityBase
;
48 DEBUG_SETPOINTER(dprintf("SetWindowPointer: window 0x%lx\n", window
));
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",
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;
88 struct SharedPointer
*shared_pointer
;
91 pointer
= GetPrivIBase(IntuitionBase
)->DefaultPointer
;
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
;
107 window
->XOffset
= shared_pointer
->xoffset
;
108 window
->YOffset
= shared_pointer
->yoffset
;
113 DEBUG_POINTER(dprintf("SetWindowPointer: can't set pointer.\n"));
118 DisposeObject(oldpointer
);
125 } /* SetWindowPointerA */