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 ScrDecorSem
;
573 struct IClass
*ScrDecorClass
;
574 struct TagItem
*ScrDecorTags
;
575 struct SignalSemaphore MenuDecorSem
;
576 struct IClass
*MenuDecorClass
;
577 struct TagItem
*MenuDecorTags
;
578 struct SignalSemaphore WinDecorSem
;
579 struct IClass
*WinDecorClass
;
580 struct TagItem
*WinDecorTags
;
582 struct List Decorations
;
583 struct NewDecorator
*Decorator
;
589 #if USE_NEWDISPLAYBEEP
593 WORD prop_clickoffset_x
, prop_clickoffset_y
;
595 struct MinList ResourceList
[RESOURCELIST_HASHSIZE
];
597 /* Menu Look Settings */
600 Object
*ActiveMonitor
;
603 OOP_AttrBase HiddAttrBase
;
604 OOP_AttrBase HiddGfxAttrBase
;
605 OOP_AttrBase HiddPixFmtAttrBase
;
607 OOP_MethodID ib_HiddGfxBase
;
608 OOP_MethodID ib_HiddBitMapBase
;
610 struct IClass
*monitorclass
;
611 struct MinList MonitorList
;
612 struct SignalSemaphore MonitorListSem
;
617 struct ExtSprite
*sprite
;
618 WORD xoffset
, yoffset
;
622 struct SharedPointer
*CreateSharedPointer(struct ExtSprite
*, int, int, struct IntuitionBase
*);
623 void ObtainSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
624 void ReleaseSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
626 #ifdef INTUITION_NOTIFY_SUPPORT
627 void sn_DoNotify(ULONG type
, APTR value
, struct Library
*_ScreenNotifyBase
);
633 struct Screen
*dri_Screen
;
634 struct SignalSemaphore dri_WinDecorSem
;
635 Object
*dri_WinDecorObj
;
636 struct SignalSemaphore dri_ScrDecorSem
;
637 Object
*dri_ScrDecorObj
;
640 #define DRI_VERSION_AROS (DRI_VERSION + 1)
642 #define LOCK_WINDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
643 #define LOCKSHARED_WINDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
644 #define UNLOCK_WINDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
646 #define LOCK_SCRDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
647 #define LOCKSHARED_SCRDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
648 #define UNLOCK_SCRDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
650 #define LOCK_MENUDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
651 #define LOCKSHARED_MENUDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
652 #define UNLOCK_MENUDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
656 struct Screen Screen
;
659 struct HashNode hashnode
;
660 struct IntDrawInfo DInfo
;
661 struct TTextAttr textattr
;
662 ULONG textattrtags
[3];
663 UWORD Pens
[NUMDRIPENS
];
664 struct PubScreenNode
*pubScrNode
;
667 struct Layer
*rootLayer
;
668 #if !USE_NEWDISPLAYBEEP
669 ULONG DisplayBeepColor0
[3];
670 struct Window
*DisplayBeepWindow
;
674 struct MonitorSpec
*Monitor
;
676 Object
*MonitorObject
;
677 struct SharedPointer
*Pointer
;
678 struct Window
*MenuVerifyActiveWindow
;
679 int MenuVerifyTimeOut
;
680 int MenuVerifyMsgCount
;
681 ULONG MenuVerifySeconds
;
682 ULONG MenuVerifyMicros
;
683 ULONG DecorUserBufferSize
;
684 IPTR DecorUserBuffer
;
686 Object
*MenuDecorObj
;
688 struct NewDecorator
*Decorator
;
690 struct BitMap
*AllocatedBitmap
;
698 struct SkinInfo SkinInfo
;
699 struct RastPort
*TitlebarBufferRP
;
700 struct Window
*TitlebarBufferWin
;
701 ULONG TitlebarWinWidth
;
702 ULONG TitlebarWinActive
;
704 #if USE_NEWDISPLAYBEEP
705 UBYTE BeepingCounter
;
709 #define GetPrivScreen(s) ((struct IntScreen *)s)
712 #define SF_IsParent (0x0001)
713 #define SF_IsChild (0x0002)
714 #define SF_InvisibleBar (0x0004)
715 #define SF_AppearingBar (0x0008)
716 #define SF_SysFont (0x0010)
717 #define SF_Draggable (0x0020) /* Screen can be dragged */
718 #define SF_ComposeAbove (0x0100) /* Composition capabilities */
719 #define SF_ComposeBelow (0x0200)
720 #define SF_ComposeLeft (0x0400)
721 #define SF_ComposeRight (0x0800)
723 #define SF_VertCompose (SF_ComposeAbove|SF_ComposeBelow)
724 #define SF_HorCompose (SF_ComposeLeft |SF_ComposeRight)
725 #define SF_Compose (SF_ComposeAbove|SF_ComposeBelow|SF_ComposeLeft|SF_ComposeRight)
727 struct IntIntuiMessage
729 struct ExtIntuiMessage eimsg
;
732 ** The following field is needed, because in case of IDCMP_RAWKEY
733 ** IntuiMessage->IAddress is a pointer to this data, not the data
734 ** itself (which is the case for IDCMP_VANILLAKEY)
740 #define INT_INTUIMESSAGE(x) ((struct IntIntuiMessage *)(x))
744 /*extern struct IntuitionBase * IntuitionBase;*/
746 #define IW(window) ((struct IntWindow *) (window))
748 #define GetPubIBase(ib) ((struct IntuitionBase *)ib)
749 #define GetPrivIBase(ib) ((struct IntIntuitionBase *)ib)
751 /* FIXME: Remove these #define xxxBase hacks
752 Do not use this in new code !
757 #define MUIMasterBase (GetPrivIBase(IntuitionBase)->MUIMasterBase)
761 /* struct Utilitybase is used in the following file so include it
762 before defining Utilitybase
764 #include <proto/utility.h>
766 /* stegerg: one can have sysgadgets outside of window border! All sysgadgets in window
767 border must have set GACT_???BORDER and, if they are in a gzz window, also
770 #define IS_GZZ_GADGET(gad) (((gad)->GadgetType) & GTYP_GZZGADGET)
772 #define IS_BORDER_GADGET(gad) (IS_GZZ_GADGET(gad) || \
773 ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER)))
775 #define IS_SYS_GADGET(gad) (((gad)->GadgetType) & GTYP_SYSTYPEMASK)
777 #define IS_BOOPSI_GADGET(gad) (((gad)->GadgetType & GTYP_GTYPEMASK) == GTYP_CUSTOMGADGET)
779 /*#define IS_BORDER_GADGET(gad) \
780 (((gad->GadgetType) & GTYP_SYSGADGET) \
781 || ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER))) */
783 #define IS_REQ_GADGET(gad) ((gad)->GadgetType & GTYP_REQGADGET)
785 #define IS_SCREEN_GADGET(gad) ((gad)->GadgetType & GTYP_SCRGADGET)
787 #define SET_GI_RPORT(gi, w, req, gad) \
788 (gi)->gi_RastPort = (IS_SCREEN_GADGET(gad) ? \
789 ((gi)->gi_Screen->BarLayer ? (gi)->gi_Screen->BarLayer->rp : NULL) : \
790 (IS_BORDER_GADGET(gad) ? (w)->BorderRPort : \
791 ((req) ? ((req)->ReqLayer->rp) : (w)->RPort)) \
795 #define REFRESHGAD_BOOPSI 1 /* boopsi gadgets */
796 #define REFRESHGAD_BORDER 2 /* gadgets in window border */
797 #define REFRESHGAD_REL 4 /* gadgets with GFLG_RELRIGHT, GFLG_RELBOTTOM,GFLG_RELWIDTH, GFLG_RELHEIGHT */
798 #define REFRESHGAD_RELS 8 /* GFLG_RELSPECIAL gadgets */
799 #define REFRESHGAD_TOPBORDER 16 /* used by setwindowtitle */
800 #define REFRESHGAD_NOGADTOOLS 32 /* used in some cases for _mustbe_ */
802 #define SYSGADGET_ACTIVE (iihdata->ActiveSysGadget != NULL)
804 VOID
int_refreshglist(struct Gadget
*gadgets
, struct Window
*window
,
805 struct Requester
*requester
, LONG numGad
, LONG mustbe
, LONG mustnotbe
,
806 struct IntuitionBase
*IntuitionBase
);
808 VOID
int_RefreshWindowFrame(struct Window
*window
, LONG mustbe
, LONG mustnotbe
,
810 struct IntuitionBase
*IntuitionBase
);
812 #define int_refreshwindowframe(a,b,c,d) int_RefreshWindowFrame(a,b,c,0,d);
814 /* Keep the system gadgets in the same order than the original intuition,
815 * some programs make bad asumptions about that...
833 #define SYSGAD(w, idx) (((struct IntWindow *)(w))->sysgads[idx])
837 struct Window window
;
839 Object
*sysgads
[NUM_SYSGADS
];
840 struct Image
*AmigaKey
;
841 struct Image
*Checkmark
;
842 struct Image
*SubMenuImage
;
843 struct Window
*menulendwindow
;
845 struct HashNode hashnode
;
847 /* When the Zoom gadget is pressed the window will have the
848 dimensions stored here. The old dimensions are backed up here
855 /* max. number of mousemove events to send to this window */
858 /* act. number of mousemove events sent to this window */
859 WORD num_mouseevents
;
861 /* max. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
862 messages to send to this window */
865 /* act. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
866 messages sent to this window */
867 WORD num_repeatevents
;
869 #if USE_IDCMPUPDATE_MESSAGECACHE
870 /* number of unreplied IDCMP_IDCMPUPDATE messages sent to window
871 used in few hacks :) */
872 WORD num_idcmpupdate
;
875 WORD sizeimage_width
;
876 WORD sizeimage_height
;
886 ULONG extrabuttonsid
; /* replaces ETI_Dummy if apps wishes it */
888 ULONG titlepos
; /* used by titlebar pattern fill stuff */
895 struct Region
*transpregion
;
896 struct Hook
*usertransphook
;
897 struct Region
*usertranspregion
;
901 struct Region
*trashregion
;
903 char titlebuffer
[TITLEBUFFERLEN
+1];
905 #if USE_IDCMPUPDATE_MESSAGECACHE
906 struct IntuiMessage
*messagecache
; //for idcmpupdate cache
909 struct Layer
*wlayer
;
910 struct Layer
*borderlayer
;
912 struct timeval lastmsgsent
;
913 struct timeval lastmsgreplied
;
915 #ifdef TIMEVALWINDOWACTIVATION
916 struct timeval activationtime
;
920 struct Hook custombackfill
;
923 struct Hook DefaultWindowShapeHook
;
925 struct Region
*OutlineShape
;
926 ULONG DecorUserBufferSize
;
927 IPTR DecorUserBuffer
;
930 #define SPFLAG_ICONIFIED 1
931 #define SPFLAG_NOICONIFY 2
932 #define SPFLAG_SKININFO 4
933 #define SPFLAG_LAYERREFRESH 8
934 #define SPFLAG_TRANSPHOOK 16
935 #define SPFLAG_LAYERRESIZED 32
936 #define SPFLAG_USERPORT 64
937 #define SPFLAG_IAMDEAD 128
938 #define SPFLAG_CLOSING 256 //used with iamdead
939 #define SPFLAG_WANTBUFFER 512
941 #define HELPF_ISHELPGROUP 1
942 #define HELPF_GADGETHELP 2
944 #define IS_NOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? TRUE : FALSE)
945 #define IS_DOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? FALSE : TRUE )
946 #define IS_SIMPLEREFRESH(win) (((win)->Flags & WFLG_SIMPLE_REFRESH) ? TRUE : FALSE)
947 #define IS_GZZWINDOW(win) (((win)->Flags & WFLG_GIMMEZEROZERO) ? TRUE : FALSE)
950 /* Flag definitions for MoreFlags */
952 #define WMFLG_NOTIFYDEPTH (1 << 0) /* Window wants notification when
953 it's depth arranged */
955 #define WMFLG_DO_UNLOCKPUBSCREEN (1 << 1)
956 #define WMFLG_MENUHELP (1 << 2)
957 #define WMFLG_POINTERDELAY (1 << 3)
958 #define WMFLG_TABLETMESSAGES (1 << 4)
960 // FIXME: ehm... this one should die a horrible death!
961 #define WMFLG_IAMMUI (1 << 5)
963 struct IntScreenBuffer
965 struct ScreenBuffer sb
;
970 /* Driver prototypes */
972 extern int intui_init (struct IntuitionBase
*);
973 extern int intui_open (struct IntuitionBase
*);
974 extern void intui_close (struct IntuitionBase
*);
975 extern void intui_expunge (struct IntuitionBase
*);
976 extern int intui_GetWindowSize (void);
977 extern void intui_WindowLimits (struct Window
* window
, WORD MinWidth
, WORD MinHeight
, UWORD MaxWidth
, UWORD MaxHeight
);
978 extern void intui_ActivateWindow (struct Window
*);
979 extern BOOL
intui_ChangeWindowBox (struct Window
* window
, WORD x
, WORD y
,
980 WORD width
, WORD height
);
981 extern void intui_CloseWindow (struct Window
*, struct IntuitionBase
*);
982 extern void intui_MoveWindow (struct Window
* window
, WORD dx
, WORD dy
);
983 extern int intui_OpenWindow (struct Window
*, struct IntuitionBase
*,
984 struct BitMap
* SuperBitMap
, struct Hook
*backfillhook
,
985 struct Region
* shape
, struct Hook
* shapehook
,
986 struct Layer
* parent
, ULONG visible
);
987 extern void intui_SetWindowTitles (struct Window
*, CONST_STRPTR
, CONST_STRPTR
);
988 extern void intui_RefreshWindowFrame(struct Window
*win
);
989 extern struct Window
*intui_FindActiveWindow(struct InputEvent
*ie
, struct IntuitionBase
*IntuitionBase
);
990 extern void intui_ScrollWindowRaster(struct Window
* win
, WORD dx
, WORD dy
, WORD xmin
,
991 WORD ymin
, WORD xmax
, WORD ymax
,
992 struct IntuitionBase
* IntuitionBase
);
994 /* wbtasktalk protos */
996 ULONG
TellWBTaskToCloseWindows(struct IntuitionBase
*IntuitionBase
);
997 ULONG
TellWBTaskToOpenWindows(struct IntuitionBase
*IntuitionBase
);
999 /* intuition_misc protos */
1000 extern void LoadDefaultPreferences(struct IntuitionBase
* IntuitionBase
);
1001 Object
* CreateStdSysImage(WORD which
, WORD preferred_height
, struct Screen
*scr
, APTR buffer
,
1002 struct DrawInfo
*dri
, struct IntuitionBase
*IntuitionBase
);
1003 extern void CheckRectFill(struct RastPort
*rp
, WORD x1
, WORD y1
, WORD x2
, WORD y2
, struct IntuitionBase
* IntuitionBase
);
1004 extern BOOL
CreateWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1005 extern VOID
KillWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1006 extern void CreateScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
1007 extern void KillScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
1008 extern void RenderScreenBar(struct Screen
*scr
, BOOL refresh
, struct IntuitionBase
*IntuitionBase
);
1009 extern void UpdateMouseCoords(struct Window
*win
);
1010 extern WORD
SubtractRectFromRect(struct Rectangle
*a
, struct Rectangle
*b
, struct Rectangle
*destrectarray
);
1012 AROS_UFP3(BOOL
, DefaultWindowShapeFunc
,
1013 AROS_UFPA(struct Hook
*, hook
, A0
),
1014 AROS_UFPA(struct Layer
*, lay
, A2
),
1015 AROS_UFPA(struct ShapeHookMsg
*, msg
, A1
));
1017 extern LONG
CalcResourceHash(APTR resource
);
1018 extern void AddResourceToList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1019 extern void RemoveResourceFromList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1020 extern BOOL
ResourceExisting(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
1021 void FireScreenNotifyMessage(IPTR data
, ULONG flag
, struct IntuitionBase
*IntuitionBase
);
1022 void FireScreenNotifyMessageCode(IPTR data
, ULONG flag
, ULONG code
, struct IntuitionBase
*IntuitionBase
);
1025 extern void MySetPointerPos(struct IntuitionBase
*IntuitionBase
);
1026 extern BOOL
ResetPointer(struct IntuitionBase
*IntuitionBase
);
1027 extern void ActivateMonitor(Object
*newmonitor
, WORD x
, WORD y
, struct IntuitionBase
*IntuitionBase
);
1028 extern struct Screen
*FindFirstScreen(Object
*monitor
, struct IntuitionBase
*IntuitionBase
);
1029 extern struct RastPort
*MyCreateRastPort(struct IntuitionBase
*IntuitionBase
);
1030 extern struct RastPort
*MyCloneRastPort(struct IntuitionBase
*IntuitionBase
, struct RastPort
*rp
);
1031 extern void MyFreeRastPort(struct IntuitionBase
*IntuitionBase
, struct RastPort
*rp
);
1032 struct TextFont
*SafeReopenFont(struct IntuitionBase
*, struct TextFont
**);
1033 extern Object
*MakePointerFromPrefs(struct IntuitionBase
*, struct Preferences
*);
1034 extern Object
*MakePointerFromData(struct IntuitionBase
*, UWORD
*, int, int, int, int);
1035 void InstallPointer(struct IntuitionBase
*, UWORD
, Object
**, Object
*);
1036 void SetPointerColors(struct IntuitionBase
*IntuitionBase
);
1037 struct IClass
*InitITextIClass (struct IntuitionBase
* IntuitionBase
);
1038 struct Gadget
*DoActivateGadget(struct Window
*win
, struct Requester
*req
, struct Gadget
*gad
,
1039 struct IntuitionBase
*IntuitionBase
);
1040 VOID
DoGMLayout(struct Gadget
*glist
, struct Window
*win
, struct Requester
*req
,
1041 UWORD numgad
, BOOL initial
, struct IntuitionBase
*IntuitionBase
);
1042 BOOL
ih_fire_intuimessage(struct Window
* w
, ULONG Class
, UWORD Code
, APTR IAddress
,
1043 struct IntuitionBase
*IntuitionBase
);
1044 void NotifyDepthArrangement(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1048 void int_PrintIText(struct RastPort
* rp
, struct IntuiText
* iText
,
1049 LONG leftOffset
, LONG topOffset
, BOOL ignore_attributes
,
1050 struct IntuitionBase
*IntuitionBase
);
1052 /* Private extra functions */
1053 OOP_Object
*FindMonitor(ULONG modeid
, struct IntuitionBase
*IntuitionBase
);
1056 BOOL
IsLayerHiddenBySibling(struct Layer
*layer
, BOOL xx
);
1057 LONG
IsLayerVisible(struct Layer
*layer
);
1060 void SetupGInfo(struct GadgetInfo
*gi
, struct Window
*win
, struct Requester
*req
,
1061 struct Gadget
*gad
, struct IntuitionBase
*IntuitionBase
);
1063 IPTR
Custom_DoMethodA(struct IntuitionBase
*, struct Gadget
*, Msg
);
1069 #define DoMethodA(x, ...) (REG_A6=(LONG)IntuitionBase, DoMethodA(x, __VA_ARGS__))
1072 #define HAS_CHILDREN(w) (NULL != w->firstchild)
1075 #define DeinitRastPort(rp) ((void)0)
1077 #define CreateRastPort() MyCreateRastPort(IntuitionBase)
1078 #define CloneRastPort(rp) MyCloneRastPort(IntuitionBase, rp)
1079 #define FreeRastPort(rp) MyFreeRastPort(IntuitionBase, rp)
1081 /* Replacement for dos.library/DisplayError() */
1082 AROS_UFP3(LONG
, Intuition_DisplayError
,
1083 AROS_UFPA(STRPTR
, formatStr
, A0
),
1084 AROS_UFPA(ULONG
, IDCMPFlags
, D0
),
1085 AROS_UFPA(APTR
, args
, A1
));
1087 #define POINTERA_SharedPointer 0x80039010
1090 #define dprintf kprintf
1093 #define DEBUG_ACTIVATEGADGET(x) ;
1094 #define DEBUG_ACTIVATEWINDOW(x) ;
1095 #define DEBUG_ADDCLASS(x) ;
1096 #define DEBUG_ADDGADGET(x) ;
1097 #define DEBUG_ADDGLIST(x) ;
1098 #define DEBUG_ALLOCINTUIMESSAGE(x) ;
1099 #define DEBUG_ALLOCSCREENBUFFER(x) ;
1100 #define DEBUG_ALOHAWORKBENCH(x) ;
1101 #define DEBUG_CHANGEWINDOWBOX(x) ;
1102 #define DEBUG_CLOSESCREEN(x) ;
1103 #define DEBUG_CLOSEWINDOW(x) ;
1104 #define DEBUG_CLOSEWORKBENCH(x) ;
1105 #define DEBUG_DISPOSEOBJECT(x) ;
1106 #define DEBUG_DOGADGETMETHOD(x) ;
1107 #define DEBUG_DRAWBORDER(x) ;
1108 #define DEBUG_FINDCLASS(x) ;
1109 #define DEBUG_FREEICDATA(x) ;
1110 #define DEBUG_FREEINTUIMESSAGE(x) ;
1111 #define DEBUG_FREESCREENBUFFER(x) ;
1112 #define DEBUG_FREESCREENDRAWINFO(x) ;
1113 #define DEBUG_GADGETMOUSE(x) ;
1114 #define DEBUG_GETATTR(x) ;
1115 #define DEBUG_GETDEFAULTPUBSCREEN(x) ;
1116 #define DEBUG_GETDEFPREFS(x) ;
1117 #define DEBUG_GETGADGETIBOX(x) ;
1118 #define DEBUG_GETPREFS(x) ;
1119 #define DEBUG_GETSCREENDATA(x) ;
1120 #define DEBUG_GETSCREENDRAWINFO(x) ;
1121 #define DEBUG_HIDEWINDOW(x) ;
1122 #define DEBUG_OPEN(x) ;
1123 #define DEBUG_CLOSE(x) ;
1124 #define DEBUG_INPUTEVENT(x) ;
1125 #define DEBUG_INTREFRESHGLIST(x) ;
1126 #define DEBUG_INTUITEXTLENGTH(x) ;
1127 #define DEBUG_LENDMENUS(x) ;
1128 #define DEBUG_LOCKPUBSCREEN(x) ;
1129 #define DEBUG_MAKECLASS(x) ;
1130 #define DEBUG_MODIFYIDCMP(x) ;
1131 #define DEBUG_NEWOBJECT(x) ;
1132 #define DEBUG_NEXTOBJECT(x) ;
1133 #define DEBUG_OBTAINGIRPORT(x) ;
1134 #define DEBUG_OFFGADGET(x) ;
1135 #define DEBUG_OFFMENU(x) ;
1136 #define DEBUG_ONGADGET(x) ;
1137 #define DEBUG_ONMENU(x) ;
1138 #define DEBUG_OPENSCREEN(x) ;
1139 #define DEBUG_OPENSCREENTAGLIST(x) ;
1140 #define DEBUG_OPENWINDOW(x) ;
1141 #define DEBUG_OPENWINDOWTAGLIST(x) ;
1142 #define DEBUG_OPENWORKBENCH(x) ;
1143 #define DEBUG_POINTER(x) ;
1144 #define DEBUG_PRINTITEXT(x) ;
1145 #define DEBUG_QUERYOVERSCAN(x) ;
1146 #define DEBUG_REFRESH(x) ;
1147 #define DEBUG_RELEASEGIRPORT(x) ;
1148 #define DEBUG_REMEMBER(x) ;
1149 #define DEBUG_REMOVEGLIST(x) ;
1150 #define DEBUG_REPORTMOUSE(x) ;
1151 #define DEBUG_REQUEST(x) ;
1152 #define DEBUG_SCROLLWINDOWRASTER(x) ;
1153 #define DEBUG_SENDINTUIMESSAGE(x) ;
1154 #define DEBUG_SETATTRS(x) ;
1155 #define DEBUG_SETGADGETATTRS(x) ;
1156 #define DEBUG_SETPOINTER(x) ;
1157 #define DEBUG_SHOWWINDOW(x) ;
1158 #define DEBUG_UNLOCKPUBSCREEN(x) ;
1159 #define DEBUG_WINDOWLIMITS(x) ;
1160 #define DEBUG_WINDOWTOBACK(x) ;
1161 #define DEBUG_WINDOWTOFRONT(x) ;
1162 #define DEBUG_ZIPWINDOW(x) ;
1163 #define DEBUG_VISITOR(x) ;
1164 #define DEBUG_WORKBENCH(x) ;
1165 #define DEBUG_LOCKPUBSCREENLIST(x) ;
1166 #define DEBUG_UNLOCKPUBSCREENLIST(x) ;
1167 #define DEBUG_RETHINKDISPLAY(x) ;
1169 #ifdef NO_RUNTIME_DEBUG
1171 #define DEBUG_INIT(x) ;
1172 #define DEBUG_SETIPREFS(x) ;
1173 #define DEBUG_SETPREFS(x) ;
1177 #define DEBUG_INIT(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1178 #define DEBUG_SETIPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1179 #define DEBUG_SETPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1184 * Private data structures of the classes defined by intuition.library
1191 struct TagItem
*ic_Mapping
;
1192 struct TagItem
*ic_CloneTags
;
1193 ULONG ic_LoopCounter
;
1199 struct MinList memberlist
;
1205 /* render bevel only with no fill? */
1208 /* inverted bevel pens? */
1221 struct DrawInfo
*dri
;
1222 struct Image
*frame
;
1238 struct ExtGadget EG
;
1245 /* We use a propinfo structure, because we use the same routines
1246 for intuition propgadtets and in propgclass */
1248 struct PropInfo propinfo
;
1250 /* A little kludge: since the HandleMouseMove function
1251 wants dx/dy and not absolute mouse coords, we
1252 have to remember the last ones */
1257 /* One only have to store total or visble, and use some other
1258 formulas than those in the RKRM:L, but for
1259 code simplicity I store them all. */
1260 UWORD top
, visible
, total
;
1263 struct BBox
*old_knobbox
;
1264 struct Hook
*DisplayHook
;
1270 struct StringInfo StrInfo
;
1271 struct StringExtend StrExtend
;
1278 struct MinList memberlist
;
1279 struct Gadget
*activegad
;
1285 /* Current left- and topedge of moving window. Ie when the user releases
1286 the LMB after a windowdrag, the window's new coords will be (curleft, curtop)
1292 /* The current x and y coordinates relative to curleft/curtop */
1296 /* Whether the dragframe is currently drawn or erased */
1299 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1302 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1303 BOOL drag_layerlock
;
1304 #ifdef USEGADGETLOCK
1305 BOOL drag_gadgetlock
;
1306 BOOL drag_inputhandlerlock
;
1308 BOOL drag_refreshed
;
1310 /* Rastport to use during update */
1311 struct RastPort
*rp
;
1313 UQUAD lasteventtime
;
1318 #ifdef USEWINDOWLOCK
1319 /* used to prevent windows from opening/closing while user drags a window */
1320 BOOL drag_windowlock
;
1323 struct Task
*movetask
;
1327 /* SizeButtonClass */
1328 struct sizebutton_data
1331 /* The current width and height of the rubber band frame */
1337 /* holds original sizes */
1343 /* the offset of the mouse pointer to the rubber band frame*/
1347 /* Whether the dragframe is currently drawn or erased */
1350 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1353 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1354 BOOL drag_layerlock
;
1355 #ifdef USEGADGETLOCK
1356 BOOL drag_gadgetlock
;
1357 BOOL drag_inputhandlerlock
;
1360 BOOL drag_refreshed
;
1362 /* Rastport to use during update */
1363 struct RastPort
*rp
;
1365 UQUAD lasteventtime
;
1367 #ifdef USEWINDOWLOCK
1368 /* used to prevent windows from opening/closing while user drags a window */
1369 BOOL drag_windowlock
;
1380 /* MenuBarLabelClass */
1381 struct MenuBarLabelData
1383 struct DrawInfo
*dri
;
1389 struct SharedPointer
*shared_pointer
;
1393 struct windecor_data
1395 ULONG userbuffersize
;
1399 struct scrdecor_data
1401 ULONG userbuffersize
;
1404 /* MenuDecorClass */
1405 struct menudecor_data
1407 ULONG userbuffersize
;
1410 #endif /* INTUITION_INTERN_H */