~ubuntu-branches/ubuntu/vivid/marco/vivid

« back to all changes in this revision

Viewing changes to src/include/xprops.h

  • Committer: Package Import Robot
  • Author(s): Mike Gabriel
  • Date: 2014-01-21 19:52:39 UTC
  • Revision ID: package-import@ubuntu.com-20140121195239-c4k1v8umdw1u4n29
Tags: upstream-1.6.2
ImportĀ upstreamĀ versionĀ 1.6.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 
2
 
 
3
/* Marco X property convenience routines */
 
4
 
 
5
/* 
 
6
 * Copyright (C) 2001 Havoc Pennington
 
7
 * 
 
8
 * This program is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU General Public License as
 
10
 * published by the Free Software Foundation; either version 2 of the
 
11
 * License, or (at your option) any later version.
 
12
 *
 
13
 * This program is distributed in the hope that it will be useful, but
 
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * General Public License for more details.
 
17
 * 
 
18
 * You should have received a copy of the GNU General Public License
 
19
 * along with this program; if not, write to the Free Software
 
20
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 
21
 * 02110-1301, USA.
 
22
 */
 
23
 
 
24
#ifndef META_XPROPS_H
 
25
#define META_XPROPS_H
 
26
 
 
27
#include <config.h>
 
28
 
 
29
#include "display.h"
 
30
#include <X11/Xutil.h>
 
31
 
 
32
#ifdef HAVE_XSYNC
 
33
#include <X11/extensions/sync.h>
 
34
#endif
 
35
 
 
36
/* Copied from Lesstif by way of GTK. Rudimentary docs can be
 
37
 * found in some Motif reference guides online.
 
38
 */
 
39
typedef struct {
 
40
    unsigned long flags;
 
41
    unsigned long functions;
 
42
    unsigned long decorations;
 
43
    long input_mode;
 
44
    unsigned long status;
 
45
} MotifWmHints, MwmHints;
 
46
 
 
47
#define MWM_HINTS_FUNCTIONS     (1L << 0)
 
48
#define MWM_HINTS_DECORATIONS   (1L << 1)
 
49
#define MWM_HINTS_INPUT_MODE    (1L << 2)
 
50
#define MWM_HINTS_STATUS        (1L << 3)
 
51
 
 
52
#define MWM_FUNC_ALL            (1L << 0)
 
53
#define MWM_FUNC_RESIZE         (1L << 1)
 
54
#define MWM_FUNC_MOVE           (1L << 2)
 
55
#define MWM_FUNC_MINIMIZE       (1L << 3)
 
56
#define MWM_FUNC_MAXIMIZE       (1L << 4)
 
57
#define MWM_FUNC_CLOSE          (1L << 5)
 
58
 
 
59
#define MWM_DECOR_ALL           (1L << 0)
 
60
#define MWM_DECOR_BORDER        (1L << 1)
 
61
#define MWM_DECOR_RESIZEH       (1L << 2)
 
62
#define MWM_DECOR_TITLE         (1L << 3)
 
63
#define MWM_DECOR_MENU          (1L << 4)
 
64
#define MWM_DECOR_MINIMIZE      (1L << 5)
 
65
#define MWM_DECOR_MAXIMIZE      (1L << 6)
 
66
 
 
67
#define MWM_INPUT_MODELESS 0
 
68
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
 
69
#define MWM_INPUT_SYSTEM_MODAL 2
 
70
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
 
71
#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
 
72
 
 
73
#define MWM_TEAROFF_WINDOW      (1L<<0)
 
74
 
 
75
/* These all return the memory from Xlib, so require an XFree()
 
76
 * when they return TRUE. They return TRUE on success.
 
77
 */
 
78
gboolean meta_prop_get_atom_list     (MetaDisplay   *display,
 
79
                                      Window         xwindow,
 
80
                                      Atom           xatom,
 
81
                                      Atom         **atoms_p,
 
82
                                      int           *n_atoms_p);
 
83
gboolean meta_prop_get_motif_hints   (MetaDisplay   *display,
 
84
                                      Window         xwindow,
 
85
                                      Atom           xatom,
 
86
                                      MotifWmHints **hints_p);
 
87
gboolean meta_prop_get_cardinal_list (MetaDisplay   *display,
 
88
                                      Window         xwindow,
 
89
                                      Atom           xatom,
 
90
                                      gulong       **cardinals_p,
 
91
                                      int           *n_cardinals_p);
 
92
gboolean meta_prop_get_latin1_string (MetaDisplay   *display,
 
93
                                      Window         xwindow,
 
94
                                      Atom           xatom,
 
95
                                      char         **str_p);
 
96
gboolean meta_prop_get_utf8_string   (MetaDisplay   *display,
 
97
                                      Window         xwindow,
 
98
                                      Atom           xatom,
 
99
                                      char         **str_p);
 
100
gboolean meta_prop_get_utf8_list     (MetaDisplay   *display,
 
101
                                      Window         xwindow,
 
102
                                      Atom           xatom,
 
103
                                      char        ***str_p,
 
104
                                      int           *n_str_p);
 
105
void     meta_prop_set_utf8_string_hint
 
106
                                     (MetaDisplay *display,
 
107
                                      Window xwindow,
 
108
                                      Atom atom,
 
109
                                      const char *val);
 
110
gboolean meta_prop_get_window        (MetaDisplay   *display,
 
111
                                      Window         xwindow,
 
112
                                      Atom           xatom,
 
113
                                      Window        *window_p);
 
114
gboolean meta_prop_get_cardinal      (MetaDisplay   *display,
 
115
                                      Window         xwindow,
 
116
                                      Atom           xatom,
 
117
                                      gulong        *cardinal_p);
 
118
gboolean meta_prop_get_cardinal_with_atom_type (MetaDisplay   *display,
 
119
                                                Window         xwindow,
 
120
                                                Atom           xatom,
 
121
                                                Atom           prop_type,
 
122
                                                gulong        *cardinal_p);
 
123
gboolean meta_prop_get_text_property (MetaDisplay   *display,
 
124
                                      Window         xwindow,
 
125
                                      Atom           xatom,
 
126
                                      char         **utf8_str_p);
 
127
 
 
128
gboolean meta_prop_get_wm_hints      (MetaDisplay   *display,
 
129
                                      Window         xwindow,
 
130
                                      Atom           xatom,
 
131
                                      XWMHints     **hints_p);
 
132
 
 
133
gboolean meta_prop_get_class_hint    (MetaDisplay   *display,
 
134
                                      Window         xwindow,
 
135
                                      Atom           xatom,
 
136
                                      XClassHint    *class_hint);
 
137
 
 
138
gboolean meta_prop_get_size_hints    (MetaDisplay   *display,
 
139
                                      Window         xwindow,
 
140
                                      Atom           xatom,
 
141
                                      XSizeHints   **hints_p,
 
142
                                      gulong        *flags_p);
 
143
 
 
144
typedef enum
 
145
{
 
146
  META_PROP_VALUE_INVALID,
 
147
  META_PROP_VALUE_UTF8,
 
148
  META_PROP_VALUE_STRING,
 
149
  META_PROP_VALUE_STRING_AS_UTF8,
 
150
  META_PROP_VALUE_MOTIF_HINTS,
 
151
  META_PROP_VALUE_CARDINAL,
 
152
  META_PROP_VALUE_WINDOW,
 
153
  META_PROP_VALUE_CARDINAL_LIST,
 
154
  META_PROP_VALUE_UTF8_LIST,
 
155
  META_PROP_VALUE_ATOM_LIST,
 
156
  META_PROP_VALUE_TEXT_PROPERTY, /* comes back as UTF-8 string */
 
157
  META_PROP_VALUE_WM_HINTS,
 
158
  META_PROP_VALUE_CLASS_HINT,
 
159
  META_PROP_VALUE_SIZE_HINTS,
 
160
  META_PROP_VALUE_SYNC_COUNTER /* comes back as CARDINAL */
 
161
} MetaPropValueType;
 
162
 
 
163
/* used to request/return/store property values */
 
164
typedef struct
 
165
{
 
166
  MetaPropValueType type;
 
167
  Atom atom;
 
168
  Atom required_type; /* autofilled if None */
 
169
  
 
170
  union
 
171
  {
 
172
    char *str;
 
173
    MotifWmHints *motif_hints;
 
174
    Window xwindow;
 
175
    gulong cardinal;
 
176
    XWMHints *wm_hints;
 
177
    XClassHint class_hint;
 
178
#ifdef HAVE_XSYNC
 
179
    XSyncCounter xcounter;
 
180
#endif
 
181
    
 
182
    struct
 
183
    {
 
184
      XSizeHints   *hints;
 
185
      unsigned long flags;
 
186
    } size_hints;
 
187
    
 
188
    struct
 
189
    {
 
190
      gulong *cardinals;
 
191
      int     n_cardinals;
 
192
    } cardinal_list;
 
193
 
 
194
    struct
 
195
    {
 
196
      char **strings;
 
197
      int    n_strings;
 
198
    } string_list;
 
199
 
 
200
    struct
 
201
    {
 
202
      Atom *atoms;
 
203
      int   n_atoms;
 
204
    } atom_list;
 
205
    
 
206
  } v;
 
207
 
 
208
} MetaPropValue;
 
209
 
 
210
/* Each value has type and atom initialized. If there's an error,
 
211
 * or property is unset, type comes back as INVALID;
 
212
 * else type comes back as it originated, and the data
 
213
 * is filled in.
 
214
 */
 
215
void meta_prop_get_values (MetaDisplay   *display,
 
216
                           Window         xwindow,
 
217
                           MetaPropValue *values,
 
218
                           int            n_values);
 
219
 
 
220
void meta_prop_free_values (MetaPropValue *values,
 
221
                            int            n_values);
 
222
 
 
223
#endif
 
224
 
 
225
 
 
226
 
 
227