2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Graphics function OpenMonitor()
9 #include <aros/atomic.h>
10 #include <aros/debug.h>
11 #include <graphics/monitor.h>
12 #include <proto/oop.h>
16 #include "graphics_intern.h"
19 /*****************************************************************************
22 #include <proto/graphics.h>
24 AROS_LH2(struct MonitorSpec
*, OpenMonitor
,
27 AROS_LHA(STRPTR
, monitor_name
, A1
),
28 AROS_LHA(ULONG
, display_id
, D0
),
31 struct GfxBase
*, GfxBase
, 119, Graphics
)
36 monitor_name - pointer to a null terminated string
37 display_id - optional 32 bit monitor/mode identifier
40 mspc - pointer to an open MonitorSpec structure
41 NULL if MonitorSpec could not be opened
50 CloseMonitor(), graphics/monitor.h
57 ******************************************************************************/
61 struct MonitorSpec
*mspc
= NULL
;
63 D(bug("[GFX] OpenMonitor(%s)\n", monitor_name
));
67 if (stricmp(monitor_name
, DEFAULT_MONITOR_NAME
))
69 ObtainSemaphoreShared(GfxBase
->MonitorListSemaphore
);
71 mspc
= (struct MonitorSpec
*)FindName(&GfxBase
->MonitorList
, monitor_name
);
72 D(bug("[OpenMonitor] Found spec 0x%p\n", mspc
));
74 ReleaseSemaphore(GfxBase
->MonitorListSemaphore
);
77 mspc
= GfxBase
->default_monitor
;
79 else if (display_id
!= INVALID_ID
)
81 struct MonitorInfo info
;
83 if (GetDisplayInfoData(NULL
, (UBYTE
*)&info
, sizeof(info
), DTAG_MNTR
, display_id
) >= offsetof(struct MonitorInfo
, ViewPosition
))
87 mspc
= GfxBase
->default_monitor
;
90 AROS_ATOMIC_INC(mspc
->ms_OpenCount
);