]> Pileus Git - ~andy/gtk/blob - gdk/x11/gdkwindow-x11.h
[broadway] Add initial keyboard event support
[~andy/gtk] / gdk / x11 / gdkwindow-x11.h
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __GDK_WINDOW_X11_H__
28 #define __GDK_WINDOW_X11_H__
29
30 #include <gdk/x11/gdkdrawable-x11.h>
31
32 #ifdef HAVE_XDAMAGE
33 #include <X11/extensions/Xdamage.h>
34 #endif
35
36 #ifdef HAVE_XSYNC
37 #include <X11/extensions/sync.h>
38 #endif
39
40 G_BEGIN_DECLS
41
42 typedef struct _GdkToplevelX11 GdkToplevelX11;
43 typedef struct _GdkWindowImplX11 GdkWindowImplX11;
44 typedef struct _GdkWindowImplX11Class GdkWindowImplX11Class;
45 typedef struct _GdkXPositionInfo GdkXPositionInfo;
46
47 /* Window implementation for X11
48  */
49
50 #define GDK_TYPE_WINDOW_IMPL_X11              (gdk_window_impl_x11_get_type ())
51 #define GDK_WINDOW_IMPL_X11(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11))
52 #define GDK_WINDOW_IMPL_X11_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11Class))
53 #define GDK_IS_WINDOW_IMPL_X11(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_X11))
54 #define GDK_IS_WINDOW_IMPL_X11_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_X11))
55 #define GDK_WINDOW_IMPL_X11_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL_X11, GdkWindowImplX11Class))
56
57 struct _GdkWindowImplX11
58 {
59   GdkDrawableImplX11 parent_instance;
60
61   GdkToplevelX11 *toplevel;     /* Toplevel-specific information */
62   GdkCursor *cursor;
63   GHashTable *device_cursor;
64
65   gint8 toplevel_window_type;
66   guint no_bg : 1;              /* Set when the window background is temporarily
67                                  * unset during resizing and scaling */
68   guint override_redirect : 1;
69   guint use_synchronized_configure : 1;
70
71 #if defined (HAVE_XCOMPOSITE) && defined(HAVE_XDAMAGE) && defined (HAVE_XFIXES)
72   Damage damage;
73 #endif
74 };
75  
76 struct _GdkWindowImplX11Class 
77 {
78   GdkDrawableImplX11Class parent_class;
79 };
80
81 struct _GdkToplevelX11
82 {
83
84   /* Set if the window, or any descendent of it, is the server's focus window
85    */
86   guint has_focus_window : 1;
87
88   /* Set if window->has_focus_window and the focus isn't grabbed elsewhere.
89    */
90   guint has_focus : 1;
91
92   /* Set if the pointer is inside this window. (This is needed for
93    * for focus tracking)
94    */
95   guint has_pointer : 1;
96   
97   /* Set if the window is a descendent of the focus window and the pointer is
98    * inside it. (This is the case where the window will receive keystroke
99    * events even window->has_focus_window is FALSE)
100    */
101   guint has_pointer_focus : 1;
102
103   /* Set if we are requesting these hints */
104   guint skip_taskbar_hint : 1;
105   guint skip_pager_hint : 1;
106   guint urgency_hint : 1;
107
108   guint on_all_desktops : 1;   /* _NET_WM_STICKY == 0xFFFFFFFF */
109
110   guint have_sticky : 1;        /* _NET_WM_STATE_STICKY */
111   guint have_maxvert : 1;       /* _NET_WM_STATE_MAXIMIZED_VERT */
112   guint have_maxhorz : 1;       /* _NET_WM_STATE_MAXIMIZED_HORZ */
113   guint have_fullscreen : 1;    /* _NET_WM_STATE_FULLSCREEN */
114
115   guint is_leader : 1;
116   
117   gulong map_serial;    /* Serial of last transition from unmapped */
118   
119   cairo_surface_t *icon_pixmap;
120   cairo_surface_t *icon_mask;
121   GdkWindow *group_leader;
122
123   /* Time of most recent user interaction. */
124   gulong user_time;
125
126   /* We use an extra X window for toplevel windows that we XSetInputFocus()
127    * to in order to avoid getting keyboard events redirected to subwindows
128    * that might not even be part of this app
129    */
130   Window focus_window;
131  
132 #ifdef HAVE_XSYNC
133   XID update_counter;
134   XSyncValue pending_counter_value; /* latest _NET_WM_SYNC_REQUEST value received */
135   XSyncValue current_counter_value; /* Latest _NET_WM_SYNC_REQUEST value received
136                                      * where we have also seen the corresponding
137                                      * ConfigureNotify
138                                      */
139 #endif
140 };
141
142 GType gdk_window_impl_x11_get_type (void);
143
144 void            gdk_x11_window_set_user_time        (GdkWindow *window,
145                                                      guint32    timestamp);
146
147 GdkToplevelX11 *_gdk_x11_window_get_toplevel        (GdkWindow *window);
148 void            _gdk_x11_window_tmp_unset_bg        (GdkWindow *window,
149                                                      gboolean   recurse);
150 void            _gdk_x11_window_tmp_reset_bg        (GdkWindow *window,
151                                                      gboolean   recurse);
152 void            _gdk_x11_window_tmp_unset_parent_bg (GdkWindow *window);
153 void            _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window);
154
155 GdkCursor      *_gdk_x11_window_get_cursor    (GdkWindow *window);
156 void            _gdk_x11_window_get_offsets   (GdkWindow *window,
157                                                gint      *x_offset,
158                                                gint      *y_offset);
159
160 G_END_DECLS
161
162 #endif /* __GDK_WINDOW_X11_H__ */