summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryce Harrington <bryce@canonical.com>2012-02-03 12:58:55 -0800
committerBryce Harrington <bryce@canonical.com>2012-02-03 12:58:55 -0800
commit7a9883cb1932a2f978ce84aabb01bd4b936930d4 (patch)
tree37965b6773865aaf5952ecd2f4d687c5db7d2d6a
parente814e7d255ab43aac26d45558b2ed1a765c84e32 (diff)
Refactor the umode_t structures into library.
-rw-r--r--examples/xrandr.c27
-rw-r--r--include/X11/extensions/XrandrUtils.h14
-rw-r--r--man/XrandrUtils.man13
3 files changed, 33 insertions, 21 deletions
diff --git a/examples/xrandr.c b/examples/xrandr.c
index 9f72fe9..68b2835 100644
--- a/examples/xrandr.c
+++ b/examples/xrandr.c
@@ -169,21 +169,6 @@ static inline double dmin (double x, double y)
return x < y ? x : y;
}
-typedef struct _umode umode_t;
-
-typedef enum _umode_action {
- umode_create, umode_destroy, umode_add, umode_delete
-} umode_action_t;
-
-struct _umode {
- struct _umode *next;
-
- umode_action_t action;
- XRRModeInfo mode;
- XRUName output;
- XRUName name;
-};
-
static char *connection[3] = {
"connected",
"disconnected",
@@ -205,7 +190,7 @@ static char *connection[3] = {
static XRUOutput *outputs = NULL;
static XRUOutput **outputs_tail = &outputs;
static XRUCrtc *crtcs;
-static umode_t *umodes;
+static XRUUmode *umodes;
static int num_crtcs;
static XRRScreenResources *res;
static int fb_width = 0, fb_height = 0;
@@ -2297,7 +2282,7 @@ main (int argc, char **argv)
}
if (!strcmp ("--newmode", argv[i]))
{
- umode_t *m = malloc (sizeof (umode_t));
+ XRUUmode *m = malloc (sizeof (XRUUmode));
double clock;
++i;
@@ -2338,7 +2323,7 @@ main (int argc, char **argv)
}
if (!strcmp ("--rmmode", argv[i]))
{
- umode_t *m = malloc (sizeof (umode_t));
+ XRUUmode *m = malloc (sizeof (XRUUmode));
if (++i>=argc) usage ();
set_name (&m->name, argv[i], name_string|name_xid);
@@ -2351,7 +2336,7 @@ main (int argc, char **argv)
}
if (!strcmp ("--addmode", argv[i]))
{
- umode_t *m = malloc (sizeof (umode_t));
+ XRUUmode *m = malloc (sizeof (XRUUmode));
if (++i>=argc) usage ();
set_name (&m->output, argv[i], name_string|name_xid);
@@ -2366,7 +2351,7 @@ main (int argc, char **argv)
}
if (!strcmp ("--delmode", argv[i]))
{
- umode_t *m = malloc (sizeof (umode_t));
+ XRUUmode *m = malloc (sizeof (XRUUmode));
if (++i>=argc) usage ();
set_name (&m->output, argv[i], name_string|name_xid);
@@ -2421,7 +2406,7 @@ main (int argc, char **argv)
if (has_1_2 && modeit)
{
- umode_t *m;
+ XRUUmode *m;
get_screen (current);
get_crtcs();
diff --git a/include/X11/extensions/XrandrUtils.h b/include/X11/extensions/XrandrUtils.h
index 1e3d43b..ed2ef18 100644
--- a/include/X11/extensions/XrandrUtils.h
+++ b/include/X11/extensions/XrandrUtils.h
@@ -219,4 +219,18 @@ struct _output {
Bool found;
};
+/* umode */
+typedef enum {
+ umode_create, umode_destroy, umode_add, umode_delete
+} XRUUmodeAction;
+
+struct _umode {
+ struct _umode *next;
+
+ umode_action_t action;
+ XRRModeInfo mode;
+ XRUName output;
+ XRUName name;
+} XRUUmode;
+
#endif /* _XRANDR_UTILS_H_ */
diff --git a/man/XrandrUtils.man b/man/XrandrUtils.man
index d97da05..65f11da 100644
--- a/man/XrandrUtils.man
+++ b/man/XrandrUtils.man
@@ -240,6 +240,19 @@ struct {
Bool found;
} XRUOutput;
+/* umode */
+typedef enum {
+ umode_create, umode_destroy, umode_add, umode_delete
+} XRUUmodeAction;
+
+struct {
+ XRUUumode *next;
+
+ umode_action_t action;
+ XRRModeInfo mode;
+ XRUName output;
+ XRUName name;
+} XRUUmode;
.sp
.fi