1 #ifndef INTUITION_INTERN_H
2 #define INTUITION_INTERN_H
5 Copyright 1995-2013, The AROS Development Team. All rights reserved.
6 Copyright 2001-2003, The MorphOS Development Team. All Rights Reserved.
10 #ifndef AROS_LIBCALL_H
11 # include <aros/libcall.h>
14 # include <aros/atomic.h>
16 #ifndef EXEC_EXECBASE_H
17 # include <exec/execbase.h>
19 #ifndef EXEC_SEMAPHORES_H
20 # include <exec/semaphores.h>
23 # include <exec/tasks.h>
26 # include <exec/ports.h>
28 #ifndef EXEC_INTERRUPTS_H
29 # include <exec/interrupts.h>
35 # include <exec/types.h>
38 # include <exec/lists.h>
40 #ifndef GRAPHICS_GFXBASE_H
41 # include <graphics/gfxbase.h>
43 #ifndef GRAPHICS_RASTPORT_H
44 # include <graphics/rastport.h>
46 #ifndef GRAPHICS_REGIONS_H
47 # include <graphics/regions.h>
49 #ifndef GRAPHICS_CLIP_H
50 # include <graphics/clip.h>
52 #ifndef GRAPHICS_TEXT_H
53 # include <graphics/text.h>
55 #ifndef INTUITION_INTUITION_H
56 # include <intuition/intuition.h>
58 #ifndef INTUITION_INTUITIONBASE_H
59 # include <intuition/intuitionbase.h>
61 #ifndef INTUITION_CLASSES_H
62 # include <intuition/classes.h>
64 #ifndef INTUITION_CGHOOKS_H
65 # include <intuition/cghooks.h>
67 #ifndef INTUITION_SGHOOKS_H
68 # include <intuition/sghooks.h>
70 #ifndef INTUITION_SCREENS_H
71 # include <intuition/screens.h>
73 #ifndef PREFS_ICONTROL_H
74 # include <prefs/icontrol.h>
77 #include <prefs/input.h>
79 #ifndef CLIB_ALIB_PROTOS_H
80 # include <clib/alib_protos.h>
82 #ifdef INTUITION_NOTIFY_SUPPORT
83 # include <libraries/screennotify.h>
84 # include <libraries/notifyintuition.h>
89 #include "intuition_debug.h"
92 #include "intuition_customize.h"
93 #include "intuition_internmos.h"
94 #include "intuition_extend.h"
97 #include "requesters.h"
99 /* Needed for aros_print_not_implemented macro */
100 #include <aros/debug.h>
102 #include <aros/asmcall.h>
105 #define ASSERT_VALID_PTR_ROMOK(ptr) \
107 if (!((IPTR)ptr & 1)) { \
108 if (TypeOfMem((APTR)ptr)) \
111 struct Task *me = FindTask(NULL); \
113 if (((IPTR)(ptr) >= (IPTR)me->tc_SPLower) && ((IPTR)(ptr) < (IPTR)me->tc_SPUpper)) \
117 bug("[intuition] Invalid pointer value %p at %s, line %u\n", ptr, __FILE__, __LINE__); \
120 #define ASSERT_VALID_PTR_ROMOK(ptr)
123 // FIXME: seems only used for RefreshWindowTitles() ? -> better names
124 // FIXME: what are the correct values?
125 #define NO_DOUBLEBUFFER (0)
126 #define DOUBLEBUFFER (1)
130 # define USE_OPAQUESIZE 1
132 # define USE_OPAQUESIZE 0
135 /* This definition turns on compatibility mode where sprite colors
136 are allocated on hi- and truecolor screens also. This may be needed
137 if some software relies on this allocation. AROS itself currently does
139 #define ALWAYS_ALLOCATE_SPRITE_COLORS */
142 void dprintf(char *, ...) __attribute__ ((format (printf
, 1, 2)));
143 void * memclr(APTR
, ULONG
);
147 void * memclr(APTR
, ULONG
);
148 #define bzero(a,b) memclr(a,b)
149 #else /* __MORPHOS__ */
150 #define memclr(a,b) bzero(a,b)
151 #endif /* __MORPHOS__ */
154 * min()/max() without macro side effects.
157 ({typeof(a) _a = (a); \
158 typeof(b) _b = (b); \
162 ({typeof(a) _a = (a); \
163 typeof(b) _b = (b); \
166 #define EXTENDWORD(x) x = (LONG)((WORD)x);
167 #define EXTENDUWORD(x) x = (ULONG)((UWORD)x);
169 /* SANITY CHECK MACRO */
170 //#define DEBUG_SANITYCHECK
172 #ifdef DEBUG_SANITYCHECK
173 #define SANITY_CHECK(x) if (!((IPTR)x)) {dprintf("Losing sanity in %s line %d\n",__FILE__,__LINE__); return;};
174 #define SANITY_CHECKR(x,v) if (!((IPTR)x)) {dprintf("Losing sanity in %s line %d\n",__FILE__,__LINE__); return v;};
176 #define SANITY_CHECK(x) if (!((IPTR)x)) return;
177 #define SANITY_CHECKR(x,v) if (!((IPTR)x)) return v;
182 #define MENUS_BACKFILL TRUE
184 #define MENUS_AMIGALOOK(base) ((GetPrivIBase(base)->IControlPrefs.ic_Flags & ICF_3DMENUS) == 0)
186 #define MENULOOK_3D 0
187 #define MENULOOK_CLASSIC 1
189 #define MENUS_UNDERMOUSE(base) (GetPrivIBase(base)->IControlPrefs.ic_Flags & ICF_POPUPMENUS)
191 #define AVOID_WINBORDERERASE(base) \
192 (GetPrivIBase(base)->IControlPrefs.ic_Flags & ICF_AVOIDWINBORDERERASE)
197 #define FRAME_SIZE(base) (GetPrivIBase(base)->FrameSize)
199 #define FRAMESIZE_THIN 0 /* 1:1 thin */
200 #define FRAMESIZE_MEDRES 1 /* 2:1 medres like AmigaOS */
201 #define FRAMESIZE_THICK 2 /* 1:1 thick */
203 #define SQUARE_WIN_GADGETS 1
206 /* FIXME: possibly enable this, once gadtools has been updated */
208 #define GADTOOLSCOMPATIBLE
209 //enables some gadtools-weirdo-code, MUST be set in both gadtools & intui to work!!!
213 //#define USEGETIPREFS
216 /* simpleref layers have gadgets redrawn when app calls beginrefresh() */
217 //#define BEGINUPDATEGADGETREFRESH
218 //#define DAMAGECACHE
220 #define USEWINDOWLOCK
222 #define LOCKWINDOW(base) ObtainSemaphore(&GetPrivIBase(base)->WindowLock);
223 #define UNLOCKWINDOW(base) ReleaseSemaphore(&GetPrivIBase(base)->WindowLock);
225 #define LOCKWINDOW(base)
226 #define UNLOCKWINDOW(base)
228 /* jDc: do NOT disable this! */
230 #define USEGADGETLOCK
232 #define LOCKGADGET(base) ObtainSemaphore(&GetPrivIBase(base)->GadgetLock);
233 #define UNLOCKGADGET(base) ReleaseSemaphore(&GetPrivIBase(base)->GadgetLock);
234 #define LOCKWINDOWLAYERS(w) ;
235 #define UNLOCKWINDOWLAYERS(w) ;
239 #define LOCKWINDOWLAYERS(w) LockLayerInfo(&w->WScreen->LayerInfo); \
240 if (((struct IntWindow *)(w))->borderlayer) {LockLayer(0,((struct IntWindow *)(w))->borderlayer);}; \
241 if (((struct IntWindow *)(w))->wlayer) {LockLayer(0,((struct IntWindow *)(w))->wlayer);};
242 #define UNLOCKWINDOWLAYERS(w) if (((struct IntWindow *)(w))->wlayer) {UnlockLayer(((struct IntWindow *)(w))->wlayer);}; \
243 if (((struct IntWindow *)(w))->borderlayer) {UnlockLayer(((struct IntWindow *)(w))->borderlayer);} \
244 UnlockLayerInfo(&w->WScreen->LayerInfo);
247 #define WLAYER(w) (((struct IntWindow *)(w))->wlayer)
248 #define BLAYER(w) (((struct IntWindow *)(w))->borderlayer)
250 //#define TIMEVALWINDOWACTIVATION
252 /* If PROP_RENDER_OPTIMIZATION is set to 1, propgadget code tries to optimize rendering
253 during prop gadget knob movement. Only area of the propgadget that is affected by
254 prop gadget knob movement is re-rendered.
256 Unfortunately this can fail with some programs, like DOpus 4.x text viewer */
258 #define PROP_RENDER_OPTIMIZATION 0
260 #define SINGLE_SETPOINTERPOS_PER_EVENTLOOP 1
262 #ifndef LIFLG_SUPPORTS_OFFSCREEN_LAYERS
263 /* Defined in <graphics/layers.h>, but apparently not on MorphOS. */
264 # define LIFLG_SUPPORTS_OFFSCREEN_LAYERS 2
267 #define INTUITIONNAME "intuition.library"
268 #define MENUBARLABELCLASS "menubarlabelclass"
270 #define DEFPUBSCREEN TRUE
272 #define USE_NEWDISPLAYBEEP 1
274 #define TITLEBUFFERLEN 255
276 #define USE_IDCMPUPDATE_MESSAGECACHE 0
279 #if INCLUDE_VERSION < 50
281 /********************************************************************************/
282 /* imageclass.h AROS extensions */
284 #define SYSIA_WithBorder IA_FGPen /* default: TRUE */
285 #define SYSIA_Style IA_BGPen /* default: SYSISTYLE_NORMAL */
287 #define SYSISTYLE_NORMAL 0
288 #define SYSISTYLE_GADTOOLS 1 /* to get arrow images in gadtools look */
290 /********************************************************************************/
291 /* gadgetclass.h AROS extenstions */
293 /* This method is invoked to learn about the sizing requirements of your class,
294 before an object is created. This is AROS specific. */
298 STACKED ULONG MethodID
; /* GM_DOMAIN */
299 STACKED
struct GadgetInfo
*gpd_GInfo
; /* see <intuition/cghooks.h> */
300 STACKED
struct RastPort
*gpd_RPort
; /* RastPort to calculate dimensions for. */
301 STACKED LONG gpd_Which
; /* see below */
302 STACKED
struct IBox gpd_Domain
; /* Resulting domain. */
303 STACKED
struct TagItem
*gpd_Attrs
; /* Additional attributes. None defined,
307 /********************************************************************************/
310 #define GDOMAIN_MINIMUM 0 /* Calculate minimum size. */
311 #define GDOMAIN_NOMINAL 1 /* Calculate nominal size. */
312 #define GDOMAIN_MAXIMUM 2 /* Calculate maximum size. */
314 #endif /* INCLUDE_VERSION < 50 */
315 #endif /* ifdef __MORPHOS__ */
317 /********************************************************************************/
318 #define GM_MOVETEST 8
319 /* this method is used by our draggad to tell if it's OK to move the mouse when window
320 is near screen boundaries and offscreen is disabled. msg = gpInput*/
322 #define MOVETEST_MOVE 0
323 #define MOVETEST_ADJUSTPOS 1
325 /* ObtainGIRPort must install a 0 clipregion and
326 set scrollx/scrolly of layer to 0. Since this
327 will be restored only when ReleaseGIRPort is
328 called, we must backup the orig values somewhere */
332 struct Region
*clipregion
;
342 #define IP_OLDOVERSCAN 3
343 #define IP_OLDICONTROL 4
344 #define IP_OLDPOINTER 7
345 #define IP_OLDPALETTE 8
348 #define IP_SCREENMODE 1
349 #define IP_FONT 101//2
350 #define IP_ICONTROL 102//4
351 #define IP_POINTER 103//7
352 #define IP_PTRCOLOR 104//8
353 #define IP_PALETTE 105
354 #define IP_IACTIONS 20
355 #define IP_IEXTENSIONS 21
356 #define IP_INPUTEXT 22
360 struct IScreenModePrefs
369 struct IIControlPrefs
375 UBYTE ic_FrontToBack
;
382 #include <intuition/iprefs.h>
393 #define COLORTABLEENTRIES 11
398 #define RESOURCELIST_HASHSIZE 32 /* Smaller hash for memory limited m68k */
400 #define RESOURCELIST_HASHSIZE 256
403 #define RESOURCE_WINDOW 1
404 #define RESOURCE_SCREEN 2
413 /* Internal Screen Notification Data */
414 struct IntScreenNotify
417 struct MsgPort
*port
;
418 struct Task
*sigtask
;
427 struct IntIntuitionBase
429 struct IntuitionBase IBase
;
431 WORD _MinXMouse
,_MaxXMouse
; /* Old 1.3 Base entries*/
432 WORD _MinYMouse
,_MaxYMouse
; /* Old 1.3 Base entries*/
433 ULONG _StartSecs
,_StartMicros
; /* Old 1.3 Base entries*/
434 char *SystemRequestTitle
; /* written by locale as it seems..what a crappy interface*/
435 char *WorkbenchTitle
; /* written by locale as it seems..what a crappy interface*/
438 * safety pad for intuitionbase accesses
439 * probably needs to be smarter
444 /* Put local shit here, invisible for the user */
446 struct Library
*MUIMasterBase
;
449 struct DosLibrary
*DOSBase
;
450 struct LayersBase
*LayersBase
;
451 struct Library
*UtilityBase
;
452 struct GfxBase
*GfxBase
;
453 struct Library
*OOPBase
;
454 struct Library
*KeymapBase
;
456 struct Library
*InputBase
;
457 struct Library
*TimerBase
;
458 struct MsgPort
*TimerMP
;
459 struct timerequest
*TimerIO
;
461 struct MsgPort
*WorkBenchMP
;
462 struct Screen
*WorkBench
;
463 struct SignalSemaphore
*IBaseLock
;
465 /* Intuition input handlers replyport. This one is set
466 int rom/inputhandler.c/InitIIH()
468 struct MsgPort
*IntuiReplyPort
;
469 struct MinList
*IntuiActionQueue
;
470 struct IOStdReq
*InputIO
;
471 struct MsgPort
*InputMP
;
473 /* Intuition Screennotify Replyport if SNOTIFY_WAIT_REPLY is specified */
475 struct MsgPort
*ScreenNotifyReplyPort
;
477 BOOL InputDeviceOpen
;
478 struct Interrupt
*InputHandler
;
480 struct Hook
*GlobalEditHook
;
481 /* The default global edit hook */
482 struct Hook DefaultEditHook
;
484 struct Screen
*DefaultPubScreen
;
485 struct SignalSemaphore PubScrListLock
;
486 struct MinList PubScreenList
;
487 UWORD pubScrGlobalMode
;
489 struct SignalSemaphore ScreenNotificationListLock
;
490 struct List ScreenNotificationList
;
492 struct SignalSemaphore GadgetLock
;
493 struct SignalSemaphore MenuLock
;
494 struct SignalSemaphore WindowLock
;
495 struct SignalSemaphore IntuiActionLock
;
496 struct SignalSemaphore InputHandlerLock
;
497 struct LayerContext BackupLayerContext
;
499 struct IClass
*dragbarclass
;
500 struct IClass
*sizebuttonclass
;
504 struct Preferences
*DefaultPreferences
;
505 struct Preferences
*ActivePreferences
;
507 struct MsgPort
*MenuHandlerPort
;
510 struct TextFont
*ScreenFont
;
511 struct TextFont
*TopazFont
;
513 /* Dos function DisplayError() before intuition.library patched it */
514 APTR OldDisplayErrorFunc
;
516 struct SignalSemaphore ClassListLock
;
517 struct MinList ClassList
;
518 struct IClass RootClass
;
521 struct ViewExtra
*ViewLordExtra
;
528 ULONG
*SmallMenuPool
;
532 struct IScreenModePrefs ScreenModePrefs
;
533 struct IIControlPrefs IControlPrefs
;
535 struct IAction
*IControlActions
;
536 struct IControlExtensions IControlExtensions
;
537 ULONG NumIControlActions
;
538 struct InputPrefsExt InputPrefsExt
;
540 struct IClass
*pointerclass
;
541 Object
*DefaultPointer
;
543 UWORD DriPens2
[NUMDRIPENS
];
544 UWORD DriPens4
[NUMDRIPENS
];
545 UWORD DriPens8
[NUMDRIPENS
];
546 struct Color32 Colors
[COLORTABLEENTRIES
];
550 struct IntScreen
*MenuVerifyScreen
;
554 struct SignalSemaphore DataTypesSem
;
555 struct Library
*DataTypesBase
; /* should be opened ONLY by int_InitCustomChanges!*/
559 ULONG LastClickMicro
; /* for doubleclick to front */
560 ULONG LastMenuDownSecs
;
561 ULONG LastMenuDownMicro
; /* for auto sticky/non-sticky menus */
562 ULONG DoubleClickCounter
;
563 ULONG DoubleClickButton
;
566 struct Hook transphook
; /* hook for windows with intui transp */
567 struct Hook notransphook
; /* hook for windows with no additional transp (borderless,etc) */
569 #ifdef INTUITION_NOTIFY_SUPPORT
570 struct Library
*ScreenNotifyBase
;
571 struct Library
*NotifyIntuitionBase
;
574 struct RastPort DoGadgetMethodRP
;
575 struct GadgetInfo DoGadgetMethodGI
;
577 struct SignalSemaphore ScrDecorSem
;
578 struct IClass
*ScrDecorClass
;
579 struct TagItem
*ScrDecorTags
;
580 struct SignalSemaphore MenuDecorSem
;
581 struct IClass
*MenuDecorClass
;
582 struct TagItem
*MenuDecorTags
;
583 struct SignalSemaphore WinDecorSem
;
584 struct IClass
*WinDecorClass
;
585 struct TagItem
*WinDecorTags
;
587 struct List Decorations
;
588 struct NewDecorator
*Decorator
;
594 #if USE_NEWDISPLAYBEEP
598 WORD prop_clickoffset_x
, prop_clickoffset_y
;
600 struct MinList ResourceList
[RESOURCELIST_HASHSIZE
];
602 /* Menu Look Settings */
605 Object
*ActiveMonitor
;
608 OOP_AttrBase HiddAttrBase
;
609 OOP_AttrBase HiddGfxAttrBase
;
610 OOP_AttrBase HiddPixFmtAttrBase
;
612 OOP_MethodID ib_HiddGfxBase
;
613 OOP_MethodID ib_HiddBitMapBase
;
615 struct IClass
*monitorclass
;
616 struct MinList MonitorList
;
617 struct SignalSemaphore MonitorListSem
;
619 struct Interrupt ShutdownHandler
;
624 struct ExtSprite
*sprite
;
625 WORD xoffset
, yoffset
;
629 struct SharedPointer
*CreateSharedPointer(struct ExtSprite
*, int, int, struct IntuitionBase
*);
630 void ObtainSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
631 void ReleaseSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
633 #ifdef INTUITION_NOTIFY_SUPPORT
634 void sn_DoNotify(ULONG type
, APTR value
, struct Library
*_ScreenNotifyBase
);
640 struct Screen
*dri_Screen
;
641 struct SignalSemaphore dri_WinDecorSem
;
642 Object
*dri_WinDecorObj
;
643 struct SignalSemaphore dri_ScrDecorSem
;
644 Object
*dri_ScrDecorObj
;
647 #define DRI_VERSION_AROS (DRI_VERSION + 1)
649 #define LOCK_WINDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
650 #define LOCKSHARED_WINDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
651 #define UNLOCK_WINDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
653 #define LOCK_SCRDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
654 #define LOCKSHARED_SCRDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
655 #define UNLOCK_SCRDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
657 #define LOCK_MENUDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
658 #define LOCKSHARED_MENUDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
659 #define UNLOCK_MENUDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
663 struct Screen Screen
;
666 struct HashNode hashnode
;
667 struct IntDrawInfo DInfo
;
668 struct TTextAttr textattr
;
669 ULONG textattrtags
[3];
670 UWORD Pens
[NUMDRIPENS
];
671 struct PubScreenNode
*pubScrNode
;
674 struct Layer
*rootLayer
;
675 #if !USE_NEWDISPLAYBEEP
676 ULONG DisplayBeepColor0
[3];
677 struct Window
*DisplayBeepWindow
;
681 struct MonitorSpec
*Monitor
;
683 Object
*MonitorObject
;
684 struct SharedPointer
*Pointer
;
685 struct Window
*MenuVerifyActiveWindow
;
686 int MenuVerifyTimeOut
;
687 int MenuVerifyMsgCount
;
688 ULONG MenuVerifySeconds
;
689 ULONG MenuVerifyMicros
;
690 ULONG DecorUserBufferSize
;
691 IPTR DecorUserBuffer
;
693 Object
*MenuDecorObj
;
695 struct NewDecorator
*Decorator
;
697 struct BitMap
*AllocatedBitmap
;
705 struct SkinInfo SkinInfo
;
706 struct RastPort
*TitlebarBufferRP
;
707 struct Window
*TitlebarBufferWin
;
708 ULONG TitlebarWinWidth
;
709 ULONG TitlebarWinActive
;
711 #if USE_NEWDISPLAYBEEP
712 UBYTE BeepingCounter
;
716 #define GetPrivScreen(s) ((struct IntScreen *)s)
719 #define SF_IsParent (0x0001)
720 #define SF_IsChild (0x0002)
721 #define SF_InvisibleBar (0x0004)
722 #define SF_AppearingBar (0x0008)
723 #define SF_SysFont (0x0010)
724 #define SF_Draggable (0x0020) /* Screen can be dragged */
725 #define SF_ComposeAbove (0x0100) /* Composition capabilities */
726 #define SF_ComposeBelow (0x0200)
727 #define SF_ComposeLeft (0x0400)
728 #define SF_ComposeRight (0x0800)
730 #define SF_VertCompose (SF_ComposeAbove|SF_ComposeBelow)
731 #define SF_HorCompose (SF_ComposeLeft |SF_ComposeRight)
732 #define SF_Compose (SF_ComposeAbove|SF_ComposeBelow|SF_ComposeLeft|SF_ComposeRight)
734 struct IntIntuiMessage
736 struct ExtIntuiMessage eimsg
;
739 ** The following field is needed, because in case of IDCMP_RAWKEY
740 ** IntuiMessage->IAddress is a pointer to this data, not the data
741 ** itself (which is the case for IDCMP_VANILLAKEY)
747 #define INT_INTUIMESSAGE(x) ((struct IntIntuiMessage *)(x))
751 /*extern struct IntuitionBase * IntuitionBase;*/
753 #define IW(window) ((struct IntWindow *) (window))
755 #define GetPubIBase(ib) ((struct IntuitionBase *)ib)
756 #define GetPrivIBase(ib) ((struct IntIntuitionBase *)ib)
758 /* FIXME: Remove these #define xxxBase hacks
759 Do not use this in new code !
764 #define MUIMasterBase (GetPrivIBase(IntuitionBase)->MUIMasterBase)
768 /* struct Utilitybase is used in the following file so include it
769 before defining Utilitybase
771 #include <proto/utility.h>
773 /* stegerg: one can have sysgadgets outside of window border! All sysgadgets in window
774 border must have set GACT_???BORDER and, if they are in a gzz window, also
777 #define IS_GZZ_GADGET(gad) (((gad)->GadgetType) & GTYP_GZZGADGET)
779 #define IS_BORDER_GADGET(gad) (IS_GZZ_GADGET(gad) || \
780 ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER)))
782 #define IS_SYS_GADGET(gad) (((gad)->GadgetType) & GTYP_SYSTYPEMASK)
784 #define IS_BOOPSI_GADGET(gad) (((gad)->GadgetType & GTYP_GTYPEMASK) == GTYP_CUSTOMGADGET)
786 /*#define IS_BORDER_GADGET(gad) \
787 (((gad->GadgetType) & GTYP_SYSGADGET) \
788 || ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER))) */
790 #define IS_REQ_GADGET(gad) ((gad)->GadgetType & GTYP_REQGADGET)
792 #define IS_SCREEN_GADGET(gad) ((gad)->GadgetType & GTYP_SCRGADGET)
794 #define SET_GI_RPORT(gi, w, req, gad) \
795 (gi)->gi_RastPort = (IS_SCREEN_GADGET(gad) ? \
796 ((gi)->gi_Screen->BarLayer ? (gi)->gi_Screen->BarLayer->rp : NULL) : \
797 (IS_BORDER_GADGET(gad) ? (w)->BorderRPort : \
798 ((req) ? ((req)->ReqLayer->rp) : (w)->RPort)) \
802 #define REFRESHGAD_BOOPSI 1 /* boopsi gadgets */
803 #define REFRESHGAD_BORDER 2 /* gadgets in window border */
804 #define REFRESHGAD_REL 4 /* gadgets with GFLG_RELRIGHT, GFLG_RELBOTTOM,GFLG_RELWIDTH, GFLG_RELHEIGHT */
805 #define REFRESHGAD_RELS 8 /* GFLG_RELSPECIAL gadgets */
806 #define REFRESHGAD_TOPBORDER 16 /* used by setwindowtitle */
807 #define REFRESHGAD_NOGADTOOLS 32 /* used in some cases for _mustbe_ */
809 #define SYSGADGET_ACTIVE (iihdata->ActiveSysGadget != NULL)
811 VOID
int_refreshglist(struct Gadget
*gadgets
, struct Window
*window
,
812 struct Requester
*requester
, LONG numGad
, LONG mustbe
, LONG mustnotbe
,
813 struct IntuitionBase
*IntuitionBase
);
815 VOID
int_RefreshWindowFrame(struct Window
*window
, LONG mustbe
, LONG mustnotbe
,
817 struct IntuitionBase
*IntuitionBase
);
819 #define int_refreshwindowframe(a,b,c,d) int_RefreshWindowFrame(a,b,c,0,d);
821 /* Keep the system gadgets in the same order than the original intuition,
822 * some programs make bad asumptions about that...
840 #define SYSGAD(w, idx) (((struct IntWindow *)(w))->sysgads[idx])
844 struct Window window
;
846 Object
*sysgads
[NUM_SYSGADS
];
847 struct Image
*AmigaKey
;
848 struct Image
*Checkmark
;
849 struct Image
*SubMenuImage
;
850 struct Window
*menulendwindow
;
852 struct HashNode hashnode
;
854 /* When the Zoom gadget is pressed the window will have the
855 dimensions stored here. The old dimensions are backed up here
862 /* max. number of mousemove events to send to this window */
865 /* act. number of mousemove events sent to this window */
866 WORD num_mouseevents
;
868 /* max. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
869 messages to send to this window */
872 /* act. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
873 messages sent to this window */
874 WORD num_repeatevents
;
876 #if USE_IDCMPUPDATE_MESSAGECACHE
877 /* number of unreplied IDCMP_IDCMPUPDATE messages sent to window
878 used in few hacks :) */
879 WORD num_idcmpupdate
;
882 WORD sizeimage_width
;
883 WORD sizeimage_height
;
893 ULONG extrabuttonsid
; /* replaces ETI_Dummy if apps wishes it */
895 ULONG titlepos
; /* used by titlebar pattern fill stuff */
902 struct Region
*transpregion
;
903 struct Hook
*usertransphook
;
904 struct Region
*usertranspregion
;
908 struct Region
*trashregion
;
910 char titlebuffer
[TITLEBUFFERLEN
+1];
912 #if USE_IDCMPUPDATE_MESSAGECACHE
913 struct IntuiMessage
*messagecache
; //for idcmpupdate cache
916 struct Layer
*wlayer
;
917 struct Layer
*borderlayer
;
919 struct timeval lastmsgsent
;
920 struct timeval lastmsgreplied
;
922 #ifdef TIMEVALWINDOWACTIVATION
923 struct timeval activationtime
;
927 struct Hook custombackfill
;
930 struct Hook DefaultWindowShapeHook
;
932 struct Region
*OutlineShape
;
933 ULONG DecorUserBufferSize
;
934 IPTR DecorUserBuffer
;
937 #define SPFLAG_ICONIFIED 1
938 #define SPFLAG_NOICONIFY 2
939 #define SPFLAG_SKININFO 4
940 #define SPFLAG_LAYERREFRESH 8
941 #define SPFLAG_TRANSPHOOK 16
942 #define SPFLAG_LAYERRESIZED 32
943 #define SPFLAG_USERPORT 64
944 #define SPFLAG_IAMDEAD 128
945 #define SPFLAG_CLOSING 256 //used with iamdead
946 #define SPFLAG_WANTBUFFER 512
948 #define HELPF_ISHELPGROUP 1
949 #define HELPF_GADGETHELP 2
951 #define IS_NOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? TRUE : FALSE)
952 #define IS_DOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? FALSE : TRUE )
953 #define IS_SIMPLEREFRESH(win) (((win)->Flags & WFLG_SIMPLE_REFRESH) ? TRUE : FALSE)
954 #define IS_GZZWINDOW(win) (((win)->Flags & WFLG_GIMMEZEROZERO) ? TRUE : FALSE)
957 /* Flag definitions for MoreFlags */
959 #define WMFLG_NOTIFYDEPTH (1 << 0) /* Window wants notification when
960 it's depth arranged */
962 #define WMFLG_DO_UNLOCKPUBSCREEN (1 << 1)
963 #define WMFLG_MENUHELP (1 << 2)
964 #define WMFLG_POINTERDELAY (1 << 3)
965 #define WMFLG_TABLETMESSAGES (1 << 4)
967 // FIXME: ehm... this one should die a horrible death!
968 #define WMFLG_IAMMUI (1 << 5)
970 struct IntScreenBuffer
972 struct ScreenBuffer sb
;
977 /* Driver prototypes */
979 extern int intui_init (struct IntuitionBase
*);
980 extern int intui_open (struct IntuitionBase
*);
981 extern void intui_close (struct IntuitionBase
*);
982 extern void intui_expunge (struct IntuitionBase
*);
983 extern int intui_GetWindowSize (void);
984 extern void intui_WindowLimits (struct Window
* window
, WORD MinWidth
, WORD MinHeight
, UWORD MaxWidth
, UWORD MaxHeight
);
985 extern void intui_ActivateWindow (struct Window
*);
986 extern BOOL
intui_ChangeWindowBox (struct Window
* window
, WORD x
, WORD y
,
987 WORD width
, WORD height
);
988 extern void intui_CloseWindow (struct Window
*, struct IntuitionBase
*);
989 extern void intui_MoveWindow (struct Window
* window
, WORD dx
, WORD dy
);
990 extern int intui_OpenWindow (struct Window
*, struct IntuitionBase
*,
991 struct BitMap
* SuperBitMap
, struct Hook
*backfillhook
,
992 struct Region
* shape
, struct Hook
* shapehook
,
993 struct Layer
* parent
, ULONG visible
);
994 extern void intui_SetWindowTitles (struct Window
*, CONST_STRPTR
, CONST_STRPTR
);
995 extern void intui_RefreshWindowFrame(struct Window
*win
);
996 extern struct Window
*intui_FindActiveWindow(struct InputEvent
*ie
, struct IntuitionBase
*IntuitionBase
);
997 extern void intui_ScrollWindowRaster(struct Window
* win
, WORD dx
, WORD dy
, WORD xmin
,
998 WORD ymin
, WORD xmax
, WORD ymax
,
999 struct IntuitionBase
* IntuitionBase
);
1001 /* wbtasktalk protos */
1003 ULONG
TellWBTaskToCloseWindows(struct IntuitionBase
*IntuitionBase
);
1004 ULONG
TellWBTaskToOpenWindows(struct IntuitionBase
*IntuitionBase
);
1006 /* intuition_misc protos */
1007 extern void LoadDefaultPreferences(struct IntuitionBase
* IntuitionBase
);
1008 Object
* CreateStdSysImage(WORD which
, WORD preferred_height
, struct Screen
*scr
, APTR buffer
,
1009 struct DrawInfo
*dri
, struct IntuitionBase
*IntuitionBase
);
1010 extern void CheckRectFill(struct RastPort
*rp
, WORD x1
, WORD y1
, WORD x2
, WORD y2
, struct IntuitionBase
* IntuitionBase
);
1011 extern BOOL
CreateWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1012 extern VOID
KillWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1013 extern void CreateScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
1014 extern void KillScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
1015 extern void RenderScreenBar(struct Screen
*scr
, BOOL refresh
, struct IntuitionBase
*IntuitionBase
);
1016 extern void UpdateMouseCoords(struct Window
*win
);
1017 extern WORD
SubtractRectFromRect(struct Rectangle
*a
, struct Rectangle
*b
, struct Rectangle
*destrectarray
);
1019 AROS_UFP3(BOOL
, DefaultWindowShapeFunc
,
1020 AROS_UFPA(struct Hook
*, hook
, A0
),
1021 AROS_UFPA(struct Layer
*, lay
, A2
),
1022 AROS_UFPA(struct ShapeHookMsg
*, msg
, A1
));
1024 extern LONG
CalcResourceHash(APTR resource
);
1025 extern void AddResourceToList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1026 extern void RemoveResourceFromList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1027 extern BOOL
ResourceExisting(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1028 void FireScreenNotifyMessage(IPTR data
, ULONG flag
, struct IntuitionBase
*IntuitionBase
);
1029 void FireScreenNotifyMessageCode(IPTR data
, ULONG flag
, ULONG code
, struct IntuitionBase
*IntuitionBase
);
1032 extern void MySetPointerPos(struct IntuitionBase
*IntuitionBase
);
1033 extern BOOL
ResetPointer(struct IntuitionBase
*IntuitionBase
);
1034 extern void ActivateMonitor(Object
*newmonitor
, WORD x
, WORD y
, struct IntuitionBase
*IntuitionBase
);
1035 extern struct Screen
*FindFirstScreen(Object
*monitor
, struct IntuitionBase
*IntuitionBase
);
1036 extern struct RastPort
*MyCreateRastPort(struct IntuitionBase
*IntuitionBase
);
1037 extern struct RastPort
*MyCloneRastPort(struct IntuitionBase
*IntuitionBase
, struct RastPort
*rp
);
1038 extern void MyFreeRastPort(struct IntuitionBase
*IntuitionBase
, struct RastPort
*rp
);
1039 struct TextFont
*SafeReopenFont(struct IntuitionBase
*, struct TextFont
**);
1040 extern Object
*MakePointerFromPrefs(struct IntuitionBase
*, struct Preferences
*);
1041 extern Object
*MakePointerFromData(struct IntuitionBase
*, const UWORD
*, int, int, int, int);
1042 void InstallPointer(struct IntuitionBase
*, UWORD
, Object
**, Object
*);
1043 void SetPointerColors(struct IntuitionBase
*IntuitionBase
);
1044 struct IClass
*InitITextIClass (struct IntuitionBase
* IntuitionBase
);
1045 struct Gadget
*DoActivateGadget(struct Window
*win
, struct Requester
*req
, struct Gadget
*gad
,
1046 struct IntuitionBase
*IntuitionBase
);
1047 VOID
DoGMLayout(struct Gadget
*glist
, struct Window
*win
, struct Requester
*req
,
1048 UWORD numgad
, BOOL initial
, struct IntuitionBase
*IntuitionBase
);
1049 BOOL
ih_fire_intuimessage(struct Window
* w
, ULONG Class
, UWORD Code
, APTR IAddress
,
1050 struct IntuitionBase
*IntuitionBase
);
1051 void NotifyDepthArrangement(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1055 void int_PrintIText(struct RastPort
* rp
, struct IntuiText
* iText
,
1056 LONG leftOffset
, LONG topOffset
, BOOL ignore_attributes
,
1057 struct IntuitionBase
*IntuitionBase
);
1059 /* Private extra functions */
1060 OOP_Object
*FindMonitor(ULONG modeid
, struct IntuitionBase
*IntuitionBase
);
1061 AROS_INTP(ShutdownScreenHandler
);
1064 BOOL
IsLayerHiddenBySibling(struct Layer
*layer
, BOOL xx
);
1065 LONG
IsLayerVisible(struct Layer
*layer
);
1068 void SetupGInfo(struct GadgetInfo
*gi
, struct Window
*win
, struct Requester
*req
,
1069 struct Gadget
*gad
, struct IntuitionBase
*IntuitionBase
);
1071 IPTR
Custom_DoMethodA(struct IntuitionBase
*, struct Gadget
*, Msg
);
1077 #define DoMethodA(x, ...) (REG_A6=(LONG)IntuitionBase, DoMethodA(x, __VA_ARGS__))
1080 #define HAS_CHILDREN(w) (NULL != w->firstchild)
1083 #define DeinitRastPort(rp) ((void)0)
1085 #define CreateRastPort() MyCreateRastPort(IntuitionBase)
1086 #define CloneRastPort(rp) MyCloneRastPort(IntuitionBase, rp)
1087 #define FreeRastPort(rp) MyFreeRastPort(IntuitionBase, rp)
1089 /* Replacement for dos.library/DisplayError() */
1090 AROS_UFP3(LONG
, Intuition_DisplayError
,
1091 AROS_UFPA(STRPTR
, formatStr
, A0
),
1092 AROS_UFPA(ULONG
, IDCMPFlags
, D0
),
1093 AROS_UFPA(APTR
, args
, A1
));
1095 #define POINTERA_SharedPointer 0x80039010
1098 #define dprintf kprintf
1101 #define DEBUG_ACTIVATEGADGET(x) ;
1102 #define DEBUG_ACTIVATEWINDOW(x) ;
1103 #define DEBUG_ADDCLASS(x) ;
1104 #define DEBUG_ADDGADGET(x) ;
1105 #define DEBUG_ADDGLIST(x) ;
1106 #define DEBUG_ALLOCINTUIMESSAGE(x) ;
1107 #define DEBUG_ALLOCSCREENBUFFER(x) ;
1108 #define DEBUG_ALOHAWORKBENCH(x) ;
1109 #define DEBUG_CHANGEWINDOWBOX(x) ;
1110 #define DEBUG_CLOSESCREEN(x) ;
1111 #define DEBUG_CLOSEWINDOW(x) ;
1112 #define DEBUG_CLOSEWORKBENCH(x) ;
1113 #define DEBUG_DISPOSEOBJECT(x) ;
1114 #define DEBUG_DOGADGETMETHOD(x) ;
1115 #define DEBUG_DRAWBORDER(x) ;
1116 #define DEBUG_FINDCLASS(x) ;
1117 #define DEBUG_FREEICDATA(x) ;
1118 #define DEBUG_FREEINTUIMESSAGE(x) ;
1119 #define DEBUG_FREESCREENBUFFER(x) ;
1120 #define DEBUG_FREESCREENDRAWINFO(x) ;
1121 #define DEBUG_GADGETMOUSE(x) ;
1122 #define DEBUG_GETATTR(x) ;
1123 #define DEBUG_GETDEFAULTPUBSCREEN(x) ;
1124 #define DEBUG_GETDEFPREFS(x) ;
1125 #define DEBUG_GETGADGETIBOX(x) ;
1126 #define DEBUG_GETPREFS(x) ;
1127 #define DEBUG_GETSCREENDATA(x) ;
1128 #define DEBUG_GETSCREENDRAWINFO(x) ;
1129 #define DEBUG_HIDEWINDOW(x) ;
1130 #define DEBUG_OPEN(x) ;
1131 #define DEBUG_CLOSE(x) ;
1132 #define DEBUG_INPUTEVENT(x) ;
1133 #define DEBUG_INTREFRESHGLIST(x) ;
1134 #define DEBUG_INTUITEXTLENGTH(x) ;
1135 #define DEBUG_LENDMENUS(x) ;
1136 #define DEBUG_LOCKPUBSCREEN(x) ;
1137 #define DEBUG_MAKECLASS(x) ;
1138 #define DEBUG_MODIFYIDCMP(x) ;
1139 #define DEBUG_NEWOBJECT(x) ;
1140 #define DEBUG_NEXTOBJECT(x) ;
1141 #define DEBUG_OBTAINGIRPORT(x) ;
1142 #define DEBUG_OFFGADGET(x) ;
1143 #define DEBUG_OFFMENU(x) ;
1144 #define DEBUG_ONGADGET(x) ;
1145 #define DEBUG_ONMENU(x) ;
1146 #define DEBUG_OPENSCREEN(x) ;
1147 #define DEBUG_OPENSCREENTAGLIST(x) ;
1148 #define DEBUG_OPENWINDOW(x) ;
1149 #define DEBUG_OPENWINDOWTAGLIST(x) ;
1150 #define DEBUG_OPENWORKBENCH(x) ;
1151 #define DEBUG_POINTER(x) ;
1152 #define DEBUG_PRINTITEXT(x) ;
1153 #define DEBUG_QUERYOVERSCAN(x) ;
1154 #define DEBUG_REFRESH(x) ;
1155 #define DEBUG_RELEASEGIRPORT(x) ;
1156 #define DEBUG_REMEMBER(x) ;
1157 #define DEBUG_REMOVEGLIST(x) ;
1158 #define DEBUG_REPORTMOUSE(x) ;
1159 #define DEBUG_REQUEST(x) ;
1160 #define DEBUG_SCROLLWINDOWRASTER(x) ;
1161 #define DEBUG_SENDINTUIMESSAGE(x) ;
1162 #define DEBUG_SETATTRS(x) ;
1163 #define DEBUG_SETGADGETATTRS(x) ;
1164 #define DEBUG_SETPOINTER(x) ;
1165 #define DEBUG_SHOWWINDOW(x) ;
1166 #define DEBUG_UNLOCKPUBSCREEN(x) ;
1167 #define DEBUG_WINDOWLIMITS(x) ;
1168 #define DEBUG_WINDOWTOBACK(x) ;
1169 #define DEBUG_WINDOWTOFRONT(x) ;
1170 #define DEBUG_ZIPWINDOW(x) ;
1171 #define DEBUG_VISITOR(x) ;
1172 #define DEBUG_WORKBENCH(x) ;
1173 #define DEBUG_LOCKPUBSCREENLIST(x) ;
1174 #define DEBUG_UNLOCKPUBSCREENLIST(x) ;
1175 #define DEBUG_RETHINKDISPLAY(x) ;
1177 #ifdef NO_RUNTIME_DEBUG
1179 #define DEBUG_INIT(x) ;
1180 #define DEBUG_SETIPREFS(x) ;
1181 #define DEBUG_SETPREFS(x) ;
1185 #define DEBUG_INIT(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1186 #define DEBUG_SETIPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1187 #define DEBUG_SETPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1192 * Private data structures of the classes defined by intuition.library
1199 struct TagItem
*ic_Mapping
;
1200 struct TagItem
*ic_CloneTags
;
1201 ULONG ic_LoopCounter
;
1207 struct MinList memberlist
;
1213 /* render bevel only with no fill? */
1216 /* inverted bevel pens? */
1229 struct DrawInfo
*dri
;
1230 struct Image
*frame
;
1246 struct ExtGadget EG
;
1253 /* We use a propinfo structure, because we use the same routines
1254 for intuition propgadtets and in propgclass */
1256 struct PropInfo propinfo
;
1258 /* A little kludge: since the HandleMouseMove function
1259 wants dx/dy and not absolute mouse coords, we
1260 have to remember the last ones */
1265 /* One only have to store total or visble, and use some other
1266 formulas than those in the RKRM:L, but for
1267 code simplicity I store them all. */
1268 UWORD top
, visible
, total
;
1271 struct BBox
*old_knobbox
;
1272 struct Hook
*DisplayHook
;
1278 struct StringInfo StrInfo
;
1279 struct StringExtend StrExtend
;
1286 struct MinList memberlist
;
1287 struct Gadget
*activegad
;
1293 /* Current left- and topedge of moving window. Ie when the user releases
1294 the LMB after a windowdrag, the window's new coords will be (curleft, curtop)
1300 /* The current x and y coordinates relative to curleft/curtop */
1304 /* Whether the dragframe is currently drawn or erased */
1307 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1310 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1311 BOOL drag_layerlock
;
1312 #ifdef USEGADGETLOCK
1313 BOOL drag_gadgetlock
;
1314 BOOL drag_inputhandlerlock
;
1316 BOOL drag_refreshed
;
1318 /* Rastport to use during update */
1319 struct RastPort
*rp
;
1321 UQUAD lasteventtime
;
1326 #ifdef USEWINDOWLOCK
1327 /* used to prevent windows from opening/closing while user drags a window */
1328 BOOL drag_windowlock
;
1331 struct Task
*movetask
;
1335 /* SizeButtonClass */
1336 struct sizebutton_data
1339 /* The current width and height of the rubber band frame */
1345 /* holds original sizes */
1351 /* the offset of the mouse pointer to the rubber band frame*/
1355 /* Whether the dragframe is currently drawn or erased */
1358 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1361 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1362 BOOL drag_layerlock
;
1363 #ifdef USEGADGETLOCK
1364 BOOL drag_gadgetlock
;
1365 BOOL drag_inputhandlerlock
;
1368 BOOL drag_refreshed
;
1370 /* Rastport to use during update */
1371 struct RastPort
*rp
;
1373 UQUAD lasteventtime
;
1375 #ifdef USEWINDOWLOCK
1376 /* used to prevent windows from opening/closing while user drags a window */
1377 BOOL drag_windowlock
;
1388 /* MenuBarLabelClass */
1389 struct MenuBarLabelData
1391 struct DrawInfo
*dri
;
1397 struct SharedPointer
*shared_pointer
;
1401 struct windecor_data
1403 ULONG userbuffersize
;
1407 struct scrdecor_data
1409 ULONG userbuffersize
;
1412 /* MenuDecorClass */
1413 struct menudecor_data
1415 ULONG userbuffersize
;
1418 #endif /* INTUITION_INTERN_H */