1 /* 2 * gdkdisplay.h 3 * 4 * Copyright 2001 Sun Microsystems Inc. 5 * 6 * Erwann Chenede <erwann.chenede@sun.com> 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Library General Public 10 * License as published by the Free Software Foundation; either 11 * version 2 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Library General Public License for more details. 17 * 18 * You should have received a copy of the GNU Library General Public 19 * License along with this library; if not, write to the 20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21 * Boston, MA 02111-1307, USA. 22 */ 23 24 #ifndef __GDK_DISPLAY_H__ 25 #define __GDK_DISPLAY_H__ 26 27 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION) 28 #error "Only <gdk/gdk.h> can be included directly." 29 #endif 30 31 #include <gdk/gdktypes.h> 32 #include <gdk/gdkevents.h> 33 34 G_BEGIN_DECLS 35 36 typedef struct _GdkDisplayClass GdkDisplayClass; 37 typedef struct _GdkDisplayPointerHooks GdkDisplayPointerHooks; 38 39 #define GDK_TYPE_DISPLAY (gdk_display_get_type ()) 40 #define GDK_DISPLAY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY, GdkDisplay)) 41 #define GDK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY, GdkDisplayClass)) 42 #define GDK_IS_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY)) 43 #define GDK_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY)) 44 #define GDK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass)) 45 46 /* Tracks information about the keyboard grab on this display */ 47 typedef struct 48 { 49 GdkWindow *window; 50 GdkWindow *native_window; 51 gulong serial; 52 gboolean owner_events; 53 guint32 time; 54 } GdkKeyboardGrabInfo; 55 56 /* Tracks information about which window and position the pointer last was in. 57 * This is useful when we need to synthesize events later. 58 * Note that we track toplevel_under_pointer using enter/leave events, 59 * so in the case of a grab, either with owner_events==FALSE or with the 60 * pointer in no clients window the x/y coordinates may actually be outside 61 * the window. 62 */ 63 typedef struct 64 { 65 GdkWindow *toplevel_under_pointer; /* The toplevel window with mouse inside, tracked via native events */ 66 GdkWindow *window_under_pointer; /* The window that last got sent a normal enter event */ 67 gdouble toplevel_x, toplevel_y; 68 guint32 state; 69 guint32 button; 70 gulong motion_hint_serial; /* 0 == didn't deliver hinted motion event */ 71 } GdkPointerWindowInfo; 72 73 struct _GdkDisplay 74 { 75 GObject parent_instance; 76 77 /*< private >*/ 78 GList *GSEAL (queued_events); 79 GList *GSEAL (queued_tail); 80 81 /* Information for determining if the latest button click 82 * is part of a double-click or triple-click 83 */ 84 guint32 GSEAL (button_click_time[2]); /* The last 2 button click times. */ 85 GdkWindow *GSEAL (button_window[2]); /* The last 2 windows to receive button presses. */ 86 gint GSEAL (button_number[2]); /* The last 2 buttons to be pressed. */ 87 88 guint GSEAL (double_click_time); /* Maximum time between clicks in msecs */ 89 GdkDevice *GSEAL (core_pointer); /* Core pointer device */ 90 91 const GdkDisplayPointerHooks *GSEAL (pointer_hooks); /* Current hooks for querying pointer */ 92 93 guint GSEAL (closed) : 1; /* Whether this display has been closed */ 94 guint GSEAL (ignore_core_events) : 1; /* Don't send core motion and button event */ 95 96 guint GSEAL (double_click_distance); /* Maximum distance between clicks in pixels */ 97 gint GSEAL (button_x[2]); /* The last 2 button click positions. */ 98 gint GSEAL (button_y[2]); 99 100 GList *GSEAL (pointer_grabs); 101 GdkKeyboardGrabInfo GSEAL (keyboard_grab); 102 GdkPointerWindowInfo GSEAL (pointer_info); 103 104 /* Last reported event time from server */ 105 guint32 GSEAL (last_event_time); 106 }; 107 108 struct _GdkDisplayClass 109 { 110 GObjectClass parent_class; 111 112 const gchar * (*get_display_name) (GdkDisplay *display); 113 gint (*get_n_screens) (GdkDisplay *display); 114 GdkScreen * (*get_screen) (GdkDisplay *display, 115 gint screen_num); 116 GdkScreen * (*get_default_screen) (GdkDisplay *display); 117 118 119 /* Signals */ 120 void (*closed) (GdkDisplay *display, 121 gboolean is_error); 122 }; 123 124 struct _GdkDisplayPointerHooks 125 { 126 void (*get_pointer) (GdkDisplay *display, 127 GdkScreen **screen, 128 gint *x, 129 gint *y, 130 GdkModifierType *mask); 131 GdkWindow* (*window_get_pointer) (GdkDisplay *display, 132 GdkWindow *window, 133 gint *x, 134 gint *y, 135 GdkModifierType *mask); 136 GdkWindow* (*window_at_pointer) (GdkDisplay *display, 137 gint *win_x, 138 gint *win_y); 139 }; 140 141 GType gdk_display_get_type (void) G_GNUC_CONST; 142 GdkDisplay *gdk_display_open (const gchar *display_name); 143 144 const gchar * gdk_display_get_name (GdkDisplay *display); 145 146 gint gdk_display_get_n_screens (GdkDisplay *display); 147 GdkScreen * gdk_display_get_screen (GdkDisplay *display, 148 gint screen_num); 149 GdkScreen * gdk_display_get_default_screen (GdkDisplay *display); 150 void gdk_display_pointer_ungrab (GdkDisplay *display, 151 guint32 time_); 152 void gdk_display_keyboard_ungrab (GdkDisplay *display, 153 guint32 time_); 154 gboolean gdk_display_pointer_is_grabbed (GdkDisplay *display); 155 void gdk_display_beep (GdkDisplay *display); 156 void gdk_display_sync (GdkDisplay *display); 157 void gdk_display_flush (GdkDisplay *display); 158 159 void gdk_display_close (GdkDisplay *display); 160 gboolean gdk_display_is_closed (GdkDisplay *display); 161 162 GList * gdk_display_list_devices (GdkDisplay *display); 163 164 GdkEvent* gdk_display_get_event (GdkDisplay *display); 165 GdkEvent* gdk_display_peek_event (GdkDisplay *display); 166 void gdk_display_put_event (GdkDisplay *display, 167 const GdkEvent *event); 168 169 void gdk_display_add_client_message_filter (GdkDisplay *display, 170 GdkAtom message_type, 171 GdkFilterFunc func, 172 gpointer data); 173 174 void gdk_display_set_double_click_time (GdkDisplay *display, 175 guint msec); 176 void gdk_display_set_double_click_distance (GdkDisplay *display, 177 guint distance); 178 179 GdkDisplay *gdk_display_get_default (void); 180 181 GdkDevice *gdk_display_get_core_pointer (GdkDisplay *display); 182 183 void gdk_display_get_pointer (GdkDisplay *display, 184 GdkScreen **screen, 185 gint *x, 186 gint *y, 187 GdkModifierType *mask); 188 GdkWindow * gdk_display_get_window_at_pointer (GdkDisplay *display, 189 gint *win_x, 190 gint *win_y); 191 void gdk_display_warp_pointer (GdkDisplay *display, 192 GdkScreen *screen, 193 gint x, 194 gint y); 195 196 #ifndef GDK_DISABLE_DEPRECATED 197 GdkDisplayPointerHooks *gdk_display_set_pointer_hooks (GdkDisplay *display, 198 const GdkDisplayPointerHooks *new_hooks); 199 #endif 200 201 GdkDisplay *gdk_display_open_default_libgtk_only (void); 202 203 gboolean gdk_display_supports_cursor_alpha (GdkDisplay *display); 204 gboolean gdk_display_supports_cursor_color (GdkDisplay *display); 205 guint gdk_display_get_default_cursor_size (GdkDisplay *display); 206 void gdk_display_get_maximal_cursor_size (GdkDisplay *display, 207 guint *width, 208 guint *height); 209 210 GdkWindow *gdk_display_get_default_group (GdkDisplay *display); 211 212 gboolean gdk_display_supports_selection_notification (GdkDisplay *display); 213 gboolean gdk_display_request_selection_notification (GdkDisplay *display, 214 GdkAtom selection); 215 216 gboolean gdk_display_supports_clipboard_persistence (GdkDisplay *display); 217 void gdk_display_store_clipboard (GdkDisplay *display, 218 GdkWindow *clipboard_window, 219 guint32 time_, 220 const GdkAtom *targets, 221 gint n_targets); 222 223 gboolean gdk_display_supports_shapes (GdkDisplay *display); 224 gboolean gdk_display_supports_input_shapes (GdkDisplay *display); 225 gboolean gdk_display_supports_composite (GdkDisplay *display); 226 227 G_END_DECLS 228 229 #endif /* __GDK_DISPLAY_H__ */ 230