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 /* Take HotSpot into account */
87 x
+= data
->pointer
->xoffset
;
88 y
+= data
->pointer
->yoffset
;
90 /* Update sprite position, just for backwards compatibility */
91 data
->pointer
->sprite
->es_SimpleSprite
.x
= x
;
92 data
->pointer
->sprite
->es_SimpleSprite
.y
= y
;
95 DB2(bug("[monitorclass] Physical coordinates: (%d, %d)\n", x
, y
));
96 HIDD_Gfx_SetCursorPos(data
->handle
->gfxhidd
, x
, y
);
99 /***********************************************************************************/
101 static void ActivationHandler(Object
*mon
, OOP_Object
*bitmap
)
103 Class
*cl
= OCLASS(mon
);
104 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
106 /* NewMonitor will be picked up by input handler when the next event arrives, so no signals etc */
107 GetPrivIBase(IntuitionBase
)->NewMonitor
= mon
;
110 /***********************************************************************************/
112 static BYTE
const pixelformats
[] = {
138 Object
*MonitorClass__OM_NEW(Class
*cl
, Object
*o
, struct opSet
*msg
)
140 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
141 struct Library
*UtilityBase
= GetPrivIBase(IntuitionBase
)->UtilityBase
;
142 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
143 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
144 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
145 OOP_AttrBase HiddPixFmtAttrBase
= GetPrivIBase(IntuitionBase
)->HiddPixFmtAttrBase
;
146 struct MonitorHandle
*handle
= (struct MonitorHandle
*)GetTagData(MA_MonitorHandle
, 0, msg
->ops_AttrList
);
147 HIDDT_ModeID mode
= vHidd_ModeID_Invalid
;
148 struct MonitorData
*data
;
149 OOP_Object
*sync
, *pixfmt
;
150 /* Tags order is important because CallBackData needs to be set before
151 function pointer. Otherwise the function can be called with a wrong
153 struct TagItem tags
[] = {
154 {aHidd_Gfx_ActiveCallBackData
, 0 },
155 {aHidd_Gfx_ActiveCallBack
, (IPTR
)ActivationHandler
},
159 D(kprintf("[monitorclass] OM_NEW\n"));
164 o
= (Object
*)DoSuperMethodA(cl
, o
, (Msg
)msg
);
168 data
= INST_DATA(cl
, o
);
170 data
->handle
= handle
;
172 /* We can't list driver's pixelformats, we can list only modes. This does not harm however,
173 just some pixelformats will be processed more than once */
174 while ((mode
= HIDD_Gfx_NextModeID(handle
->gfxhidd
, mode
, &sync
, &pixfmt
)) != vHidd_ModeID_Invalid
) {
178 OOP_GetAttr(pixfmt
, aHidd_PixFmt_StdPixFmt
, &stdpf
);
179 cgxpf
= pixelformats
[stdpf
];
180 D(bug("[monitorclass] Mode 0x%08lX, StdPixFmt %lu, CGX pixfmt %d\n", mode
, stdpf
, cgxpf
));
183 data
->pfobjects
[cgxpf
] = pixfmt
;
184 data
->pixelformats
[cgxpf
] = TRUE
;
188 tags
[0].ti_Data
= (IPTR
)o
;
189 OOP_SetAttrs(handle
->gfxhidd
, tags
);
191 ObtainSemaphore(&GetPrivIBase(IntuitionBase
)->MonitorListSem
);
192 AddTail((struct List
*)&GetPrivIBase(IntuitionBase
)->MonitorList
, (struct Node
*)data
);
193 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->MonitorListSem
);
198 /*****************************************************************************************
210 Query monitor driver name
222 *****************************************************************************************/
224 /*****************************************************************************************
236 Query video card hardware manufacturer name
239 Not all drivers may specify manufacturer string. NULL is a valid return value.
249 *****************************************************************************************/
251 /*****************************************************************************************
263 Query video card hardware's numeric manufacturer ID (which may come from PCI,
267 Not all drivers may have assigned IDs. For example VGA driver and virtual
268 hosted drivers do not associate themselves with any IDs.
279 *****************************************************************************************/
281 /*****************************************************************************************
293 Query video card hardware's numeric product ID (which may come from PCI, Zorro, etc).
296 Not all drivers may have assigned IDs. For example VGA driver and virtual
297 hosted drivers do not associate themselves with any IDs.
308 *****************************************************************************************/
310 /*****************************************************************************************
322 Query total size of video card memory in bytes.
335 *****************************************************************************************/
337 /*****************************************************************************************
349 Query table of supported pixelformats.
351 A returned value is a pointer to static array of ULONGs, one ULONG per CyberGraphX
352 pixelformat. Values of these ULONGs are actually booleans. TRUE value in the array
353 says that the pixelformat is supported, FALSE means it's not.
360 GetAttr(MA_PixelFormats, monitor, (IPTR *)&pfs);
361 if (pfs[PUXFMT_LUT8])
362 printf("The display driver supports LUT8 format\n");
371 *****************************************************************************************/
373 /*****************************************************************************************
385 Get a pointer to a monitor placed in top-left diagonal direction relative to
388 This attribute is used to describe relative placement of monitors in user's
389 physical environment.
396 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
400 MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor, MA_MiddleRightMonitor,
401 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
405 *****************************************************************************************/
407 /*****************************************************************************************
419 Get a pointer to a monitor placed in top direction relative to the current one.
421 This attribute is used to describe relative placement of monitors in user's
422 physical environment.
429 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
433 MA_TopLeftMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor, MA_MiddleRightMonitor,
434 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
438 *****************************************************************************************/
440 /*****************************************************************************************
452 Get a pointer to a monitor placed in top-right diagonal direction relative to
455 This attribute is used to describe relative placement of monitors in user's
456 physical environment.
463 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
467 MA_TopLeftMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor, MA_MiddleRightMonitor,
468 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
472 *****************************************************************************************/
474 /*****************************************************************************************
486 Get a pointer to a monitor placed in left direction relative to
489 This attribute is used to describe relative placement of monitors in user's
490 physical environment.
497 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
501 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleRightMonitor,
502 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
506 *****************************************************************************************/
508 /*****************************************************************************************
511 MA_MiddleRightMonitor
520 Get a pointer to a monitor placed in right direction relative to
523 This attribute is used to describe relative placement of monitors in user's
524 physical environment.
531 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
535 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor,
536 MA_BottomLeftMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
540 *****************************************************************************************/
542 /*****************************************************************************************
554 Get a pointer to a monitor placed in bottom-left diagonal direction relative to
557 This attribute is used to describe relative placement of monitors in user's
558 physical environment.
565 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
569 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor,
570 MA_MiddleRightMonitor, MA_BottomMiddleMonitor, MA_BottomRightMonitor
574 *****************************************************************************************/
576 /*****************************************************************************************
579 MA_BottomMiddleMonitor
588 Get a pointer to a monitor placed in bottom direction relative to the current one.
590 This attribute is used to describe relative placement of monitors in user's
591 physical environment.
598 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
602 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor,
603 MA_MiddleRightMonitor, MA_BottomLeftMonitor, MA_BottomRightMonitor
607 *****************************************************************************************/
609 /*****************************************************************************************
612 MA_BottomRightMonitor
621 Get a pointer to a monitor placed in bottom-right diagonal direction relative to
624 This attribute is used to describe relative placement of monitors in user's
625 physical environment.
632 In MorphOS up to v2.5 this attribute returns monitor ID, not a pointer to a
636 MA_TopLeftMonitor, MA_TopMiddleMonitor, MA_TopRightMonior, MA_MiddleLeftMonitor,
637 MA_MiddleRightMonitor, MA_BottomLeftMonitor, MA_BottomMiddleMonitor
641 *****************************************************************************************/
643 /*****************************************************************************************
655 Query if the display driver supports gamma control
664 MM_GetDefaultGammaTables, MM_SetDefaultGammaTables
668 *****************************************************************************************/
670 /*****************************************************************************************
682 Query supported mouse pointer sprite formats.
684 The returned value is a combination of the following bit flags:
685 PointerType_3Plus1 - color 0 transparent, 1-3 visible (Amiga(tm) chipset sprite)
686 PointerType_2Plus1 - color 0 transparent, 1 undefined (can be for example clear or
687 inverse), 2-3 visible
688 PointerType_ARGB - Direct color bitmap (hi-color or truecolor, possibly with alpha
702 *****************************************************************************************/
704 /*****************************************************************************************
716 Query CyberGraphX driver name. It is the name which can be given to
717 cybergraphics.library/BestCModeIDTagList() as CYBRBIDTG_BoardName value.
730 *****************************************************************************************/
732 /*****************************************************************************************
744 Query video card's memory clock in Hz. 0 is a valid value meaning 'unknown'.
757 *****************************************************************************************/
759 /*****************************************************************************************
771 Check if this monitor is a window on hosted OS desktop.
773 This means that the host OS is responsible for handling mouse input and display
774 activation. Monitors with this attribute set to TRUE should be ignored by
775 multi-display desktop configuration software.
777 These monitors should have no spatial links to other monitors. Activation of these
778 monitors is done by clicking on their windows on the host's desktop and is handled
779 by the driver itself.
782 This attribute is AROS-specific, it does not exist in MorphOS.
792 *****************************************************************************************/
794 /***********************************************************************************/
796 IPTR
MonitorClass__OM_GET(Class
*cl
, Object
*o
, struct opGet
*msg
)
798 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
799 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
800 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
801 OOP_AttrBase HiddAttrBase
= GetPrivIBase(IntuitionBase
)->HiddAttrBase
;
802 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
803 struct MonitorData
*data
= INST_DATA(cl
, o
);
805 D(kprintf("[monitorclass] OM_GET\n"));
807 switch (msg
->opg_AttrID
)
810 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Name
, msg
->opg_Storage
);
813 case MA_Manufacturer
:
814 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_ProducerName
, msg
->opg_Storage
);
817 case MA_ManufacturerID
:
818 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Producer
, msg
->opg_Storage
);
822 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Product
, msg
->opg_Storage
);
826 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_MemorySize
, msg
->opg_Storage
);
829 case MA_PixelFormats
:
830 *msg
->opg_Storage
= (IPTR
)data
->pixelformats
;
833 case MA_TopLeftMonitor
:
834 *msg
->opg_Storage
= (IPTR
)data
->topleft
;
837 case MA_TopMiddleMonitor
:
838 *msg
->opg_Storage
= (IPTR
)data
->topmiddle
;
841 case MA_TopRightMonitor
:
842 *msg
->opg_Storage
= (IPTR
)data
->topright
;
845 case MA_MiddleLeftMonitor
:
846 *msg
->opg_Storage
= (IPTR
)data
->middleleft
;
849 case MA_MiddleRightMonitor
:
850 *msg
->opg_Storage
= (IPTR
)data
->middleright
;
853 case MA_BottomLeftMonitor
:
854 *msg
->opg_Storage
= (IPTR
)data
->bottomleft
;
857 case MA_BottomMiddleMonitor
:
858 *msg
->opg_Storage
= (IPTR
)data
->bottommiddle
;
861 case MA_BottomRightMonitor
:
862 *msg
->opg_Storage
= (IPTR
)data
->bottomright
;
865 case MA_GammaControl
:
866 *msg
->opg_Storage
= HIDD_Gfx_GetGamma(data
->handle
->gfxhidd
, NULL
, NULL
, NULL
);
870 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_HWSpriteTypes
, msg
->opg_Storage
);
874 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_DriverName
, msg
->opg_Storage
);
878 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_MemoryClock
, msg
->opg_Storage
);
882 OOP_GetAttr(data
->handle
->gfxhidd
, aHidd_Gfx_IsWindowed
, msg
->opg_Storage
);
886 return DoSuperMethodA(cl
, o
, (Msg
)msg
);
892 /***********************************************************************************/
894 IPTR
MonitorClass__OM_SET(Class
*cl
, Object
*o
, struct opSet
*msg
)
896 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
897 struct Library
*UtilityBase
= GetPrivIBase(IntuitionBase
)->UtilityBase
;
898 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
899 struct MonitorData
*data
= INST_DATA(cl
, o
);
900 struct TagItem
*tag
, *tstate
;
902 tstate
= msg
->ops_AttrList
;
903 while((tag
= NextTagItem((const struct TagItem
**)&tstate
))) {
904 switch (tag
->ti_Tag
) {
905 case MA_TopLeftMonitor
:
906 data
->topleft
= (Object
*)tag
->ti_Data
;
909 case MA_TopMiddleMonitor
:
910 data
->topmiddle
= (Object
*)tag
->ti_Data
;
913 case MA_TopRightMonitor
:
914 data
->topright
= (Object
*)tag
->ti_Data
;
917 case MA_MiddleLeftMonitor
:
918 data
->middleleft
= (Object
*)tag
->ti_Data
;
921 case MA_MiddleRightMonitor
:
922 data
->middleright
= (Object
*)tag
->ti_Data
;
925 case MA_BottomLeftMonitor
:
926 data
->bottomleft
= (Object
*)tag
->ti_Data
;
929 case MA_BottomMiddleMonitor
:
930 data
->bottommiddle
= (Object
*)tag
->ti_Data
;
933 case MA_BottomRightMonitor
:
934 data
->bottomright
= (Object
*)tag
->ti_Data
;
937 case MA_PointerVisible
:
938 HIDD_Gfx_SetCursorVisible(data
->handle
->gfxhidd
, tag
->ti_Data
);
942 return DoSuperMethodA(cl
, o
, (Msg
)msg
);
945 /***********************************************************************************/
947 #define Relink(nextAttr, prev, prevAttr, next) \
949 SetAttrs(prev, nextAttr, next, TAG_DONE); \
951 SetAttrs(next, prevAttr, prev, TAG_DONE)
953 IPTR
MonitorClass__OM_DISPOSE(Class
*cl
, Object
*o
, Msg msg
)
955 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
956 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
957 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
958 struct MonitorData
*data
= INST_DATA(cl
, o
);
959 struct TagItem tags
[] = {
960 {aHidd_Gfx_ActiveCallBack
, 0},
964 D(kprintf("MonitorClass: OM_DISPOSE\n"));
966 /* Disable activation callback */
967 OOP_SetAttrs(data
->handle
->gfxhidd
, tags
);
969 ObtainSemaphore(&GetPrivIBase(IntuitionBase
)->MonitorListSem
);
970 Remove((struct Node
*)data
);
972 /* Remove this monitor from spatial links */
973 Relink(MA_BottomRightMonitor
, data
->topleft
, MA_TopLeftMonitor
, data
->bottomright
);
974 Relink(MA_BottomMiddleMonitor
, data
->topmiddle
, MA_TopMiddleMonitor
, data
->bottommiddle
);
975 Relink(MA_BottomLeftMonitor
, data
->topright
, MA_TopRightMonitor
, data
->bottomleft
);
976 Relink(MA_MiddleLeftMonitor
, data
->middleright
, MA_MiddleRightMonitor
, data
->middleleft
);
978 /* If an active monitor is being removed, we should activate another one */
979 if (GetPrivIBase(IntuitionBase
)->ActiveMonitor
== o
)
980 ActivateMonitor((Object
*)GetHead(&GetPrivIBase(IntuitionBase
)->MonitorList
), -1, -1, IntuitionBase
);
982 ReleaseSemaphore(&GetPrivIBase(IntuitionBase
)->MonitorListSem
);
984 return DoSuperMethodA(cl
, o
, msg
);
987 /************************************************************************************
993 DoMethod(Object *obj, ULONG MethodID, ULONG PixelFormat, struct BitMap **Store);
995 DoMethodA(Object *obj, struct msGetRootBitMap *msg);
1000 This method is provided only for source code compatibility with MorphOS operating
1003 Under MorphOS this method returns a pointer to internal root bitmap of the
1004 display driver corresponding to the specified pixelformat. Displayable bitmaps are
1005 supposed to be created as friends of the root bitmap.
1007 In AROS displayable bitmaps need complete display mode information and not
1008 only pixelformat. So this method will never be implemented and will always return NULL
1009 pointer. In order to create a displayable RTG bitmap on AROS the user needs to supply
1010 a taglist with BMATags_DisplayID specification to AllocBitMap() function.
1013 obj - A monitor object
1014 MethodID - MM_GetRootBitMap
1015 PixelFormat - A CyberGraphX pixelformat code to get root bitmap for
1016 Store - A storage where root bitmap pointer will be placed.
1028 graphics.library/AllocBitMap()
1032 ************************************************************************************/
1034 IPTR
MonitorClass__MM_GetRootBitMap(Class
*cl
, Object
*obj
, struct msGetRootBitMap
*msg
)
1041 /************************************************************************************
1047 DoMethod(Object *obj, ULONG MethodID, ULONG PixelFormat, ULONG *Store);
1049 DoMethodA(Object *obj, struct msQuery3DSupport *msg);
1054 Ask the display driver for type of 3D support for the given pixelformat.
1056 Supplied storage will be filled with one of:
1057 MSQUERY3D_UNKNOWN - Unsupported pixelformat or some internal error
1058 MSQUERY3D_NODRIVER - There is no 3D support for the given pixelformat
1059 MSQUERY3D_SWDRIVER - A software 3D support is available for the given
1061 MSQUERY3D_HWDRIVER - A hardware 3D support is available for the given
1065 obj - A monitor object to query
1066 MethodID - MM_Query3DSupport
1067 PixelFormat - A CyberGraphX pixelformat code
1068 Store - A pointer to a storage where return value will be placed
1083 ************************************************************************************/
1085 IPTR
MonitorClass__MM_Query3DSupport(Class
*cl
, Object
*obj
, struct msQuery3DSupport
*msg
)
1087 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1088 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
1089 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1090 OOP_AttrBase HiddPixFmtAttrBase
= GetPrivIBase(IntuitionBase
)->HiddPixFmtAttrBase
;
1091 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1092 OOP_Object
*pf
= data
->pfobjects
[msg
->PixelFormat
];
1095 if (HIDD_Gfx_QueryHardware3D(data
->handle
->gfxhidd
, pf
))
1096 *msg
->Store
= MSQUERY3D_HWDRIVER
;
1100 OOP_GetAttr(pf
, aHidd_PixFmt_Depth
, &depth
);
1102 *msg
->Store
= MSQUERY3D_SWDRIVER
;
1104 *msg
->Store
= MSQUERY3D_NODRIVER
;
1107 *msg
->Store
= MSQUERY3D_UNKNOWN
;
1112 /************************************************************************************
1115 MM_GetDefaultGammaTables
1118 DoMethod(Object *obj, ULONG MethodID, UBYTE *Red, UBYTE *Green, UBYTE *Blue);
1120 DoMethodA(Object *obj, struct msGetDefaultGammaTables *msg);
1125 Get default gamma correction tables for the monitor
1128 obj - A monitor object to query
1129 MethodID - MM_GetDefaultGammaTables
1130 Red - A pointer to an array of 256 bytes where gamma correction data for
1131 red component will be placed. You may speciy a NULL pointer in order
1132 to ignore this component.
1133 Green - A pointer to an array of 256 bytes where gamma correction data for
1134 green component will be placed. You may speciy a NULL pointer in order
1135 to ignore this component.
1136 Blue - A pointer to an array of 256 bytes where gamma correction data for
1137 blue component will be placed. You may speciy a NULL pointer in order
1138 to ignore this component.
1150 MM_SetDefaultGammaTables
1154 ************************************************************************************/
1156 IPTR
MonitorClass__MM_GetDefaultGammaTables(Class
*cl
, Object
*obj
, struct msGetDefaultGammaTables
*msg
)
1158 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1159 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1160 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1162 /* Currently we don't use per-screen gamma tables, so we just forward the request
1164 If we implement per-screen gamma correction, we'll need more sophisticated
1166 return HIDD_Gfx_GetGamma(data
->handle
->gfxhidd
, msg
->Red
, msg
->Green
, msg
->Blue
);
1169 /************************************************************************************
1172 MM_GetDefaultPixelFormat
1175 DoMethod(Object *obj, ULONG MethodID, ULONG Depth, ULONG *Store);
1177 DoMethodA(Object *obj, struct msGetDefaultPixelFormat *msg);
1182 Get driver's preferred pixelformat for specified bitmap depth.
1185 obj - A monitor object
1186 MethodID - MM_GetDefaultPixelFormat
1187 Depth - Depth to ask about
1188 Store - A pointer to an ULONG location where CyberGraphX pixelformat
1189 number will be placed. -1 means unsupported depth.
1204 ************************************************************************************/
1206 IPTR
MonitorClass__MM_GetDefaultPixelFormat(Class
*cl
, Object
*obj
, struct msGetDefaultPixelFormat
*msg
)
1208 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1209 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
1210 OOP_AttrBase HiddPixFmtAttrBase
= GetPrivIBase(IntuitionBase
)->HiddPixFmtAttrBase
;
1211 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1214 for (i
= 0; i
< MONITOR_MAXPIXELFORMATS
; i
++) {
1215 if (data
->pfobjects
[i
]) {
1218 OOP_GetAttr(data
->pfobjects
[i
], aHidd_PixFmt_Depth
, &depth
);
1219 if (depth
== msg
->Depth
) {
1226 if (i
== MONITOR_MAXPIXELFORMATS
)
1232 /************************************************************************************
1238 DoMethod(Object *obj, ULONG MethodID, ULONG PointerType, ULONG *Width, ULONG *Height);
1240 DoMethodA(Object *obj, struct msGetPointerBounds *msg);
1246 Get maximum allowed size of mouse pointer sprite.
1249 obj - A monitor object
1250 MethodID - MM_GetPointerBounds
1251 PointerType - Pointer type (one of PointerType_...)
1252 Width - A pointer to an ULONG location where width will be placed.
1253 Height - A pointer to an ULONG location where height will be placed.
1256 FALSE is given pointer type is not supported, TRUE otherwise.
1259 Width and Height are considered undefined if the method returns FALSE.
1270 ************************************************************************************/
1272 IPTR
MonitorClass__MM_GetPointerBounds(Class
*cl
, Object
*obj
, struct msGetPointerBounds
*msg
)
1274 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1275 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1276 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1278 return HIDD_Gfx_GetMaxSpriteSize(data
->handle
->gfxhidd
, msg
->PointerType
, msg
->Width
, msg
->Height
);
1281 /************************************************************************************
1287 DoMethod(Object *obj, ULONG MethodID);
1289 DoMethodA(Object *obj, Msg *msg);
1294 Starts screensaver on the monitor.
1296 At the moment AROS has no integrated screensaver support. The method is
1297 considered reserved and not implemented.
1300 obj - A monitor object
1301 MethodID - MM_RunBlanker
1313 MM_EnterPowerSaveMode, MM_ExitBlanker
1317 ************************************************************************************/
1319 IPTR
MonitorClass__MM_RunBlanker(Class
*cl
, Object
*obj
, Msg
*msg
)
1321 /* We have no integrated screensaver support */
1326 /************************************************************************************
1329 MM_EnterPowerSaveMode
1332 DoMethod(Object *obj, ULONG MethodID);
1334 DoMethodA(Object *obj, Msg *msg);
1339 Starts power saving mode on the monitor.
1342 obj - A monitor object
1343 MethodID - MM_EnterPowerSaveMode
1355 MM_RunBlanker, MM_ExitBlanker
1358 Current implementation just immediately sets DMPS level to "Off" for the
1361 ************************************************************************************/
1363 IPTR
MonitorClass__MM_EnterPowerSaveMode(Class
*cl
, Object
*obj
, Msg
*msg
)
1365 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1366 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
1367 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
1368 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1369 struct TagItem tags
[] =
1371 {aHidd_Gfx_DPMSLevel
, vHidd_Gfx_DPMSLevel_Off
},
1375 return OOP_SetAttrs(data
->handle
->gfxhidd
, tags
);
1378 /************************************************************************************
1384 DoMethod(Object *obj, ULONG MethodID);
1386 DoMethodA(Object *obj, Msg *msg);
1391 Stops screensaver and/or power saving mode on the monitor.
1394 obj - A monitor object
1395 MethodID - MM_ExitBlanker
1407 MM_EnterPowerSaveMode, MM_RunBlanker
1411 ************************************************************************************/
1413 IPTR
MonitorClass__MM_ExitBlanker(Class
*cl
, Object
*obj
, Msg
*msg
)
1415 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1416 struct Library
*OOPBase
= GetPrivIBase(IntuitionBase
)->OOPBase
;
1417 OOP_AttrBase HiddGfxAttrBase
= GetPrivIBase(IntuitionBase
)->HiddGfxAttrBase
;
1418 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1419 struct TagItem tags
[] =
1421 {aHidd_Gfx_DPMSLevel
, vHidd_Gfx_DPMSLevel_On
},
1425 return OOP_SetAttrs(data
->handle
->gfxhidd
, tags
);
1428 /************************************************************************************
1431 MM_SetDefaultGammaTables
1434 DoMethod(Object *obj, ULONG MethodID, UBYTE *Red, UBYTE *Green, UBYTE *Blue);
1436 DoMethodA(Object *obj, struct msSetDefaultGammaTables *msg);
1441 Set default gamma correction tables for the monitor
1444 obj - A monitor object to query
1445 MethodID - MM_GetDefaultGammaTables
1446 Red - A pointer to an array of 256 bytes where gamma correction data for
1447 red component is placed. You may speciy a NULL pointer in order
1448 to ignore this component.
1449 Green - A pointer to an array of 256 bytes where gamma correction data for
1450 green component is placed. You may speciy a NULL pointer in order
1451 to ignore this component.
1452 Blue - A pointer to an array of 256 bytes where gamma correction data for
1453 blue component is placed. You may speciy a NULL pointer in order
1454 to ignore this component.
1460 This method is AROS-specific.
1467 MM_GetDefaultGammaTables
1471 ************************************************************************************/
1473 IPTR
MonitorClass__MM_SetDefaultGammaTables(Class
*cl
, Object
*obj
, struct msSetDefaultGammaTables
*msg
)
1475 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1476 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1477 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1479 /* Currently we don't use per-screen gamma tables, so we just forward the request
1481 If we implement per-screen gamma correction, we'll need more sophisticated
1483 return HIDD_Gfx_SetGamma(data
->handle
->gfxhidd
, msg
->Red
, msg
->Green
, msg
->Blue
);
1486 /************************************************************************************/
1488 ULONG
MonitorClass__MM_GetCompositionFlags(Class
*cl
, Object
*obj
, struct msGetCompositionFlags
*msg
)
1490 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1491 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1492 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1493 struct HIDD_ModeProperties modeprops
;
1495 HIDD_Gfx_ModeProperties(data
->handle
->gfxhidd
, msg
->ModeID
& (!data
->handle
->mask
),
1496 &modeprops
, sizeof(modeprops
));
1497 return modeprops
.CompositionFlags
;
1500 /************************************************************************************/
1502 void MonitorClass__MM_SetPointerPos(Class
*cl
, Object
*obj
, struct msSetPointerPos
*msg
)
1504 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1505 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1507 data
->mouseX
= msg
->x
;
1508 data
->mouseY
= msg
->y
;
1509 SetPointerPos(data
, IntuitionBase
);
1512 /************************************************************************************/
1514 IPTR
MonitorClass__MM_CheckID(Class
*cl
, Object
*obj
, struct msGetCompositionFlags
*msg
)
1516 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1518 return ((msg
->ModeID
& data
->handle
->mask
) == data
->handle
->id
);
1521 /************************************************************************************/
1523 IPTR
MonitorClass__MM_SetPointerShape(Class
*cl
, Object
*obj
, struct msSetPointerShape
*msg
)
1525 struct IntuitionBase
*IntuitionBase
= (struct IntuitionBase
*)cl
->cl_UserData
;
1526 OOP_MethodID HiddGfxBase
= GetPrivIBase(IntuitionBase
)->ib_HiddGfxBase
;
1527 struct MonitorData
*data
= INST_DATA(cl
, obj
);
1531 D(bug("[monitorclass] SetPointerShape(0x%p), old pointer 0x%p\n", msg
->pointer
, data
->pointer
));
1532 /* Don't do anything if already set */
1533 if (data
->pointer
== msg
->pointer
)
1536 bm
= msg
->pointer
->sprite
->es_BitMap
;
1537 /* Currently we don't work with planar sprites */
1538 if (!(bm
->Flags
& BMF_SPECIALFMT
))
1541 res
= HIDD_Gfx_SetCursorShape(data
->handle
->gfxhidd
, (OOP_Object
*)bm
->Planes
[0], msg
->pointer
->xoffset
, msg
->pointer
->yoffset
);
1542 D(bug("[monitorclass] SetCursorShape() returned %d\n", res
));
1544 data
->pointer
= msg
->pointer
;
1545 /* This will fix up sprite position if hotspot changed */
1546 SetPointerPos(data
, IntuitionBase
);