File: xfce-randr.h

package info (click to toggle)
xfce4-settings 4.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 12,244 kB
  • sloc: ansic: 28,113; sh: 4,365; makefile: 996; python: 111; xml: 43
file content (168 lines) | stat: -rw-r--r-- 5,664 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
 *  Copyright (c) 2008 Nick Schermer <nick@xfce.org>
 *  Copyright (C) 2010 Lionel Le Folgoc <lionel@lefolgoc.net>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <xfconf/xfconf.h>
#include <gdk/gdk.h>
#include <X11/extensions/Xrandr.h>

#ifndef __XFCE_RANDR_H__
#define __XFCE_RANDR_H__

#define XFCE_RANDR_ROTATIONS_MASK             (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
#define XFCE_RANDR_REFLECTIONS_MASK           (RR_Reflect_X|RR_Reflect_Y)

/* check for randr 1.3 or better */
#if RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 3)
#define HAS_RANDR_ONE_POINT_THREE
#else
#undef HAS_RANDR_ONE_POINT_THREE
#endif

typedef struct _XfceRandr          XfceRandr;
typedef struct _XfceRandrPrivate   XfceRandrPrivate;
typedef struct _XfceRRMode         XfceRRMode;
typedef struct _XfceOutputInfo     XfceOutputInfo;
typedef enum   _XfceOutputStatus   XfceOutputStatus;
typedef struct _XfceOutputPosition XfceOutputPosition;

enum _XfceOutputStatus
{
    XFCE_OUTPUT_STATUS_PRIMARY,
    XFCE_OUTPUT_STATUS_SECONDARY
};

struct _XfceRRMode
{
    RRMode  id;
    guint   width;
    guint   height;
    gdouble rate;
};

struct _XfceOutputPosition
{
    gint x;
    gint y;
};

struct _XfceRandr
{
    /* number of connected outputs */
    guint                noutput;

    /* selected settings for all connected outputs */
    RRMode              *mode;
    gfloat              *scalex;
    gfloat              *scaley;
    Rotation            *rotation;
    Rotation            *rotations;
    XfceOutputPosition  *position;
    XfceOutputStatus    *status;
    gboolean            *mirrored;
    gchar              **friendly_name;

    /* implementation details */
    XfceRandrPrivate    *priv;
};

struct _XfceOutputInfo
{
    /* Identifiers */
    guint      id;
    gchar     *display_name;

    /* Status */
    gboolean   on;
    gboolean   connected;
    gboolean   mirrored;

    /* Position */
    gint      x;
    gint      y;

    /* Dimensions */
    gint      width;
    gint      height;
    guint      pref_width;
    guint      pref_height;
    Rotation   rotation;
    gdouble    scalex;
    gdouble    scaley;

    /* Frequency */
    gdouble    rate;

    /* User Data (e.g. GrabInfo) */
    gpointer   user_data;
};

XfceRandr        *xfce_randr_new             (GdkDisplay      *display,
                                              GError         **error);

void              xfce_randr_free            (XfceRandr        *randr);

void              xfce_randr_reload          (XfceRandr        *randr);

void              xfce_randr_save_output     (XfceRandr        *randr,
                                              const gchar      *scheme,
                                              XfconfChannel    *channel,
                                              guint             output);

void              xfce_randr_apply           (XfceRandr        *randr,
                                              const gchar      *scheme,
                                              XfconfChannel    *channel);

void              xfce_randr_load            (XfceRandr        *randr,
                                              const gchar      *scheme,
                                              XfconfChannel    *channel);

guint8 *          xfce_randr_read_edid_data  (Display          *xdisplay,
                                              RROutput          output);

const XfceRRMode *xfce_randr_find_mode_by_id (XfceRandr        *randr,
                                              guint             output,
                                              RRMode            id);

RRMode            xfce_randr_preferred_mode  (XfceRandr        *randr,
                                              guint             output);

RRMode            xfce_randr_clonable_mode   (XfceRandr        *randr);

gchar *           xfce_randr_get_edid        (XfceRandr        *randr,
                                              guint             noutput);

gchar *           xfce_randr_get_output_info_name (XfceRandr *randr,
                                                   guint        noutput);

const XfceRRMode *xfce_randr_get_modes       (XfceRandr        *randr,
                                              guint             output,
                                              gint             *nmode);

gboolean          xfce_randr_get_positions   (XfceRandr        *randr,
                                              guint             output,
                                              gint             *x,
                                              gint             *y);

guint             xfce_randr_mode_width      (const XfceRRMode *mode,
                                              Rotation          rot);

guint             xfce_randr_mode_height     (const XfceRRMode *mode,
                                              Rotation          rot);

#endif /* !__XFCE_RANDR_H__ */