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
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
195
  
196
  
197
  
198
  
199
  
200
  
201
  
202
  
203
  
204
  
205
  
206
  
207
  
208
  
209
  
210
  
211
  
212
  
213
  
214
  
215
  
216
  
217
  
218
  
219
  
220
  
221
  
222
  
223
  
224
  
225
  
226
  
227
  
228
  
229
  
230
  
231
  
232
  
233
  
234
  
235
  
236
  
237
  
238
  
239
  
240
  
241
  
242
  
243
  
244
  
245
  
246
  
247
  
248
  
249
  
250
  
251
  
252
  
253
  
254
  
255
  
256
  
257
  
258
  
259
  
260
  
261
  
262
  
263
  
264
  
265
  
266
  
267
  
268
  
269
  
270
  
271
  
272
  
273
  
274
  
275
  
276
  
277
  
278
  
279
  
280
  
281
  
282
  
/* -*- C -*- */ 
require gtk22; 
 
class GDK2.Display; 
inherit G.Object; 
 
//! GdkDisplay object. 
 
%{ 
#define GTK_GDKDISPLAY(X) GDK_DISPLAY_OBJECT(X) 
%} 
 
signal closed; 
 
void create() 
//! Get the default display. 
{ 
  pgtk2_verify_not_inited(); 
  pgtk2_verify_setup(); 
  { 
    GdkDisplay *gd; 
 
    gd=gdk_display_get_default(); 
    THIS->obj=G_OBJECT(gd); 
  } 
  pgtk2_pop_n_elems(args); 
  pgtk2__init_this_object(); 
} 
 
void open(string name) 
//! Opens a display. 
{ 
  pgtk2_verify_inited(); 
  { 
    const gchar *name; 
    GdkDisplay *gd; 
 
    get_all_args(NULL,args,"%s",&name); 
    gd=gdk_display_open(name); 
    if (THIS->obj) 
      g_object_unref(THIS->obj); 
    THIS->obj=G_OBJECT(gd); 
  } 
  RETURN_THIS(); 
} 
 
string get_name(); 
//! Gets the name of the display. 
 
int get_n_screens(); 
//! Gets the number of screens managed by the display. 
 
GDK2.Screen get_screen(int screen_num); 
//! Returns a screen for one of the screens. 
 
GDK2.Screen get_default_screen(); 
//! Get the default screen. 
 
void pointer_ungrab() 
//! Release any pointer grab. 
{ 
  pgtk2_verify_inited(); 
  gdk_display_pointer_ungrab(GDK_DISPLAY_OBJECT(THIS->obj),GDK_CURRENT_TIME); 
  RETURN_THIS(); 
} 
 
void keyboard_ungrab() 
//! Release any keyboard grab. 
{ 
  pgtk2_verify_inited(); 
  gdk_display_keyboard_ungrab(GDK_DISPLAY_OBJECT(THIS->obj),GDK_CURRENT_TIME); 
  RETURN_THIS(); 
} 
 
int pointer_is_grabbed(); 
//! Test if the pointer is grabbed. 
 
void beep(); 
//! Emits a short beep on display 
 
void sync(); 
//! Flushes any requests queued for the windowing system and waits until all 
//! requests have been handled.  This is often used for making sure that the 
//! display is synchronized with the current state of the program.  Calling 
//! sync() before (gdk_error_trap_pop()) makes sure that any errors 
//! generated from earlier requests are handled before the error trap is 
//! removed. 
//! <p> 
//! This is most useful for X11.  On windowing systems where requests are 
//! handled synchronously, this function will do nothing. 
 
require gtk24; 
void flush(); 
//! Flushes any requests queued for the windowing system; this happens 
//! automatically when the main loop blocks waiting for new events, but if 
//! your application is drawing without returning control to the main loop, 
//! you may need to call this function explicitly.  A common case where this 
//! function needs to be called is when an application is executing drawing 
//! commands from a thread other than the thread where the main loop is 
//! running. 
endrequire; 
 
void close(); 
//! Closes the connection to the window system for the given display, and 
//! cleans up associated resources. 
 
GDK2.Event get_event(); 
//! Gets the next GDK2.Event to be processed, fetching events from the 
//! windowing system if necessary. 
 
GDK2.Event peek_event(); 
//! Gets a copy of the first GDK2.Event in the event queue, without removing 
//! the event from the queue.  (Note that this function will not get more 
//! events from the windowing system.  It only checks the events that have 
//! already been moved to the GDK event queue.) 
 
void put_event(GDK2.Event event); 
//! Appends a copy of the given event onto the front of the event queue. 
 
void set_double_click_time(int msec); 
//! Sets the double click time (two clicks within this time interval counts 
//! as a double click and result in a GDK_2BUTTON_PRESS event).  Applications 
//! should not set this, it is a global user-configured setting. 
 
require gtk24; 
void set_double_click_distance(int distance); 
//! Sets the double click distance (two clicks within this distance count as 
//! a double click and result in a GDK_2BUTTON_PRESS event).  See also 
//! set_double_click_time(). 
endrequire; 
 
mapping get_pointer() 
//! Gets the current location of the pointer and the current modifier mask. 
{ 
  pgtk2_verify_inited(); 
  { 
    gint x,y; 
    GdkModifierType mask; 
    gdk_display_get_pointer(GDK_DISPLAY_OBJECT(THIS->obj),NULL,&x,&y,&mask); 
    pgtk2_pop_n_elems(args); 
    ref_push_string(_STR("x")); push_int(x); 
    ref_push_string(_STR("y")); push_int(y); 
    ref_push_string(_STR("mask")); push_int(mask); 
    f_aggregate_mapping(6); 
  } 
} 
 
mapping get_window_at_pointer() 
//! Obtains the window underneath the mouse pointer, and the x,y location. 
//! Returns 0 if the window is not known to GDK (for example, belongs to 
//! another application). 
{ 
  pgtk2_verify_inited(); 
  pgtk2_pop_n_elems(args); 
  { 
    gint x,y; 
    GdkWindow *gw; 
    gw=gdk_display_get_window_at_pointer(GDK_DISPLAY_OBJECT(THIS->obj),&x,&y); 
/*    push_text("window"); push_gobject(gw,window); */ 
    ref_push_string(_STR("window")); push_gobject(gw); 
    ref_push_string(_STR("x")); push_int(x); 
    ref_push_string(_STR("y")); push_int(y); 
    f_aggregate_mapping(6); 
  } 
} 
 
require gtk28; 
void warp_pointer(GDK2.Screen screen, int x, int y) 
//! Warps the pointer to the point x,y on the screen, unless the pointer 
//! is confined to a window by a grab, in which case it will be moved as far 
//! as allowed by the grab.  Warping the pointer creates events as if the 
//! user had moved the mouse instantaneously to the destination. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    INT_TYPE x,y; 
 
    get_all_args(NULL,args,"%o%i%i",&o1,&x,&y); 
    gdk_display_warp_pointer(GDK_DISPLAY_OBJECT(THIS->obj), 
                        GDK_SCREEN(get_gobject(o1)),x,y); 
  } 
  RETURN_THIS(); 
} 
endrequire; 
 
require gtk24; 
int supports_cursor_color(); 
//! Returns true if multicolored cursors are supported.  Otherwise, cursors 
//! have only a foreground and a background color. 
 
int supports_cursor_alpha(); 
//! Returns true if cursors can use an 8bit alpha channel.  Otherwise, cursors 
//! are restricted to bilevel alpha (i.e. a mask). 
 
int get_default_cursor_size(); 
//! Returns the default size to use for cursors. 
 
mapping get_maximal_cursor_size() 
//! Returns the maximal size to use for cursors. 
{ 
  pgtk2_verify_inited(); 
  { 
    guint width,height; 
    gdk_display_get_maximal_cursor_size(GDK_DISPLAY_OBJECT(THIS->obj), 
                        &width,&height); 
    pgtk2_pop_n_elems(args); 
    ref_push_string(_STR("width")); push_int(width); 
    ref_push_string(_STR("height")); push_int(height); 
    f_aggregate_mapping(4); 
  } 
} 
 
+GDK2.Window get_default_group(); 
//! Returns the default group leader window for all toplevel windows.  This 
//! window is implicitly create by GDK. 
endrequire; 
 
require gtk26; 
int supports_selection_notification(); 
//! Returns whether GdkEventOwnerChange events will be sent when the owner 
//! of a selection changes. 
 
int request_selection_notification(GDK2.Atom selection) 
//! Request GdkEventOwnerChange events for ownership changes of the selection 
//! named by the given atom. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    int res; 
    get_all_args(NULL,args,"%o",&o1); 
    res=gdk_display_request_selection_notification( 
                GDK_DISPLAY_OBJECT(THIS->obj), 
                get_gdkatom(o1)); 
    pgtk2_pop_n_elems(args); 
    push_int(res); 
  } 
} 
 
int supports_clipboard_persistence(); 
//! Returns whether the specified display supports clipboard persistence, i.e. 
//! if it's possible to store the clipboard data after an application has quit. 
//! On X11 this checks if a clipboard daemon is running. 
 
void store_clipboard(GDK2.Window clipboard_window, 
                     array(GDK2.Atom) targets) 
//! Issues a request to the clipboard manager to store the clipboard data. 
{ 
  pgtk2_verify_inited(); 
  { 
    struct object *o1; 
    struct array *a=NULL; 
 
    get_all_args(NULL,args,"%o%A",&o1,&a); 
    if (a!=NULL) { 
      GdkAtom *targets; 
      int n; 
 
      targets=xalloc(a->size); 
      for (n=0; n<a->size; n++) 
        targets[n]=get_gdkatom(ITEM(a)[n].u.object); 
      gdk_display_store_clipboard(GDK_DISPLAY_OBJECT(THIS->obj), 
                        GDK_WINDOW(get_gobject(o1)),GDK_CURRENT_TIME, 
                        targets,n); 
      xfree(targets); 
    } 
  }  
  RETURN_THIS(); 
} 
endrequire; 
 
require gtk210; 
int supports_shapes(); 
//! Returns true if GDK2.Window->shape_combine_mask() can be used to create 
//! shaped windows. 
 
int supports_input_shapes(); 
//! Returns true if GDK2.Window->input_shape_combine_mask() can be used to 
//! modify the input shape of windows. 
endrequire;