1 #ifndef INTUITION_INTERN_H
2 #define INTUITION_INTERN_H
5 Copyright 1995-2009, 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>
100 #define ASSERT_VALID_PTR_ROMOK(ptr) \
101 if (((ULONG) ptr & 1) || !TypeOfMem(ptr)) \
102 bug("[intuition] Invalid pointer value %p at %s, line %u\n", ptr, __FILE__, __LINE__);
104 #define ASSERT_VALID_PTR_ROMOK(ptr)
107 // FIXME: seems only used for RefreshWindowTitles() ? -> better names
108 // FIXME: what are the correct values?
109 #define NO_DOUBLEBUFFER (0)
110 #define DOUBLEBUFFER (1)
114 # define USE_OPAQUESIZE 1
116 # define USE_OPAQUESIZE 0
121 void dprintf(char *, ...) __attribute__ ((format (printf
, 1, 2)));
122 void * memclr(APTR
, ULONG
);
126 void * memclr(APTR
, ULONG
);
127 #define bzero(a,b) memclr(a,b)
128 #else /* __MORPHOS__ */
129 #define memclr(a,b) bzero(a,b)
130 #endif /* __MORPHOS__ */
133 * min()/max() without macro side effects.
136 ({typeof(a) _a = (a); \
137 typeof(b) _b = (b); \
141 ({typeof(a) _a = (a); \
142 typeof(b) _b = (b); \
145 #define EXTENDWORD(x) x = (LONG)((WORD)x);
146 #define EXTENDUWORD(x) x = (ULONG)((UWORD)x);
148 /* SANITY CHECK MACRO */
149 //#define DEBUG_SANITYCHECK
151 #ifdef DEBUG_SANITYCHECK
152 #define SANITY_CHECK(x) if (!((IPTR)x)) {dprintf("Losing sanity in %s line %d\n",__FILE__,__LINE__); return;};
153 #define SANITY_CHECKR(x,v) if (!((IPTR)x)) {dprintf("Losing sanity in %s line %d\n",__FILE__,__LINE__); return v;};
155 #define SANITY_CHECK(x) if (!((IPTR)x)) return;
156 #define SANITY_CHECKR(x,v) if (!((IPTR)x)) return v;
161 #define MENUS_BACKFILL TRUE
163 #define MENUS_AMIGALOOK ((GetPrivIBase(IntuitionBase)->IControlPrefs.ic_Flags & ICF_3DMENUS) == 0)
165 #define MENULOOK_3D 0
166 #define MENULOOK_CLASSIC 1
168 #define MENUS_UNDERMOUSE (GetPrivIBase(IntuitionBase)->IControlPrefs.ic_Flags & ICF_POPUPMENUS)
170 #define AVOID_WINBORDERERASE (GetPrivIBase(IntuitionBase)->IControlPrefs.ic_Flags & ICF_AVOIDWINBORDERERASE)
175 #define FRAME_SIZE (GetPrivIBase(IntuitionBase)->FrameSize)
177 #define FRAMESIZE_THIN 0 /* 1:1 thin */
178 #define FRAMESIZE_MEDRES 1 /* 2:1 medres like AmigaOS */
179 #define FRAMESIZE_THICK 2 /* 1:1 thick */
181 #define SQUARE_WIN_GADGETS 1
184 /* FIXME: possibly enable this, once gadtools has been updated */
186 #define GADTOOLSCOMPATIBLE
187 //enables some gadtools-weirdo-code, MUST be set in both gadtools & intui to work!!!
191 //#define USEGETIPREFS
194 /* simpleref layers have gadgets redrawn when app calls beginrefresh() */
195 //#define BEGINUPDATEGADGETREFRESH
196 //#define DAMAGECACHE
198 //#define USEWINDOWLOCK
200 #define LOCKWINDOW ObtainSemaphore(&GetPrivIBase(IntuitionBase)->WindowLock);
201 #define UNLOCKWINDOW ReleaseSemaphore(&GetPrivIBase(IntuitionBase)->WindowLock);
206 /* jDc: do NOT disable this! */
208 #define USEGADGETLOCK
210 #define LOCKGADGET ObtainSemaphore(&GetPrivIBase(IntuitionBase)->GadgetLock);
211 #define UNLOCKGADGET ReleaseSemaphore(&GetPrivIBase(IntuitionBase)->GadgetLock);
212 #define LOCKWINDOWLAYERS(w) ;
213 #define UNLOCKWINDOWLAYERS(w) ;
217 #define LOCKWINDOWLAYERS(w) LockLayerInfo(&w->WScreen->LayerInfo); \
218 if (((struct IntWindow *)(w))->borderlayer) {LockLayer(0,((struct IntWindow *)(w))->borderlayer);}; \
219 if (((struct IntWindow *)(w))->wlayer) {LockLayer(0,((struct IntWindow *)(w))->wlayer);};
220 #define UNLOCKWINDOWLAYERS(w) if (((struct IntWindow *)(w))->wlayer) {UnlockLayer(((struct IntWindow *)(w))->wlayer);}; \
221 if (((struct IntWindow *)(w))->borderlayer) {UnlockLayer(((struct IntWindow *)(w))->borderlayer);} \
222 UnlockLayerInfo(&w->WScreen->LayerInfo);
225 #define WLAYER(w) (((struct IntWindow *)(w))->wlayer)
226 #define BLAYER(w) (((struct IntWindow *)(w))->borderlayer)
228 //#define TIMEVALWINDOWACTIVATION
230 /* If PROP_RENDER_OPTIMIZATION is set to 1, propgadget code tries to optimize rendering
231 during prop gadget knob movement. Only area of the propgadget that is affected by
232 prop gadget knob movement is re-rendered.
234 Unfortunately this can fail with some programs, like DOpus 4.x text viewer */
236 #define PROP_RENDER_OPTIMIZATION 0
238 #define SINGLE_SETPOINTERPOS_PER_EVENTLOOP 1
240 #ifndef LIFLG_SUPPORTS_OFFSCREEN_LAYERS
241 /* Defined in <graphics/layers.h>, but apparently not on MorphOS. */
242 # define LIFLG_SUPPORTS_OFFSCREEN_LAYERS 2
245 #define INTUITIONNAME "intuition.library"
246 #define MENUBARLABELCLASS "menubarlabelclass"
248 #define DEFPUBSCREEN TRUE
250 #define USE_NEWDISPLAYBEEP 1
252 #define TITLEBUFFERLEN 255
254 #define USE_IDCMPUPDATE_MESSAGECACHE 0
257 #if INCLUDE_VERSION < 50
259 /********************************************************************************/
260 /* imageclass.h AROS extensions */
262 #define SYSIA_WithBorder IA_FGPen /* default: TRUE */
263 #define SYSIA_Style IA_BGPen /* default: SYSISTYLE_NORMAL */
265 #define SYSISTYLE_NORMAL 0
266 #define SYSISTYLE_GADTOOLS 1 /* to get arrow images in gadtools look */
268 /********************************************************************************/
269 /* gadgetclass.h AROS extenstions */
271 /* This method is invoked to learn about the sizing requirements of your class,
272 before an object is created. This is AROS specific. */
276 STACKED ULONG MethodID
; /* GM_DOMAIN */
277 STACKED
struct GadgetInfo
*gpd_GInfo
; /* see <intuition/cghooks.h> */
278 STACKED
struct RastPort
*gpd_RPort
; /* RastPort to calculate dimensions for. */
279 STACKED LONG gpd_Which
; /* see below */
280 STACKED
struct IBox gpd_Domain
; /* Resulting domain. */
281 STACKED
struct TagItem
*gpd_Attrs
; /* Additional attributes. None defined,
285 /********************************************************************************/
288 #define GDOMAIN_MINIMUM 0 /* Calculate minimum size. */
289 #define GDOMAIN_NOMINAL 1 /* Calculate nominal size. */
290 #define GDOMAIN_MAXIMUM 2 /* Calculate maximum size. */
292 #endif /* INCLUDE_VERSION < 50 */
293 #endif /* ifdef __MORPHOS__ */
295 /********************************************************************************/
296 #define GM_MOVETEST 8
297 /* this method is used by our draggad to tell if it's OK to move the mouse when window
298 is near screen boundaries and offscreen is disabled. msg = gpInput*/
300 #define MOVETEST_MOVE 0
301 #define MOVETEST_ADJUSTPOS 1
303 /* ObtainGIRPort must install a 0 clipregion and
304 set scrollx/scrolly of layer to 0. Since this
305 will be restored only when ReleaseGIRPort is
306 called, we must backup the orig values somewhere */
310 struct Region
*clipregion
;
320 #define IP_OLDOVERSCAN 3
321 #define IP_OLDICONTROL 4
322 #define IP_OLDPOINTER 7
323 #define IP_OLDPALETTE 8
326 #define IP_SCREENMODE 1
327 #define IP_FONT 101//2
328 #define IP_ICONTROL 102//4
329 #define IP_POINTER 103//7
330 #define IP_PTRCOLOR 104//8
331 #define IP_PALETTE 105
332 #define IP_IACTIONS 20
333 #define IP_IEXTENSIONS 21
334 #define IP_INPUTEXT 22
338 struct IScreenModePrefs
347 struct IIControlPrefs
353 UBYTE ic_FrontToBack
;
360 #include <intuition/iprefs.h>
371 #define COLORTABLEENTRIES 8
375 #define RESOURCELIST_HASHSIZE 256
377 #define RESOURCE_WINDOW 1
378 #define RESOURCE_SCREEN 2
387 /* Internal Screen Notification Data */
388 struct IntScreenNotify
391 struct MsgPort
*port
;
392 struct Task
*sigtask
;
401 struct IntIntuitionBase
403 struct IntuitionBase IBase
;
405 WORD _MinXMouse
,_MaxXMouse
; /* Old 1.3 Base entries*/
406 WORD _MinYMouse
,_MaxYMouse
; /* Old 1.3 Base entries*/
407 ULONG _StartSecs
,_StartMicros
; /* Old 1.3 Base entries*/
408 char *SystemRequestTitle
; /* written by locale as it seems..what a crappy interface*/
409 char *WorkbenchTitle
; /* written by locale as it seems..what a crappy interface*/
412 * savety pad for intuitionbase accesses
413 * probably needs to be smarter
418 /* Put local shit here, invisible for the user */
420 struct Library
*CyberGfxBase
;
421 struct Library
*MUIMasterBase
;
424 struct Library
*InputBase
;
425 struct Library
*TimerBase
;
426 struct MsgPort
*TimerMP
;
427 struct timerequest
*TimerIO
;
429 struct MsgPort
*WorkBenchMP
;
430 struct Screen
*WorkBench
;
431 struct SignalSemaphore
*IBaseLock
;
433 /* Intuition input handlers replyport. This one is set
434 int rom/inputhandler.c/InitIIH()
436 struct MsgPort
*IntuiReplyPort
;
437 struct MinList
*IntuiActionQueue
;
438 struct IOStdReq
*InputIO
;
439 struct MsgPort
*InputMP
;
441 /* Intuition Screennotify Replyport if SNOTIFY_WAIT_REPLY is specified */
443 struct MsgPort
*ScreenNotifyReplyPort
;
445 BOOL InputDeviceOpen
;
446 struct Interrupt
*InputHandler
;
448 struct Hook
*GlobalEditHook
;
449 /* The default global edit hook */
450 struct Hook DefaultEditHook
;
453 APTR DriverData
; /* Pointer which the driver may use */
455 struct Screen
*DefaultPubScreen
;
456 struct SignalSemaphore PubScrListLock
;
457 struct MinList PubScreenList
;
458 UWORD pubScrGlobalMode
;
460 struct SignalSemaphore ScreenNotificationListLock
;
461 struct List ScreenNotificationList
;
463 struct SignalSemaphore GadgetLock
;
464 struct SignalSemaphore MenuLock
;
465 struct SignalSemaphore WindowLock
;
466 struct SignalSemaphore IntuiActionLock
;
467 struct SignalSemaphore InputHandlerLock
;
468 struct LayerContext BackupLayerContext
;
470 struct IClass
*dragbarclass
;
471 struct IClass
*sizebuttonclass
;
475 struct Preferences
*DefaultPreferences
;
476 struct Preferences
*ActivePreferences
;
478 struct MsgPort
*MenuHandlerPort
;
481 struct TextFont
*ScreenFont
;
482 struct TextFont
*TopazFont
;
484 /* Dos function DisplayError() before intuition.library patched it */
485 APTR OldDisplayErrorFunc
;
487 struct SignalSemaphore ClassListLock
;
488 struct MinList ClassList
;
489 struct IClass RootClass
;
492 struct ViewExtra
*ViewLordExtra
;
497 ULONG
*SmallMenuPool
;
501 struct IScreenModePrefs ScreenModePrefs
;
502 struct IIControlPrefs IControlPrefs
;
504 struct IAction
*IControlActions
;
505 struct IControlExtensions IControlExtensions
;
506 ULONG NumIControlActions
;
507 struct InputPrefsExt InputPrefsExt
;
509 struct IClass
*pointerclass
;
510 Object
*DefaultPointer
;
512 UWORD DriPens2
[NUMDRIPENS
];
513 UWORD DriPens4
[NUMDRIPENS
];
514 UWORD DriPens8
[NUMDRIPENS
];
515 struct Color32 Colors
[COLORTABLEENTRIES
];
518 struct IntScreen
*MenuVerifyScreen
;
522 struct SignalSemaphore DataTypesSem
;
523 struct Library
*DataTypesBase
; /* should be opened ONLY by int_InitCustomChanges!*/
527 ULONG LastClickMicro
; /* for doubleclick to front */
528 ULONG DoubleClickCounter
;
529 ULONG DoubleClickButton
;
532 struct Hook transphook
; /* hook for windows with intui transp */
533 struct Hook notransphook
; /* hook for windows with no additional transp (borderless,etc) */
535 //#ifdef INTUITION_NOTIFY_SUPPORT // commented to avoid offset fuckup! - Piru
536 struct Library
*ScreenNotifyBase
;
537 struct Library
*NotifyIntuitionBase
;
540 struct RastPort DoGadgetMethodRP
;
541 struct GadgetInfo DoGadgetMethodGI
;
543 struct SignalSemaphore WinDecorSem
;
545 struct SignalSemaphore ScrDecorSem
;
547 struct SignalSemaphore MenuDecorSem
;
548 Object
*MenuDecorObj
;
550 Object
*DefWinDecorObj
;
551 Object
*DefScrDecorObj
;
552 Object
*DefMenuDecorObj
;
554 struct List Decorations
;
555 struct NewDecorator
*Decorator
;
561 #if USE_NEWDISPLAYBEEP
565 WORD prop_clickoffset_x
, prop_clickoffset_y
;
567 struct MinList ResourceList
[RESOURCELIST_HASHSIZE
];
569 /* Menu Look Settings */
575 struct ExtSprite
*sprite
;
576 WORD xoffset
, yoffset
;
580 struct SharedPointer
*CreateSharedPointer(struct ExtSprite
*, int, int, struct IntuitionBase
*);
581 void ObtainSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
582 void ReleaseSharedPointer(struct SharedPointer
*, struct IntuitionBase
*);
584 #ifdef INTUITION_NOTIFY_SUPPORT
585 void sn_DoNotify(ULONG type
, APTR value
, struct Library
*_ScreenNotifyBase
);
591 struct Screen
*dri_Screen
;
592 struct SignalSemaphore dri_WinDecorSem
;
593 Object
*dri_WinDecorObj
;
594 struct SignalSemaphore dri_ScrDecorSem
;
595 Object
*dri_ScrDecorObj
;
598 #define LOCK_WINDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
599 #define LOCKSHARED_WINDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
600 #define UNLOCK_WINDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->WinDecorSem);
602 #define LOCK_SCRDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
603 #define LOCKSHARED_SCRDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
604 #define UNLOCK_SCRDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->ScrDecorSem);
606 #define LOCK_MENUDECOR(IntuitionBase) ObtainSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
607 #define LOCKSHARED_MENUDECOR(IntuitionBase) ObtainSemaphoreShared(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
608 #define UNLOCK_MENUDECOR(IntuitionBase) ReleaseSemaphore(&((struct IntIntuitionBase *)(IntuitionBase))->MenuDecorSem);
612 struct Screen Screen
;
615 struct HashNode hashnode
;
616 struct IntDrawInfo DInfo
;
617 struct TTextAttr textattr
;
618 ULONG textattrtags
[3];
619 UWORD Pens
[NUMDRIPENS
];
620 struct PubScreenNode
*pubScrNode
;
623 struct Layer
*rootLayer
;
624 ULONG DisplayBeepColor0
[3];
625 struct Window
*DisplayBeepWindow
;
627 struct MonitorSpec
*Monitor
;
628 struct SharedPointer
*Pointer
;
629 struct Window
*MenuVerifyActiveWindow
;
630 int MenuVerifyTimeOut
;
631 int MenuVerifyMsgCount
;
632 ULONG MenuVerifySeconds
;
633 ULONG MenuVerifyMicros
;
634 ULONG DecorUserBufferSize
;
635 IPTR DecorUserBuffer
;
638 Object
*MenuDecorObj
;
639 struct NewDecorator
*Decorator
;
641 struct BitMap
*AllocatedBitmap
;
651 struct SkinInfo SkinInfo
;
652 struct RastPort
*TitlebarBufferRP
;
653 struct Window
*TitlebarBufferWin
;
654 ULONG TitlebarWinWidth
;
655 ULONG TitlebarWinActive
;
657 #if USE_NEWDISPLAYBEEP
658 UBYTE BeepingCounter
;
662 #define GetPrivScreen(s) ((struct IntScreen *)s)
665 #define SF_IsParent (0x0001)
666 #define SF_IsChild (0x0002)
667 #define SF_InvisibleBar (0x0004)
668 #define SF_AppearingBar (0x0008)
669 #define SF_SysFont (0x0010)
671 struct IntIntuiMessage
673 struct ExtIntuiMessage eimsg
;
676 ** The following field is needed, because in case of IDCMP_RAWKEY
677 ** IntuiMessage->IAddress is a pointer to this data, not the data
678 ** itself (which is the case for IDCMP_VANILLAKEY)
684 #define INT_INTUIMESSAGE(x) ((struct IntIntuiMessage *)(x))
688 /*extern struct IntuitionBase * IntuitionBase;*/
690 #define IW(window) ((struct IntWindow *) (window))
692 #define GetPubIBase(ib) ((struct IntuitionBase *)ib)
693 #define GetPrivIBase(ib) ((struct IntIntuitionBase *)ib)
699 #define CyberGfxBase (GetPrivIBase(IntuitionBase)->CyberGfxBase)
702 #define MUIMasterBase (GetPrivIBase(IntuitionBase)->MUIMasterBase)
709 #define InputBase (GetPrivIBase(IntuitionBase)->InputBase)
714 #define TimerBase (GetPrivIBase(IntuitionBase)->TimerBase)
719 #define TimerMP (GetPrivIBase(IntuitionBase)->TimerMP)
724 #define TimerIO (GetPrivIBase(IntuitionBase)->TimerIO)
726 #define PublicClassList ((struct List *)&(GetPrivIBase(IntuitionBase)->ClassList))
729 /* stegerg: one can have sysgadgets outside of window border! All sysgadgets in window
730 border must have set GACT_???BORDER and, if they are in a gzz window, also
733 #define IS_GZZ_GADGET(gad) (((gad)->GadgetType) & GTYP_GZZGADGET)
735 #define IS_BORDER_GADGET(gad) (IS_GZZ_GADGET(gad) || \
736 ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER)))
738 #define IS_SYS_GADGET(gad) (((gad)->GadgetType) & GTYP_SYSTYPEMASK)
740 #define IS_BOOPSI_GADGET(gad) (((gad)->GadgetType & GTYP_GTYPEMASK) == GTYP_CUSTOMGADGET)
742 /*#define IS_BORDER_GADGET(gad) \
743 (((gad->GadgetType) & GTYP_SYSGADGET) \
744 || ((gad)->Activation & (GACT_RIGHTBORDER|GACT_LEFTBORDER|GACT_TOPBORDER|GACT_BOTTOMBORDER))) */
746 #define IS_REQ_GADGET(gad) ((gad)->GadgetType & GTYP_REQGADGET)
748 #define IS_SCREEN_GADGET(gad) ((gad)->GadgetType & GTYP_SCRGADGET)
750 #define SET_GI_RPORT(gi, w, req, gad) \
751 (gi)->gi_RastPort = (IS_SCREEN_GADGET(gad) ? \
752 ((gi)->gi_Screen->BarLayer ? (gi)->gi_Screen->BarLayer->rp : NULL) : \
753 (IS_BORDER_GADGET(gad) ? (w)->BorderRPort : \
754 ((req) ? ((req)->ReqLayer->rp) : (w)->RPort)) \
758 #define REFRESHGAD_BOOPSI 1 /* boopsi gadgets */
759 #define REFRESHGAD_BORDER 2 /* gadgets in window border */
760 #define REFRESHGAD_REL 4 /* gadgets with GFLG_RELRIGHT, GFLG_RELBOTTOM,GFLG_RELWIDTH, GFLG_RELHEIGHT */
761 #define REFRESHGAD_RELS 8 /* GFLG_RELSPECIAL gadgets */
762 #define REFRESHGAD_TOPBORDER 16 /* used by setwindowtitle */
763 #define REFRESHGAD_NOGADTOOLS 32 /* used in some cases for _mustbe_ */
765 #define SYSGADGET_ACTIVE (iihdata->ActiveSysGadget != NULL)
767 VOID
int_refreshglist(struct Gadget
*gadgets
, struct Window
*window
,
768 struct Requester
*requester
, LONG numGad
, LONG mustbe
, LONG mustnotbe
,
769 struct IntuitionBase
*IntuitionBase
);
771 VOID
int_RefreshWindowFrame(struct Window
*window
, LONG mustbe
, LONG mustnotbe
,
773 struct IntuitionBase
*IntuitionBase
);
775 #define int_refreshwindowframe(a,b,c,d) int_RefreshWindowFrame(a,b,c,0,d);
777 /* Keep the system gadgets in the same order than the original intuition,
778 * some programs make bad asumptions about that...
796 #define SYSGAD(w, idx) (((struct IntWindow *)(w))->sysgads[idx])
800 struct Window window
;
802 Object
*sysgads
[NUM_SYSGADS
];
803 struct Image
*AmigaKey
;
804 struct Image
*Checkmark
;
805 struct Image
*SubMenuImage
;
806 struct Window
*menulendwindow
;
808 struct HashNode hashnode
;
810 /* When the Zoom gadget is pressed the window will have the
811 dimensions stored here. The old dimensions are backed up here
818 /* max. number of mousemove events to send to this window */
821 /* act. number of mousemove events sent to this window */
822 WORD num_mouseevents
;
824 /* max. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
825 messages to send to this window */
828 /* act. number of repeated IDCMP_RAWKEY, IDCMP_VANILLAKEY and IDCMP_IDCMPUPDATE
829 messages sent to this window */
830 WORD num_repeatevents
;
832 #if USE_IDCMPUPDATE_MESSAGECACHE
833 /* number of unreplied IDCMP_IDCMPUPDATE messages sent to window
834 used in few hacks :) */
835 WORD num_idcmpupdate
;
838 WORD sizeimage_width
;
839 WORD sizeimage_height
;
849 ULONG extrabuttonsid
; /* replaces ETI_Dummy if apps wishes it */
851 ULONG titlepos
; /* used by titlebar pattern fill stuff */
858 struct Region
*transpregion
;
859 struct Hook
*usertransphook
;
860 struct Region
*usertranspregion
;
864 struct Region
*trashregion
;
866 char titlebuffer
[TITLEBUFFERLEN
+1];
868 #if USE_IDCMPUPDATE_MESSAGECACHE
869 struct IntuiMessage
*messagecache
; //for idcmpupdate cache
872 struct Layer
*wlayer
;
873 struct Layer
*borderlayer
;
875 struct timeval lastmsgsent
;
876 struct timeval lastmsgreplied
;
878 #ifdef TIMEVALWINDOWACTIVATION
879 struct timeval activationtime
;
883 struct Hook custombackfill
;
886 struct Hook DefaultWindowShapeHook
;
888 struct Region
*OutlineShape
;
889 ULONG DecorUserBufferSize
;
890 IPTR DecorUserBuffer
;
893 #define SPFLAG_ICONIFIED 1
894 #define SPFLAG_NOICONIFY 2
895 #define SPFLAG_SKININFO 4
896 #define SPFLAG_LAYERREFRESH 8
897 #define SPFLAG_TRANSPHOOK 16
898 #define SPFLAG_LAYERRESIZED 32
899 #define SPFLAG_USERPORT 64
900 #define SPFLAG_IAMDEAD 128
901 #define SPFLAG_CLOSING 256 //used with iamdead
902 #define SPFLAG_WANTBUFFER 512
904 #define HELPF_ISHELPGROUP 1
905 #define HELPF_GADGETHELP 2
907 #define IS_NOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? TRUE : FALSE)
908 #define IS_DOCAREREFRESH(win) (((win)->Flags & WFLG_NOCAREREFRESH) ? FALSE : TRUE )
909 #define IS_SIMPLEREFRESH(win) (((win)->Flags & WFLG_SIMPLE_REFRESH) ? TRUE : FALSE)
910 #define IS_GZZWINDOW(win) (((win)->Flags & WFLG_GIMMEZEROZERO) ? TRUE : FALSE)
913 /* Flag definitions for MoreFlags */
915 #define WMFLG_NOTIFYDEPTH (1 << 0) /* Window wants notification when
916 it's depth arranged */
918 #define WMFLG_DO_UNLOCKPUBSCREEN (1 << 1)
919 #define WMFLG_MENUHELP (1 << 2)
920 #define WMFLG_POINTERDELAY (1 << 3)
921 #define WMFLG_TABLETMESSAGES (1 << 4)
923 // FIXME: ehm... this one should die a horrible death!
924 #define WMFLG_IAMMUI (1 << 5)
926 struct IntScreenBuffer
928 struct ScreenBuffer sb
;
933 /* Driver prototypes */
935 extern int intui_init (struct IntuitionBase
*);
936 extern int intui_open (struct IntuitionBase
*);
937 extern void intui_close (struct IntuitionBase
*);
938 extern void intui_expunge (struct IntuitionBase
*);
939 extern int intui_GetWindowSize (void);
940 extern void intui_WindowLimits (struct Window
* window
, WORD MinWidth
, WORD MinHeight
, UWORD MaxWidth
, UWORD MaxHeight
);
941 extern void intui_ActivateWindow (struct Window
*);
942 extern BOOL
intui_ChangeWindowBox (struct Window
* window
, WORD x
, WORD y
,
943 WORD width
, WORD height
);
944 extern void intui_CloseWindow (struct Window
*, struct IntuitionBase
*);
945 extern void intui_MoveWindow (struct Window
* window
, WORD dx
, WORD dy
);
946 extern int intui_OpenWindow (struct Window
*, struct IntuitionBase
*,
947 struct BitMap
* SuperBitMap
, struct Hook
*backfillhook
,
948 struct Region
* shape
, struct Hook
* shapehook
,
949 struct Layer
* parent
, ULONG visible
);
950 extern void intui_SetWindowTitles (struct Window
*, CONST_STRPTR
, CONST_STRPTR
);
951 extern void intui_RefreshWindowFrame(struct Window
*win
);
952 extern struct Window
*intui_FindActiveWindow(struct InputEvent
*ie
, struct IntuitionBase
*IntuitionBase
);
953 extern void intui_ScrollWindowRaster(struct Window
* win
, WORD dx
, WORD dy
, WORD xmin
,
954 WORD ymin
, WORD xmax
, WORD ymax
,
955 struct IntuitionBase
* IntuitionBase
);
957 /* wbtasktalk protos */
959 ULONG
TellWBTaskToCloseWindows(struct IntuitionBase
*IntuitionBase
);
960 ULONG
TellWBTaskToOpenWindows(struct IntuitionBase
*IntuitionBase
);
962 /* intuition_misc protos */
963 extern void LoadDefaultPreferences(struct IntuitionBase
* IntuitionBase
);
964 Object
* CreateStdSysImage(WORD which
, WORD preferred_height
, struct Screen
*scr
, APTR buffer
,
965 struct DrawInfo
*dri
, struct IntuitionBase
*IntuitionBase
);
966 extern void CheckRectFill(struct RastPort
*rp
, WORD x1
, WORD y1
, WORD x2
, WORD y2
, struct IntuitionBase
* IntuitionBase
);
967 extern BOOL
CreateWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
968 extern VOID
KillWinSysGadgets(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
969 extern void CreateScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
970 extern void KillScreenBar(struct Screen
*scr
, struct IntuitionBase
*IntuitionBase
);
971 extern void RenderScreenBar(struct Screen
*scr
, BOOL refresh
, struct IntuitionBase
*IntuitionBase
);
972 extern void UpdateMouseCoords(struct Window
*win
);
973 extern WORD
SubtractRectFromRect(struct Rectangle
*a
, struct Rectangle
*b
, struct Rectangle
*destrectarray
);
974 extern struct Region
*DefaultWindowShapeFunc(struct Hook
*hook
, struct Layer
*lay
, struct ShapeHookMsg
*msg
);
976 extern LONG
CalcResourceHash(APTR resource
);
977 extern void AddResourceToList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
978 extern void RemoveResourceFromList(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
979 extern BOOL
ResourceExisting(APTR resource
, UWORD resourcetype
, struct IntuitionBase
*IntuitionBase
);
980 void FireScreenNotifyMessage(IPTR data
, ULONG flag
, struct IntuitionBase
*IntuitionBase
);
981 void FireScreenNotifyMessageCode(IPTR data
, ULONG flag
, ULONG code
, struct IntuitionBase
*IntuitionBase
);
984 extern struct RastPort
*MyCreateRastPort(struct IntuitionBase
*);
985 extern struct RastPort
*MyCloneRastPort(struct IntuitionBase
*, struct RastPort
*);
986 extern void MyFreeRastPort(struct IntuitionBase
*, struct RastPort
*);
987 extern void MySetPointerPos(struct IntuitionBase
*, int, int);
988 struct TextFont
*SafeReopenFont(struct IntuitionBase
*, struct TextFont
**);
989 extern Object
*MakePointerFromPrefs(struct IntuitionBase
*, struct Preferences
*);
990 extern Object
*MakePointerFromData(struct IntuitionBase
*, UWORD
*, int, int, int, int);
991 void InstallPointer(struct IntuitionBase
*, Object
**, Object
*);
992 void SetPointerColors(struct IntuitionBase
*IntuitionBase
);
993 struct IClass
*InitITextIClass (struct IntuitionBase
* IntuitionBase
);
994 struct Gadget
*DoActivateGadget(struct Window
*win
, struct Requester
*req
, struct Gadget
*gad
,
995 struct IntuitionBase
*IntuitionBase
);
996 VOID
DoGMLayout(struct Gadget
*glist
, struct Window
*win
, struct Requester
*req
,
997 UWORD numgad
, BOOL initial
, struct IntuitionBase
*IntuitionBase
);
998 BOOL
ih_fire_intuimessage(struct Window
* w
, ULONG Class
, UWORD Code
, APTR IAddress
,
999 struct IntuitionBase
*IntuitionBase
);
1000 void NotifyDepthArrangement(struct Window
*w
, struct IntuitionBase
*IntuitionBase
);
1004 void int_PrintIText(struct RastPort
* rp
, struct IntuiText
* iText
,
1005 LONG leftOffset
, LONG topOffset
, BOOL ignore_attributes
,
1006 struct IntuitionBase
*IntuitionBase
);
1009 BOOL
IsLayerHiddenBySibling(struct Layer
*layer
, BOOL xx
);
1010 LONG
IsLayerVisible(struct Layer
*layer
);
1013 void SetupGInfo(struct GadgetInfo
*gi
, struct Window
*win
, struct Requester
*req
,
1014 struct Gadget
*gad
, struct IntuitionBase
*IntuitionBase
);
1016 IPTR
Custom_DoMethodA(struct IntuitionBase
*, struct Gadget
*, Msg
);
1022 #define DoMethodA(x, ...) (REG_A6=(LONG)IntuitionBase, DoMethodA(x, __VA_ARGS__))
1025 #define Custom_DoMethodA(x, ...) Custom_DoMethodA(IntuitionBase, x, __VA_ARGS__)
1027 #define HAS_CHILDREN(w) (NULL != w->firstchild)
1030 #define DeinitRastPort(rp) ((void)0)
1031 #define CreateRastPort() MyCreateRastPort(IntuitionBase)
1032 #define CloneRastPort(rp) MyCloneRastPort(IntuitionBase, rp)
1033 #define FreeRastPort(rp) MyFreeRastPort(IntuitionBase, rp)
1034 #define SetPointerPos(x, y) MySetPointerPos(IntuitionBase, x, y)
1035 #define MouseCoordsRelative() 1
1038 /* Replacement for dos.library/DisplayError() */
1039 AROS_UFP3(LONG
, Intuition_DisplayError
,
1040 AROS_UFPA(STRPTR
, formatStr
, A0
),
1041 AROS_UFPA(ULONG
, IDCMPFlags
, D0
),
1042 AROS_UFPA(APTR
, args
, A1
));
1044 #define POINTERA_SharedPointer 0x80039010
1047 #define dprintf kprintf
1050 #define DEBUG_ACTIVATEGADGET(x) ;
1051 #define DEBUG_ACTIVATEWINDOW(x) ;
1052 #define DEBUG_ADDCLASS(x) ;
1053 #define DEBUG_ADDGADGET(x) ;
1054 #define DEBUG_ADDGLIST(x) ;
1055 #define DEBUG_ALLOCINTUIMESSAGE(x) ;
1056 #define DEBUG_ALLOCSCREENBUFFER(x) ;
1057 #define DEBUG_ALOHAWORKBENCH(x) ;
1058 #define DEBUG_CHANGEWINDOWBOX(x) ;
1059 #define DEBUG_CLOSESCREEN(x) ;
1060 #define DEBUG_CLOSEWINDOW(x) ;
1061 #define DEBUG_CLOSEWORKBENCH(x) ;
1062 #define DEBUG_DISPOSEOBJECT(x) ;
1063 #define DEBUG_DOGADGETMETHOD(x) ;
1064 #define DEBUG_DRAWBORDER(x) ;
1065 #define DEBUG_FINDCLASS(x) ;
1066 #define DEBUG_FREEICDATA(x) ;
1067 #define DEBUG_FREEINTUIMESSAGE(x) ;
1068 #define DEBUG_FREESCREENBUFFER(x) ;
1069 #define DEBUG_FREESCREENDRAWINFO(x) ;
1070 #define DEBUG_GADGETMOUSE(x) ;
1071 #define DEBUG_GETATTR(x) ;
1072 #define DEBUG_GETDEFAULTPUBSCREEN(x) ;
1073 #define DEBUG_GETDEFPREFS(x) ;
1074 #define DEBUG_GETGADGETIBOX(x) ;
1075 #define DEBUG_GETPREFS(x) ;
1076 #define DEBUG_GETSCREENDATA(x) ;
1077 #define DEBUG_GETSCREENDRAWINFO(x) ;
1078 #define DEBUG_HIDEWINDOW(x) ;
1080 #define DEBUG_INIT(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1082 #define DEBUG_INIT(x) ;
1084 #define DEBUG_OPEN(x) ;
1085 #define DEBUG_CLOSE(x) ;
1086 #define DEBUG_INPUTEVENT(x) ;
1087 #define DEBUG_INTREFRESHGLIST(x) ;
1088 #define DEBUG_INTUITEXTLENGTH(x) ;
1089 #define DEBUG_LENDMENUS(x) ;
1090 #define DEBUG_LOCKPUBSCREEN(x) ;
1091 #define DEBUG_MAKECLASS(x) ;
1092 #define DEBUG_MODIFYIDCMP(x) ;
1093 #define DEBUG_NEWOBJECT(x) ;
1094 #define DEBUG_NEXTOBJECT(x) ;
1095 #define DEBUG_OBTAINGIRPORT(x) ;
1096 #define DEBUG_OFFGADGET(x) ;
1097 #define DEBUG_OFFMENU(x) ;
1098 #define DEBUG_ONGADGET(x) ;
1099 #define DEBUG_ONMENU(x) ;
1100 #define DEBUG_OPENSCREEN(x) ;
1101 #define DEBUG_OPENSCREENTAGLIST(x) ;
1102 #define DEBUG_OPENWINDOW(x) ;
1103 #define DEBUG_OPENWINDOWTAGLIST(x) ;
1104 #define DEBUG_OPENWORKBENCH(x) ;
1105 #define DEBUG_POINTER(x) ;
1106 #define DEBUG_PRINTITEXT(x) ;
1107 #define DEBUG_QUERYOVERSCAN(x) ;
1108 #define DEBUG_REFRESH(x) ;
1109 #define DEBUG_RELEASEGIRPORT(x) ;
1110 #define DEBUG_REMEMBER(x) ;
1111 #define DEBUG_REMOVEGLIST(x) ;
1112 #define DEBUG_REPORTMOUSE(x) ;
1113 #define DEBUG_REQUEST(x) ;
1114 #define DEBUG_SCROLLWINDOWRASTER(x) ;
1115 #define DEBUG_SENDINTUIMESSAGE(x) ;
1116 #define DEBUG_SETATTRS(x) ;
1117 #define DEBUG_SETGADGETATTRS(x) ;
1118 #define DEBUG_SETPOINTER(x) ;
1120 #define DEBUG_SETIPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1122 #define DEBUG_SETIPREFS(x) ;
1125 #define DEBUG_SETPREFS(x) if (SysBase->ex_DebugFlags & EXECDEBUGF_INIT) x;
1127 #define DEBUG_SETPREFS(x) ;
1129 #define DEBUG_SHOWWINDOW(x) ;
1130 #define DEBUG_UNLOCKPUBSCREEN(x) ;
1131 #define DEBUG_WINDOWLIMITS(x) ;
1132 #define DEBUG_WINDOWTOBACK(x) ;
1133 #define DEBUG_WINDOWTOFRONT(x) ;
1134 #define DEBUG_ZIPWINDOW(x) ;
1135 #define DEBUG_VISITOR(x) ;
1136 #define DEBUG_WORKBENCH(x) ;
1137 #define DEBUG_LOCKPUBSCREENLIST(x) ;
1138 #define DEBUG_UNLOCKPUBSCREENLIST(x) ;
1139 #define DEBUG_RETHINKDISPLAY(x) ;
1142 * Private data structures of the classes defined by intuition.library
1149 struct TagItem
*ic_Mapping
;
1150 struct TagItem
*ic_CloneTags
;
1151 ULONG ic_LoopCounter
;
1157 struct MinList memberlist
;
1163 /* render bevel only with no fill? */
1166 /* inverted bevel pens? */
1179 struct DrawInfo
*dri
;
1180 struct Image
*frame
;
1196 struct ExtGadget EG
;
1203 /* We use a propinfo structure, because we use the same routines
1204 for intuition propgadtets and in propgclass */
1206 struct PropInfo propinfo
;
1208 /* A little kludge: since the HandleMouseMove function
1209 wants dx/dy and not absolute mouse coords, we
1210 have to remember the last ones */
1215 /* One only have to store total or visble, and use some other
1216 formulas than those in the RKRM:L, but for
1217 code simplicity I store them all. */
1218 UWORD top
, visible
, total
;
1221 struct BBox
*old_knobbox
;
1222 struct Hook
*DisplayHook
;
1228 struct StringInfo StrInfo
;
1229 struct StringExtend StrExtend
;
1236 struct MinList memberlist
;
1237 struct Gadget
*activegad
;
1243 /* Current left- and topedge of moving window. Ie when the user releases
1244 the LMB after a windowdrag, the window's new coords will be (curleft, curtop)
1250 /* The current x and y coordinates relative to curleft/curtop */
1254 /* Whether the dragframe is currently drawn or erased */
1257 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1260 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1261 BOOL drag_layerlock
;
1262 #ifdef USEGADGETLOCK
1263 BOOL drag_gadgetlock
;
1265 BOOL drag_refreshed
;
1267 /* Rastport to use during update */
1268 struct RastPort
*rp
;
1270 UQUAD lasteventtime
;
1275 #ifdef USEWINDOWLOCK
1276 /* used to prevent windows from opening/closing while user drags a window */
1277 BOOL drag_windowlock
;
1280 struct Task
*movetask
;
1284 /* SizeButtonClass */
1285 struct sizebutton_data
1288 /* The current width and height of the rubber band frame */
1294 /* holds original sizes */
1300 /* the offset of the mouse pointer to the rubber band frame*/
1304 /* Whether the dragframe is currently drawn or erased */
1307 /* Used to tell GM_GOINACTIVE whether the drag was canceled or not */
1310 /* Used to tell GM_GOINACTIVE whether UnlockLayer() or not */
1311 BOOL drag_layerlock
;
1312 #ifdef USEGADGETLOCK
1313 BOOL drag_gadgetlock
;
1316 BOOL drag_refreshed
;
1318 /* Rastport to use during update */
1319 struct RastPort
*rp
;
1321 UQUAD lasteventtime
;
1323 #ifdef USEWINDOWLOCK
1324 /* used to prevent windows from opening/closing while user drags a window */
1325 BOOL drag_windowlock
;
1336 /* MenuBarLabelClass */
1337 struct MenuBarLabelData
1339 struct DrawInfo
*dri
;
1345 struct SharedPointer
*shared_pointer
;
1349 struct windecor_data
1351 ULONG userbuffersize
;
1355 struct scrdecor_data
1357 ULONG userbuffersize
;
1360 /* MenuDecorClass */
1361 struct menudecor_data
1363 ULONG userbuffersize
;
1366 #endif /* INTUITION_INTERN_H */