1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gdk-X-Window-System-Interaction.html
27  * outPack = gdk
28  * outFile = X11
29  * strct   = 
30  * realStrct=
31  * ctorStrct=
32  * clss    = X11
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_x11_
41  * omit structs:
42  * omit prefixes:
43  * 	- gdkx_visual_get
44  * 	- gdkx_colormap_get
45  * 	- gdk_pixmap_foreign_new
46  * 	- gdk_pixmap_foreign_new_for_display
47  * 	- gdk_pixmap_foreign_new_for_screen
48  * 	- gdk_window_foreign_new_for_display
49  * 	- gdk_xid_table_lookup_for_display
50  * 	- gdk_window_lookup_for_display
51  * 	- gdk_pixmap_lookup_for_display
52  * 	- gdk_x11_lookup_xdisplay
53  * 	- gdk_net_wm_supports
54  * 	- gdk_x11_screen_supports_net_wm_hint
55  * 	- gdk_x11_screen_get_window_manager_name
56  * 	- gdk_x11_screen_lookup_visual
57  * 	- gdk_x11_display_get_user_time
58  * 	- gdk_x11_colormap_foreign_new
59  * 	- gdk_x11_colormap_get_xcolormap
60  * 	- gdk_x11_colormap_get_xdisplay
61  * 	- gdk_x11_cursor_get_xcursor
62  * 	- gdk_x11_cursor_get_xdisplay
63  * 	- gdk_x11_display_get_xdisplay
64  * 	- gdk_x11_display_grab
65  * 	- gdk_x11_display_ungrab
66  * 	- gdk_x11_display_set_cursor_theme
67  * 	- gdk_x11_register_standard_event_type
68  * 	- gdk_x11_drawable_get_xdisplay
69  * 	- gdk_x11_font_get_xdisplay
70  * 	- gdk_x11_gc_get_xdisplay
71  * 	- gdk_x11_gc_get_xgc
72  * 	- gdk_x11_get_default_root_xwindow
73  * 	- gdk_x11_get_default_xdisplay
74  * 	- gdk_x11_image_get_xdisplay
75  * 	- gdk_x11_image_get_ximage
76  * 	- gdk_x11_screen_get_screen_number
77  * 	- gdk_x11_screen_get_xscreen
78  * 	- gdk_x11_visual_get_xvisual
79  * 	- gdk_x11_atom_to_xatom
80  * 	- gdk_x11_atom_to_xatom_for_display
81  * 	- gdk_x11_xatom_to_atom
82  * 	- gdk_x11_xatom_to_atom_for_display
83  * 	- gdk_x11_get_xatom_by_name
84  * 	- gdk_x11_get_xatom_by_name_for_display
85  * 	- gdk_x11_get_xatom_name
86  * 	- gdk_x11_get_xatom_name_for_display
87  * 	- gdk_x11_window_foreign_new_for_display
88  * 	- gdk_x11_window_lookup_for_display
89  * omit code:
90  * omit signals:
91  * imports:
92  * 	- glib.Str
93  * 	- gdk.Drawable
94  * 	- gdk.Display
95  * 	- gdk.Window
96  * 	- gdk.Font
97  * 	- gdk.Pixmap
98  * structWrap:
99  * 	- GdkDisplay* -> Display
100  * 	- GdkDrawable* -> Drawable
101  * 	- GdkFont* -> Font
102  * 	- GdkPixmap* -> Pixmap
103  * 	- GdkWindow* -> Window
104  * module aliases:
105  * local aliases:
106  * overrides:
107  */
108 
109 module gdk.X11;
110 
111 public  import gtkc.gdktypes;
112 
113 private import gtkc.gdk;
114 private import glib.ConstructionException;
115 private import gobject.ObjectG;
116 
117 
118 private import glib.Str;
119 private import gdk.Drawable;
120 private import gdk.Display;
121 private import gdk.Window;
122 private import gdk.Font;
123 private import gdk.Pixmap;
124 
125 
126 
127 
128 /**
129  * Description
130  */
131 public class X11
132 {
133 	
134 	/**
135 	 */
136 	
137 	/**
138 	 * Warning
139 	 * gdk_window_foreign_new is deprecated and should not be used in newly-written code.
140 	 * Wraps a native window for the default display in a GdkWindow.
141 	 * This may fail if the window has been destroyed.
142 	 * For example in the X backend, a native window handle is an Xlib
143 	 * XID.
144 	 * Params:
145 	 * anid = a native window handle.
146 	 * Returns: the newly-created GdkWindow wrapper for the native window or NULL if the window has been destroyed.
147 	 */
148 	public static Window gdkWindowForeignNew(GdkNativeWindow anid)
149 	{
150 		// GdkWindow * gdk_window_foreign_new (GdkNativeWindow anid);
151 		auto p = gdk_window_foreign_new(anid);
152 		
153 		if(p is null)
154 		{
155 			return null;
156 		}
157 		
158 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
159 	}
160 	
161 	/**
162 	 * Warning
163 	 * gdk_xid_table_lookup has been deprecated since version 2.24 and should not be used in newly-written code. This function will be removed in GTK+ 3.0. GTK+
164 	 *  only stores windows in its X id table nowadays, so use
165 	 *  gdk_x11_window_lookup_for_display() instead.
166 	 * Returns the Gdk object associated with the given X id for the default
167 	 * display.
168 	 * Params:
169 	 * xid = an X id.
170 	 * Returns: the associated Gdk object, which may be a GdkPixmap, a GdkWindow or a GdkFont or NULL if no object is associated with the X id.
171 	 */
172 	public static void* gdkXidTableLookup(uint xid)
173 	{
174 		// gpointer gdk_xid_table_lookup (XID xid);
175 		return gdk_xid_table_lookup(xid);
176 	}
177 	
178 	/**
179 	 * Warning
180 	 * gdk_window_lookup has been deprecated since version 2.24 and should not be used in newly-written code. Use gdk_x11_window_lookup_for_display() or equivalent
181 	 *  backend-specific functionality instead
182 	 * Looks up the GdkWindow that wraps the given native window handle.
183 	 * For example in the X backend, a native window handle is an Xlib
184 	 * XID.
185 	 * Params:
186 	 * anid = a native window handle.
187 	 * Returns: the GdkWindow wrapper for the native window, or NULL if there is none.
188 	 */
189 	public static Window gdkWindowLookup(GdkNativeWindow anid)
190 	{
191 		// GdkWindow * gdk_window_lookup (GdkNativeWindow anid);
192 		auto p = gdk_window_lookup(anid);
193 		
194 		if(p is null)
195 		{
196 			return null;
197 		}
198 		
199 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
200 	}
201 	
202 	/**
203 	 * Looks up the GdkPixmap that wraps the given native pixmap handle.
204 	 * For example in the X backend, a native pixmap handle is an Xlib
205 	 * XID.
206 	 * Params:
207 	 * anid = a native pixmap handle.
208 	 * Returns: the GdkPixmap wrapper for the native pixmap, or NULL if there is none.
209 	 */
210 	public static Pixmap gdkPixmapLookup(GdkNativeWindow anid)
211 	{
212 		// GdkPixmap * gdk_pixmap_lookup (GdkNativeWindow anid);
213 		auto p = gdk_pixmap_lookup(anid);
214 		
215 		if(p is null)
216 		{
217 			return null;
218 		}
219 		
220 		return ObjectG.getDObject!(Pixmap)(cast(GdkPixmap*) p);
221 	}
222 	
223 	/**
224 	 * Routine to get the current X server time stamp.
225 	 * Params:
226 	 * window = a GdkWindow, used for communication with the server.
227 	 * The window must have GDK_PROPERTY_CHANGE_MASK in its
228 	 * events mask or a hang will result.
229 	 * Returns: the time stamp.
230 	 */
231 	public static uint getServerTime(Window window)
232 	{
233 		// guint32 gdk_x11_get_server_time (GdkWindow *window);
234 		return gdk_x11_get_server_time((window is null) ? null : window.getWindowStruct());
235 	}
236 	
237 	/**
238 	 * Gets the XID of the specified output/monitor.
239 	 * If the X server does not support version 1.2 of the RANDR
240 	 * extension, 0 is returned.
241 	 * Since 2.14
242 	 * Params:
243 	 * screen = a GdkScreen
244 	 * monitorNum = number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
245 	 * Returns: the XID of the monitor
246 	 */
247 	public static uint screenGetMonitorOutput(GdkScreen* screen, int monitorNum)
248 	{
249 		// XID gdk_x11_screen_get_monitor_output (GdkScreen *screen,  gint monitor_num);
250 		return gdk_x11_screen_get_monitor_output(screen, monitorNum);
251 	}
252 	
253 	/**
254 	 * The application can use this call to update the _NET_WM_USER_TIME
255 	 * property on a toplevel window. This property stores an Xserver
256 	 * time which represents the time of the last user input event
257 	 * received for this window. This property may be used by the window
258 	 * manager to alter the focus, stacking, and/or placement behavior of
259 	 * windows when they are mapped depending on whether the new window
260 	 * was created by a user action or is a "pop-up" window activated by a
261 	 * timer or some other event.
262 	 * Note that this property is automatically updated by GDK, so this
263 	 * function should only be used by applications which handle input
264 	 * events bypassing GDK.
265 	 * Since 2.6
266 	 * Params:
267 	 * window = A toplevel GdkWindow
268 	 * timestamp = An XServer timestamp to which the property should be set
269 	 */
270 	public static void windowSetUserTime(Window window, uint timestamp)
271 	{
272 		// void gdk_x11_window_set_user_time (GdkWindow *window,  guint32 timestamp);
273 		gdk_x11_window_set_user_time((window is null) ? null : window.getWindowStruct(), timestamp);
274 	}
275 	
276 	/**
277 	 * Moves the window to the correct workspace when running under a
278 	 * window manager that supports multiple workspaces, as described
279 	 * in the Extended
280 	 * Window Manager Hints. Will not do anything if the
281 	 * window is already on all workspaces.
282 	 * Since 2.8
283 	 * Params:
284 	 * window = a GdkWindow
285 	 */
286 	public static void windowMoveToCurrentDesktop(Window window)
287 	{
288 		// void gdk_x11_window_move_to_current_desktop  (GdkWindow *window);
289 		gdk_x11_window_move_to_current_desktop((window is null) ? null : window.getWindowStruct());
290 	}
291 	
292 	/**
293 	 * Gets the startup notification ID for a display.
294 	 * Since 2.12
295 	 * Params:
296 	 * display = a GdkDisplay
297 	 * Returns: the startup notification ID for display
298 	 */
299 	public static string displayGetStartupNotificationId(Display display)
300 	{
301 		// const gchar * gdk_x11_display_get_startup_notification_id  (GdkDisplay *display);
302 		return Str.toString(gdk_x11_display_get_startup_notification_id((display is null) ? null : display.getDisplayStruct()));
303 	}
304 	
305 	/**
306 	 * Returns the X resource (window or pixmap) belonging to a GdkDrawable.
307 	 * Params:
308 	 * drawable = a GdkDrawable.
309 	 * Returns: the ID of drawable's X resource.
310 	 */
311 	public static uint drawableGetXid(Drawable drawable)
312 	{
313 		// XID gdk_x11_drawable_get_xid (GdkDrawable *drawable);
314 		return gdk_x11_drawable_get_xid((drawable is null) ? null : drawable.getDrawableStruct());
315 	}
316 	
317 	/**
318 	 * Warning
319 	 * gdk_x11_font_get_name is deprecated and should not be used in newly-written code.
320 	 * Return the X Logical Font Description (for font->type == GDK_FONT_FONT)
321 	 * or comma separated list of XLFDs (for font->type == GDK_FONT_FONTSET)
322 	 * that was used to load the font. If the same font was loaded
323 	 * via multiple names, which name is returned is undefined.
324 	 * Params:
325 	 * font = a GdkFont.
326 	 * Returns: the name of the font. This string is owned by GDK and must not be modified or freed.
327 	 */
328 	public static string fontGetName(Font font)
329 	{
330 		// const char * gdk_x11_font_get_name (GdkFont *font);
331 		return Str.toString(gdk_x11_font_get_name((font is null) ? null : font.getFontStruct()));
332 	}
333 	
334 	/**
335 	 * Warning
336 	 * gdk_x11_font_get_xfont is deprecated and should not be used in newly-written code.
337 	 * Returns the X font belonging to a GdkFont.
338 	 * Params:
339 	 * font = a GdkFont.
340 	 * Returns: an Xlib XFontStruct* or an XFontSet.
341 	 */
342 	public static void* fontGetXfont(Font font)
343 	{
344 		// gpointer gdk_x11_font_get_xfont (GdkFont *font);
345 		return gdk_x11_font_get_xfont((font is null) ? null : font.getFontStruct());
346 	}
347 	
348 	/**
349 	 * Gets the default GTK+ screen number.
350 	 * Returns: returns the screen number specified by the --display command line option or the DISPLAY environment variable when gdk_init() calls XOpenDisplay().
351 	 */
352 	public static int getDefaultScreen()
353 	{
354 		// gint gdk_x11_get_default_screen (void);
355 		return gdk_x11_get_default_screen();
356 	}
357 	
358 	/**
359 	 * Call gdk_x11_display_grab() on the default display.
360 	 * To ungrab the server again, use gdk_x11_ungrab_server().
361 	 * gdk_x11_grab_server()/gdk_x11_ungrab_server() calls can be nested.
362 	 */
363 	public static void grabServer()
364 	{
365 		// void gdk_x11_grab_server (void);
366 		gdk_x11_grab_server();
367 	}
368 	
369 	/**
370 	 * Ungrab the default display after it has been grabbed with
371 	 * gdk_x11_grab_server().
372 	 */
373 	public static void ungrabServer()
374 	{
375 		// void gdk_x11_ungrab_server (void);
376 		gdk_x11_ungrab_server();
377 	}
378 	
379 	/**
380 	 * Sets the SM_CLIENT_ID property on the application's leader window so that
381 	 * the window manager can save the application's state using the X11R6 ICCCM
382 	 * session management protocol.
383 	 * See the X Session Management Library documentation for more information on
384 	 * session management and the Inter-Client Communication Conventions Manual
385 	 * Since 2.24
386 	 * Params:
387 	 * smClientId = the client id assigned by the session manager when the
388 	 * connection was opened, or NULL to remove the property.
389 	 */
390 	public static void setSmClientId(string smClientId)
391 	{
392 		// void gdk_x11_set_sm_client_id (const gchar *sm_client_id);
393 		gdk_x11_set_sm_client_id(Str.toStringz(smClientId));
394 	}
395 }