gtk2/gdk/broadway/gdkcursor-broadway.c

188 lines
4.6 KiB
C
Raw Normal View History

2010-11-12 12:18:58 +00:00
/* GDK - 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
2012-02-27 13:01:10 +00:00
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
2010-11-12 12:18:58 +00:00
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
2010-11-15 19:08:18 +00:00
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
2010-11-12 12:18:58 +00:00
*/
#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 "gdkcursor.h"
#include "gdkcursorprivate.h"
2010-11-12 12:18:58 +00:00
#include "gdkprivate-broadway.h"
#include "gdkdisplay-broadway.h"
#include <string.h>
#include <errno.h>
struct _GdkBroadwayCursor
2010-11-12 12:18:58 +00:00
{
GdkCursor cursor;
};
2010-11-12 12:18:58 +00:00
struct _GdkBroadwayCursorClass
2010-11-12 12:18:58 +00:00
{
GdkCursorClass cursor_class;
};
2010-11-12 12:18:58 +00:00
/*** GdkBroadwayCursor ***/
2010-11-12 12:18:58 +00:00
G_DEFINE_TYPE (GdkBroadwayCursor, gdk_broadway_cursor, GDK_TYPE_CURSOR)
2010-11-12 12:18:58 +00:00
static cairo_surface_t * gdk_broadway_cursor_get_surface (GdkCursor *cursor,
gdouble *x_hot,
gdouble *y_hot);
2010-11-12 12:18:58 +00:00
static void
gdk_broadway_cursor_finalize (GObject *object)
{
G_OBJECT_CLASS (gdk_broadway_cursor_parent_class)->finalize (object);
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_cursor_class_init (GdkBroadwayCursorClass *xcursor_class)
2010-11-12 12:18:58 +00:00
{
GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (xcursor_class);
GObjectClass *object_class = G_OBJECT_CLASS (xcursor_class);
2010-11-12 12:18:58 +00:00
object_class->finalize = gdk_broadway_cursor_finalize;
2010-11-12 12:18:58 +00:00
cursor_class->get_surface = gdk_broadway_cursor_get_surface;
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_cursor_init (GdkBroadwayCursor *cursor)
{
}
2010-11-12 12:18:58 +00:00
/* Called by gdk_display_broadway_finalize to flush any cached cursors
* for a dead display.
2010-11-12 12:18:58 +00:00
*/
void
_gdk_broadway_cursor_display_finalize (GdkDisplay *display)
{
}
2010-11-12 12:18:58 +00:00
GdkCursor*
_gdk_broadway_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type)
2010-11-12 12:18:58 +00:00
{
GdkBroadwayCursor *private;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
2010-11-12 12:18:58 +00:00
private = g_object_new (GDK_TYPE_BROADWAY_CURSOR,
"cursor-type", cursor_type,
"display", display,
NULL);
return GDK_CURSOR (private);
2010-11-12 12:18:58 +00:00
}
static cairo_surface_t *
gdk_broadway_cursor_get_surface (GdkCursor *cursor,
gdouble *x_hot,
gdouble *y_hot)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (cursor != NULL, NULL);
return NULL;
}
void
_gdk_broadway_cursor_update_theme (GdkCursor *cursor)
2010-11-12 12:18:58 +00:00
{
g_return_if_fail (cursor != NULL);
}
GdkCursor *
_gdk_broadway_display_get_cursor_for_surface (GdkDisplay *display,
cairo_surface_t *surface,
gdouble x,
gdouble y)
2010-11-12 12:18:58 +00:00
{
GdkBroadwayCursor *private;
2010-11-12 12:18:58 +00:00
GdkCursor *cursor;
private = g_object_new (GDK_TYPE_BROADWAY_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL);
2010-11-12 12:18:58 +00:00
cursor = (GdkCursor *) private;
2010-11-15 19:08:18 +00:00
2010-11-12 12:18:58 +00:00
return cursor;
}
2010-11-15 19:08:18 +00:00
GdkCursor*
_gdk_broadway_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name)
2010-11-12 12:18:58 +00:00
{
GdkBroadwayCursor *private;
2010-11-12 12:18:58 +00:00
private = g_object_new (GDK_TYPE_BROADWAY_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL);
2010-11-12 12:18:58 +00:00
return GDK_CURSOR (private);
2010-11-12 12:18:58 +00:00
}
2010-11-15 19:08:18 +00:00
gboolean
_gdk_broadway_display_supports_cursor_alpha (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
2010-11-15 19:08:18 +00:00
return TRUE;
2010-11-12 12:18:58 +00:00
}
2010-11-15 19:08:18 +00:00
gboolean
_gdk_broadway_display_supports_cursor_color (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
2010-11-15 19:08:18 +00:00
return TRUE;
2010-11-12 12:18:58 +00:00
}
void
_gdk_broadway_display_get_default_cursor_size (GdkDisplay *display,
guint *width,
guint *height)
2010-11-12 12:18:58 +00:00
{
g_return_if_fail (GDK_IS_DISPLAY (display));
2010-11-12 12:18:58 +00:00
*width = *height = 20;
2010-11-12 12:18:58 +00:00
}
2010-11-15 19:08:18 +00:00
void
_gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height)
2010-11-12 12:18:58 +00:00
{
g_return_if_fail (GDK_IS_DISPLAY (display));
2010-11-15 19:08:18 +00:00
*width = 128;
*height = 128;
2010-11-12 12:18:58 +00:00
}