1 /*
2  * Copyright 2002-2004 Red Hat Inc., Durham, North Carolina.
3  *
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation on the rights to use, copy, modify, merge,
10  * publish, distribute, sublicense, and/or sell copies of the Software,
11  * and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial
16  * portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  */
27 
28 /*
29  * Authors:
30  *   Rickard E. (Rik) Faith <faith@redhat.com>
31  *
32  */
33 
34 /** \file
35  * This file describes the interface to the client-side libdmx.a
36  * library.  All DMX-aware client-side applications should include this
37  * file. */
38 
39 #ifndef _DMXEXT_H_
40 #define _DMXEXT_H_
41 
42 #include <X11/extensions/dmx.h>
43 
44 /** Client-library screen information structure, returned by
45  * #DMXGetScreenAttributes.  */
46 typedef struct {
47     char         *displayName;
48     int          logicalScreen;
49 
50     unsigned int screenWindowWidth;    /* displayName's coordinate system */
51     unsigned int screenWindowHeight;   /* displayName's coordinate system */
52     int          screenWindowXoffset;  /* displayName's coordinate system */
53     int          screenWindowYoffset;  /* displayName's coordinate system */
54 
55     unsigned int rootWindowWidth;      /* screenWindow's coordinate system */
56     unsigned int rootWindowHeight;     /* screenWindow's coordinate system */
57     int          rootWindowXoffset;    /* screenWindow's coordinate system */
58     int          rootWindowYoffset;    /* screenWindow's coordinate system */
59 
60     int          rootWindowXorigin;    /* global coordinate system */
61     int          rootWindowYorigin;    /* global coordinate system */
62 } DMXScreenAttributes;
63 
64 /** Client-library window information structure, returned by
65  * #DMXGetWindowAttributes. */
66 typedef struct {
67     int          screen;
68     Window       window;
69     XRectangle   pos, vis;
70 } DMXWindowAttributes;
71 
72 /** Client-library desktop information structure, returned by
73  * #DMXGetDesktopAttributes. */
74 typedef struct {
75     unsigned int width;         /* global coordinate system */
76     unsigned int height;        /* global coordinate system */
77     int          shiftX;        /* global coordinate system */
78     int          shiftY;        /* global coordinate system */
79 } DMXDesktopAttributes;
80 
81 /** Enumeration for the #inputType field in the #DMXInputAttributes
82  * structure. */
83 typedef enum {
84     DMXLocalInputType,
85     DMXConsoleInputType,
86     DMXBackendInputType
87 } DMXInputEnum;
88 
89 /** Client-library input information structure, returned by
90  * #DMXGetInputAttributes. */
91 typedef struct {
92     DMXInputEnum inputType;
93     int          physicalScreen;
94     int          physicalId;
95     Bool         isCore;
96     Bool         sendsCore;
97     const char   *name;
98     Bool         detached;
99 } DMXInputAttributes;
100 
101 _XFUNCPROTOBEGIN
102 
103 extern Bool DMXQueryExtension(Display *dpy,
104                               int *event_basep, int *error_basep);
105 extern Bool DMXQueryVersion(Display *dpy, int *major_version,
106                             int *minor_version, int *patch_version);
107 extern Bool DMXSync(Display *dpy);
108 extern Bool DMXForceWindowCreation(Display *dpy, Window window);
109 
110 
111 extern Bool DMXGetScreenCount(Display *dpy, int *screen_count);
112 extern Bool DMXGetScreenAttributes(Display *dpy,
113                                    int screen,
114                                    DMXScreenAttributes *attr);
115 extern int  DMXChangeScreensAttributes(Display *dpy,
116                                        int screen_count,
117                                        int *screens,
118                                        int mask_count,
119                                        unsigned int *masks,
120                                        DMXScreenAttributes *attr, /* vector */
121                                        int *error_screen);
122 
123 extern Bool DMXAddScreen(Display *dpy,
124                          const char *displayName,
125                          unsigned int mask,
126                          DMXScreenAttributes *attr,
127                          int *screen);
128 extern Bool DMXRemoveScreen(Display *dpy, int screen);
129 
130 /* Call DMXGetScreenWindowCount and allocate info to that size.  Pass
131  * the size in available_count.  This call can generate a large amount
132  * of wire traffic and should not be used called with available_count=0
133  * just to determine the screen_count value -- use DMXGetScreenCount
134  * instead.  NOTE: Also see DMX protocol specification (DMXSpec.txt) for
135  * usage of DMXSync to flush pending commands. */
136 extern Bool DMXGetWindowAttributes(Display *dpy, Window window,
137                                    int *screen_count, int available_count,
138                                    DMXWindowAttributes *attr);
139 
140 extern Bool DMXGetDesktopAttributes(Display *dpy, DMXDesktopAttributes *attr);
141 extern int  DMXChangeDesktopAttributes(Display *dpy,
142                                        unsigned int mask,
143                                        DMXDesktopAttributes *attr);
144 
145 extern Bool DMXGetInputCount(Display *dpy, int *input_count);
146 extern Bool DMXGetInputAttributes(Display *dpy, int id,
147                                   DMXInputAttributes *attr);
148 
149 extern Bool DMXAddInput(Display *dpy,
150                         unsigned int mask,
151                         DMXInputAttributes *attr,
152                         int *id);
153 extern Bool DMXRemoveInput(Display *dpy, int id);
154 
155 /* These are helper functions that call DMXAddInput. */
156 extern Bool DMXAddBackendInput(Display *dpy, int screen, int sendsCore,
157                                int *newId);
158 extern Bool DMXAddConsoleInput(Display *dpy, const char *name, int sendsCore,
159                                int *newId);
160 
161 _XFUNCPROTOEND
162 #endif
163