2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
7 #include <cybergraphx/cybergraphics.h>
8 #include <hidd/graphics.h>
10 #include <graphics/driver.h>
11 #include <graphics/sprite.h>
12 #include <intuition/intuition.h>
13 #include <intuition/intuitionbase.h>
14 #include <intuition/classes.h>
15 #include <intuition/classusr.h>
16 #include <intuition/monitorclass.h>
17 #include <proto/alib.h>
18 #include <proto/exec.h>
19 #include <proto/intuition.h>
20 #include <proto/oop.h>
21 #include <proto/utility.h>
23 #include "intuition_intern.h"
24 #include "monitorclass_intern.h"
25 #include "monitorclass_private.h"
27 /*****************************************************************************************
36 In AROS display drivers have associated BOOPSI objects of MONITORCLASS class.
37 This class provides information about relative physical placement of monitors
38 in user's workspace as well as some additional properties.
40 MONITORCLASS is a pseudo name. This class is in fact private to the system and
41 does not have a public ID. The user can't create objects of this class manually.
43 This class is fully compatible with MorphOS starting from v2.6.
45 *****************************************************************************************/
47 Object
*DisplayDriverNotify(APTR obj
, BOOL add
, struct IntuitionBase
*IntuitionBase
)
51 Object
*mon
= NewObject(GetPrivIBase(IntuitionBase
)->monitorclass
, NULL
, MA_MonitorHandle
, obj
, TAG_DONE
);
53 D(bug("[monitorclass] Created monitorclass object 0x%p\n", mon
));
55 /* Install default mouse pointer on the new monitor */
56 Object
*ptr
= GetPrivIBase(IntuitionBase
)->DefaultPointer
;
59 struct SharedPointer
*pointer
;
61 GetAttr(POINTERA_SharedPointer
, ptr
, (IPTR
*)&pointer
);
62 DoMethod(mon
, MM_SetPointerShape
, pointer
);
75 /***********************************************************************************/
77 static void SetPointerPos(struct MonitorData
*data
, struct IntuitionBase
*IntuitionBase
)
79 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
80 ULONG x
= data
->mouseX
;
81 ULONG y
= data
->mouseY
;
83 DB2(bug("[monitorclass] SetPointerPos(%d, %d), pointer 0x%p\n", x
, y
, data
->pointer
));
86 /* Update sprite position, just for backwards compatibility */
87 data
->pointer
->sprite
->es_SimpleSprite
.x
= x
;
88 data
->pointer
->sprite
->es_SimpleSprite
.y
= y
;
91 DB2(bug("[monitorclass] Physical coordinates: (%d, %d)\n", x
, y
));
92 HIDD_Gfx_SetCursorPos(data
->handle
->gfxhidd
, x
, y
);
95 /***********************************************************************************/
97 static void ActivationHandler(Object
*mon
, OOP_Object
*bitmap
)
99 Class
*cl
= OCLASS(mon
);
100 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
102 /* NewMonitor will be picked up by input handler when the next event arrives, so no signals etc */
103 GetPrivIBase(IntuitionBase
)->NewMonitor
= mon
;
106 /***********************************************************************************/
108 static BYTE
const pixelformats
[] = {
134 Object
*MonitorClass__OM_NEW(Class
*cl
, Object
*o
, struct opSet
*msg
)
136 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
137 struct Library
*UtilityBase
= GetPrivIBase(IntuitionBase
)->UtilityBase
;
138 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
139 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
140 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
141 OOP_AttrBase HiddPixFmtAttrBase
= GetPrivIBase(IntuitionBase
)->HiddPixFmtAttrBase
;
142 struct MonitorHandle
*handle
= (struct MonitorHandle
*)GetTagData(MA_MonitorHandle
, 0, msg
->ops_AttrList
);
143 HIDDT_ModeID mode
= vHidd_ModeID_Invalid
;
144 struct MonitorData
*data
;
145 OOP_Object
*sync
, *pixfmt
;
146 /* Tags order is important because CallBackData needs to be set before
147 function pointer. Otherwise the function can be called with a wrong
149 struct TagItem tags
[] = {
150 {aHidd_Gfx_ActiveCallBackData
, 0 },
151 {aHidd_Gfx_ActiveCallBack
, (IPTR
)ActivationHandler
},
155 D(kprintf("[monitorclass] OM_NEW\n"));
160 o
= (Object
*)DoSuperMethodA(cl
, o
, (Msg
)msg
);
164 data
= INST_DATA(cl
, o
);
166 data
->handle
= handle
;
168 /* We can't list driver's pixelformats, we can list only modes. This does not harm however,
169 just some pixelformats will be processed more than once */
170 while ((mode
= HIDD_Gfx_NextModeID(handle
->gfxhidd
, mode
, &sync
, &pixfmt
)) != vHidd_ModeID_Invalid
) {
174 OOP_GetAttr(pixfmt
, aHidd_PixFmt_StdPixFmt
, &stdpf
);
175 cgxpf
= pixelformats
[stdpf
];
176 D(bug("[monitorclass] Mode 0x%08lX, StdPixFmt %lu, CGX pixfmt %d\n", mode
, stdpf
, cgxpf
));
179 data
->pfobjects
[cgxpf
] = pixfmt
;
180 data
->pixelformats
[cgxpf
] = TRUE
;
184 tags
[0].ti_Data
= (IPTR
)o
;
185 OOP_SetAttrs(handle
->gfxhidd
, tags
);
187 ObtainSemaphore(&GetPrivIBase(IntuitionBase
)->MonitorListSem
);
188 AddTail((struct List
*)&GetPrivIBase(IntuitionBase
)->MonitorList
, (struct Node
*)data
);
189 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->MonitorListSem
);
194 /*****************************************************************************************
206 Query monitor driver name
218 *****************************************************************************************/
220 /*****************************************************************************************
232 Query video card hardware manufacturer name
235 Not all drivers may specify manufacturer string. NULL is a valid return value.
245 *****************************************************************************************/
247 /*****************************************************************************************
259 Query video card hardware's numeric manufacturer ID (which may come from PCI,
263 Not all drivers may have assigned IDs. For example VGA driver and virtual
264 hosted drivers do not associate themselves with any IDs.
275 *****************************************************************************************/
277 /*****************************************************************************************
289 Query video card hardware's numeric product ID (which may come from PCI, Zorro, etc).
292 Not all drivers may have assigned IDs. For example VGA driver and virtual
293 hosted drivers do not associate themselves with any IDs.
304 *****************************************************************************************/
306 /*****************************************************************************************
318 Query total size of video card memory in bytes.
331 *****************************************************************************************/
333 /*****************************************************************************************
345 Query table of supported pixelformats.
347 A returned value is a pointer to static array of ULONGs, one ULONG per CyberGraphX
348 pixelformat. Values of these ULONGs are actually booleans. TRUE value in the array
349 says that the pixelformat is supported, FALSE means it's not.
356 GetAttr(MA_PixelFormats, monitor, (IPTR *)&pfs);
357 if (pfs[PUXFMT_LUT8])
358 printf("The display driver supports LUT8 format\n");
367 *****************************************************************************************/
369 /*****************************************************************************************
381 Get a pointer to a monitor placed in top-left diagonal direction relative to
384 This attribute is used to describe relative placement of monitors in user's
385 physical environment.
392 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
396 MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor, MA_MiddleRightMonitor,
397 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
401 *****************************************************************************************/
403 /*****************************************************************************************
415 Get a pointer to a monitor placed in top direction relative to the current one.
417 This attribute is used to describe relative placement of monitors in user's
418 physical environment.
425 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
429 MA_TopLeftMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor, MA_MiddleRightMonitor,
430 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
434 *****************************************************************************************/
436 /*****************************************************************************************
448 Get a pointer to a monitor placed in top-right diagonal direction relative to
451 This attribute is used to describe relative placement of monitors in user's
452 physical environment.
459 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
463 MA_TopLeftMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor, MA_MiddleRightMonitor,
464 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
468 *****************************************************************************************/
470 /*****************************************************************************************
482 Get a pointer to a monitor placed in left direction relative to
485 This attribute is used to describe relative placement of monitors in user's
486 physical environment.
493 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
497 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleRightMonitor,
498 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
502 *****************************************************************************************/
504 /*****************************************************************************************
507 MA_MiddleRightMonitor
516 Get a pointer to a monitor placed in right direction relative to
519 This attribute is used to describe relative placement of monitors in user's
520 physical environment.
527 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
531 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor,
532 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
536 *****************************************************************************************/
538 /*****************************************************************************************
550 Get a pointer to a monitor placed in bottom-left diagonal direction relative to
553 This attribute is used to describe relative placement of monitors in user's
554 physical environment.
561 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
565 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor,
566 MA_MiddleRightMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
570 *****************************************************************************************/
572 /*****************************************************************************************
575 MA_BottomMiddleMonitor
584 Get a pointer to a monitor placed in bottom direction relative to the current one.
586 This attribute is used to describe relative placement of monitors in user's
587 physical environment.
594 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
598 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor,
599 MA_MiddleRightMonitor, MA_BottomLeftMonitor, MA_BottomRightMonitor
603 *****************************************************************************************/
605 /*****************************************************************************************
608 MA_BottomRightMonitor
617 Get a pointer to a monitor placed in bottom-right diagonal direction relative to
620 This attribute is used to describe relative placement of monitors in user's
621 physical environment.
628 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
632 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor,
633 MA_MiddleRightMonitor, MA_BottomLeftMonitor, MA_BottomMiddleMonitor
637 *****************************************************************************************/
639 /*****************************************************************************************
651 Query if the display driver supports gamma control
660 MM_GetDefaultGammaTables, MM_SetDefaultGammaTables
664 *****************************************************************************************/
666 /*****************************************************************************************
678 Query supported mouse pointer sprite formats.
680 The returned value is a combination of the following bit flags:
681 PointerType_3Plus1 - color 0 transparent, 1-3 visible (Amiga(tm) chipset sprite)
682 PointerType_2Plus1 - color 0 transparent, 1 undefined (can be for example clear or
683 inverse), 2-3 visible
684 PointerType_ARGB - Direct color bitmap (hi-color or truecolor, possibly with alpha
698 *****************************************************************************************/
700 /*****************************************************************************************
712 Query CyberGraphX driver name. It is the name which can be given to
713 cybergraphics.library/BestCModeIDTagList() as CYBRBIDTG_BoardName value.
726 *****************************************************************************************/
728 /*****************************************************************************************
740 Query video card's memory clock in Hz. 0 is a valid value meaning 'unknown'.
753 *****************************************************************************************/
755 /*****************************************************************************************
767 Check if this monitor is a window on hosted OS desktop.
769 This means that the host OS is responsible for handling mouse input and display
770 activation. Monitors with this attribute set to TRUE should be ignored by
771 multi-display desktop configuration software.
773 These monitors should have no spatial links to other monitors. Activation of these
774 monitors is done by clicking on their windows on the host's desktop and is handled
775 by the driver itself.
778 This attribute is AROS-specific, it does not exist in MorphOS.
788 *****************************************************************************************/
790 /***********************************************************************************/
792 IPTR
MonitorClass__OM_GET(Class
*cl
, Object
*o
, struct opGet
*msg
)
794 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
795 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
796 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
797 OOP_AttrBase HiddAttrBase
= GetPrivIBase(IntuitionBase
)->HiddAttrBase
;
798 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
799 struct MonitorData
*data
= INST_DATA(cl
, o
);
801 D(kprintf("[monitorclass] OM_GET\n"));
803 switch (msg
->opg_AttrID
)
806 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Name
, msg
->opg_Storage
);
809 case MA_Manufacturer
:
810 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_ProducerName
, msg
->opg_Storage
);
813 case MA_ManufacturerID
:
814 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Producer
, msg
->opg_Storage
);
818 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Product
, msg
->opg_Storage
);
822 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_MemorySize
, msg
->opg_Storage
);
825 case MA_PixelFormats
:
826 *msg
->opg_Storage
= (IPTR
)data
->pixelformats
;
829 case MA_TopLeftMonitor
:
830 *msg
->opg_Storage
= (IPTR
)data
->topleft
;
833 case MA_TopMiddleMonitor
:
834 *msg
->opg_Storage
= (IPTR
)data
->topmiddle
;
837 case MA_TopRightMonitor
:
838 *msg
->opg_Storage
= (IPTR
)data
->topright
;
841 case MA_MiddleLeftMonitor
:
842 *msg
->opg_Storage
= (IPTR
)data
->middleleft
;
845 case MA_MiddleRightMonitor
:
846 *msg
->opg_Storage
= (IPTR
)data
->middleright
;
849 case MA_BottomLeftMonitor
:
850 *msg
->opg_Storage
= (IPTR
)data
->bottomleft
;
853 case MA_BottomMiddleMonitor
:
854 *msg
->opg_Storage
= (IPTR
)data
->bottommiddle
;
857 case MA_BottomRightMonitor
:
858 *msg
->opg_Storage
= (IPTR
)data
->bottomright
;
861 case MA_GammaControl
:
862 *msg
->opg_Storage
= HIDD_Gfx_GetGamma(data
->handle
->gfxhidd
, NULL
, NULL
, NULL
);
866 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_HWSpriteTypes
, msg
->opg_Storage
);
870 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_DriverName
, msg
->opg_Storage
);
874 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_MemoryClock
, msg
->opg_Storage
);
878 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_IsWindowed
, msg
->opg_Storage
);
882 return DoSuperMethodA(cl
, o
, (Msg
)msg
);
888 /***********************************************************************************/
890 IPTR
MonitorClass__OM_SET(Class
*cl
, Object
*o
, struct opSet
*msg
)
892 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
893 struct Library
*UtilityBase
= GetPrivIBase(IntuitionBase
)->UtilityBase
;
894 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
895 struct MonitorData
*data
= INST_DATA(cl
, o
);
896 struct TagItem
*tag
, *tstate
;
898 tstate
= msg
->ops_AttrList
;
899 while((tag
= NextTagItem(&tstate
))) {
900 switch (tag
->ti_Tag
) {
901 case MA_TopLeftMonitor
:
902 data
->topleft
= (Object
*)tag
->ti_Data
;
905 case MA_TopMiddleMonitor
:
906 data
->topmiddle
= (Object
*)tag
->ti_Data
;
909 case MA_TopRightMonitor
:
910 data
->topright
= (Object
*)tag
->ti_Data
;
913 case MA_MiddleLeftMonitor
:
914 data
->middleleft
= (Object
*)tag
->ti_Data
;
917 case MA_MiddleRightMonitor
:
918 data
->middleright
= (Object
*)tag
->ti_Data
;
921 case MA_BottomLeftMonitor
:
922 data
->bottomleft
= (Object
*)tag
->ti_Data
;
925 case MA_BottomMiddleMonitor
:
926 data
->bottommiddle
= (Object
*)tag
->ti_Data
;
929 case MA_BottomRightMonitor
:
930 data
->bottomright
= (Object
*)tag
->ti_Data
;
933 case MA_PointerVisible
:
934 HIDD_Gfx_SetCursorVisible(data
->handle
->gfxhidd
, tag
->ti_Data
);
938 return DoSuperMethodA(cl
, o
, (Msg
)msg
);
941 /***********************************************************************************/
943 #define Relink(nextAttr, prev, prevAttr, next) \
945 SetAttrs(prev, nextAttr, next, TAG_DONE); \
947 SetAttrs(next, prevAttr, prev, TAG_DONE)
949 IPTR
MonitorClass__OM_DISPOSE(Class
*cl
, Object
*o
, Msg msg
)
951 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
952 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
953 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
954 struct MonitorData
*data
= INST_DATA(cl
, o
);
955 struct TagItem tags
[] = {
956 {aHidd_Gfx_ActiveCallBack
, 0},
960 D(kprintf("MonitorClass: OM_DISPOSE\n"));
962 /* Disable activation callback */
963 OOP_SetAttrs(data
->handle
->gfxhidd
, tags
);
965 ObtainSemaphore(&GetPrivIBase(IntuitionBase
)->MonitorListSem
);
966 Remove((struct Node
*)data
);
968 /* Remove this monitor from spatial links */
969 Relink(MA_BottomRightMonitor
, data
->topleft
, MA_TopLeftMonitor
, data
->bottomright
);
970 Relink(MA_BottomMiddleMonitor
, data
->topmiddle
, MA_TopMiddleMonitor
, data
->bottommiddle
);
971 Relink(MA_BottomLeftMonitor
, data
->topright
, MA_TopRightMonitor
, data
->bottomleft
);
972 Relink(MA_MiddleLeftMonitor
, data
->middleright
, MA_MiddleRightMonitor
, data
->middleleft
);
974 /* If an active monitor is being removed, we should activate another one */
975 if (GetPrivIBase(IntuitionBase
)->ActiveMonitor
== o
)
976 ActivateMonitor((Object
*)GetHead(&GetPrivIBase(IntuitionBase
)->MonitorList
), -1, -1, IntuitionBase
);
978 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->MonitorListSem
);
980 return DoSuperMethodA(cl
, o
, msg
);
983 /************************************************************************************
989 DoMethod(Object *obj, ULONG MethodID, ULONG PixelFormat, struct BitMap **Store);
991 DoMethodA(Object *obj, struct msGetRootBitMap *msg);
996 This method is provided only for source code compatibility with MorphOS operating
999 Under MorphOS this method returns a pointer to internal root bitmap of the
1000 display driver corresponding to the specified pixelformat. Displayable bitmaps are
1001 supposed to be created as friends of the root bitmap.
1003 In AROS displayable bitmaps need complete display mode information and not
1004 only pixelformat. So this method will never be implemented and will always return NULL
1005 pointer. In order to create a displayable RTG bitmap on AROS the user needs to supply
1006 a taglist with BMATags_DisplayID specification to AllocBitMap() function.
1009 obj - A monitor object
1010 MethodID - MM_GetRootBitMap
1011 PixelFormat - A CyberGraphX pixelformat code to get root bitmap for
1012 Store - A storage where root bitmap pointer will be placed.
1024 graphics.library/AllocBitMap()
1028 ************************************************************************************/
1030 IPTR
MonitorClass__MM_GetRootBitMap(Class
*cl
, Object
*obj
, struct msGetRootBitMap
*msg
)
1037 /************************************************************************************
1043 DoMethod(Object *obj, ULONG MethodID, ULONG PixelFormat, ULONG *Store);
1045 DoMethodA(Object *obj, struct msQuery3DSupport *msg);
1050 Ask the display driver for type of 3D support for the given pixelformat.
1052 Supplied storage will be filled with one of:
1053 MSQUERY3D_UNKNOWN - Unsupported pixelformat or some internal error
1054 MSQUERY3D_NODRIVER - There is no 3D support for the given pixelformat
1055 MSQUERY3D_SWDRIVER - A software 3D support is available for the given
1057 MSQUERY3D_HWDRIVER - A hardware 3D support is available for the given
1061 obj - A monitor object to query
1062 MethodID - MM_Query3DSupport
1063 PixelFormat - A CyberGraphX pixelformat code
1064 Store - A pointer to a storage where return value will be placed
1079 ************************************************************************************/
1081 IPTR
MonitorClass__MM_Query3DSupport(Class
*cl
, Object
*obj
, struct msQuery3DSupport
*msg
)
1083 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1084 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
1085 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1086 OOP_AttrBase HiddPixFmtAttrBase
= GetPrivIBase(IntuitionBase
)->HiddPixFmtAttrBase
;
1087 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1088 OOP_Object
*pf
= data
->pfobjects
[msg
->PixelFormat
];
1091 if (HIDD_Gfx_QueryHardware3D(data
->handle
->gfxhidd
, pf
))
1092 *msg
->Store
= MSQUERY3D_HWDRIVER
;
1096 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &depth
);
1098 *msg
->Store
= MSQUERY3D_SWDRIVER
;
1100 *msg
->Store
= MSQUERY3D_NODRIVER
;
1103 *msg
->Store
= MSQUERY3D_UNKNOWN
;
1108 /************************************************************************************
1111 MM_GetDefaultGammaTables
1114 DoMethod(Object *obj, ULONG MethodID, UBYTE *Red, UBYTE *Green, UBYTE *Blue);
1116 DoMethodA(Object *obj, struct msGetDefaultGammaTables *msg);
1121 Get default gamma correction tables for the monitor
1124 obj - A monitor object to query
1125 MethodID - MM_GetDefaultGammaTables
1126 Red - A pointer to an array of 256 bytes where gamma correction data for
1127 red component will be placed. You may speciy a NULL pointer in order
1128 to ignore this component.
1129 Green - A pointer to an array of 256 bytes where gamma correction data for
1130 green component will be placed. You may speciy a NULL pointer in order
1131 to ignore this component.
1132 Blue - A pointer to an array of 256 bytes where gamma correction data for
1133 blue component will be placed. You may speciy a NULL pointer in order
1134 to ignore this component.
1146 MM_SetDefaultGammaTables
1150 ************************************************************************************/
1152 IPTR
MonitorClass__MM_GetDefaultGammaTables(Class
*cl
, Object
*obj
, struct msGetDefaultGammaTables
*msg
)
1154 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1155 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1156 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1158 /* Currently we don't use per-screen gamma tables, so we just forward the request
1160 If we implement per-screen gamma correction, we'll need more sophisticated
1162 return HIDD_Gfx_GetGamma(data
->handle
->gfxhidd
, msg
->Red
, msg
->Green
, msg
->Blue
);
1165 /************************************************************************************
1168 MM_GetDefaultPixelFormat
1171 DoMethod(Object *obj, ULONG MethodID, ULONG Depth, ULONG *Store);
1173 DoMethodA(Object *obj, struct msGetDefaultPixelFormat *msg);
1178 Get driver's preferred pixelformat for specified bitmap depth.
1181 obj - A monitor object
1182 MethodID - MM_GetDefaultPixelFormat
1183 Depth - Depth to ask about
1184 Store - A pointer to an ULONG location where CyberGraphX pixelformat
1185 number will be placed. -1 means unsupported depth.
1200 ************************************************************************************/
1202 IPTR
MonitorClass__MM_GetDefaultPixelFormat(Class
*cl
, Object
*obj
, struct msGetDefaultPixelFormat
*msg
)
1204 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1205 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
1206 OOP_AttrBase HiddPixFmtAttrBase
= GetPrivIBase(IntuitionBase
)->HiddPixFmtAttrBase
;
1207 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1210 for (i
= 0; i
< MONITOR_MAXPIXELFORMATS
; i
++) {
1211 if (data
->pfobjects
[i
]) {
1214 OOP_GetAttr(data
->pfobjects
[i
], aHidd_PixFmt_Depth
, &depth
);
1215 if (depth
== msg
->Depth
) {
1222 if (i
== MONITOR_MAXPIXELFORMATS
)
1228 /************************************************************************************
1234 DoMethod(Object *obj, ULONG MethodID, ULONG PointerType, ULONG *Width, ULONG *Height);
1236 DoMethodA(Object *obj, struct msGetPointerBounds *msg);
1242 Get maximum allowed size of mouse pointer sprite.
1245 obj - A monitor object
1246 MethodID - MM_GetPointerBounds
1247 PointerType - Pointer type (one of PointerType_...)
1248 Width - A pointer to an ULONG location where width will be placed.
1249 Height - A pointer to an ULONG location where height will be placed.
1252 FALSE is given pointer type is not supported, TRUE otherwise.
1255 Width and Height are considered undefined if the method returns FALSE.
1266 ************************************************************************************/
1268 IPTR
MonitorClass__MM_GetPointerBounds(Class
*cl
, Object
*obj
, struct msGetPointerBounds
*msg
)
1270 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1271 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1272 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1274 return HIDD_Gfx_GetMaxSpriteSize(data
->handle
->gfxhidd
, msg
->PointerType
, msg
->Width
, msg
->Height
);
1277 /************************************************************************************
1283 DoMethod(Object *obj, ULONG MethodID);
1285 DoMethodA(Object *obj, Msg *msg);
1290 Starts screensaver on the monitor.
1292 At the moment AROS has no integrated screensaver support. The method is
1293 considered reserved and not implemented.
1296 obj - A monitor object
1297 MethodID - MM_RunBlanker
1309 MM_EnterPowerSaveMode, MM_ExitBlanker
1313 ************************************************************************************/
1315 IPTR
MonitorClass__MM_RunBlanker(Class
*cl
, Object
*obj
, Msg
*msg
)
1317 /* We have no integrated screensaver support */
1322 /************************************************************************************
1325 MM_EnterPowerSaveMode
1328 DoMethod(Object *obj, ULONG MethodID);
1330 DoMethodA(Object *obj, Msg *msg);
1335 Starts power saving mode on the monitor.
1338 obj - A monitor object
1339 MethodID - MM_EnterPowerSaveMode
1351 MM_RunBlanker, MM_ExitBlanker
1354 Current implementation just immediately sets DMPS level to "Off" for the
1357 ************************************************************************************/
1359 IPTR
MonitorClass__MM_EnterPowerSaveMode(Class
*cl
, Object
*obj
, Msg
*msg
)
1361 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1362 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
1363 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
1364 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1365 struct TagItem tags
[] =
1367 {aHidd_Gfx_DPMSLevel
, vHidd_Gfx_DPMSLevel_Off
},
1371 return OOP_SetAttrs(data
->handle
->gfxhidd
, tags
);
1374 /************************************************************************************
1380 DoMethod(Object *obj, ULONG MethodID);
1382 DoMethodA(Object *obj, Msg *msg);
1387 Stops screensaver and/or power saving mode on the monitor.
1390 obj - A monitor object
1391 MethodID - MM_ExitBlanker
1403 MM_EnterPowerSaveMode, MM_RunBlanker
1407 ************************************************************************************/
1409 IPTR
MonitorClass__MM_ExitBlanker(Class
*cl
, Object
*obj
, Msg
*msg
)
1411 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1412 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
1413 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
1414 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1415 struct TagItem tags
[] =
1417 {aHidd_Gfx_DPMSLevel
, vHidd_Gfx_DPMSLevel_On
},
1421 return OOP_SetAttrs(data
->handle
->gfxhidd
, tags
);
1424 /************************************************************************************
1427 MM_SetDefaultGammaTables
1430 DoMethod(Object *obj, ULONG MethodID, UBYTE *Red, UBYTE *Green, UBYTE *Blue);
1432 DoMethodA(Object *obj, struct msSetDefaultGammaTables *msg);
1437 Set default gamma correction tables for the monitor
1440 obj - A monitor object to query
1441 MethodID - MM_GetDefaultGammaTables
1442 Red - A pointer to an array of 256 bytes where gamma correction data for
1443 red component is placed. You may speciy a NULL pointer in order
1444 to ignore this component.
1445 Green - A pointer to an array of 256 bytes where gamma correction data for
1446 green component is placed. You may speciy a NULL pointer in order
1447 to ignore this component.
1448 Blue - A pointer to an array of 256 bytes where gamma correction data for
1449 blue component is placed. You may speciy a NULL pointer in order
1450 to ignore this component.
1456 This method is AROS-specific.
1463 MM_GetDefaultGammaTables
1467 ************************************************************************************/
1469 IPTR
MonitorClass__MM_SetDefaultGammaTables(Class
*cl
, Object
*obj
, struct msSetDefaultGammaTables
*msg
)
1471 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1472 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1473 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1475 /* Currently we don't use per-screen gamma tables, so we just forward the request
1477 If we implement per-screen gamma correction, we'll need more sophisticated
1479 return HIDD_Gfx_SetGamma(data
->handle
->gfxhidd
, msg
->Red
, msg
->Green
, msg
->Blue
);
1482 /************************************************************************************/
1484 ULONG
MonitorClass__MM_GetCompositionFlags(Class
*cl
, Object
*obj
, struct msGetCompositionFlags
*msg
)
1486 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1487 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1488 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1489 struct HIDD_ModeProperties modeprops
;
1491 HIDD_Gfx_ModeProperties(data
->handle
->gfxhidd
, msg
->ModeID
& (!data
->handle
->mask
),
1492 &modeprops
, sizeof(modeprops
));
1493 return modeprops
.CompositionFlags
;
1496 /************************************************************************************/
1498 void MonitorClass__MM_SetPointerPos(Class
*cl
, Object
*obj
, struct msSetPointerPos
*msg
)
1500 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1501 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1503 data
->mouseX
= msg
->x
;
1504 data
->mouseY
= msg
->y
;
1505 SetPointerPos(data
, IntuitionBase
);
1508 /************************************************************************************/
1510 IPTR
MonitorClass__MM_CheckID(Class
*cl
, Object
*obj
, struct msGetCompositionFlags
*msg
)
1512 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1514 return ((msg
->ModeID
& data
->handle
->mask
) == data
->handle
->id
);
1517 /************************************************************************************/
1519 IPTR
MonitorClass__MM_SetPointerShape(Class
*cl
, Object
*obj
, struct msSetPointerShape
*msg
)
1521 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1522 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1523 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1527 D(bug("[monitorclass] SetPointerShape(0x%p), old pointer 0x%p\n", msg
->pointer
, data
->pointer
));
1528 /* Don't do anything if already set */
1529 if (data
->pointer
== msg
->pointer
)
1532 bm
= msg
->pointer
->sprite
->es_BitMap
;
1533 /* Currently we don't work with planar sprites */
1534 if (!(bm
->Flags
& BMF_SPECIALFMT
))
1537 res
= HIDD_Gfx_SetCursorShape(data
->handle
->gfxhidd
, (OOP_Object
*)bm
->Planes
[0], msg
->pointer
->xoffset
, msg
->pointer
->yoffset
);
1538 D(bug("[monitorclass] SetCursorShape() returned %d\n", res
));
1540 data
->pointer
= msg
->pointer
;
1541 /* This will fix up sprite position if hotspot changed */
1542 SetPointerPos(data
, IntuitionBase
);