gdkdisplay.h 11.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * gdkdisplay.h
 * 
 * Copyright 2001 Sun Microsystems Inc. 
 *
 * Erwann Chenede <erwann.chenede@sun.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

24
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
25 26 27
#error "Only <gdk/gdk.h> can be included directly."
#endif

28 29 30 31 32
#ifndef __GDK_DISPLAY_H__
#define __GDK_DISPLAY_H__

#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
33
#include <gdk/gdkdevicemanager.h>
34 35 36 37 38 39 40 41 42 43

G_BEGIN_DECLS

#define GDK_TYPE_DISPLAY              (gdk_display_get_type ())
#define GDK_DISPLAY_OBJECT(object)    (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY, GdkDisplay))
#define GDK_DISPLAY_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY, GdkDisplayClass))
#define GDK_IS_DISPLAY(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY))
#define GDK_IS_DISPLAY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY))
#define GDK_DISPLAY_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass))

44 45
typedef struct _GdkDisplayPointerHooks GdkDisplayPointerHooks;
typedef struct _GdkDisplayDeviceHooks GdkDisplayDeviceHooks;
46

47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
/**
 * GdkDisplayPointerHooks:
 * @get_pointer: Obtains the current pointer position and modifier state.
 *  The position is given in coordinates relative to the screen containing
 *  the pointer, which is returned in @screen.
 * @window_get_pointer: Obtains the window underneath the mouse pointer.
 *  Current pointer position and modifier state are returned in @x, @y and
 *  @mask. The position is given in coordinates relative to @window.
 * @window_at_pointer: Obtains the window underneath the mouse pointer,
 *  returning the location of that window in @win_x, @win_y. Returns %NULL
 *  if the window under the mouse pointer is not known to GDK (for example,
 *  belongs to another application).
 *
 * A table of pointers to functions for getting quantities related to
 * the current pointer position. Each #GdkDisplay has a table of this type,
 * which can be set using gdk_display_set_pointer_hooks().
 *
 * This is only useful for such low-level tools as an event recorder.
 * Applications should never have any reason to use this facility
 *
 * Since: 2.2
 */
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
struct _GdkDisplayPointerHooks
{
  void (*get_pointer)              (GdkDisplay      *display,
				    GdkScreen      **screen,
				    gint            *x,
				    gint            *y,
				    GdkModifierType *mask);
  GdkWindow* (*window_get_pointer) (GdkDisplay      *display,
				    GdkWindow       *window,
				    gint            *x,
				    gint            *y,
				    GdkModifierType *mask);
  GdkWindow* (*window_at_pointer)  (GdkDisplay      *display,
				    gint            *win_x,
				    gint            *win_y);
};

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
/**
 * GdkDisplayDeviceHooks:
 * @get_device_state: Obtains the current position and modifier state for
 * @device. The position is given in coordinates relative to the window
 * containing the pointer, which is returned in @window.
 * @window_get_device_position: Obtains the window underneath the device
 * position. Current device position and modifier state are returned in
 * @x, @y and @mask. The position is given in coordinates relative to
 * @window.
 * @window_at_device_position: Obtains the window underneath the device
 * position, returning the location of that window in @win_x, @win_y.
 * Returns %NULL if the window under the mouse pointer is not known to
 * GDK (for example, belongs to another application).
 *
 * A table of pointers to functions for getting quantities related to
 * the current device position. Each #GdkDisplay has a table of this type,
 * which can be set using gdk_display_set_device_hooks().
 */
struct _GdkDisplayDeviceHooks
{
  void (* get_device_state)                  (GdkDisplay       *display,
                                              GdkDevice        *device,
                                              GdkScreen       **screen,
                                              gint             *x,
                                              gint             *y,
                                              GdkModifierType  *mask);
  GdkWindow * (* window_get_device_position) (GdkDisplay      *display,
                                              GdkDevice       *device,
                                              GdkWindow       *window,
                                              gint            *x,
                                              gint            *y,
                                              GdkModifierType *mask);
  GdkWindow * (* window_at_device_position)  (GdkDisplay *display,
                                              GdkDevice  *device,
                                              gint       *win_x,
                                              gint       *win_y);
};

Matthias Clasen's avatar
Matthias Clasen committed
124
GType       gdk_display_get_type (void) G_GNUC_CONST;
Owen Taylor's avatar
Owen Taylor committed
125
GdkDisplay *gdk_display_open                (const gchar *display_name);
126 127 128 129 130 131 132

G_CONST_RETURN gchar * gdk_display_get_name (GdkDisplay *display);

gint        gdk_display_get_n_screens      (GdkDisplay  *display);
GdkScreen * gdk_display_get_screen         (GdkDisplay  *display,
					    gint         screen_num);
GdkScreen * gdk_display_get_default_screen (GdkDisplay  *display);
133 134

#ifndef GDK_MULTIDEVICE_SAFE
135
void        gdk_display_pointer_ungrab     (GdkDisplay  *display,
136
					    guint32      time_);
137
void        gdk_display_keyboard_ungrab    (GdkDisplay  *display,
138
					    guint32      time_);
139
gboolean    gdk_display_pointer_is_grabbed (GdkDisplay  *display);
140 141 142 143
#endif /* GDK_MULTIDEVICE_SAFE */

gboolean    gdk_display_device_is_grabbed  (GdkDisplay  *display,
                                            GdkDevice   *device);
144 145
void        gdk_display_beep               (GdkDisplay  *display);
void        gdk_display_sync               (GdkDisplay  *display);
146 147
void        gdk_display_flush              (GdkDisplay  *display);

John Stowers's avatar
John Stowers committed
148 149
void	    gdk_display_close		       (GdkDisplay  *display);
gboolean    gdk_display_is_closed          (GdkDisplay  *display);
150

151
#ifndef GDK_DISABLE_DEPRECATED
152
GList *     gdk_display_list_devices       (GdkDisplay  *display);
153
#endif /* GDK_DISABLE_DEPRECATED */
154

155 156 157
GdkEvent* gdk_display_get_event  (GdkDisplay     *display);
GdkEvent* gdk_display_peek_event (GdkDisplay     *display);
void      gdk_display_put_event  (GdkDisplay     *display,
158 159
                                  const GdkEvent *event);
gboolean  gdk_display_has_pending (GdkDisplay  *display);
160 161 162 163 164 165

void gdk_display_add_client_message_filter (GdkDisplay   *display,
					    GdkAtom       message_type,
					    GdkFilterFunc func,
					    gpointer      data);

166 167 168 169
void gdk_display_set_double_click_time     (GdkDisplay   *display,
					    guint         msec);
void gdk_display_set_double_click_distance (GdkDisplay   *display,
					    guint         distance);
170

Owen Taylor's avatar
Owen Taylor committed
171
GdkDisplay *gdk_display_get_default (void);
172

173 174
#ifndef GDK_MULTIDEVICE_SAFE

175 176 177 178 179 180 181 182
void             gdk_display_get_pointer           (GdkDisplay             *display,
						    GdkScreen             **screen,
						    gint                   *x,
						    gint                   *y,
						    GdkModifierType        *mask);
GdkWindow *      gdk_display_get_window_at_pointer (GdkDisplay             *display,
						    gint                   *win_x,
						    gint                   *win_y);
183 184 185 186
void             gdk_display_warp_pointer          (GdkDisplay             *display,
						    GdkScreen              *screen,
						    gint                   x,
						    gint                   y);
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
#endif /* GDK_MULTIDEVICE_SAFE */

void             gdk_display_get_device_state              (GdkDisplay            *display,
                                                            GdkDevice             *device,
                                                            GdkScreen            **screen,
                                                            gint                  *x,
                                                            gint                  *y,
                                                            GdkModifierType       *mask);
GdkWindow *      gdk_display_get_window_at_device_position (GdkDisplay            *display,
                                                            GdkDevice             *device,
                                                            gint                  *win_x,
                                                            gint                  *win_y);
void             gdk_display_warp_device                   (GdkDisplay            *display,
                                                            GdkDevice             *device,
                                                            GdkScreen             *screen,
                                                            gint                   x,
                                                            gint                   y);

#ifndef GDK_MULTIDEVICE_SAFE
206 207
GdkDisplayPointerHooks *gdk_display_set_pointer_hooks (GdkDisplay                   *display,
						       const GdkDisplayPointerHooks *new_hooks);
208 209 210 211
#endif /* GDK_MULTIDEVICE_SAFE */

GdkDisplayDeviceHooks *gdk_display_set_device_hooks (GdkDisplay                  *display,
                                                     const GdkDisplayDeviceHooks *new_hooks);
212

213 214
GdkDisplay *gdk_display_open_default_libgtk_only (void);

Matthias Clasen's avatar
Matthias Clasen committed
215 216 217 218 219 220 221
gboolean gdk_display_supports_cursor_alpha     (GdkDisplay    *display);
gboolean gdk_display_supports_cursor_color     (GdkDisplay    *display);
guint    gdk_display_get_default_cursor_size   (GdkDisplay    *display);
void     gdk_display_get_maximal_cursor_size   (GdkDisplay    *display,
						guint         *width,
						guint         *height);

222 223
GdkWindow *gdk_display_get_default_group       (GdkDisplay *display); 

224 225 226 227
gboolean gdk_display_supports_selection_notification (GdkDisplay *display);
gboolean gdk_display_request_selection_notification  (GdkDisplay *display,
						      GdkAtom     selection);

228 229 230 231 232 233
gboolean gdk_display_supports_clipboard_persistence (GdkDisplay    *display);
void     gdk_display_store_clipboard                (GdkDisplay    *display,
						     GdkWindow     *clipboard_window,
						     guint32        time_,
						     const GdkAtom *targets,
						     gint           n_targets);
234

235 236
gboolean gdk_display_supports_shapes           (GdkDisplay    *display);
gboolean gdk_display_supports_input_shapes     (GdkDisplay    *display);
237
gboolean gdk_display_supports_composite        (GdkDisplay    *display);
238

239 240
GdkDeviceManager * gdk_display_get_device_manager (GdkDisplay *display);

241 242
GdkAppLaunchContext *gdk_display_get_app_launch_context (GdkDisplay *display);

243

244 245
G_END_DECLS

246
#endif	/* __GDK_DISPLAY_H__ */