Indentation fix, cleanup.
[AROS.git] / rom / graphics / nextdisplayinfo.c
blob7c76fe1fb090bbac2ed26f5e4958aa99da5f545b
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function NextDisplayInfo()
6 Lang: english
7 */
8 #include <graphics/displayinfo.h>
9 #include <hidd/graphics.h>
10 #include <proto/oop.h>
11 #include "graphics_intern.h"
12 #include "dispinfo.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH1(ULONG, NextDisplayInfo,
21 /* SYNOPSIS */
22 AROS_LHA(ULONG, last_ID, D0),
24 /* LOCATION */
25 struct GfxBase *, GfxBase, 122, Graphics)
27 /* FUNCTION
28 Go to next entry in the DisplayInfo database.
30 INPUTS
31 last_ID - previous displayinfo identifier
32 or INVALID_ID if beginning iteration
34 RESULT
35 next_ID - subsequent displayinfo identifier
36 or INVALID_ID if no more records
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 FindDisplayInfo(), GetDisplayInfoData(), graphics/displayinfo.h
47 INTERNALS
49 HISTORY
52 ******************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct monitor_driverdata *mdd = NULL;
57 struct DisplayInfoHandle *dh = NULL;
59 if (last_ID == INVALID_ID)
60 /* Start from the beginning */
61 mdd = CDD(GfxBase)->monitors;
62 else {
63 /* Find handle and driver of current mode */
64 dh = FindDisplayInfo(last_ID);
65 if (dh)
66 mdd = dh->drv;
69 while (mdd) {
70 /* Take next (or first) mode handle */
71 if (dh)
72 dh++;
73 else
74 dh = mdd->modes;
76 /* If it's not the last handle, return it */
77 if (dh->id != vHidd_ModeID_Invalid)
78 return dh->drv->id | dh->id;
80 /* Next driver, first handle */
81 mdd = mdd->next;
82 dh = NULL;
85 return INVALID_ID;
87 AROS_LIBFUNC_EXIT
88 } /* NextDisplayInfo */