]> Pileus Git - ~andy/gtk/blob - gdk/broadway/gdkcursor-broadway.c
Reimplement _NET_WM_SYNC_REQUEST inside X11 backend
[~andy/gtk] / gdk / broadway / gdkcursor-broadway.c
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, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24
25 #include "config.h"
26
27 /* needs to be first because any header might include gdk-pixbuf.h otherwise */
28 #define GDK_PIXBUF_ENABLE_BACKEND
29 #include <gdk-pixbuf/gdk-pixbuf.h>
30
31 #include "gdkcursor.h"
32 #include "gdkcursorprivate.h"
33
34 #include "gdkprivate-broadway.h"
35 #include "gdkdisplay-broadway.h"
36
37 #include <string.h>
38 #include <errno.h>
39
40 struct _GdkBroadwayCursor
41 {
42   GdkCursor cursor;
43 };
44
45 struct _GdkBroadwayCursorClass
46 {
47   GdkCursorClass cursor_class;
48 };
49
50 /*** GdkBroadwayCursor ***/
51
52 G_DEFINE_TYPE (GdkBroadwayCursor, gdk_broadway_cursor, GDK_TYPE_CURSOR)
53
54 static GdkPixbuf* gdk_broadway_cursor_get_image (GdkCursor *cursor);
55
56 static void
57 gdk_broadway_cursor_finalize (GObject *object)
58 {
59   G_OBJECT_CLASS (gdk_broadway_cursor_parent_class)->finalize (object);
60 }
61
62 static void
63 gdk_broadway_cursor_class_init (GdkBroadwayCursorClass *xcursor_class)
64 {
65   GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (xcursor_class);
66   GObjectClass *object_class = G_OBJECT_CLASS (xcursor_class);
67
68   object_class->finalize = gdk_broadway_cursor_finalize;
69
70   cursor_class->get_image = gdk_broadway_cursor_get_image;
71 }
72
73 static void
74 gdk_broadway_cursor_init (GdkBroadwayCursor *cursor)
75 {
76 }
77
78 /* Called by gdk_display_broadway_finalize to flush any cached cursors
79  * for a dead display.
80  */
81 void
82 _gdk_broadway_cursor_display_finalize (GdkDisplay *display)
83 {
84 }
85
86 GdkCursor*
87 _gdk_broadway_display_get_cursor_for_type (GdkDisplay    *display,
88                                            GdkCursorType  cursor_type)
89 {
90   GdkBroadwayCursor *private;
91
92   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
93
94   private = g_object_new (GDK_TYPE_BROADWAY_CURSOR,
95                           "cursor-type", cursor_type,
96                           "display", display,
97                           NULL);
98
99   return GDK_CURSOR (private);
100 }
101
102 static GdkPixbuf*
103 gdk_broadway_cursor_get_image (GdkCursor *cursor)
104 {
105   g_return_val_if_fail (cursor != NULL, NULL);
106
107   return NULL;
108 }
109
110 void
111 _gdk_broadway_cursor_update_theme (GdkCursor *cursor)
112 {
113   g_return_if_fail (cursor != NULL);
114 }
115
116 GdkCursor *
117 _gdk_broadway_display_get_cursor_for_pixbuf (GdkDisplay *display,
118                                              GdkPixbuf  *pixbuf,
119                                              gint        x,
120                                              gint        y)
121 {
122   GdkBroadwayCursor *private;
123   GdkCursor *cursor;
124
125   private = g_object_new (GDK_TYPE_BROADWAY_CURSOR, 
126                           "cursor-type", GDK_CURSOR_IS_PIXMAP,
127                           "display", display,
128                           NULL);
129   cursor = (GdkCursor *) private;
130
131   return cursor;
132 }
133
134 GdkCursor*
135 _gdk_broadway_display_get_cursor_for_name (GdkDisplay  *display,
136                                            const gchar *name)
137 {
138   GdkBroadwayCursor *private;
139
140   private = g_object_new (GDK_TYPE_BROADWAY_CURSOR,
141                           "cursor-type", GDK_CURSOR_IS_PIXMAP,
142                           "display", display,
143                           NULL);
144
145   return GDK_CURSOR (private);
146 }
147
148 gboolean
149 _gdk_broadway_display_supports_cursor_alpha (GdkDisplay *display)
150 {
151   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
152
153   return TRUE;
154 }
155
156 gboolean
157 _gdk_broadway_display_supports_cursor_color (GdkDisplay *display)
158 {
159   g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
160
161   return TRUE;
162 }
163
164 void
165 _gdk_broadway_display_get_default_cursor_size (GdkDisplay *display,
166                                                guint      *width,
167                                                guint      *height)
168 {
169   g_return_if_fail (GDK_IS_DISPLAY (display));
170
171   *width = *height = 20;
172 }
173
174 void
175 _gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display,
176                                                guint       *width,
177                                                guint       *height)
178 {
179   g_return_if_fail (GDK_IS_DISPLAY (display));
180
181   *width = 128;
182   *height = 128;
183 }