gdkx.h 8.51 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3 4
/* GDK - The GIMP Drawing Kit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
Elliot Lee's avatar
Elliot Lee committed
6 7 8 9 10 11
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
12
 * Lesser General Public License for more details.
Elliot Lee's avatar
Elliot Lee committed
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
15 16 17
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
Elliot Lee's avatar
Elliot Lee committed
18
 */
19 20

/*
21
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22 23 24 25 26
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
 */

Elliot Lee's avatar
Elliot Lee committed
27 28 29
#ifndef __GDK_X_H__
#define __GDK_X_H__

30 31 32 33
#include <gdk/gdkprivate.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

34 35
G_BEGIN_DECLS

36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

/**
 * SECTION:x_interaction
 * @Short_description: X backend-specific functions
 * @Title: X Window System Interaction
 *
 * The functions in this section are specific to the GDK X11 backend.
 * To use them, you need to include the <literal>&lt;gdk/gdkx.h&gt;</literal>
 * header and use the X11-specific pkg-config files to build your
 * application (either <literal>gdk-x11-3.0</literal> or
 * <literal>gtk+-x11-3.0</literal>).
 *
 * To make your code compile with other GDK backends, guard backend-specific
 * calls by an ifdef as follows:
 * <informalexample><programlisting>
 * #ifdef GDK_WINDOWING_X11
 *   /<!---->* X11-specific calls here... *<!---->/
 * #endif
 * </programlisting></informalexample>
 */


58
Window   gdk_x11_window_get_xid           (GdkWindow   *window);
59 60
Display *gdk_x11_cursor_get_xdisplay      (GdkCursor   *cursor);
Cursor   gdk_x11_cursor_get_xcursor       (GdkCursor   *cursor);
61
Display *gdk_x11_display_get_xdisplay     (GdkDisplay  *display);
62
Visual * gdk_x11_visual_get_xvisual       (GdkVisual   *visual);
63 64
Screen * gdk_x11_screen_get_xscreen       (GdkScreen   *screen);
int      gdk_x11_screen_get_screen_number (GdkScreen   *screen);
Matthias Clasen's avatar
Matthias Clasen committed
65 66
void     gdk_x11_window_set_user_time     (GdkWindow   *window,
					   guint32      timestamp);
67
void     gdk_x11_window_move_to_current_desktop (GdkWindow   *window);
68 69 70

const char* gdk_x11_screen_get_window_manager_name (GdkScreen *screen);

71
#ifndef GDK_MULTIHEAD_SAFE
72 73 74
Window   gdk_x11_get_default_root_xwindow (void);
Display *gdk_x11_get_default_xdisplay     (void);
gint     gdk_x11_get_default_screen       (void);
75
#endif
76

77 78 79 80 81 82 83 84
/**
 * GDK_CURSOR_XDISPLAY:
 * @cursor: a #GdkCursor.
 *
 * Returns the display of a #GdkCursor.
 *
 * Returns: an Xlib <type>Display*</type>.
 */
85
#define GDK_CURSOR_XDISPLAY(cursor)   (gdk_x11_cursor_get_xdisplay (cursor))
86 87 88 89 90 91 92 93 94

/**
 * GDK_CURSOR_XCURSOR:
 * @cursor: a #GdkCursor.
 *
 * Returns the X cursor belonging to a #GdkCursor.
 *
 * Returns: an Xlib <type>Cursor</type>.
 */
95
#define GDK_CURSOR_XCURSOR(cursor)    (gdk_x11_cursor_get_xcursor (cursor))
96

97

Manish Singh's avatar
Manish Singh committed
98
#ifdef GDK_COMPILATION
99 100

#include "gdkprivate-x11.h"
101
#include "gdkscreen-x11.h"
102

103 104 105 106 107 108
/**
 * GDK_DISPLAY_XDISPLAY:
 * @display: a #GdkDisplay.
 *
 * Returns the display of a #GdkDisplay.
 */
109 110
#define GDK_DISPLAY_XDISPLAY(display) (GDK_DISPLAY_X11(display)->xdisplay)

111 112 113 114 115 116 117 118
/**
 * GDK_WINDOW_XDISPLAY:
 * @win: a #GdkWindow.
 *
 * Returns the display of a #GdkWindow.
 *
 * Returns: an Xlib <type>Display*</type>.
 */
119
#define GDK_WINDOW_XDISPLAY(win)      (GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (win))->xdisplay)
120
#define GDK_WINDOW_XID(win)           (GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)win)->impl)->xid)
121
#define GDK_WINDOW_XWINDOW(win)       (GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)win)->impl)->xid)
122

123
#define GDK_SCREEN_XDISPLAY(screen)   (GDK_SCREEN_X11 (screen)->xdisplay)
124 125 126 127 128 129 130 131 132

/**
 * GDK_SCREEN_XSCREEN:
 * @screen: a #GdkScreen
 *
 * Returns the screen of a #GdkScreen.
 *
 * Returns: an Xlib <type>Screen*</type>.
 */
133
#define GDK_SCREEN_XSCREEN(screen)    (GDK_SCREEN_X11 (screen)->xscreen)
134
#define GDK_SCREEN_XNUMBER(screen)    (GDK_SCREEN_X11 (screen)->screen_num) 
Elliot Lee's avatar
Elliot Lee committed
135

Manish Singh's avatar
Manish Singh committed
136
#else /* GDK_COMPILATION */
137

138
#ifndef GDK_MULTIHEAD_SAFE
139 140 141 142 143
/**
 * GDK_ROOT_WINDOW:
 *
 * Obtains the Xlib window id of the root window of the current screen.
 */
144
#define GDK_ROOT_WINDOW()             (gdk_x11_get_default_root_xwindow ())
145 146 147 148
#endif

#define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))

149
#define GDK_WINDOW_XDISPLAY(win)      (GDK_DISPLAY_XDISPLAY (gdk_window_get_display (win)))
150 151 152 153 154 155 156 157 158

/**
 * GDK_WINDOW_XID:
 * @win: a #GdkWindow.
 *
 * Returns the X window belonging to a #GdkWindow.
 *
 * Returns: the Xlib <type>Window</type> of @win.
 */
159
#define GDK_WINDOW_XID(win)           (gdk_x11_window_get_xid (win))
160 161 162 163 164 165

/**
 * GDK_WINDOW_XWINDOW:
 *
 * Another name for GDK_DRAWABLE_XID().
 */
166
#define GDK_WINDOW_XWINDOW(win)       (gdk_x11_window_get_xid (win))
167 168
#define GDK_SCREEN_XDISPLAY(screen)   (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
#define GDK_SCREEN_XSCREEN(screen)    (gdk_x11_screen_get_xscreen (screen))
169 170 171 172 173 174 175 176 177 178

/**
 * GDK_SCREEN_XNUMBER:
 * @screen: a #GdkScreen
 *
 * Returns the index of a #GdkScreen.
 *
 * Returns: the position of @screen among the screens of
 *  its display.
 */
179
#define GDK_SCREEN_XNUMBER(screen)    (gdk_x11_screen_get_screen_number (screen))
180

Manish Singh's avatar
Manish Singh committed
181
#endif /* GDK_COMPILATION */
182

183 184
#define GDK_VISUAL_XVISUAL(visual)    (gdk_x11_visual_get_xvisual (visual))

185 186
GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
					 VisualID   xvisualid);
187 188 189 190
#ifndef GDK_MULTIHEAD_SAFE
GdkVisual* gdkx_visual_get            (VisualID   xvisualid);
#endif

191
     /* Return the Gdk* for a particular XID */
192 193
gpointer      gdk_xid_table_lookup_for_display (GdkDisplay *display,
						XID         xid);
194
guint32       gdk_x11_get_server_time  (GdkWindow       *window);
195
guint32       gdk_x11_display_get_user_time (GdkDisplay *display);
196

197
G_CONST_RETURN gchar *gdk_x11_display_get_startup_notification_id (GdkDisplay *display);
198 199
void          gdk_x11_display_set_startup_notification_id         (GdkDisplay  *display,
                                                                   const gchar *startup_id);
200

201 202 203 204
void          gdk_x11_display_set_cursor_theme (GdkDisplay  *display,
						const gchar *theme,
						const gint   size);

205 206 207 208
void gdk_x11_display_broadcast_startup_message (GdkDisplay *display,
						const char *message_type,
						...) G_GNUC_NULL_TERMINATED;

Havoc Pennington's avatar
Havoc Pennington committed
209
/* returns TRUE if we support the given WM spec feature */
210 211 212
gboolean gdk_x11_screen_supports_net_wm_hint (GdkScreen *screen,
					      GdkAtom    property);

Søren Sandmann's avatar
Søren Sandmann committed
213 214 215
XID      gdk_x11_screen_get_monitor_output   (GdkScreen *screen,
                                              gint       monitor_num);

216 217 218
#ifndef GDK_MULTIHEAD_SAFE
gpointer      gdk_xid_table_lookup   (XID              xid);
gboolean      gdk_net_wm_supports    (GdkAtom    property);
219 220
void          gdk_x11_grab_server    (void);
void          gdk_x11_ungrab_server  (void);
221 222 223
#endif

GdkDisplay   *gdk_x11_lookup_xdisplay (Display *xdisplay);
Havoc Pennington's avatar
Havoc Pennington committed
224

225 226 227

/* Functions to get the X Atom equivalent to the GdkAtom */
Atom	              gdk_x11_atom_to_xatom_for_display (GdkDisplay  *display,
Alex Larsson's avatar
Alex Larsson committed
228
							 GdkAtom      atom);
229 230 231 232 233 234 235
GdkAtom		      gdk_x11_xatom_to_atom_for_display (GdkDisplay  *display,
							 Atom	      xatom);
Atom		      gdk_x11_get_xatom_by_name_for_display (GdkDisplay  *display,
							     const gchar *atom_name);
G_CONST_RETURN gchar *gdk_x11_get_xatom_name_for_display (GdkDisplay  *display,
							  Atom         xatom);
#ifndef GDK_MULTIHEAD_SAFE
236 237 238 239
Atom                  gdk_x11_atom_to_xatom     (GdkAtom      atom);
GdkAtom               gdk_x11_xatom_to_atom     (Atom         xatom);
Atom                  gdk_x11_get_xatom_by_name (const gchar *atom_name);
G_CONST_RETURN gchar *gdk_x11_get_xatom_name    (Atom         xatom);
240
#endif
241

242 243
void	    gdk_x11_display_grab	      (GdkDisplay *display);
void	    gdk_x11_display_ungrab	      (GdkDisplay *display);
244 245 246 247 248 249

void                           gdk_x11_display_error_trap_push        (GdkDisplay *display);
/* warn unused because you could use pop_ignored otherwise */
G_GNUC_WARN_UNUSED_RESULT gint gdk_x11_display_error_trap_pop         (GdkDisplay *display);
void                           gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display);

250 251 252
void        gdk_x11_register_standard_event_type (GdkDisplay *display,
						  gint        event_base,
						  gint        n_events);
253

254 255 256

G_END_DECLS

Elliot Lee's avatar
Elliot Lee committed
257
#endif /* __GDK_X_H__ */