1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/* CDK - The GIMP Drawing Kit
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * Modified by the CTK+ Team and others 1997-2000.  See the AUTHORS
 * file for a list of people on the CTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
 * CTK+ at ftp://ftp.ctk.org/pub/ctk/.
 */

#include "config.h"

/* needs to be first because any header might include gdk-pixbuf.h otherwise */
#define GDK_PIXBUF_ENABLE_BACKEND
#include <gdk-pixbuf/gdk-pixbuf.h>

#include "cdkcursor.h"
#include "cdkcursorprivate.h"

#include "cdkprivate-broadway.h"
#include "cdkdisplay-broadway.h"

#include <string.h>
#include <errno.h>

struct _CdkBroadwayCursor
{
  CdkCursor cursor;
};

struct _CdkBroadwayCursorClass
{
  CdkCursorClass cursor_class;
};

/*** CdkBroadwayCursor ***/

G_DEFINE_TYPE (CdkBroadwayCursor, cdk_broadway_cursor, CDK_TYPE_CURSOR)<--- There is an unknown macro here somewhere. Configuration is required. If G_DEFINE_TYPE is a macro then please configure it.

static cairo_surface_t * cdk_broadway_cursor_get_surface (CdkCursor *cursor,
							  gdouble   *x_hot,
							  gdouble   *y_hot);

static void
cdk_broadway_cursor_finalize (GObject *object)
{
  G_OBJECT_CLASS (cdk_broadway_cursor_parent_class)->finalize (object);
}

static void
cdk_broadway_cursor_class_init (CdkBroadwayCursorClass *xcursor_class)
{
  CdkCursorClass *cursor_class = CDK_CURSOR_CLASS (xcursor_class);
  GObjectClass *object_class = G_OBJECT_CLASS (xcursor_class);

  object_class->finalize = cdk_broadway_cursor_finalize;

  cursor_class->get_surface = cdk_broadway_cursor_get_surface;
}

static void
cdk_broadway_cursor_init (CdkBroadwayCursor *cursor G_GNUC_UNUSED)
{
}

/* Called by cdk_display_broadway_finalize to flush any cached cursors
 * for a dead display.
 */
void
_cdk_broadway_cursor_display_finalize (CdkDisplay *display G_GNUC_UNUSED)
{
}

CdkCursor*
_cdk_broadway_display_get_cursor_for_type (CdkDisplay    *display,
					   CdkCursorType  cursor_type)
{
  CdkBroadwayCursor *private;

  g_return_val_if_fail (CDK_IS_DISPLAY (display), NULL);

  private = g_object_new (CDK_TYPE_BROADWAY_CURSOR,
                          "cursor-type", cursor_type,
                          "display", display,
			  NULL);

  return CDK_CURSOR (private);
}

static cairo_surface_t *
cdk_broadway_cursor_get_surface (CdkCursor *cursor,
				 gdouble   *x_hot G_GNUC_UNUSED,
				 gdouble   *y_hot G_GNUC_UNUSED)
{
  g_return_val_if_fail (cursor != NULL, NULL);

  return NULL;
}

void
_cdk_broadway_cursor_update_theme (CdkCursor *cursor)
{
  g_return_if_fail (cursor != NULL);
}

CdkCursor *
_cdk_broadway_display_get_cursor_for_surface (CdkDisplay      *display,
					      cairo_surface_t *surface G_GNUC_UNUSED,
					      gdouble          x G_GNUC_UNUSED,
					      gdouble          y G_GNUC_UNUSED)
{
  CdkBroadwayCursor *private;
  CdkCursor *cursor;

  private = g_object_new (CDK_TYPE_BROADWAY_CURSOR, 
                          "cursor-type", CDK_CURSOR_IS_PIXMAP,
                          "display", display,
                          NULL);
  cursor = (CdkCursor *) private;

  return cursor;
}

CdkCursor*
_cdk_broadway_display_get_cursor_for_name (CdkDisplay  *display,
					   const gchar *name G_GNUC_UNUSED)
{
  CdkBroadwayCursor *private;

  private = g_object_new (CDK_TYPE_BROADWAY_CURSOR,
                          "cursor-type", CDK_CURSOR_IS_PIXMAP,
                          "display", display,
                          NULL);

  return CDK_CURSOR (private);
}

gboolean
_cdk_broadway_display_supports_cursor_alpha (CdkDisplay *display)
{
  g_return_val_if_fail (CDK_IS_DISPLAY (display), FALSE);

  return TRUE;
}

gboolean
_cdk_broadway_display_supports_cursor_color (CdkDisplay *display)
{
  g_return_val_if_fail (CDK_IS_DISPLAY (display), FALSE);

  return TRUE;
}

void
_cdk_broadway_display_get_default_cursor_size (CdkDisplay *display,
					       guint      *width,
					       guint      *height)
{
  g_return_if_fail (CDK_IS_DISPLAY (display));

  *width = *height = 20;
}

void
_cdk_broadway_display_get_maximal_cursor_size (CdkDisplay *display,
					       guint       *width,
					       guint       *height)
{
  g_return_if_fail (CDK_IS_DISPLAY (display));

  *width = 128;
  *height = 128;
}