1 #ifndef INTUITION_INTERN_H
2 #define INTUITION_INTERN_H
5 Copyright 1995-2011, 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>
32 # include <exec/types.h>
35 # include <exec/lists.h>
37 #ifndef GRAPHICS_GFXBASE_H
38 # include <graphics/gfxbase.h>
40 #ifndef GRAPHICS_RASTPORT_H
41 # include <graphics/rastport.h>
43 #ifndef GRAPHICS_REGIONS_H
44 # include <graphics/regions.h>
46 #ifndef GRAPHICS_CLIP_H
47 # include <graphics/clip.h>
49 #ifndef GRAPHICS_TEXT_H
50 # include <graphics/text.h>
52 #ifndef INTUITION_INTUITION_H
53 # include <intuition/intuition.h>
55 #ifndef INTUITION_INTUITIONBASE_H
56 # include <intuition/intuitionbase.h>
58 #ifndef INTUITION_CLASSES_H
59 # include <intuition/classes.h>
61 #ifndef INTUITION_CGHOOKS_H
62 # include <intuition/cghooks.h>
64 #ifndef INTUITION_SGHOOKS_H
65 # include <intuition/sghooks.h>
67 #ifndef INTUITION_SCREENS_H
68 # include <intuition/screens.h>
70 #ifndef PREFS_ICONTROL_H
71 # include <prefs/icontrol.h>
74 #include <prefs/input.h>
76 #ifndef CLIB_ALIB_PROTOS_H
77 # include <clib/alib_protos.h>
79 #ifdef INTUITION_NOTIFY_SUPPORT
80 # include <libraries/screennotify.h>
81 # include <libraries/notifyintuition.h>
86 #include "intuition_debug.h"
89 #include "intuition_customize.h"
90 #include "intuition_internmos.h"
91 #include "intuition_extend.h"
94 #include "requesters.h"
96 /* Needed for aros_print_not_implemented macro */
97 #include <aros/debug.h>
99 #include <aros/asmcall.h>
102 #define ASSERT_VALID_PTR_ROMOK(ptr) \
104 if (!((IPTR)ptr & 1)) { \
105 if (TypeOfMem((APTR)ptr)) \
108 struct Task *me = FindTask(NULL); \
110 if (((IPTR)(ptr) >= (IPTR)me->tc_SPLower) && ((IPTR)(ptr) < (IPTR)me->tc_SPUpper)) \
114 bug("[intuition] Invalid pointer value %p at %s, line %u\n", ptr, __FILE__, __LINE__); \
117 #define ASSERT_VALID_PTR_ROMOK(ptr)
120 // FIXME: seems only used for RefreshWindowTitles() ? -> better names
121 // FIXME: what are the correct values?
122 #define NO_DOUBLEBUFFER (0)
123 #define DOUBLEBUFFER (1)
127 # define USE_OPAQUESIZE 1
129 # define USE_OPAQUESIZE 0
132 /* This definition turns on compatibility mode where sprite colors
133 are allocated on hi- and truecolor screens also. This may be needed
134 if some software relies on this allocation. AROS itself currently does
136 #define ALWAYS_ALLOCATE_SPRITE_COLORS */
139 void dprintf(char *, ...) __attribute__ ((format (printf
, 1, 2)));
140 void * memclr(APTR
, ULONG
);
144 void * memclr(APTR
, ULONG
);
145 #define bzero(a,b) memclr(a,b)
146 #else /* __MORPHOS__ */
147 #define memclr(a,b) bzero(a,b)
148 #endif /* __MORPHOS__ */
151 * min()/max() without macro side effects.
154 ({typeof(a) _a = (a); \
155 typeof(b) _b = (b); \
159 ({typeof(a) _a = (a); \
160 typeof(b) _b = (b); \
163 #define EXTENDWORD(x) x = (LONG)((WORD)x);
164 #define EXTENDUWORD(x) x = (ULONG)((UWORD)x);
166 /* SANITY CHECK MACRO */
167 //#define DEBUG_SANITYCHECK
169 #ifdef DEBUG_SANITYCHECK
170 #define SANITY_CHECK(x) if (!((IPTR)x)) {dprintf("Losing sanity in %s line %d\n",__FILE__,__LINE__); return;};
171 #define SANITY_CHECKR(x,v) if (!((IPTR)x)) {dprintf("Losing sanity in %s line %d\n",__FILE__,__LINE__); return v;};
173 #define SANITY_CHECK(x) if (!((IPTR)x)) return;
174 #define SANITY_CHECKR(x,v) if (!((IPTR)x)) return v;
179 #define MENUS_BACKFILL TRUE
181 #define MENUS_AMIGALOOK(base) ((GetPrivIBase(base)->IControlPrefs.ic_Flags & ICF_3DMENUS) == 0)
183 #define MENULOOK_3D 0
184 #define MENULOOK_CLASSIC 1
186 #define MENUS_UNDERMOUSE(base) (GetPrivIBase(base)->IControlPrefs.ic_Flags & ICF_POPUPMENUS)
188 #define AVOID_WINBORDERERASE(base) \
189 (GetPrivIBase(base)->IControlPrefs.ic_Flags & ICF_AVOIDWINBORDERERASE)
194 #define FRAME_SIZE(base) (GetPrivIBase(base)->FrameSize)
196 #define FRAMESIZE_THIN 0 /* 1:1 thin */
197 #define FRAMESIZE_MEDRES 1 /* 2:1 medres like AmigaOS */
198 #define FRAMESIZE_THICK 2 /* 1:1 thick */
200 #define SQUARE_WIN_GADGETS 1
203 /* FIXME: possibly enable this, once gadtools has been updated */
205 #define GADTOOLSCOMPATIBLE
206 //enables some gadtools-weirdo-code, MUST be set in both gadtools & intui to work!!!
210 //#define USEGETIPREFS
213 /* simpleref layers have gadgets redrawn when app calls beginrefresh() */
214 //#define BEGINUPDATEGADGETREFRESH
215 //#define DAMAGECACHE
217 #define USEWINDOWLOCK
219 #define LOCKWINDOW(base) ObtainSemaphore(&GetPrivIBase(base)->WindowLock);
220 #define UNLOCKWINDOW(base) ReleaseSemaphore(&GetPrivIBase(base)->WindowLock);
222 #define LOCKWINDOW(base)
223 #define UNLOCKWINDOW(base)
225 /* jDc: do NOT disable this! */
227 #define USEGADGETLOCK
229 #define LOCKGADGET(base) ObtainSemaphore(&GetPrivIBase(base)->GadgetLock);
230 #define UNLOCKGADGET(base) ReleaseSemaphore(&GetPrivIBase(base)->GadgetLock);
231 #define LOCKWINDOWLAYERS(w) ;
232 #define UNLOCKWINDOWLAYERS(w) ;
236 #define LOCKWINDOWLAYERS(w) LockLayerInfo(&w->WScreen->LayerInfo); \
237 if (((struct IntWindow *)(w))->borderlayer) {LockLayer(0,((struct IntWindow *)(w))->borderlayer);}; \
238 if (((struct IntWindow *)(w))->wlayer) {LockLayer(0,((struct IntWindow *)(w))->wlayer);};
239 #define UNLOCKWINDOWLAYERS(w) if (((struct IntWindow *)(w))->wlayer) {UnlockLayer(((struct IntWindow *)(w))->wlayer);}; \
240 if (((struct IntWindow *)(w))->borderlayer) {UnlockLayer(((struct IntWindow *)(w))->borderlayer);} \
241 UnlockLayerInfo(&w->WScreen->LayerInfo);
244 #define WLAYER(w) (((struct IntWindow *)(w))->wlayer)
245 #define BLAYER(w) (((struct IntWindow *)(w))->borderlayer)
247 //#define TIMEVALWINDOWACTIVATION
249 /* If PROP_RENDER_OPTIMIZATION is set to 1, propgadget code tries to optimize rendering
250 during prop gadget knob movement. Only area of the propgadget that is affected by
251 prop gadget knob movement is re-rendered.
253 Unfortunately this can fail with some programs, like DOpus 4.x text viewer */
255 #define PROP_RENDER_OPTIMIZATION 0
257 #define SINGLE_SETPOINTERPOS_PER_EVENTLOOP 1
259 #ifndef LIFLG_SUPPORTS_OFFSCREEN_LAYERS
260 /* Defined in <graphics/layers.h>, but apparently not on MorphOS. */
261 # define LIFLG_SUPPORTS_OFFSCREEN_LAYERS 2
264 #define INTUITIONNAME "intuition.library"
265 #define MENUBARLABELCLASS "menubarlabelclass"
267 #define DEFPUBSCREEN TRUE
269 #define USE_NEWDISPLAYBEEP 1
271 #define TITLEBUFFERLEN 255
273 #define USE_IDCMPUPDATE_MESSAGECACHE 0
276 #if INCLUDE_VERSION < 50
278 /********************************************************************************/
279 /* imageclass.h AROS extensions */
281 #define SYSIA_WithBorder IA_FGPen /* default: TRUE */
282 #define SYSIA_Style IA_BGPen /* default: SYSISTYLE_NORMAL */
284 #define SYSISTYLE_NORMAL 0
285 #define SYSISTYLE_GADTOOLS 1 /* to get arrow images in gadtools look */
287 /********************************************************************************/
288 /* gadgetclass.h AROS extenstions */
290 /* This method is invoked to learn about the sizing requirements of your class,
291 before an object is created. This is AROS specific. */
295 STACKED ULONG MethodID
; /* GM_DOMAIN */
296 STACKED
struct GadgetInfo
*gpd_GInfo
; /* see <intuition/cghooks.h> */
297 STACKED
struct RastPort
*gpd_RPort
; /* RastPort to calculate dimensions for. */
298 STACKED LONG gpd_Which
; /* see below */
299 STACKED
struct IBox gpd_Domain
; /* Resulting domain. */
300 STACKED
struct TagItem
*gpd_Attrs
; /* Additional attributes. None defined,
304 /********************************************************************************/
307 #define GDOMAIN_MINIMUM 0 /* Calculate minimum size. */
308 #define GDOMAIN_NOMINAL 1 /* Calculate nominal size. */
309 #define GDOMAIN_MAXIMUM 2 /* Calculate maximum size. */
311 #endif /* INCLUDE_VERSION < 50 */
312 #endif /* ifdef __MORPHOS__ */
314 /********************************************************************************/
315 #define GM_MOVETEST 8
316 /* this method is used by our draggad to tell if it's OK to move the mouse when window
317 is near screen boundaries and offscreen is disabled. msg = gpInput*/
319 #define MOVETEST_MOVE 0
320 #define MOVETEST_ADJUSTPOS 1
322 /* ObtainGIRPort must install a 0 clipregion and
323 set scrollx/scrolly of layer to 0. Since this
324 will be restored only when ReleaseGIRPort is
325 called, we must backup the orig values somewhere */
329 struct Region
*clipregion
;
339 #define IP_OLDOVERSCAN 3
340 #define IP_OLDICONTROL 4
341 #define IP_OLDPOINTER 7
342 #define IP_OLDPALETTE 8
345 #define IP_SCREENMODE 1
346 #define IP_FONT 101//2
347 #define IP_ICONTROL 102//4
348 #define IP_POINTER 103//7
349 #define IP_PTRCOLOR 104//8
350 #define IP_PALETTE 105
351 #define IP_IACTIONS 20
352 #define IP_IEXTENSIONS 21
353 #define IP_INPUTEXT 22
357 struct IScreenModePrefs
366 struct IIControlPrefs
372 UBYTE ic_FrontToBack
;
379 #include <intuition/iprefs.h>
390 #define COLORTABLEENTRIES 11
395 #define RESOURCELIST_HASHSIZE 32 /* Smaller hash for memory limited m68k */
397 #define RESOURCELIST_HASHSIZE 256
400 #define RESOURCE_WINDOW 1
401 #define RESOURCE_SCREEN 2
410 /* Internal Screen Notification Data */
411 struct IntScreenNotify
414 struct MsgPort
*port
;
415 struct Task
*sigtask
;
424 struct IntIntuitionBase
426 struct IntuitionBase IBase
;
428 WORD _MinXMouse
,_MaxXMouse
; /* Old 1.3 Base entries*/
429 WORD _MinYMouse
,_MaxYMouse
; /* Old 1.3 Base entries*/
430 ULONG _StartSecs
,_StartMicros
; /* Old 1.3 Base entries*/
431 char *SystemRequestTitle
; /* written by locale as it seems..what a crappy interface*/
432 char *WorkbenchTitle
; /* written by locale as it seems..what a crappy interface*/
435 * savety pad for intuitionbase accesses
436 * probably needs to be smarter
441 /* Put local shit here, invisible for the user */
443 struct Library
*MUIMasterBase
;
446 struct DosLibrary
*DOSBase
;
447 struct LayersBase
*LayersBase
;
448 struct Library
*UtilityBase
;
449 struct GfxBase
*GfxBase
;
450 struct Library
*OOPBase
;
451 struct Library
*KeymapBase
;
453 struct Library
*InputBase
;
454 struct Library
*TimerBase
;
455 struct MsgPort
*TimerMP
;
456 struct timerequest
*TimerIO
;
458 struct MsgPort
*WorkBenchMP
;
459 struct Screen
*WorkBench
;
460 struct SignalSemaphore
*IBaseLock
;
462 /* Intuition input handlers replyport. This one is set
463 int rom/inputhandler.c/InitIIH()
465 struct MsgPort
*IntuiReplyPort
;
466 struct MinList
*IntuiActionQueue
;
467 struct IOStdReq
*InputIO
;
468 struct MsgPort
*InputMP
;
470 /* Intuition Screennotify Replyport if SNOTIFY_WAIT_REPLY is specified */
472 struct MsgPort
*ScreenNotifyReplyPort
;
474 BOOL InputDeviceOpen
;
475 struct Interrupt
*InputHandler
;
477 struct Hook
*GlobalEditHook
;
478 /* The default global edit hook */
479 struct Hook DefaultEditHook
;
481 struct Screen
*DefaultPubScreen
;
482 struct SignalSemaphore PubScrListLock
;
483 struct MinList PubScreenList
;
484 UWORD pubScrGlobalMode
;
486 struct SignalSemaphore ScreenNotificationListLock
;
487 struct List ScreenNotificationList
;
489 struct SignalSemaphore GadgetLock
;
490 struct SignalSemaphore MenuLock
;
491 struct SignalSemaphore WindowLock
;
492 struct SignalSemaphore IntuiActionLock
;
493 struct SignalSemaphore InputHandlerLock
;
494 struct LayerContext BackupLayerContext
;
496 struct IClass
*dragbarclass
;
497 struct IClass
*sizebuttonclass
;
501 struct Preferences
*DefaultPreferences
;
502 struct Preferences
*ActivePreferences
;
504 struct MsgPort
*MenuHandlerPort
;
507 struct TextFont
*ScreenFont
;
508 struct TextFont
*TopazFont
;
510 /* Dos function DisplayError() before intuition.library patched it */
511 APTR OldDisplayErrorFunc
;
513 struct SignalSemaphore ClassListLock
;
514 struct MinList ClassList
;
515 struct IClass RootClass
;
518 struct ViewExtra
*ViewLordExtra
;
525 ULONG
*SmallMenuPool
;
529 struct IScreenModePrefs ScreenModePrefs
;
530 struct IIControlPrefs IControlPrefs
;
532 struct IAction
*IControlActions
;
533 struct IControlExtensions IControlExtensions
;
534 ULONG NumIControlActions
;
535 struct InputPrefsExt InputPrefsExt
;
537 struct IClass
*pointerclass
;
538 Object
*DefaultPointer
;
540 UWORD DriPens2
[NUMDRIPENS
];
541 UWORD DriPens4
[NUMDRIPENS
];
542 UWORD DriPens8
[NUMDRIPENS
];
543 struct Color32 Colors
[COLORTABLEENTRIES
];
547 struct IntScreen
*MenuVerifyScreen
;
551 struct SignalSemaphore DataTypesSem
;
552 struct Library
*DataTypesBase
; /* should be opened ONLY by int_InitCustomChanges!*/
556 ULONG LastClickMicro
; /* for doubleclick to front */
557 ULONG LastMenuDownSecs
;
558 ULONG LastMenuDownMicro
; /* for auto sticky/non-sticky menus */
559 ULONG DoubleClickCounter
;
560 ULONG DoubleClickButton
;
563 struct Hook transphook
; /* hook for windows with intui transp */
564 struct Hook notransphook
; /* hook for windows with no additional transp (borderless,etc) */
566 #ifdef INTUITION_NOTIFY_SUPPORT
567 struct Library
*ScreenNotifyBase
;
568 struct Library
*NotifyIntuitionBase
;
571 struct RastPort DoGadgetMethodRP
;
572 struct GadgetInfo DoGadgetMethodGI
;
574 struct SignalSemaphore ScrDecorSem
;
575 struct IClass
*ScrDecorClass
;
576 struct TagItem
*ScrDecorTags
;
577 struct SignalSemaphore MenuDecorSem
;
578 struct IClass
*MenuDecorClass
;
579 struct TagItem
*MenuDecorTags
;
580 struct SignalSemaphore WinDecorSem
;
581 struct IClass
*WinDecorClass
;
582 struct TagItem
*WinDecorTags
;
584 struct List Decorations
;
585 struct NewDecorator
*Decorator
;
591 #if USE_NEWDISPLAYBEEP
595 WORD prop_clickoffset_x
, prop_clickoffset_y
;
597 struct MinList ResourceList
[RESOURCELIST_HASHSIZE
];
599 /* Menu Look Settings */
602 Object
*ActiveMonitor
;
605 OOP_AttrBase HiddAttrBase
;
606 OOP_AttrBase HiddGfxAttrBase
;
607 OOP_AttrBase HiddPixFmtAttrBase
;
609 OOP_MethodID ib_HiddGfxBase
;
610 OOP_MethodID ib_HiddBitMapBase
;
612 struct IClass
*monitorclass
;
613 struct MinList MonitorList
;
614 struct SignalSemaphore MonitorListSem
;
619 struct ExtSprite
*sprite
;
620 WORD xoffset
, yoffset
;
624 struct SharedPointer
*CreateSharedPointer(struct ExtSprite
*, int, int, struct IntuitionBase
*);
625 void ObtainSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
626 void ReleaseSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
628 #ifdef INTUITION_NOTIFY_SUPPORT
629 void sn_DoNotify(ULONG type
, APTR value
, struct Library
*_ScreenNotifyBase
);
635 struct Screen
*dri_Screen
;
636 struct SignalSemaphore dri_WinDecorSem
;
637 Object
*dri_WinDecorObj
;
638 struct SignalSemaphore dri_ScrDecorSem
;
639 Object
*dri_ScrDecorObj
;
642 #define DRI_VERSION_AROS (DRI_VERSION + 1)
644 #define LOCK_WINDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
645 #define LOCKSHARED_WINDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
646 #define UNLOCK_WINDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
648 #define LOCK_SCRDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
649 #define LOCKSHARED_SCRDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
650 #define UNLOCK_SCRDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
652 #define LOCK_MENUDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
653 #define LOCKSHARED_MENUDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
654 #define UNLOCK_MENUDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
658 struct Screen Screen
;
661 struct HashNode hashnode
;
662 struct IntDrawInfo DInfo
;
663 struct TTextAttr textattr
;
664 ULONG textattrtags
[3];
665 UWORD Pens
[NUMDRIPENS
];
666 struct PubScreenNode
*pubScrNode
;
669 struct Layer
*rootLayer
;
670 #if !USE_NEWDISPLAYBEEP
671 ULONG DisplayBeepColor0
[3];
672 struct Window
*DisplayBeepWindow
;
676 struct MonitorSpec
*Monitor
;
678 Object
*MonitorObject
;
679 struct SharedPointer
*Pointer
;
680 struct Window
*MenuVerifyActiveWindow
;
681 int MenuVerifyTimeOut
;
682 int MenuVerifyMsgCount
;
683 ULONG MenuVerifySeconds
;
684 ULONG MenuVerifyMicros
;
685 ULONG DecorUserBufferSize
;
686 IPTR DecorUserBuffer
;
688 Object
*MenuDecorObj
;
690 struct NewDecorator
*Decorator
;
692 struct BitMap
*AllocatedBitmap
;
700 struct SkinInfo SkinInfo
;
701 struct RastPort
*TitlebarBufferRP
;
702 struct Window
*TitlebarBufferWin
;
703 ULONG TitlebarWinWidth
;
704 ULONG TitlebarWinActive
;
706 #if USE_NEWDISPLAYBEEP
707 UBYTE BeepingCounter
;
711 #define GetPrivScreen(s) ((struct IntScreen *)s)
714 #define SF_IsParent (0x0001)
715 #define SF_IsChild (0x0002)
716 #define SF_InvisibleBar (0x0004)
717 #define SF_AppearingBar (0x0008)
718 #define SF_SysFont (0x0010)
719 #define SF_Draggable (0x0020) /* Screen can be dragged */
720 #define SF_ComposeAbove (0x0100) /* Composition capabilities */
721 #define SF_ComposeBelow (0x0200)
722 #define SF_ComposeLeft (0x0400)
723 #define SF_ComposeRight (0x0800)
725 #define SF_VertCompose (SF_ComposeAbove|SF_ComposeBelow)
726 #define SF_HorCompose (SF_ComposeLeft |SF_ComposeRight)
727 #define SF_Compose (SF_ComposeAbove|SF_ComposeBelow|SF_ComposeLeft|SF_ComposeRight)
729 struct IntIntuiMessage
731 struct ExtIntuiMessage eimsg
;
734 ** The following field is needed, because in case of IDCMP_RAWKEY
735 ** IntuiMessage->IAddress is a pointer to this data, not the data
736 ** itself (which is the case for IDCMP_VANILLAKEY)
742 #define INT_INTUIMESSAGE(x) ((struct IntIntuiMessage *)(x))
746 /*extern struct IntuitionBase * IntuitionBase;*/
748 #define IW(window) ((struct IntWindow *) (window))
750 #define GetPubIBase(ib) ((struct IntuitionBase *)ib)
751 #define GetPrivIBase(ib) ((struct IntIntuitionBase *)ib)
753 /* FIXME: Remove these #define xxxBase hacks
754 Do not use this in new code !
759 #define MUIMasterBase (GetPrivIBase(IntuitionBase)->MUIMasterBase)
763 /* struct Utilitybase is used in the following file so include it
764 before defining Utilitybase
766 #include <proto/utility.h>
768 /* stegerg: one can have sysgadgets outside of window border! All sysgadgets in window
769 border must have set GACT_???BORDER and, if they are in a gzz window, also
772 #define IS_GZZ_GADGET(gad) (((gad)->GadgetType) & GTYP_GZZGADGET)
774 #define IS_BORDER_GADGET(gad) (IS_GZZ_GADGET(gad) || \
775 ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER)))
777 #define IS_SYS_GADGET(gad) (((gad)->GadgetType) & GTYP_SYSTYPEMASK)
779 #define IS_BOOPSI_GADGET(gad) (((gad)->GadgetType & GTYP_GTYPEMASK) == GTYP_CUSTOMGADGET)
781 /*#define IS_BORDER_GADGET(gad) \
782 (((gad->GadgetType) & GTYP_SYSGADGET) \
783 || ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER))) */
785 #define IS_REQ_GADGET(gad) ((gad)->GadgetType & GTYP_REQGADGET)
787 #define IS_SCREEN_GADGET(gad) ((gad)->GadgetType & GTYP_SCRGADGET)
789 #define SET_GI_RPORT(gi, w, req, gad) \
790 (gi)->gi_RastPort = (IS_SCREEN_GADGET(gad) ? \
791 ((gi)->gi_Screen->BarLayer ? (gi)->gi_Screen->BarLayer->rp : NULL) : \
792 (IS_BORDER_GADGET(gad) ? (w)->BorderRPort : \
793 ((req) ? ((req)->ReqLayer->rp) : (w)->RPort)) \
797 #define REFRESHGAD_BOOPSI 1 /* boopsi gadgets */
798 #define REFRESHGAD_BORDER 2 /* gadgets in window border */
799 #define REFRESHGAD_REL 4 /* gadgets with GFLG_RELRIGHT, GFLG_RELBOTTOM,GFLG_RELWIDTH, GFLG_RELHEIGHT */
800 #define REFRESHGAD_RELS 8 /* GFLG_RELSPECIAL gadgets */
801 #define REFRESHGAD_TOPBORDER 16 /* used by setwindowtitle */
802 #define REFRESHGAD_NOGADTOOLS 32 /* used in some cases for _mustbe_ */
804 #define SYSGADGET_ACTIVE (iihdata->ActiveSysGadget != NULL)
806 VOID
int_refreshglist(struct Gadget
*gadgets
, struct Window
*window
,
807 struct Requester
*requester
, LONG numGad
, LONG mustbe
, LONG mustnotbe
,
808 struct IntuitionBase
*IntuitionBase
);
810 VOID
int_RefreshWindowFrame(struct Window
*window
, LONG mustbe
, LONG mustnotbe
,
812 struct IntuitionBase
*IntuitionBase
);
814 #define int_refreshwindowframe(a,b,c,d) int_RefreshWindowFrame(a,b,c,0,d);
816 /* Keep the system gadgets in the same order than the original intuition,
817 * some programs make bad asumptions about that...
835 #define SYSGAD(w, idx) (((struct IntWindow *)(w))->sysgads[idx])
839 struct Window window
;
841 Object
*sysgads
[NUM_SYSGADS
];
842 struct Image
*AmigaKey
;
843 struct Image
*Checkmark
;
844 struct Image
*SubMenuImage
;
845 struct Window
*menulendwindow
;
847 struct HashNode hashnode
;
849 /* When the Zoom gadget is pressed the window will have the
850 dimensions stored here. The old dimensions are backed up here
857 /* max. number of mousemove events to send to this window */
860 /* act. number of mousemove events sent to this window */
861 WORD num_mouseevents
;
863 /* max. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
864 messages to send to this window */
867 /* act. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
868 messages sent to this window */
869 WORD num_repeatevents
;
871 #if USE_IDCMPUPDATE_MESSAGECACHE
872 /* number of unreplied IDCMP_IDCMPUPDATE messages sent to window
873 used in few hacks :) */
874 WORD num_idcmpupdate
;
877 WORD sizeimage_width
;
878 WORD sizeimage_height
;
888 ULONG extrabuttonsid
; /* replaces ETI_Dummy if apps wishes it */
890 ULONG titlepos
; /* used by titlebar pattern fill stuff */
897 struct Region
*transpregion
;
898 struct Hook
*usertransphook
;
899 struct Region
*usertranspregion
;
903 struct Region
*trashregion
;
905 char titlebuffer
[TITLEBUFFERLEN
+1];
907 #if USE_IDCMPUPDATE_MESSAGECACHE
908 struct IntuiMessage
*messagecache
; //for idcmpupdate cache
911 struct Layer
*wlayer
;
912 struct Layer
*borderlayer
;
914 struct timeval lastmsgsent
;
915 struct timeval lastmsgreplied
;
917 #ifdef TIMEVALWINDOWACTIVATION
918 struct timeval activationtime
;
922 struct Hook custombackfill
;
925 struct Hook DefaultWindowShapeHook
;
927 struct Region
*OutlineShape
;
928 ULONG DecorUserBufferSize
;
929 IPTR DecorUserBuffer
;
932 #define SPFLAG_ICONIFIED 1
933 #define SPFLAG_NOICONIFY 2
934 #define SPFLAG_SKININFO 4
935 #define SPFLAG_LAYERREFRESH 8
936 #define SPFLAG_TRANSPHOOK 16
937 #define SPFLAG_LAYERRESIZED 32
938 #define SPFLAG_USERPORT 64
939 #define SPFLAG_IAMDEAD 128
940 #define SPFLAG_CLOSING 256 //used with iamdead
941 #define SPFLAG_WANTBUFFER 512
943 #define HELPF_ISHELPGROUP 1
944 #define HELPF_GADGETHELP 2
946 #define IS_NOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? TRUE : FALSE)
947 #define IS_DOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? FALSE : TRUE )
948 #define IS_SIMPLEREFRESH(win) (((win)->Flags & WFLG_SIMPLE_REFRESH) ? TRUE : FALSE)
949 #define IS_GZZWINDOW(win) (((win)->Flags & WFLG_GIMMEZEROZERO) ? TRUE : FALSE)
952 /* Flag definitions for MoreFlags */
954 #define WMFLG_NOTIFYDEPTH (1 << 0) /* Window wants notification when
955 it's depth arranged */
957 #define WMFLG_DO_UNLOCKPUBSCREEN (1 << 1)
958 #define WMFLG_MENUHELP (1 << 2)
959 #define WMFLG_POINTERDELAY (1 << 3)
960 #define WMFLG_TABLETMESSAGES (1 << 4)
962 // FIXME: ehm... this one should die a horrible death!
963 #define WMFLG_IAMMUI (1 << 5)
965 struct IntScreenBuffer
967 struct ScreenBuffer sb
;
972 /* Driver prototypes */
974 extern int intui_init (struct IntuitionBase
*);
975 extern int intui_open (struct IntuitionBase
*);
976 extern void intui_close (struct IntuitionBase
*);
977 extern void intui_expunge (struct IntuitionBase
*);
978 extern int intui_GetWindowSize (void);
979 extern void intui_WindowLimits (struct Window
* window
, WORD MinWidth
, WORD MinHeight
, UWORD MaxWidth
, UWORD MaxHeight
);
980 extern void intui_ActivateWindow (struct Window
*);
981 extern BOOL
intui_ChangeWindowBox (struct Window
* window
, WORD x
, WORD y
,
982 WORD width
, WORD height
);
983 extern void intui_CloseWindow (struct Window
*, struct IntuitionBase
*);
984 extern void intui_MoveWindow (struct Window
* window
, WORD dx
, WORD dy
);
985 extern int intui_OpenWindow (struct Window
*, struct IntuitionBase
*,
986 struct BitMap
* SuperBitMap
, struct Hook
*backfillhook
,
987 struct Region
* shape
, struct Hook
* shapehook
,
988 struct Layer
* parent
, ULONG visible
);
989 extern void intui_SetWindowTitles (struct Window
*, CONST_STRPTR
, CONST_STRPTR
);
990 extern void intui_RefreshWindowFrame(struct Window
*win
);
991 extern struct Window
*intui_FindActiveWindow(struct InputEvent
*ie
, struct IntuitionBase
*IntuitionBase
);
992 extern void intui_ScrollWindowRaster(struct Window
* win
, WORD dx
, WORD dy
, WORD xmin
,
993 WORD ymin
, WORD xmax
, WORD ymax
,
994 struct IntuitionBase
* IntuitionBase
);
996 /* wbtasktalk protos */
998 ULONG
TellWBTaskToCloseWindows(struct IntuitionBase
*IntuitionBase
);
999 ULONG
TellWBTaskToOpenWindows(struct IntuitionBase
*IntuitionBase
);
1001 /* intuition_misc protos */
1002 extern void LoadDefaultPreferences(struct IntuitionBase
* IntuitionBase
);
1003 Object
* CreateStdSysImage(WORD which
, WORD preferred_height
, struct Screen
*scr
, APTR buffer
,
1004 struct DrawInfo
*dri
, struct IntuitionBase
*IntuitionBase
);
1005 extern void CheckRectFill(struct RastPort
*rp
, WORD x1
, WORD y1
, WORD x2
, WORD y2
, struct IntuitionBase
* IntuitionBase
);
1006 extern BOOL
CreateWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1007 extern VOID
KillWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1008 extern void CreateScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
1009 extern void KillScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
1010 extern void RenderScreenBar(struct Screen
*scr
, BOOL refresh
, struct IntuitionBase
*IntuitionBase
);
1011 extern void UpdateMouseCoords(struct Window
*win
);
1012 extern WORD
SubtractRectFromRect(struct Rectangle
*a
, struct Rectangle
*b
, struct Rectangle
*destrectarray
);
1014 AROS_UFP3(BOOL
, DefaultWindowShapeFunc
,
1015 AROS_UFPA(struct Hook
*, hook
, A0
),
1016 AROS_UFPA(struct Layer
*, lay
, A2
),
1017 AROS_UFPA(struct ShapeHookMsg
*, msg
, A1
));
1019 extern LONG
CalcResourceHash(APTR resource
);
1020 extern void AddResourceToList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1021 extern void RemoveResourceFromList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1022 extern BOOL
ResourceExisting(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1023 void FireScreenNotifyMessage(IPTR data
, ULONG flag
, struct IntuitionBase
*IntuitionBase
);
1024 void FireScreenNotifyMessageCode(IPTR data
, ULONG flag
, ULONG code
, struct IntuitionBase
*IntuitionBase
);
1027 extern void MySetPointerPos(struct IntuitionBase
*IntuitionBase
);
1028 extern BOOL
ResetPointer(struct IntuitionBase
*IntuitionBase
);
1029 extern void ActivateMonitor(Object
*newmonitor
, WORD x
, WORD y
, struct IntuitionBase
*IntuitionBase
);
1030 extern struct Screen
*FindFirstScreen(Object
*monitor
, struct IntuitionBase
*IntuitionBase
);
1031 extern struct RastPort
*MyCreateRastPort(struct IntuitionBase
*IntuitionBase
);
1032 extern struct RastPort
*MyCloneRastPort(struct IntuitionBase
*IntuitionBase
, struct RastPort
*rp
);
1033 extern void MyFreeRastPort(struct IntuitionBase
*IntuitionBase
, struct RastPort
*rp
);
1034 struct TextFont
*SafeReopenFont(struct IntuitionBase
*, struct TextFont
**);
1035 extern Object
*MakePointerFromPrefs(struct IntuitionBase
*, struct Preferences
*);
1036 extern Object
*MakePointerFromData(struct IntuitionBase
*, UWORD
*, int, int, int, int);
1037 void InstallPointer(struct IntuitionBase
*, UWORD
, Object
**, Object
*);
1038 void SetPointerColors(struct IntuitionBase
*IntuitionBase
);
1039 struct IClass
*InitITextIClass (struct IntuitionBase
* IntuitionBase
);
1040 struct Gadget
*DoActivateGadget(struct Window
*win
, struct Requester
*req
, struct Gadget
*gad
,
1041 struct IntuitionBase
*IntuitionBase
);
1042 VOID
DoGMLayout(struct Gadget
*glist
, struct Window
*win
, struct Requester
*req
,
1043 UWORD numgad
, BOOL initial
, struct IntuitionBase
*IntuitionBase
);
1044 BOOL
ih_fire_intuimessage(struct Window
* w
, ULONG Class
, UWORD Code
, APTR IAddress
,
1045 struct IntuitionBase
*IntuitionBase
);
1046 void NotifyDepthArrangement(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1050 void int_PrintIText(struct RastPort
* rp
, struct IntuiText
* iText
,
1051 LONG leftOffset
, LONG topOffset
, BOOL ignore_attributes
,
1052 struct IntuitionBase
*IntuitionBase
);
1054 /* Private extra functions */
1055 OOP_Object
*FindMonitor(ULONG modeid
, struct IntuitionBase
*IntuitionBase
);
1058 BOOL
IsLayerHiddenBySibling(struct Layer
*layer
, BOOL xx
);
1059 LONG
IsLayerVisible(struct Layer
*layer
);
1062 void SetupGInfo(struct GadgetInfo
*gi
, struct Window
*win
, struct Requester
*req
,
1063 struct Gadget
*gad
, struct IntuitionBase
*IntuitionBase
);
1065 IPTR
Custom_DoMethodA(struct IntuitionBase
*, struct Gadget
*, Msg
);
1071 #define DoMethodA(x, ...) (REG_A6=(LONG)IntuitionBase, DoMethodA(x, __VA_ARGS__))
1074 #define HAS_CHILDREN(w) (NULL != w->firstchild)
1077 #define DeinitRastPort(rp) ((void)0)
1079 #define CreateRastPort() MyCreateRastPort(IntuitionBase)
1080 #define CloneRastPort(rp) MyCloneRastPort(IntuitionBase, rp)
1081 #define FreeRastPort(rp) MyFreeRastPort(IntuitionBase, rp)
1083 /* Replacement for dos.library/DisplayError() */
1084 AROS_UFP3(LONG
, Intuition_DisplayError
,
1085 AROS_UFPA(STRPTR
, formatStr
, A0
),
1086 AROS_UFPA(ULONG
, IDCMPFlags
, D0
),
1087 AROS_UFPA(APTR
, args
, A1
));
1089 #define POINTERA_SharedPointer 0x80039010
1092 #define dprintf kprintf
1095 #define DEBUG_ACTIVATEGADGET(x) ;
1096 #define DEBUG_ACTIVATEWINDOW(x) ;
1097 #define DEBUG_ADDCLASS(x) ;
1098 #define DEBUG_ADDGADGET(x) ;
1099 #define DEBUG_ADDGLIST(x) ;
1100 #define DEBUG_ALLOCINTUIMESSAGE(x) ;
1101 #define DEBUG_ALLOCSCREENBUFFER(x) ;
1102 #define DEBUG_ALOHAWORKBENCH(x) ;
1103 #define DEBUG_CHANGEWINDOWBOX(x) ;
1104 #define DEBUG_CLOSESCREEN(x) ;
1105 #define DEBUG_CLOSEWINDOW(x) ;
1106 #define DEBUG_CLOSEWORKBENCH(x) ;
1107 #define DEBUG_DISPOSEOBJECT(x) ;
1108 #define DEBUG_DOGADGETMETHOD(x) ;
1109 #define DEBUG_DRAWBORDER(x) ;
1110 #define DEBUG_FINDCLASS(x) ;
1111 #define DEBUG_FREEICDATA(x) ;
1112 #define DEBUG_FREEINTUIMESSAGE(x) ;
1113 #define DEBUG_FREESCREENBUFFER(x) ;
1114 #define DEBUG_FREESCREENDRAWINFO(x) ;
1115 #define DEBUG_GADGETMOUSE(x) ;
1116 #define DEBUG_GETATTR(x) ;
1117 #define DEBUG_GETDEFAULTPUBSCREEN(x) ;
1118 #define DEBUG_GETDEFPREFS(x) ;
1119 #define DEBUG_GETGADGETIBOX(x) ;
1120 #define DEBUG_GETPREFS(x) ;
1121 #define DEBUG_GETSCREENDATA(x) ;
1122 #define DEBUG_GETSCREENDRAWINFO(x) ;
1123 #define DEBUG_HIDEWINDOW(x) ;
1124 #define DEBUG_OPEN(x) ;
1125 #define DEBUG_CLOSE(x) ;
1126 #define DEBUG_INPUTEVENT(x) ;
1127 #define DEBUG_INTREFRESHGLIST(x) ;
1128 #define DEBUG_INTUITEXTLENGTH(x) ;
1129 #define DEBUG_LENDMENUS(x) ;
1130 #define DEBUG_LOCKPUBSCREEN(x) ;
1131 #define DEBUG_MAKECLASS(x) ;
1132 #define DEBUG_MODIFYIDCMP(x) ;
1133 #define DEBUG_NEWOBJECT(x) ;
1134 #define DEBUG_NEXTOBJECT(x) ;
1135 #define DEBUG_OBTAINGIRPORT(x) ;
1136 #define DEBUG_OFFGADGET(x) ;
1137 #define DEBUG_OFFMENU(x) ;
1138 #define DEBUG_ONGADGET(x) ;
1139 #define DEBUG_ONMENU(x) ;
1140 #define DEBUG_OPENSCREEN(x) ;
1141 #define DEBUG_OPENSCREENTAGLIST(x) ;
1142 #define DEBUG_OPENWINDOW(x) ;
1143 #define DEBUG_OPENWINDOWTAGLIST(x) ;
1144 #define DEBUG_OPENWORKBENCH(x) ;
1145 #define DEBUG_POINTER(x) ;
1146 #define DEBUG_PRINTITEXT(x) ;
1147 #define DEBUG_QUERYOVERSCAN(x) ;
1148 #define DEBUG_REFRESH(x) ;
1149 #define DEBUG_RELEASEGIRPORT(x) ;
1150 #define DEBUG_REMEMBER(x) ;
1151 #define DEBUG_REMOVEGLIST(x) ;
1152 #define DEBUG_REPORTMOUSE(x) ;
1153 #define DEBUG_REQUEST(x) ;
1154 #define DEBUG_SCROLLWINDOWRASTER(x) ;
1155 #define DEBUG_SENDINTUIMESSAGE(x) ;
1156 #define DEBUG_SETATTRS(x) ;
1157 #define DEBUG_SETGADGETATTRS(x) ;
1158 #define DEBUG_SETPOINTER(x) ;
1159 #define DEBUG_SHOWWINDOW(x) ;
1160 #define DEBUG_UNLOCKPUBSCREEN(x) ;
1161 #define DEBUG_WINDOWLIMITS(x) ;
1162 #define DEBUG_WINDOWTOBACK(x) ;
1163 #define DEBUG_WINDOWTOFRONT(x) ;
1164 #define DEBUG_ZIPWINDOW(x) ;
1165 #define DEBUG_VISITOR(x) ;
1166 #define DEBUG_WORKBENCH(x) ;
1167 #define DEBUG_LOCKPUBSCREENLIST(x) ;
1168 #define DEBUG_UNLOCKPUBSCREENLIST(x) ;
1169 #define DEBUG_RETHINKDISPLAY(x) ;
1171 #ifdef NO_RUNTIME_DEBUG
1173 #define DEBUG_INIT(x) ;
1174 #define DEBUG_SETIPREFS(x) ;
1175 #define DEBUG_SETPREFS(x) ;
1179 #define DEBUG_INIT(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1180 #define DEBUG_SETIPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1181 #define DEBUG_SETPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1186 * Private data structures of the classes defined by intuition.library
1193 struct TagItem
*ic_Mapping
;
1194 struct TagItem
*ic_CloneTags
;
1195 ULONG ic_LoopCounter
;
1201 struct MinList memberlist
;
1207 /* render bevel only with no fill? */
1210 /* inverted bevel pens? */
1223 struct DrawInfo
*dri
;
1224 struct Image
*frame
;
1240 struct ExtGadget EG
;
1247 /* We use a propinfo structure, because we use the same routines
1248 for intuition propgadtets and in propgclass */
1250 struct PropInfo propinfo
;
1252 /* A little kludge: since the HandleMouseMove function
1253 wants dx/dy and not absolute mouse coords, we
1254 have to remember the last ones */
1259 /* One only have to store total or visble, and use some other
1260 formulas than those in the RKRM:L, but for
1261 code simplicity I store them all. */
1262 UWORD top
, visible
, total
;
1265 struct BBox
*old_knobbox
;
1266 struct Hook
*DisplayHook
;
1272 struct StringInfo StrInfo
;
1273 struct StringExtend StrExtend
;
1280 struct MinList memberlist
;
1281 struct Gadget
*activegad
;
1287 /* Current left- and topedge of moving window. Ie when the user releases
1288 the LMB after a windowdrag, the window's new coords will be (curleft, curtop)
1294 /* The current x and y coordinates relative to curleft/curtop */
1298 /* Whether the dragframe is currently drawn or erased */
1301 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1304 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1305 BOOL drag_layerlock
;
1306 #ifdef USEGADGETLOCK
1307 BOOL drag_gadgetlock
;
1308 BOOL drag_inputhandlerlock
;
1310 BOOL drag_refreshed
;
1312 /* Rastport to use during update */
1313 struct RastPort
*rp
;
1315 UQUAD lasteventtime
;
1320 #ifdef USEWINDOWLOCK
1321 /* used to prevent windows from opening/closing while user drags a window */
1322 BOOL drag_windowlock
;
1325 struct Task
*movetask
;
1329 /* SizeButtonClass */
1330 struct sizebutton_data
1333 /* The current width and height of the rubber band frame */
1339 /* holds original sizes */
1345 /* the offset of the mouse pointer to the rubber band frame*/
1349 /* Whether the dragframe is currently drawn or erased */
1352 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1355 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1356 BOOL drag_layerlock
;
1357 #ifdef USEGADGETLOCK
1358 BOOL drag_gadgetlock
;
1359 BOOL drag_inputhandlerlock
;
1362 BOOL drag_refreshed
;
1364 /* Rastport to use during update */
1365 struct RastPort
*rp
;
1367 UQUAD lasteventtime
;
1369 #ifdef USEWINDOWLOCK
1370 /* used to prevent windows from opening/closing while user drags a window */
1371 BOOL drag_windowlock
;
1382 /* MenuBarLabelClass */
1383 struct MenuBarLabelData
1385 struct DrawInfo
*dri
;
1391 struct SharedPointer
*shared_pointer
;
1395 struct windecor_data
1397 ULONG userbuffersize
;
1401 struct scrdecor_data
1403 ULONG userbuffersize
;
1406 /* MenuDecorClass */
1407 struct menudecor_data
1409 ULONG userbuffersize
;
1412 #endif /* INTUITION_INTERN_H */