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 DoubleClickCounter
;
558 ULONG DoubleClickButton
;
561 struct Hook transphook
; /* hook for windows with intui transp */
562 struct Hook notransphook
; /* hook for windows with no additional transp (borderless,etc) */
564 #ifdef INTUITION_NOTIFY_SUPPORT
565 struct Library
*ScreenNotifyBase
;
566 struct Library
*NotifyIntuitionBase
;
569 struct RastPort DoGadgetMethodRP
;
570 struct GadgetInfo DoGadgetMethodGI
;
572 struct SignalSemaphore WinDecorSem
;
574 struct SignalSemaphore ScrDecorSem
;
576 struct SignalSemaphore MenuDecorSem
;
577 Object
*MenuDecorObj
;
579 Object
*DefWinDecorObj
;
580 Object
*DefScrDecorObj
;
581 Object
*DefMenuDecorObj
;
583 struct List Decorations
;
584 struct NewDecorator
*Decorator
;
590 #if USE_NEWDISPLAYBEEP
594 WORD prop_clickoffset_x
, prop_clickoffset_y
;
596 struct MinList ResourceList
[RESOURCELIST_HASHSIZE
];
598 /* Menu Look Settings */
601 Object
*ActiveMonitor
;
604 OOP_AttrBase HiddAttrBase
;
605 OOP_AttrBase HiddGfxAttrBase
;
606 OOP_AttrBase HiddPixFmtAttrBase
;
608 OOP_MethodID ib_HiddGfxBase
;
609 OOP_MethodID ib_HiddBitMapBase
;
611 struct IClass
*monitorclass
;
612 struct MinList MonitorList
;
613 struct SignalSemaphore MonitorListSem
;
618 struct ExtSprite
*sprite
;
619 WORD xoffset
, yoffset
;
623 struct SharedPointer
*CreateSharedPointer(struct ExtSprite
*, int, int, struct IntuitionBase
*);
624 void ObtainSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
625 void ReleaseSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
627 #ifdef INTUITION_NOTIFY_SUPPORT
628 void sn_DoNotify(ULONG type
, APTR value
, struct Library
*_ScreenNotifyBase
);
634 struct Screen
*dri_Screen
;
635 struct SignalSemaphore dri_WinDecorSem
;
636 Object
*dri_WinDecorObj
;
637 struct SignalSemaphore dri_ScrDecorSem
;
638 Object
*dri_ScrDecorObj
;
641 #define DRI_VERSION_AROS (DRI_VERSION + 1)
643 #define LOCK_WINDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
644 #define LOCKSHARED_WINDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
645 #define UNLOCK_WINDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
647 #define LOCK_SCRDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
648 #define LOCKSHARED_SCRDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
649 #define UNLOCK_SCRDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
651 #define LOCK_MENUDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
652 #define LOCKSHARED_MENUDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
653 #define UNLOCK_MENUDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
657 struct Screen Screen
;
660 struct HashNode hashnode
;
661 struct IntDrawInfo DInfo
;
662 struct TTextAttr textattr
;
663 ULONG textattrtags
[3];
664 UWORD Pens
[NUMDRIPENS
];
665 struct PubScreenNode
*pubScrNode
;
668 struct Layer
*rootLayer
;
669 #if !USE_NEWDISPLAYBEEP
670 ULONG DisplayBeepColor0
[3];
671 struct Window
*DisplayBeepWindow
;
675 struct MonitorSpec
*Monitor
;
677 Object
*MonitorObject
;
678 struct SharedPointer
*Pointer
;
679 struct Window
*MenuVerifyActiveWindow
;
680 int MenuVerifyTimeOut
;
681 int MenuVerifyMsgCount
;
682 ULONG MenuVerifySeconds
;
683 ULONG MenuVerifyMicros
;
684 ULONG DecorUserBufferSize
;
685 IPTR DecorUserBuffer
;
688 Object
*MenuDecorObj
;
689 struct NewDecorator
*Decorator
;
691 struct BitMap
*AllocatedBitmap
;
699 struct SkinInfo SkinInfo
;
700 struct RastPort
*TitlebarBufferRP
;
701 struct Window
*TitlebarBufferWin
;
702 ULONG TitlebarWinWidth
;
703 ULONG TitlebarWinActive
;
705 #if USE_NEWDISPLAYBEEP
706 UBYTE BeepingCounter
;
710 #define GetPrivScreen(s) ((struct IntScreen *)s)
713 #define SF_IsParent (0x0001)
714 #define SF_IsChild (0x0002)
715 #define SF_InvisibleBar (0x0004)
716 #define SF_AppearingBar (0x0008)
717 #define SF_SysFont (0x0010)
718 #define SF_Draggable (0x0020) /* Screen can be dragged */
719 #define SF_ComposeAbove (0x0100) /* Composition capabilities */
720 #define SF_ComposeBelow (0x0200)
721 #define SF_ComposeLeft (0x0400)
722 #define SF_ComposeRight (0x0800)
724 #define SF_VertCompose (SF_ComposeAbove|SF_ComposeBelow)
725 #define SF_HorCompose (SF_ComposeLeft |SF_ComposeRight)
726 #define SF_Compose (SF_ComposeAbove|SF_ComposeBelow|SF_ComposeLeft|SF_ComposeRight)
728 struct IntIntuiMessage
730 struct ExtIntuiMessage eimsg
;
733 ** The following field is needed, because in case of IDCMP_RAWKEY
734 ** IntuiMessage->IAddress is a pointer to this data, not the data
735 ** itself (which is the case for IDCMP_VANILLAKEY)
741 #define INT_INTUIMESSAGE(x) ((struct IntIntuiMessage *)(x))
745 /*extern struct IntuitionBase * IntuitionBase;*/
747 #define IW(window) ((struct IntWindow *) (window))
749 #define GetPubIBase(ib) ((struct IntuitionBase *)ib)
750 #define GetPrivIBase(ib) ((struct IntIntuitionBase *)ib)
752 /* FIXME: Remove these #define xxxBase hacks
753 Do not use this in new code !
758 #define MUIMasterBase (GetPrivIBase(IntuitionBase)->MUIMasterBase)
762 /* struct Utilitybase is used in the following file so include it
763 before defining Utilitybase
765 #include <proto/utility.h>
767 /* stegerg: one can have sysgadgets outside of window border! All sysgadgets in window
768 border must have set GACT_???BORDER and, if they are in a gzz window, also
771 #define IS_GZZ_GADGET(gad) (((gad)->GadgetType) & GTYP_GZZGADGET)
773 #define IS_BORDER_GADGET(gad) (IS_GZZ_GADGET(gad) || \
774 ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER)))
776 #define IS_SYS_GADGET(gad) (((gad)->GadgetType) & GTYP_SYSTYPEMASK)
778 #define IS_BOOPSI_GADGET(gad) (((gad)->GadgetType & GTYP_GTYPEMASK) == GTYP_CUSTOMGADGET)
780 /*#define IS_BORDER_GADGET(gad) \
781 (((gad->GadgetType) & GTYP_SYSGADGET) \
782 || ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER))) */
784 #define IS_REQ_GADGET(gad) ((gad)->GadgetType & GTYP_REQGADGET)
786 #define IS_SCREEN_GADGET(gad) ((gad)->GadgetType & GTYP_SCRGADGET)
788 #define SET_GI_RPORT(gi, w, req, gad) \
789 (gi)->gi_RastPort = (IS_SCREEN_GADGET(gad) ? \
790 ((gi)->gi_Screen->BarLayer ? (gi)->gi_Screen->BarLayer->rp : NULL) : \
791 (IS_BORDER_GADGET(gad) ? (w)->BorderRPort : \
792 ((req) ? ((req)->ReqLayer->rp) : (w)->RPort)) \
796 #define REFRESHGAD_BOOPSI 1 /* boopsi gadgets */
797 #define REFRESHGAD_BORDER 2 /* gadgets in window border */
798 #define REFRESHGAD_REL 4 /* gadgets with GFLG_RELRIGHT, GFLG_RELBOTTOM,GFLG_RELWIDTH, GFLG_RELHEIGHT */
799 #define REFRESHGAD_RELS 8 /* GFLG_RELSPECIAL gadgets */
800 #define REFRESHGAD_TOPBORDER 16 /* used by setwindowtitle */
801 #define REFRESHGAD_NOGADTOOLS 32 /* used in some cases for _mustbe_ */
803 #define SYSGADGET_ACTIVE (iihdata->ActiveSysGadget != NULL)
805 VOID
int_refreshglist(struct Gadget
*gadgets
, struct Window
*window
,
806 struct Requester
*requester
, LONG numGad
, LONG mustbe
, LONG mustnotbe
,
807 struct IntuitionBase
*IntuitionBase
);
809 VOID
int_RefreshWindowFrame(struct Window
*window
, LONG mustbe
, LONG mustnotbe
,
811 struct IntuitionBase
*IntuitionBase
);
813 #define int_refreshwindowframe(a,b,c,d) int_RefreshWindowFrame(a,b,c,0,d);
815 /* Keep the system gadgets in the same order than the original intuition,
816 * some programs make bad asumptions about that...
834 #define SYSGAD(w, idx) (((struct IntWindow *)(w))->sysgads[idx])
838 struct Window window
;
840 Object
*sysgads
[NUM_SYSGADS
];
841 struct Image
*AmigaKey
;
842 struct Image
*Checkmark
;
843 struct Image
*SubMenuImage
;
844 struct Window
*menulendwindow
;
846 struct HashNode hashnode
;
848 /* When the Zoom gadget is pressed the window will have the
849 dimensions stored here. The old dimensions are backed up here
856 /* max. number of mousemove events to send to this window */
859 /* act. number of mousemove events sent to this window */
860 WORD num_mouseevents
;
862 /* max. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
863 messages to send to this window */
866 /* act. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
867 messages sent to this window */
868 WORD num_repeatevents
;
870 #if USE_IDCMPUPDATE_MESSAGECACHE
871 /* number of unreplied IDCMP_IDCMPUPDATE messages sent to window
872 used in few hacks :) */
873 WORD num_idcmpupdate
;
876 WORD sizeimage_width
;
877 WORD sizeimage_height
;
887 ULONG extrabuttonsid
; /* replaces ETI_Dummy if apps wishes it */
889 ULONG titlepos
; /* used by titlebar pattern fill stuff */
896 struct Region
*transpregion
;
897 struct Hook
*usertransphook
;
898 struct Region
*usertranspregion
;
902 struct Region
*trashregion
;
904 char titlebuffer
[TITLEBUFFERLEN
+1];
906 #if USE_IDCMPUPDATE_MESSAGECACHE
907 struct IntuiMessage
*messagecache
; //for idcmpupdate cache
910 struct Layer
*wlayer
;
911 struct Layer
*borderlayer
;
913 struct timeval lastmsgsent
;
914 struct timeval lastmsgreplied
;
916 #ifdef TIMEVALWINDOWACTIVATION
917 struct timeval activationtime
;
921 struct Hook custombackfill
;
924 struct Hook DefaultWindowShapeHook
;
926 struct Region
*OutlineShape
;
927 ULONG DecorUserBufferSize
;
928 IPTR DecorUserBuffer
;
931 #define SPFLAG_ICONIFIED 1
932 #define SPFLAG_NOICONIFY 2
933 #define SPFLAG_SKININFO 4
934 #define SPFLAG_LAYERREFRESH 8
935 #define SPFLAG_TRANSPHOOK 16
936 #define SPFLAG_LAYERRESIZED 32
937 #define SPFLAG_USERPORT 64
938 #define SPFLAG_IAMDEAD 128
939 #define SPFLAG_CLOSING 256 //used with iamdead
940 #define SPFLAG_WANTBUFFER 512
942 #define HELPF_ISHELPGROUP 1
943 #define HELPF_GADGETHELP 2
945 #define IS_NOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? TRUE : FALSE)
946 #define IS_DOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? FALSE : TRUE )
947 #define IS_SIMPLEREFRESH(win) (((win)->Flags & WFLG_SIMPLE_REFRESH) ? TRUE : FALSE)
948 #define IS_GZZWINDOW(win) (((win)->Flags & WFLG_GIMMEZEROZERO) ? TRUE : FALSE)
951 /* Flag definitions for MoreFlags */
953 #define WMFLG_NOTIFYDEPTH (1 << 0) /* Window wants notification when
954 it's depth arranged */
956 #define WMFLG_DO_UNLOCKPUBSCREEN (1 << 1)
957 #define WMFLG_MENUHELP (1 << 2)
958 #define WMFLG_POINTERDELAY (1 << 3)
959 #define WMFLG_TABLETMESSAGES (1 << 4)
961 // FIXME: ehm... this one should die a horrible death!
962 #define WMFLG_IAMMUI (1 << 5)
964 struct IntScreenBuffer
966 struct ScreenBuffer sb
;
971 /* Driver prototypes */
973 extern int intui_init (struct IntuitionBase
*);
974 extern int intui_open (struct IntuitionBase
*);
975 extern void intui_close (struct IntuitionBase
*);
976 extern void intui_expunge (struct IntuitionBase
*);
977 extern int intui_GetWindowSize (void);
978 extern void intui_WindowLimits (struct Window
* window
, WORD MinWidth
, WORD MinHeight
, UWORD MaxWidth
, UWORD MaxHeight
);
979 extern void intui_ActivateWindow (struct Window
*);
980 extern BOOL
intui_ChangeWindowBox (struct Window
* window
, WORD x
, WORD y
,
981 WORD width
, WORD height
);
982 extern void intui_CloseWindow (struct Window
*, struct IntuitionBase
*);
983 extern void intui_MoveWindow (struct Window
* window
, WORD dx
, WORD dy
);
984 extern int intui_OpenWindow (struct Window
*, struct IntuitionBase
*,
985 struct BitMap
* SuperBitMap
, struct Hook
*backfillhook
,
986 struct Region
* shape
, struct Hook
* shapehook
,
987 struct Layer
* parent
, ULONG visible
);
988 extern void intui_SetWindowTitles (struct Window
*, CONST_STRPTR
, CONST_STRPTR
);
989 extern void intui_RefreshWindowFrame(struct Window
*win
);
990 extern struct Window
*intui_FindActiveWindow(struct InputEvent
*ie
, struct IntuitionBase
*IntuitionBase
);
991 extern void intui_ScrollWindowRaster(struct Window
* win
, WORD dx
, WORD dy
, WORD xmin
,
992 WORD ymin
, WORD xmax
, WORD ymax
,
993 struct IntuitionBase
* IntuitionBase
);
995 /* wbtasktalk protos */
997 ULONG
TellWBTaskToCloseWindows(struct IntuitionBase
*IntuitionBase
);
998 ULONG
TellWBTaskToOpenWindows(struct IntuitionBase
*IntuitionBase
);
1000 /* intuition_misc protos */
1001 extern void LoadDefaultPreferences(struct IntuitionBase
* IntuitionBase
);
1002 Object
* CreateStdSysImage(WORD which
, WORD preferred_height
, struct Screen
*scr
, APTR buffer
,
1003 struct DrawInfo
*dri
, struct IntuitionBase
*IntuitionBase
);
1004 extern void CheckRectFill(struct RastPort
*rp
, WORD x1
, WORD y1
, WORD x2
, WORD y2
, struct IntuitionBase
* IntuitionBase
);
1005 extern BOOL
CreateWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1006 extern VOID
KillWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1007 extern void CreateScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
1008 extern void KillScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
1009 extern void RenderScreenBar(struct Screen
*scr
, BOOL refresh
, struct IntuitionBase
*IntuitionBase
);
1010 extern void UpdateMouseCoords(struct Window
*win
);
1011 extern WORD
SubtractRectFromRect(struct Rectangle
*a
, struct Rectangle
*b
, struct Rectangle
*destrectarray
);
1013 AROS_UFP3(BOOL
, DefaultWindowShapeFunc
,
1014 AROS_UFPA(struct Hook
*, hook
, A0
),
1015 AROS_UFPA(struct Layer
*, lay
, A2
),
1016 AROS_UFPA(struct ShapeHookMsg
*, msg
, A1
));
1018 extern LONG
CalcResourceHash(APTR resource
);
1019 extern void AddResourceToList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1020 extern void RemoveResourceFromList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1021 extern BOOL
ResourceExisting(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1022 void FireScreenNotifyMessage(IPTR data
, ULONG flag
, struct IntuitionBase
*IntuitionBase
);
1023 void FireScreenNotifyMessageCode(IPTR data
, ULONG flag
, ULONG code
, struct IntuitionBase
*IntuitionBase
);
1026 extern void MySetPointerPos(struct IntuitionBase
*IntuitionBase
);
1027 extern BOOL
ResetPointer(struct IntuitionBase
*IntuitionBase
);
1028 extern void ActivateMonitor(Object
*newmonitor
, WORD x
, WORD y
, struct IntuitionBase
*IntuitionBase
);
1029 extern struct Screen
*FindFirstScreen(Object
*monitor
, struct IntuitionBase
*IntuitionBase
);
1030 extern struct RastPort
*MyCreateRastPort(struct IntuitionBase
*IntuitionBase
);
1031 extern struct RastPort
*MyCloneRastPort(struct IntuitionBase
*IntuitionBase
, struct RastPort
*rp
);
1032 extern void MyFreeRastPort(struct IntuitionBase
*IntuitionBase
, struct RastPort
*rp
);
1033 struct TextFont
*SafeReopenFont(struct IntuitionBase
*, struct TextFont
**);
1034 extern Object
*MakePointerFromPrefs(struct IntuitionBase
*, struct Preferences
*);
1035 extern Object
*MakePointerFromData(struct IntuitionBase
*, UWORD
*, int, int, int, int);
1036 void InstallPointer(struct IntuitionBase
*, UWORD
, Object
**, Object
*);
1037 void SetPointerColors(struct IntuitionBase
*IntuitionBase
);
1038 struct IClass
*InitITextIClass (struct IntuitionBase
* IntuitionBase
);
1039 struct Gadget
*DoActivateGadget(struct Window
*win
, struct Requester
*req
, struct Gadget
*gad
,
1040 struct IntuitionBase
*IntuitionBase
);
1041 VOID
DoGMLayout(struct Gadget
*glist
, struct Window
*win
, struct Requester
*req
,
1042 UWORD numgad
, BOOL initial
, struct IntuitionBase
*IntuitionBase
);
1043 BOOL
ih_fire_intuimessage(struct Window
* w
, ULONG Class
, UWORD Code
, APTR IAddress
,
1044 struct IntuitionBase
*IntuitionBase
);
1045 void NotifyDepthArrangement(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1049 void int_PrintIText(struct RastPort
* rp
, struct IntuiText
* iText
,
1050 LONG leftOffset
, LONG topOffset
, BOOL ignore_attributes
,
1051 struct IntuitionBase
*IntuitionBase
);
1053 /* Private extra functions */
1054 OOP_Object
*FindMonitor(ULONG modeid
, struct IntuitionBase
*IntuitionBase
);
1057 BOOL
IsLayerHiddenBySibling(struct Layer
*layer
, BOOL xx
);
1058 LONG
IsLayerVisible(struct Layer
*layer
);
1061 void SetupGInfo(struct GadgetInfo
*gi
, struct Window
*win
, struct Requester
*req
,
1062 struct Gadget
*gad
, struct IntuitionBase
*IntuitionBase
);
1064 IPTR
Custom_DoMethodA(struct IntuitionBase
*, struct Gadget
*, Msg
);
1070 #define DoMethodA(x, ...) (REG_A6=(LONG)IntuitionBase, DoMethodA(x, __VA_ARGS__))
1073 #define HAS_CHILDREN(w) (NULL != w->firstchild)
1076 #define DeinitRastPort(rp) ((void)0)
1078 #define CreateRastPort() MyCreateRastPort(IntuitionBase)
1079 #define CloneRastPort(rp) MyCloneRastPort(IntuitionBase, rp)
1080 #define FreeRastPort(rp) MyFreeRastPort(IntuitionBase, rp)
1082 /* Replacement for dos.library/DisplayError() */
1083 AROS_UFP3(LONG
, Intuition_DisplayError
,
1084 AROS_UFPA(STRPTR
, formatStr
, A0
),
1085 AROS_UFPA(ULONG
, IDCMPFlags
, D0
),
1086 AROS_UFPA(APTR
, args
, A1
));
1088 #define POINTERA_SharedPointer 0x80039010
1091 #define dprintf kprintf
1094 #define DEBUG_ACTIVATEGADGET(x) ;
1095 #define DEBUG_ACTIVATEWINDOW(x) ;
1096 #define DEBUG_ADDCLASS(x) ;
1097 #define DEBUG_ADDGADGET(x) ;
1098 #define DEBUG_ADDGLIST(x) ;
1099 #define DEBUG_ALLOCINTUIMESSAGE(x) ;
1100 #define DEBUG_ALLOCSCREENBUFFER(x) ;
1101 #define DEBUG_ALOHAWORKBENCH(x) ;
1102 #define DEBUG_CHANGEWINDOWBOX(x) ;
1103 #define DEBUG_CLOSESCREEN(x) ;
1104 #define DEBUG_CLOSEWINDOW(x) ;
1105 #define DEBUG_CLOSEWORKBENCH(x) ;
1106 #define DEBUG_DISPOSEOBJECT(x) ;
1107 #define DEBUG_DOGADGETMETHOD(x) ;
1108 #define DEBUG_DRAWBORDER(x) ;
1109 #define DEBUG_FINDCLASS(x) ;
1110 #define DEBUG_FREEICDATA(x) ;
1111 #define DEBUG_FREEINTUIMESSAGE(x) ;
1112 #define DEBUG_FREESCREENBUFFER(x) ;
1113 #define DEBUG_FREESCREENDRAWINFO(x) ;
1114 #define DEBUG_GADGETMOUSE(x) ;
1115 #define DEBUG_GETATTR(x) ;
1116 #define DEBUG_GETDEFAULTPUBSCREEN(x) ;
1117 #define DEBUG_GETDEFPREFS(x) ;
1118 #define DEBUG_GETGADGETIBOX(x) ;
1119 #define DEBUG_GETPREFS(x) ;
1120 #define DEBUG_GETSCREENDATA(x) ;
1121 #define DEBUG_GETSCREENDRAWINFO(x) ;
1122 #define DEBUG_HIDEWINDOW(x) ;
1123 #define DEBUG_OPEN(x) ;
1124 #define DEBUG_CLOSE(x) ;
1125 #define DEBUG_INPUTEVENT(x) ;
1126 #define DEBUG_INTREFRESHGLIST(x) ;
1127 #define DEBUG_INTUITEXTLENGTH(x) ;
1128 #define DEBUG_LENDMENUS(x) ;
1129 #define DEBUG_LOCKPUBSCREEN(x) ;
1130 #define DEBUG_MAKECLASS(x) ;
1131 #define DEBUG_MODIFYIDCMP(x) ;
1132 #define DEBUG_NEWOBJECT(x) ;
1133 #define DEBUG_NEXTOBJECT(x) ;
1134 #define DEBUG_OBTAINGIRPORT(x) ;
1135 #define DEBUG_OFFGADGET(x) ;
1136 #define DEBUG_OFFMENU(x) ;
1137 #define DEBUG_ONGADGET(x) ;
1138 #define DEBUG_ONMENU(x) ;
1139 #define DEBUG_OPENSCREEN(x) ;
1140 #define DEBUG_OPENSCREENTAGLIST(x) ;
1141 #define DEBUG_OPENWINDOW(x) ;
1142 #define DEBUG_OPENWINDOWTAGLIST(x) ;
1143 #define DEBUG_OPENWORKBENCH(x) ;
1144 #define DEBUG_POINTER(x) ;
1145 #define DEBUG_PRINTITEXT(x) ;
1146 #define DEBUG_QUERYOVERSCAN(x) ;
1147 #define DEBUG_REFRESH(x) ;
1148 #define DEBUG_RELEASEGIRPORT(x) ;
1149 #define DEBUG_REMEMBER(x) ;
1150 #define DEBUG_REMOVEGLIST(x) ;
1151 #define DEBUG_REPORTMOUSE(x) ;
1152 #define DEBUG_REQUEST(x) ;
1153 #define DEBUG_SCROLLWINDOWRASTER(x) ;
1154 #define DEBUG_SENDINTUIMESSAGE(x) ;
1155 #define DEBUG_SETATTRS(x) ;
1156 #define DEBUG_SETGADGETATTRS(x) ;
1157 #define DEBUG_SETPOINTER(x) ;
1158 #define DEBUG_SHOWWINDOW(x) ;
1159 #define DEBUG_UNLOCKPUBSCREEN(x) ;
1160 #define DEBUG_WINDOWLIMITS(x) ;
1161 #define DEBUG_WINDOWTOBACK(x) ;
1162 #define DEBUG_WINDOWTOFRONT(x) ;
1163 #define DEBUG_ZIPWINDOW(x) ;
1164 #define DEBUG_VISITOR(x) ;
1165 #define DEBUG_WORKBENCH(x) ;
1166 #define DEBUG_LOCKPUBSCREENLIST(x) ;
1167 #define DEBUG_UNLOCKPUBSCREENLIST(x) ;
1168 #define DEBUG_RETHINKDISPLAY(x) ;
1170 #ifdef NO_RUNTIME_DEBUG
1172 #define DEBUG_INIT(x) ;
1173 #define DEBUG_SETIPREFS(x) ;
1174 #define DEBUG_SETPREFS(x) ;
1178 #define DEBUG_INIT(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1179 #define DEBUG_SETIPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1180 #define DEBUG_SETPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1185 * Private data structures of the classes defined by intuition.library
1192 struct TagItem
*ic_Mapping
;
1193 struct TagItem
*ic_CloneTags
;
1194 ULONG ic_LoopCounter
;
1200 struct MinList memberlist
;
1206 /* render bevel only with no fill? */
1209 /* inverted bevel pens? */
1222 struct DrawInfo
*dri
;
1223 struct Image
*frame
;
1239 struct ExtGadget EG
;
1246 /* We use a propinfo structure, because we use the same routines
1247 for intuition propgadtets and in propgclass */
1249 struct PropInfo propinfo
;
1251 /* A little kludge: since the HandleMouseMove function
1252 wants dx/dy and not absolute mouse coords, we
1253 have to remember the last ones */
1258 /* One only have to store total or visble, and use some other
1259 formulas than those in the RKRM:L, but for
1260 code simplicity I store them all. */
1261 UWORD top
, visible
, total
;
1264 struct BBox
*old_knobbox
;
1265 struct Hook
*DisplayHook
;
1271 struct StringInfo StrInfo
;
1272 struct StringExtend StrExtend
;
1279 struct MinList memberlist
;
1280 struct Gadget
*activegad
;
1286 /* Current left- and topedge of moving window. Ie when the user releases
1287 the LMB after a windowdrag, the window's new coords will be (curleft, curtop)
1293 /* The current x and y coordinates relative to curleft/curtop */
1297 /* Whether the dragframe is currently drawn or erased */
1300 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1303 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1304 BOOL drag_layerlock
;
1305 #ifdef USEGADGETLOCK
1306 BOOL drag_gadgetlock
;
1307 BOOL drag_inputhandlerlock
;
1309 BOOL drag_refreshed
;
1311 /* Rastport to use during update */
1312 struct RastPort
*rp
;
1314 UQUAD lasteventtime
;
1319 #ifdef USEWINDOWLOCK
1320 /* used to prevent windows from opening/closing while user drags a window */
1321 BOOL drag_windowlock
;
1324 struct Task
*movetask
;
1328 /* SizeButtonClass */
1329 struct sizebutton_data
1332 /* The current width and height of the rubber band frame */
1338 /* holds original sizes */
1344 /* the offset of the mouse pointer to the rubber band frame*/
1348 /* Whether the dragframe is currently drawn or erased */
1351 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1354 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1355 BOOL drag_layerlock
;
1356 #ifdef USEGADGETLOCK
1357 BOOL drag_gadgetlock
;
1358 BOOL drag_inputhandlerlock
;
1361 BOOL drag_refreshed
;
1363 /* Rastport to use during update */
1364 struct RastPort
*rp
;
1366 UQUAD lasteventtime
;
1368 #ifdef USEWINDOWLOCK
1369 /* used to prevent windows from opening/closing while user drags a window */
1370 BOOL drag_windowlock
;
1381 /* MenuBarLabelClass */
1382 struct MenuBarLabelData
1384 struct DrawInfo
*dri
;
1390 struct SharedPointer
*shared_pointer
;
1394 struct windecor_data
1396 ULONG userbuffersize
;
1400 struct scrdecor_data
1402 ULONG userbuffersize
;
1405 /* MenuDecorClass */
1406 struct menudecor_data
1408 ULONG userbuffersize
;
1411 #endif /* INTUITION_INTERN_H */