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