1 #ifndef INTUITION_INTERN_H
2 #define INTUITION_INTERN_H
5 Copyright 1995-2006, 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>
84 #include "intuition_debug.h"
87 #include "intuition_customize.h"
88 #include "intuition_internmos.h"
89 #include "intuition_extend.h"
92 #include "requesters.h"
94 /* Needed for aros_print_not_implemented macro */
95 #include <aros/debug.h>
97 #include <aros/asmcall.h>
99 // FIXME: implement macro for AROS ??
101 # define ASSERT_VALID_PTR_ROMOK(ptr)
104 // FIXME: seems only used for RefreshWindowTitles() ? -> better names
105 // FIXME: what are the correct values?
106 #define NO_DOUBLEBUFFER (0)
107 #define DOUBLEBUFFER (1)
111 # define USE_OPAQUESIZE 1
113 # define USE_OPAQUESIZE 0
118 void dprintf(char *, ...) __attribute__ ((format (printf
, 1, 2)));
119 void * memclr(APTR
, ULONG
);
123 void * memclr(APTR
, ULONG
);
124 #define bzero(a,b) memclr(a,b)
125 #else /* __MORPHOS__ */
126 #define memclr(a,b) bzero(a,b)
127 #endif /* __MORPHOS__ */
130 * min()/max() without macro side effects.
133 ({typeof(a) _a = (a); \
134 typeof(b) _b = (b); \
138 ({typeof(a) _a = (a); \
139 typeof(b) _b = (b); \
142 #define EXTENDWORD(x) x = (LONG)((WORD)x);
143 #define EXTENDUWORD(x) x = (ULONG)((UWORD)x);
145 /* SANITY CHECK MACRO */
146 //#define DEBUG_SANITYCHECK
148 #ifdef DEBUG_SANITYCHECK
149 #define SANITY_CHECK(x) if (!((IPTR)x)) {dprintf("Losing sanity in %s line %d\n",__FILE__,__LINE__); return;};
150 #define SANITY_CHECKR(x,v) if (!((IPTR)x)) {dprintf("Losing sanity in %s line %d\n",__FILE__,__LINE__); return v;};
152 #define SANITY_CHECK(x) if (!((IPTR)x)) return;
153 #define SANITY_CHECKR(x,v) if (!((IPTR)x)) return v;
158 #define MENUS_BACKFILL TRUE
160 #define MENUS_AMIGALOOK ((GetPrivIBase(IntuitionBase)->IControlPrefs.ic_Flags & ICF_3DMENUS) == 0)
162 #define MENULOOK_3D 0
163 #define MENULOOK_CLASSIC 1
165 #define MENUS_UNDERMOUSE (GetPrivIBase(IntuitionBase)->IControlPrefs.ic_Flags & ICF_POPUPMENUS)
167 #define AVOID_WINBORDERERASE (GetPrivIBase(IntuitionBase)->IControlPrefs.ic_Flags & ICF_AVOIDWINBORDERERASE)
172 #define FRAME_SIZE (GetPrivIBase(IntuitionBase)->FrameSize)
174 #define FRAMESIZE_THIN 0 /* 1:1 thin */
175 #define FRAMESIZE_MEDRES 1 /* 2:1 medres like AmigaOS */
176 #define FRAMESIZE_THICK 2 /* 1:1 thick */
178 #define SQUARE_WIN_GADGETS 1
181 /* FIXME: possibly enable this, once gadtools has been updated */
183 #define GADTOOLSCOMPATIBLE
184 //enables some gadtools-weirdo-code, MUST be set in both gadtools & intui to work!!!
188 //#define USEGETIPREFS
191 /* simpleref layers have gadgets redrawn when app calls beginrefresh() */
192 //#define BEGINUPDATEGADGETREFRESH
193 //#define DAMAGECACHE
195 //#define USEWINDOWLOCK
197 #define LOCKWINDOW ObtainSemaphore(&GetPrivIBase(IntuitionBase)->WindowLock);
198 #define UNLOCKWINDOW ReleaseSemaphore(&GetPrivIBase(IntuitionBase)->WindowLock);
203 /* jDc: do NOT disable this! */
205 #define USEGADGETLOCK
207 #define LOCKGADGET ObtainSemaphore(&GetPrivIBase(IntuitionBase)->GadgetLock);
208 #define UNLOCKGADGET ReleaseSemaphore(&GetPrivIBase(IntuitionBase)->GadgetLock);
209 #define LOCKWINDOWLAYERS(w) ;
210 #define UNLOCKWINDOWLAYERS(w) ;
214 #define LOCKWINDOWLAYERS(w) LockLayerInfo(&w->WScreen->LayerInfo); \
215 if (((struct IntWindow *)(w))->borderlayer) {LockLayer(0,((struct IntWindow *)(w))->borderlayer);}; \
216 if (((struct IntWindow *)(w))->wlayer) {LockLayer(0,((struct IntWindow *)(w))->wlayer);};
217 #define UNLOCKWINDOWLAYERS(w) if (((struct IntWindow *)(w))->wlayer) {UnlockLayer(((struct IntWindow *)(w))->wlayer);}; \
218 if (((struct IntWindow *)(w))->borderlayer) {UnlockLayer(((struct IntWindow *)(w))->borderlayer);} \
219 UnlockLayerInfo(&w->WScreen->LayerInfo);
222 #define WLAYER(w) (((struct IntWindow *)(w))->wlayer)
223 #define BLAYER(w) (((struct IntWindow *)(w))->borderlayer)
225 //#define TIMEVALWINDOWACTIVATION
227 /* If PROP_RENDER_OPTIMIZATION is set to 1, propgadget code tries to optimize rendering
228 during prop gadget knob movement. Only area of the propgadget that is affected by
229 prop gadget knob movement is re-rendered.
231 Unfortunately this can fail with some programs, like DOpus 4.x text viewer */
233 #define PROP_RENDER_OPTIMIZATION 0
235 #define SINGLE_SETPOINTERPOS_PER_EVENTLOOP 1
237 #ifndef LIFLG_SUPPORTS_OFFSCREEN_LAYERS
238 /* Defined in <graphics/layers.h>, but apparently not on MorphOS. */
239 # define LIFLG_SUPPORTS_OFFSCREEN_LAYERS 2
242 #define INTUITIONNAME "intuition.library"
243 #define MENUBARLABELCLASS "menubarlabelclass"
245 #define DEFPUBSCREEN TRUE
247 #define USE_NEWDISPLAYBEEP 1
249 #define TITLEBUFFERLEN 255
251 #define USE_IDCMPUPDATE_MESSAGECACHE 0
254 #if INCLUDE_VERSION < 50
256 /********************************************************************************/
257 /* imageclass.h AROS extensions */
259 #define SYSIA_WithBorder IA_FGPen /* default: TRUE */
260 #define SYSIA_Style IA_BGPen /* default: SYSISTYLE_NORMAL */
262 #define SYSISTYLE_NORMAL 0
263 #define SYSISTYLE_GADTOOLS 1 /* to get arrow images in gadtools look */
265 /********************************************************************************/
266 /* gadgetclass.h AROS extenstions */
268 /* This method is invoked to learn about the sizing requirements of your class,
269 before an object is created. This is AROS specific. */
273 STACKULONG MethodID
; /* GM_DOMAIN */
274 struct GadgetInfo
*gpd_GInfo
; /* see <intuition/cghooks.h> */
275 struct RastPort
*gpd_RPort
; /* RastPort to calculate dimensions for. */
276 STACKLONG gpd_Which
; /* see below */
277 struct IBox gpd_Domain
; /* Resulting domain. */
278 struct TagItem
*gpd_Attrs
; /* Additional attributes. None defined,
282 /********************************************************************************/
285 #define GDOMAIN_MINIMUM 0 /* Calculate minimum size. */
286 #define GDOMAIN_NOMINAL 1 /* Calculate nominal size. */
287 #define GDOMAIN_MAXIMUM 2 /* Calculate maximum size. */
289 #endif /* INCLUDE_VERSION < 50 */
290 #endif /* ifdef __MORPHOS__ */
292 /********************************************************************************/
293 #define GM_MOVETEST 8
294 /* this method is used by our draggad to tell if it's OK to move the mouse when window
295 is near screen boundaries and offscreen is disabled. msg = gpInput*/
297 #define MOVETEST_MOVE 0
298 #define MOVETEST_ADJUSTPOS 1
300 /* ObtainGIRPort must install a 0 clipregion and
301 set scrollx/scrolly of layer to 0. Since this
302 will be restored only when ReleaseGIRPort is
303 called, we must backup the orig values somewhere */
307 struct Region
*clipregion
;
317 #define IP_OLDOVERSCAN 3
318 #define IP_OLDICONTROL 4
319 #define IP_OLDPOINTER 7
320 #define IP_OLDPALETTE 8
323 #define IP_SCREENMODE 1
324 #define IP_FONT 101//2
325 #define IP_ICONTROL 102//4
326 #define IP_POINTER 103//7
327 #define IP_PTRCOLOR 104//8
328 #define IP_PALETTE 105
329 #define IP_IACTIONS 20
330 #define IP_IEXTENSIONS 21
331 #define IP_INPUTEXT 22
335 struct IScreenModePrefs
344 struct IIControlPrefs
350 UBYTE ic_FrontToBack
;
357 #include <intuition/iprefs.h>
368 #define COLORTABLEENTRIES 32 //8
372 #define RESOURCELIST_HASHSIZE 256
374 #define RESOURCE_WINDOW 1
375 #define RESOURCE_SCREEN 2
384 /* Internal Screen Notification Data */
385 struct IntScreenNotify
388 struct MsgPort
*port
;
389 struct Task
*sigtask
;
398 struct IntIntuitionBase
400 struct IntuitionBase IBase
;
402 WORD _MinXMouse
,_MaxXMouse
; /* Old 1.3 Base entries*/
403 WORD _MinYMouse
,_MaxYMouse
; /* Old 1.3 Base entries*/
404 ULONG _StartSecs
,_StartMicros
; /* Old 1.3 Base entries*/
405 char *SystemRequestTitle
; /* written by locale as it seems..what a crappy interface*/
406 char *WorkbenchTitle
; /* written by locale as it seems..what a crappy interface*/
409 * savety pad for intuitionbase accesses
410 * probably needs to be smarter
415 /* Put local shit here, invisible for the user */
417 struct Library
*CyberGfxBase
;
418 struct Library
*MUIMasterBase
;
421 struct Library
*InputBase
;
422 struct Library
*TimerBase
;
423 struct MsgPort
*TimerMP
;
424 struct timerequest
*TimerIO
;
426 struct MsgPort
*WorkBenchMP
;
427 struct Screen
*WorkBench
;
428 struct SignalSemaphore
*IBaseLock
;
430 /* Intuition input handlers replyport. This one is set
431 int rom/inputhandler.c/InitIIH()
433 struct MsgPort
*IntuiReplyPort
;
434 struct MinList
*IntuiActionQueue
;
435 struct IOStdReq
*InputIO
;
436 struct MsgPort
*InputMP
;
438 /* Intuition Screennotify Replyport if SNOTIFY_WAIT_REPLY is specified */
440 struct MsgPort
*ScreenNotifyReplyPort
;
442 BOOL InputDeviceOpen
;
443 struct Interrupt
*InputHandler
;
445 struct Hook
*GlobalEditHook
;
446 /* The default global edit hook */
447 struct Hook DefaultEditHook
;
450 APTR DriverData
; /* Pointer which the driver may use */
452 struct Screen
*DefaultPubScreen
;
453 struct SignalSemaphore PubScrListLock
;
454 struct MinList PubScreenList
;
455 UWORD pubScrGlobalMode
;
457 struct SignalSemaphore ScreenNotificationListLock
;
458 struct List ScreenNotificationList
;
460 struct SignalSemaphore GadgetLock
;
461 struct SignalSemaphore MenuLock
;
462 struct SignalSemaphore WindowLock
;
463 struct SignalSemaphore IntuiActionLock
;
464 struct SignalSemaphore InputHandlerLock
;
465 struct LayerContext BackupLayerContext
;
467 struct IClass
*dragbarclass
;
468 struct IClass
*sizebuttonclass
;
472 struct Preferences
*DefaultPreferences
;
473 struct Preferences
*ActivePreferences
;
475 struct MsgPort
*MenuHandlerPort
;
478 struct TextFont
*ScreenFont
;
479 struct TextFont
*TopazFont
;
481 /* Dos function DisplayError() before intuition.library patched it */
482 APTR OldDisplayErrorFunc
;
484 struct SignalSemaphore ClassListLock
;
485 struct MinList ClassList
;
486 struct IClass RootClass
;
489 struct ViewExtra
*ViewLordExtra
;
494 ULONG
*SmallMenuPool
;
498 struct IScreenModePrefs ScreenModePrefs
;
499 struct IIControlPrefs IControlPrefs
;
501 struct IAction
*IControlActions
;
502 struct IControlExtensions IControlExtensions
;
503 ULONG NumIControlActions
;
504 struct InputPrefsExt InputPrefsExt
;
506 struct IClass
*pointerclass
;
507 Object
*DefaultPointer
;
509 UWORD DriPens2
[NUMDRIPENS
];
510 UWORD DriPens4
[NUMDRIPENS
];
511 UWORD DriPens8
[NUMDRIPENS
];
512 struct Color32 Colors
[COLORTABLEENTRIES
];
515 struct IntScreen
*MenuVerifyScreen
;
519 struct SignalSemaphore DataTypesSem
;
520 struct Library
*DataTypesBase
; /* should be opened ONLY by int_InitCustomChanges!*/
524 ULONG LastClickMicro
; /* for doubleclick to front */
525 ULONG DoubleClickCounter
;
526 ULONG DoubleClickButton
;
529 struct Hook transphook
; /* hook for windows with intui transp */
530 struct Hook notransphook
; /* hook for windows with no additional transp (borderless,etc) */
533 //#ifdef INTUITION_NOTIFY_SUPPORT // commented to avoid offset fuckup! - Piru
534 struct Library
*ScreenNotifyBase
;
535 struct Library
*NotifyIntuitionBase
;
538 struct RastPort DoGadgetMethodRP
;
539 struct GadgetInfo DoGadgetMethodGI
;
545 #if USE_NEWDISPLAYBEEP
549 WORD prop_clickoffset_x
, prop_clickoffset_y
;
551 struct MinList ResourceList
[RESOURCELIST_HASHSIZE
];
553 /* Menu Look Settings */
559 struct ExtSprite
*sprite
;
560 WORD xoffset
, yoffset
;
564 struct SharedPointer
*CreateSharedPointer(struct ExtSprite
*, int, int, struct IntuitionBase
*);
565 void ObtainSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
566 void ReleaseSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
568 #ifdef INTUITION_NOTIFY_SUPPORT
569 void sn_DoNotify(ULONG type
, APTR value
, struct Library
*_ScreenNotifyBase
);
575 struct Screen
*dri_Screen
;
576 struct SignalSemaphore dri_WinDecorSem
;
577 Object
*dri_WinDecorObj
;
578 struct SignalSemaphore dri_ScrDecorSem
;
579 Object
*dri_ScrDecorObj
;
582 #define LOCK_WINDECOR(dri) ObtainSemaphore(&((struct IntDrawInfo *)(dri))->dri_WinDecorSem);
583 #define LOCKSHARED_WINDECOR(dri) ObtainSemaphoreShared(&((struct IntDrawInfo *)(dri))->dri_WinDecorSem);
584 #define UNLOCK_WINDECOR(dri) ReleaseSemaphore(&((struct IntDrawInfo *)(dri))->dri_WinDecorSem);
586 #define LOCK_SCRDECOR(dri) ObtainSemaphore(&((struct IntDrawInfo *)(dri))->dri_ScrDecorSem);
587 #define LOCKSHARED_SCRDECOR(dri) ObtainSemaphoreShared(&((struct IntDrawInfo *)(dri))->dri_ScrDecorSem);
588 #define UNLOCK_SCRDECOR(dri) ReleaseSemaphore(&((struct IntDrawInfo *)(dri))->dri_ScrDecorSem);
592 struct Screen Screen
;
595 struct HashNode hashnode
;
596 struct IntDrawInfo DInfo
;
597 struct TTextAttr textattr
;
598 ULONG textattrtags
[3];
599 UWORD Pens
[NUMDRIPENS
];
600 struct PubScreenNode
*pubScrNode
;
603 struct Layer
*rootLayer
;
604 ULONG DisplayBeepColor0
[3];
605 struct Window
*DisplayBeepWindow
;
607 struct MonitorSpec
*Monitor
;
608 struct SharedPointer
*Pointer
;
609 struct Window
*MenuVerifyActiveWindow
;
610 int MenuVerifyTimeOut
;
611 int MenuVerifyMsgCount
;
612 ULONG MenuVerifySeconds
;
613 ULONG MenuVerifyMicros
;
614 struct BitMap
*AllocatedBitmap
;
623 struct SkinInfo SkinInfo
;
624 struct RastPort
*TitlebarBufferRP
;
625 struct Window
*TitlebarBufferWin
;
626 ULONG TitlebarWinWidth
;
627 ULONG TitlebarWinActive
;
629 #if USE_NEWDISPLAYBEEP
630 UBYTE BeepingCounter
;
634 #define GetPrivScreen(s) ((struct IntScreen *)s)
637 #define SF_IsParent (0x0001)
638 #define SF_IsChild (0x0002)
639 #define SF_InvisibleBar (0x0004)
640 #define SF_AppearingBar (0x0008)
641 #define SF_SysFont (0x0010)
643 struct IntIntuiMessage
645 struct ExtIntuiMessage eimsg
;
648 ** The following field is needed, because in case of IDCMP_RAWKEY
649 ** IntuiMessage->IAddress is a pointer to this data, not the data
650 ** itself (which is the case for IDCMP_VANILLAKEY)
656 #define INT_INTUIMESSAGE(x) ((struct IntIntuiMessage *)(x))
660 /*extern struct IntuitionBase * IntuitionBase;*/
662 #define IW(window) ((struct IntWindow *) (window))
664 #define GetPubIBase(ib) ((struct IntuitionBase *)ib)
665 #define GetPrivIBase(ib) ((struct IntIntuitionBase *)ib)
671 #define CyberGfxBase (GetPrivIBase(IntuitionBase)->CyberGfxBase)
674 #define MUIMasterBase (GetPrivIBase(IntuitionBase)->MUIMasterBase)
681 #define InputBase (GetPrivIBase(IntuitionBase)->InputBase)
686 #define TimerBase (GetPrivIBase(IntuitionBase)->TimerBase)
691 #define TimerMP (GetPrivIBase(IntuitionBase)->TimerMP)
696 #define TimerIO (GetPrivIBase(IntuitionBase)->TimerIO)
698 #define PublicClassList ((struct List *)&(GetPrivIBase(IntuitionBase)->ClassList))
701 /* stegerg: one can have sysgadgets outside of window border! All sysgadgets in window
702 border must have set GACT_???BORDER and, if they are in a gzz window, also
705 #define IS_GZZ_GADGET(gad) (((gad)->GadgetType) & GTYP_GZZGADGET)
707 #define IS_BORDER_GADGET(gad) (IS_GZZ_GADGET(gad) || \
708 ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER)))
710 #define IS_SYS_GADGET(gad) (((gad)->GadgetType) & GTYP_SYSTYPEMASK)
712 #define IS_BOOPSI_GADGET(gad) (((gad)->GadgetType & GTYP_GTYPEMASK) == GTYP_CUSTOMGADGET)
714 /*#define IS_BORDER_GADGET(gad) \
715 (((gad->GadgetType) & GTYP_SYSGADGET) \
716 || ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER))) */
718 #define IS_REQ_GADGET(gad) ((gad)->GadgetType & GTYP_REQGADGET)
720 #define IS_SCREEN_GADGET(gad) ((gad)->GadgetType & GTYP_SCRGADGET)
722 #define SET_GI_RPORT(gi, w, req, gad) \
723 (gi)->gi_RastPort = (IS_SCREEN_GADGET(gad) ? \
724 ((gi)->gi_Screen->BarLayer ? (gi)->gi_Screen->BarLayer->rp : NULL) : \
725 (IS_BORDER_GADGET(gad) ? (w)->BorderRPort : \
726 ((req) ? ((req)->ReqLayer->rp) : (w)->RPort)) \
730 #define REFRESHGAD_BOOPSI 1 /* boopsi gadgets */
731 #define REFRESHGAD_BORDER 2 /* gadgets in window border */
732 #define REFRESHGAD_REL 4 /* gadgets with GFLG_RELRIGHT, GFLG_RELBOTTOM,GFLG_RELWIDTH, GFLG_RELHEIGHT */
733 #define REFRESHGAD_RELS 8 /* GFLG_RELSPECIAL gadgets */
734 #define REFRESHGAD_TOPBORDER 16 /* used by setwindowtitle */
735 #define REFRESHGAD_NOGADTOOLS 32 /* used in some cases for _mustbe_ */
737 #define SYSGADGET_ACTIVE (iihdata->ActiveSysGadget != NULL)
739 VOID
int_refreshglist(struct Gadget
*gadgets
, struct Window
*window
,
740 struct Requester
*requester
, LONG numGad
, LONG mustbe
, LONG mustnotbe
,
741 struct IntuitionBase
*IntuitionBase
);
743 VOID
int_RefreshWindowFrame(struct Window
*window
, LONG mustbe
, LONG mustnotbe
,
745 struct IntuitionBase
*IntuitionBase
);
747 #define int_refreshwindowframe(a,b,c,d) int_RefreshWindowFrame(a,b,c,0,d);
749 /* Keep the system gadgets in the same order than the original intuition,
750 * some programs make bad asumptions about that...
768 #define SYSGAD(w, idx) (((struct IntWindow *)(w))->sysgads[idx])
772 struct Window window
;
774 Object
*sysgads
[NUM_SYSGADS
];
775 struct Image
*AmigaKey
;
776 struct Image
*Checkmark
;
777 struct Window
*menulendwindow
;
779 struct HashNode hashnode
;
781 /* When the Zoom gadget is pressed the window will have the
782 dimensions stored here. The old dimensions are backed up here
789 /* max. number of mousemove events to send to this window */
792 /* act. number of mousemove events sent to this window */
793 WORD num_mouseevents
;
795 /* max. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
796 messages to send to this window */
799 /* act. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
800 messages sent to this window */
801 WORD num_repeatevents
;
803 #if USE_IDCMPUPDATE_MESSAGECACHE
804 /* number of unreplied IDCMP_IDCMPUPDATE messages sent to window
805 used in few hacks :) */
806 WORD num_idcmpupdate
;
809 WORD sizeimage_width
;
810 WORD sizeimage_height
;
820 ULONG extrabuttonsid
; /* replaces ETI_Dummy if apps wishes it */
822 ULONG titlepos
; /* used by titlebar pattern fill stuff */
829 struct Region
*transpregion
;
830 struct Hook
*usertransphook
;
831 struct Region
*usertranspregion
;
835 struct Region
*trashregion
;
837 char titlebuffer
[TITLEBUFFERLEN
+1];
839 #if USE_IDCMPUPDATE_MESSAGECACHE
840 struct IntuiMessage
*messagecache
; //for idcmpupdate cache
843 struct Layer
*wlayer
;
844 struct Layer
*borderlayer
;
846 struct timeval lastmsgsent
;
847 struct timeval lastmsgreplied
;
849 #ifdef TIMEVALWINDOWACTIVATION
850 struct timeval activationtime
;
854 struct Hook custombackfill
;
859 #define SPFLAG_ICONIFIED 1
860 #define SPFLAG_NOICONIFY 2
861 #define SPFLAG_SKININFO 4
862 #define SPFLAG_LAYERREFRESH 8
863 #define SPFLAG_TRANSPHOOK 16
864 #define SPFLAG_LAYERRESIZED 32
865 #define SPFLAG_USERPORT 64
866 #define SPFLAG_IAMDEAD 128
867 #define SPFLAG_CLOSING 256 //used with iamdead
868 #define SPFLAG_WANTBUFFER 512
870 #define HELPF_ISHELPGROUP 1
871 #define HELPF_GADGETHELP 2
873 #define IS_NOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? TRUE : FALSE)
874 #define IS_DOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? FALSE : TRUE )
875 #define IS_SIMPLEREFRESH(win) (((win)->Flags & WFLG_SIMPLE_REFRESH) ? TRUE : FALSE)
876 #define IS_GZZWINDOW(win) (((win)->Flags & WFLG_GIMMEZEROZERO) ? TRUE : FALSE)
879 /* Flag definitions for MoreFlags */
881 #define WMFLG_NOTIFYDEPTH (1 << 0) /* Window wants notification when
882 it's depth arranged */
884 #define WMFLG_DO_UNLOCKPUBSCREEN (1 << 1)
885 #define WMFLG_MENUHELP (1 << 2)
886 #define WMFLG_POINTERDELAY (1 << 3)
887 #define WMFLG_TABLETMESSAGES (1 << 4)
889 // FIXME: ehm... this one should die a horrible death!
890 #define WMFLG_IAMMUI (1 << 5)
892 struct IntScreenBuffer
894 struct ScreenBuffer sb
;
899 /* Driver prototypes */
901 extern int intui_init (struct IntuitionBase
*);
902 extern int intui_open (struct IntuitionBase
*);
903 extern void intui_close (struct IntuitionBase
*);
904 extern void intui_expunge (struct IntuitionBase
*);
905 extern int intui_GetWindowSize (void);
906 extern void intui_WindowLimits (struct Window
* window
, WORD MinWidth
, WORD MinHeight
, UWORD MaxWidth
, UWORD MaxHeight
);
907 extern void intui_ActivateWindow (struct Window
*);
908 extern BOOL
intui_ChangeWindowBox (struct Window
* window
, WORD x
, WORD y
,
909 WORD width
, WORD height
);
910 extern void intui_CloseWindow (struct Window
*, struct IntuitionBase
*);
911 extern void intui_MoveWindow (struct Window
* window
, WORD dx
, WORD dy
);
912 extern int intui_OpenWindow (struct Window
*, struct IntuitionBase
*,
913 struct BitMap
* SuperBitMap
, struct Hook
*backfillhook
,
914 struct Region
* shape
, struct Hook
* shapehook
,
915 struct Layer
* parent
, ULONG visible
);
916 extern void intui_SetWindowTitles (struct Window
*, CONST_STRPTR
, CONST_STRPTR
);
917 extern void intui_RefreshWindowFrame(struct Window
*win
);
918 extern struct Window
*intui_FindActiveWindow(struct InputEvent
*ie
, struct IntuitionBase
*IntuitionBase
);
919 extern void intui_ScrollWindowRaster(struct Window
* win
, WORD dx
, WORD dy
, WORD xmin
,
920 WORD ymin
, WORD xmax
, WORD ymax
,
921 struct IntuitionBase
* IntuitionBase
);
923 /* wbtasktalk protos */
925 ULONG
TellWBTaskToCloseWindows(struct IntuitionBase
*IntuitionBase
);
926 ULONG
TellWBTaskToOpenWindows(struct IntuitionBase
*IntuitionBase
);
928 /* intuition_misc protos */
929 extern void LoadDefaultPreferences(struct IntuitionBase
* IntuitionBase
);
930 Object
* CreateStdSysImage(WORD which
, WORD preferred_height
, struct Screen
*scr
,
931 struct DrawInfo
*dri
, struct IntuitionBase
*IntuitionBase
);
932 extern void CheckRectFill(struct RastPort
*rp
, WORD x1
, WORD y1
, WORD x2
, WORD y2
, struct IntuitionBase
* IntuitionBase
);
933 extern BOOL
CreateWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
934 extern VOID
KillWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
935 extern void CreateScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
936 extern void KillScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
937 extern void RenderScreenBar(struct Screen
*scr
, BOOL refresh
, struct IntuitionBase
*IntuitionBase
);
938 extern void UpdateMouseCoords(struct Window
*win
);
939 extern WORD
SubtractRectFromRect(struct Rectangle
*a
, struct Rectangle
*b
, struct Rectangle
*destrectarray
);
941 extern LONG
CalcResourceHash(APTR resource
);
942 extern void AddResourceToList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
943 extern void RemoveResourceFromList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
944 extern BOOL
ResourceExisting(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
945 void FireScreenNotifyMessage(IPTR data
, ULONG flag
, struct IntuitionBase
*IntuitionBase
);
946 void FireScreenNotifyMessageCode(IPTR data
, ULONG flag
, ULONG code
, struct IntuitionBase
*IntuitionBase
);
949 extern struct RastPort
*MyCreateRastPort(struct IntuitionBase
*);
950 extern struct RastPort
*MyCloneRastPort(struct IntuitionBase
*, struct RastPort
*);
951 extern void MyFreeRastPort(struct IntuitionBase
*, struct RastPort
*);
952 extern void MySetPointerPos(struct IntuitionBase
*, int, int);
953 struct TextFont
*SafeReopenFont(struct IntuitionBase
*, struct TextFont
**);
954 extern Object
*MakePointerFromPrefs(struct IntuitionBase
*, struct Preferences
*);
955 extern Object
*MakePointerFromData(struct IntuitionBase
*, UWORD
*, int, int, int, int);
956 void InstallPointer(struct IntuitionBase
*, Object
**, Object
*);
957 void SetPointerColors(struct IntuitionBase
*IntuitionBase
);
958 struct IClass
*InitITextIClass (struct IntuitionBase
* IntuitionBase
);
959 struct Gadget
*DoActivateGadget(struct Window
*win
, struct Requester
*req
, struct Gadget
*gad
,
960 struct IntuitionBase
*IntuitionBase
);
961 VOID
DoGMLayout(struct Gadget
*glist
, struct Window
*win
, struct Requester
*req
,
962 UWORD numgad
, BOOL initial
, struct IntuitionBase
*IntuitionBase
);
963 BOOL
ih_fire_intuimessage(struct Window
* w
, ULONG Class
, UWORD Code
, APTR IAddress
,
964 struct IntuitionBase
*IntuitionBase
);
965 void NotifyDepthArrangement(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
969 void int_PrintIText(struct RastPort
* rp
, struct IntuiText
* iText
,
970 LONG leftOffset
, LONG topOffset
, BOOL ignore_attributes
,
971 struct IntuitionBase
*IntuitionBase
);
974 BOOL
IsLayerHiddenBySibling(struct Layer
*layer
, BOOL xx
);
975 LONG
IsLayerVisible(struct Layer
*layer
);
978 void SetupGInfo(struct GadgetInfo
*gi
, struct Window
*win
, struct Requester
*req
,
979 struct Gadget
*gad
, struct IntuitionBase
*IntuitionBase
);
981 IPTR
Custom_DoMethodA(struct IntuitionBase
*, struct Gadget
*, Msg
);
987 #define DoMethodA(x, ...) (REG_A6=(LONG)IntuitionBase, DoMethodA(x, __VA_ARGS__))
990 #define Custom_DoMethodA(x, ...) Custom_DoMethodA(IntuitionBase, x, __VA_ARGS__)
992 #define HAS_CHILDREN(w) (NULL != w->firstchild)
995 #define DeinitRastPort(rp) ((void)0)
996 #define CreateRastPort() MyCreateRastPort(IntuitionBase)
997 #define CloneRastPort(rp) MyCloneRastPort(IntuitionBase, rp)
998 #define FreeRastPort(rp) MyFreeRastPort(IntuitionBase, rp)
999 #define SetPointerPos(x, y) MySetPointerPos(IntuitionBase, x, y)
1000 #define MouseCoordsRelative() 1
1003 /* Replacement for dos.library/DisplayError() */
1004 AROS_UFP3(LONG
, Intuition_DisplayError
,
1005 AROS_UFPA(STRPTR
, formatStr
, A0
),
1006 AROS_UFPA(ULONG
, IDCMPFlags
, D0
),
1007 AROS_UFPA(APTR
, args
, A1
));
1009 #define POINTERA_SharedPointer 0x80039010
1012 #define dprintf kprintf
1015 #define DEBUG_ACTIVATEGADGET(x) ;
1016 #define DEBUG_ACTIVATEWINDOW(x) ;
1017 #define DEBUG_ADDCLASS(x) ;
1018 #define DEBUG_ADDGADGET(x) ;
1019 #define DEBUG_ADDGLIST(x) ;
1020 #define DEBUG_ALLOCINTUIMESSAGE(x) ;
1021 #define DEBUG_ALLOCSCREENBUFFER(x) ;
1022 #define DEBUG_ALOHAWORKBENCH(x) ;
1023 #define DEBUG_CHANGEWINDOWBOX(x) ;
1024 #define DEBUG_CLOSESCREEN(x) ;
1025 #define DEBUG_CLOSEWINDOW(x) ;
1026 #define DEBUG_CLOSEWORKBENCH(x) ;
1027 #define DEBUG_DISPOSEOBJECT(x) ;
1028 #define DEBUG_DOGADGETMETHOD(x) ;
1029 #define DEBUG_DRAWBORDER(x) ;
1030 #define DEBUG_FINDCLASS(x) ;
1031 #define DEBUG_FREEICDATA(x) ;
1032 #define DEBUG_FREEINTUIMESSAGE(x) ;
1033 #define DEBUG_FREESCREENBUFFER(x) ;
1034 #define DEBUG_FREESCREENDRAWINFO(x) ;
1035 #define DEBUG_GADGETMOUSE(x) ;
1036 #define DEBUG_GETATTR(x) ;
1037 #define DEBUG_GETDEFAULTPUBSCREEN(x) ;
1038 #define DEBUG_GETDEFPREFS(x) ;
1039 #define DEBUG_GETGADGETIBOX(x) ;
1040 #define DEBUG_GETPREFS(x) ;
1041 #define DEBUG_GETSCREENDATA(x) ;
1042 #define DEBUG_GETSCREENDRAWINFO(x) ;
1043 #define DEBUG_HIDEWINDOW(x) ;
1045 #define DEBUG_INIT(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1047 #define DEBUG_INIT(x) ;
1049 #define DEBUG_OPEN(x) ;
1050 #define DEBUG_CLOSE(x) ;
1051 #define DEBUG_INPUTEVENT(x) ;
1052 #define DEBUG_INTREFRESHGLIST(x) ;
1053 #define DEBUG_INTUITEXTLENGTH(x) ;
1054 #define DEBUG_LENDMENUS(x) ;
1055 #define DEBUG_LOCKPUBSCREEN(x) ;
1056 #define DEBUG_MAKECLASS(x) ;
1057 #define DEBUG_MODIFYIDCMP(x) ;
1058 #define DEBUG_NEWOBJECT(x) ;
1059 #define DEBUG_NEXTOBJECT(x) ;
1060 #define DEBUG_OBTAINGIRPORT(x) ;
1061 #define DEBUG_OFFGADGET(x) ;
1062 #define DEBUG_OFFMENU(x) ;
1063 #define DEBUG_ONGADGET(x) ;
1064 #define DEBUG_ONMENU(x) ;
1065 #define DEBUG_OPENSCREEN(x) ;
1066 #define DEBUG_OPENSCREENTAGLIST(x) ;
1067 #define DEBUG_OPENWINDOW(x) ;
1068 #define DEBUG_OPENWINDOWTAGLIST(x) ;
1069 #define DEBUG_OPENWORKBENCH(x) ;
1070 #define DEBUG_POINTER(x) ;
1071 #define DEBUG_PRINTITEXT(x) ;
1072 #define DEBUG_QUERYOVERSCAN(x) ;
1073 #define DEBUG_REFRESH(x) ;
1074 #define DEBUG_RELEASEGIRPORT(x) ;
1075 #define DEBUG_REMEMBER(x) ;
1076 #define DEBUG_REMOVEGLIST(x) ;
1077 #define DEBUG_REPORTMOUSE(x) ;
1078 #define DEBUG_REQUEST(x) ;
1079 #define DEBUG_SCROLLWINDOWRASTER(x) ;
1080 #define DEBUG_SENDINTUIMESSAGE(x) ;
1081 #define DEBUG_SETATTRS(x) ;
1082 #define DEBUG_SETGADGETATTRS(x) ;
1083 #define DEBUG_SETPOINTER(x) ;
1085 #define DEBUG_SETIPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1087 #define DEBUG_SETIPREFS(x) ;
1090 #define DEBUG_SETPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1092 #define DEBUG_SETPREFS(x) ;
1094 #define DEBUG_SHOWWINDOW(x) ;
1095 #define DEBUG_UNLOCKPUBSCREEN(x) ;
1096 #define DEBUG_WINDOWLIMITS(x) ;
1097 #define DEBUG_WINDOWTOBACK(x) ;
1098 #define DEBUG_WINDOWTOFRONT(x) ;
1099 #define DEBUG_ZIPWINDOW(x) ;
1100 #define DEBUG_VISITOR(x) ;
1101 #define DEBUG_WORKBENCH(x) ;
1102 #define DEBUG_LOCKPUBSCREENLIST(x) ;
1103 #define DEBUG_UNLOCKPUBSCREENLIST(x) ;
1104 #define DEBUG_RETHINKDISPLAY(x) ;
1107 * Private data structures of the classes defined by intuition.library
1114 struct TagItem
*ic_Mapping
;
1115 struct TagItem
*ic_CloneTags
;
1116 ULONG ic_LoopCounter
;
1122 struct MinList memberlist
;
1128 /* render bevel only with no fill? */
1131 /* inverted bevel pens? */
1144 struct DrawInfo
*dri
;
1145 struct Image
*frame
;
1160 struct ExtGadget EG
;
1167 /* We use a propinfo structure, because we use the same routines
1168 for intuition propgadtets and in propgclass */
1170 struct PropInfo propinfo
;
1172 /* A little kludge: since the HandleMouseMove function
1173 wants dx/dy and not absolute mouse coords, we
1174 have to remember the last ones */
1179 /* One only have to store total or visble, and use some other
1180 formulas than those in the RKRM:L, but for
1181 code simplicity I store them all. */
1182 UWORD top
, visible
, total
;
1185 struct BBox
*old_knobbox
;
1191 struct StringInfo StrInfo
;
1192 struct StringExtend StrExtend
;
1199 struct MinList memberlist
;
1200 struct Gadget
*activegad
;
1206 /* Current left- and topedge of moving window. Ie when the user releases
1207 the LMB after a windowdrag, the window's new coords will be (curleft, curtop)
1213 /* The current x and y coordinates relative to curleft/curtop */
1217 /* Whether the dragframe is currently drawn or erased */
1220 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1223 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1224 BOOL drag_layerlock
;
1225 #ifdef USEGADGETLOCK
1226 BOOL drag_gadgetlock
;
1228 BOOL drag_refreshed
;
1230 /* Rastport to use during update */
1231 struct RastPort
*rp
;
1233 UQUAD lasteventtime
;
1238 #ifdef USEWINDOWLOCK
1239 /* used to prevent windows from opening/closing while user drags a window */
1240 BOOL drag_windowlock
;
1243 struct Task
*movetask
;
1247 /* SizeButtonClass */
1248 struct sizebutton_data
1251 /* The current width and height of the rubber band frame */
1257 /* holds original sizes */
1263 /* the offset of the mouse pointer to the rubber band frame*/
1267 /* Whether the dragframe is currently drawn or erased */
1270 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1273 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1274 BOOL drag_layerlock
;
1275 #ifdef USEGADGETLOCK
1276 BOOL drag_gadgetlock
;
1279 BOOL drag_refreshed
;
1281 /* Rastport to use during update */
1282 struct RastPort
*rp
;
1284 UQUAD lasteventtime
;
1286 #ifdef USEWINDOWLOCK
1287 /* used to prevent windows from opening/closing while user drags a window */
1288 BOOL drag_windowlock
;
1299 /* MenuBarLabelClass */
1300 struct MenuBarLabelData
1302 struct DrawInfo
*dri
;
1308 struct SharedPointer
*shared_pointer
;
1312 struct windecor_data
1314 struct IntDrawInfo
*dri
;
1319 struct scrdecor_data
1321 struct IntDrawInfo
*dri
;
1325 #endif /* INTUITION_INTERN_H */