1997-11-24 22:37:52 +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
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* 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/>.
|
1997-11-24 22:37:52 +00:00
|
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2005-06-15 18:37:18 +00:00
|
|
|
|
|
2010-10-18 16:19:17 +00:00
|
|
|
|
/* needs to be first because any header might include gdk-pixbuf.h otherwise */
|
|
|
|
|
#define GDK_PIXBUF_ENABLE_BACKEND
|
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
|
|
|
|
|
2010-10-15 02:05:51 +00:00
|
|
|
|
#include "gdkcursor.h"
|
2010-12-20 01:20:48 +00:00
|
|
|
|
#include "gdkcursorprivate.h"
|
2010-10-15 02:05:51 +00:00
|
|
|
|
#include "gdkprivate-x11.h"
|
|
|
|
|
#include "gdkdisplay-x11.h"
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
#include <X11/cursorfont.h>
|
2003-06-30 22:30:54 +00:00
|
|
|
|
#ifdef HAVE_XCURSOR
|
|
|
|
|
#include <X11/Xcursor/Xcursor.h>
|
|
|
|
|
#endif
|
2005-06-14 15:10:13 +00:00
|
|
|
|
#ifdef HAVE_XFIXES
|
|
|
|
|
#include <X11/extensions/Xfixes.h>
|
|
|
|
|
#endif
|
|
|
|
|
#include <string.h>
|
2010-10-15 18:34:44 +00:00
|
|
|
|
#include <errno.h>
|
2013-08-07 10:18:38 +00:00
|
|
|
|
#include <math.h>
|
1999-10-01 23:18:30 +00:00
|
|
|
|
|
2010-12-20 02:09:31 +00:00
|
|
|
|
struct _GdkX11Cursor
|
2010-12-20 01:07:27 +00:00
|
|
|
|
{
|
|
|
|
|
GdkCursor cursor;
|
2010-12-20 02:09:31 +00:00
|
|
|
|
|
2010-12-20 01:07:27 +00:00
|
|
|
|
Cursor xcursor;
|
|
|
|
|
gchar *name;
|
|
|
|
|
guint serial;
|
|
|
|
|
};
|
|
|
|
|
|
2010-12-20 02:09:31 +00:00
|
|
|
|
struct _GdkX11CursorClass
|
|
|
|
|
{
|
|
|
|
|
GdkCursorClass cursor_class;
|
|
|
|
|
};
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
2005-06-17 17:26:24 +00:00
|
|
|
|
static guint theme_serial = 0;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2009-01-20 02:15:59 +00:00
|
|
|
|
/* cursor_cache holds a cache of non-pixmap cursors to avoid expensive
|
2009-01-24 21:29:36 +00:00
|
|
|
|
* libXcursor searches, cursors are added to it but only removed when
|
|
|
|
|
* their display is closed. We make the assumption that since there are
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* a small number of display’s and a small number of cursor’s that this
|
2009-01-24 21:29:36 +00:00
|
|
|
|
* list will stay small enough not to be a problem.
|
2009-01-20 02:15:59 +00:00
|
|
|
|
*/
|
|
|
|
|
static GSList* cursor_cache = NULL;
|
|
|
|
|
|
|
|
|
|
struct cursor_cache_key
|
|
|
|
|
{
|
|
|
|
|
GdkDisplay* display;
|
|
|
|
|
GdkCursorType type;
|
|
|
|
|
const char* name;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Caller should check if there is already a match first.
|
|
|
|
|
* Cursor MUST be either a typed cursor or a pixmap with
|
|
|
|
|
* a non-NULL name.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
2010-12-20 02:09:31 +00:00
|
|
|
|
add_to_cache (GdkX11Cursor* cursor)
|
2009-01-20 02:15:59 +00:00
|
|
|
|
{
|
|
|
|
|
cursor_cache = g_slist_prepend (cursor_cache, cursor);
|
|
|
|
|
|
|
|
|
|
/* Take a ref so that if the caller frees it we still have it */
|
2010-12-20 02:12:33 +00:00
|
|
|
|
g_object_ref (cursor);
|
2009-01-20 02:15:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns 0 on a match
|
|
|
|
|
*/
|
|
|
|
|
static gint
|
|
|
|
|
cache_compare_func (gconstpointer listelem,
|
|
|
|
|
gconstpointer target)
|
|
|
|
|
{
|
2010-12-20 02:09:31 +00:00
|
|
|
|
GdkX11Cursor* cursor = (GdkX11Cursor*)listelem;
|
2009-01-20 02:15:59 +00:00
|
|
|
|
struct cursor_cache_key* key = (struct cursor_cache_key*)target;
|
|
|
|
|
|
|
|
|
|
if ((cursor->cursor.type != key->type) ||
|
2010-12-20 12:55:46 +00:00
|
|
|
|
(gdk_cursor_get_display (GDK_CURSOR (cursor)) != key->display))
|
2009-01-20 02:15:59 +00:00
|
|
|
|
return 1; /* No match */
|
|
|
|
|
|
|
|
|
|
/* Elements marked as pixmap must be named cursors
|
|
|
|
|
* (since we don't store normal pixmap cursors
|
|
|
|
|
*/
|
|
|
|
|
if (key->type == GDK_CURSOR_IS_PIXMAP)
|
|
|
|
|
return strcmp (key->name, cursor->name);
|
|
|
|
|
|
|
|
|
|
return 0; /* Match */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Returns the cursor if there is a match, NULL if not
|
|
|
|
|
* For named cursors type shall be GDK_CURSOR_IS_PIXMAP
|
|
|
|
|
* For unnamed, typed cursors, name shall be NULL
|
|
|
|
|
*/
|
2010-12-20 02:09:31 +00:00
|
|
|
|
static GdkX11Cursor*
|
2009-01-20 02:15:59 +00:00
|
|
|
|
find_in_cache (GdkDisplay *display,
|
|
|
|
|
GdkCursorType type,
|
|
|
|
|
const char *name)
|
|
|
|
|
{
|
|
|
|
|
GSList* res;
|
|
|
|
|
struct cursor_cache_key key;
|
|
|
|
|
|
|
|
|
|
key.display = display;
|
|
|
|
|
key.type = type;
|
|
|
|
|
key.name = name;
|
|
|
|
|
|
|
|
|
|
res = g_slist_find_custom (cursor_cache, &key, cache_compare_func);
|
|
|
|
|
|
|
|
|
|
if (res)
|
2010-12-20 02:09:31 +00:00
|
|
|
|
return (GdkX11Cursor *) res->data;
|
2009-01-20 02:15:59 +00:00
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-20 18:20:10 +00:00
|
|
|
|
/* Called by gdk_x11_display_finalize to flush any cached cursors
|
2009-01-20 02:15:59 +00:00
|
|
|
|
* for a dead display.
|
|
|
|
|
*/
|
2010-12-21 06:43:08 +00:00
|
|
|
|
void
|
2009-01-20 02:15:59 +00:00
|
|
|
|
_gdk_x11_cursor_display_finalize (GdkDisplay *display)
|
|
|
|
|
{
|
|
|
|
|
GSList* item;
|
|
|
|
|
GSList** itemp; /* Pointer to the thing to fix when we delete an item */
|
|
|
|
|
item = cursor_cache;
|
|
|
|
|
itemp = &cursor_cache;
|
|
|
|
|
while (item)
|
|
|
|
|
{
|
2010-12-20 02:09:31 +00:00
|
|
|
|
GdkX11Cursor* cursor = (GdkX11Cursor*)(item->data);
|
2010-12-20 12:55:46 +00:00
|
|
|
|
if (gdk_cursor_get_display (GDK_CURSOR (cursor)) == display)
|
2009-01-20 02:15:59 +00:00
|
|
|
|
{
|
2010-12-13 17:36:35 +00:00
|
|
|
|
GSList* olditem;
|
2011-10-15 12:35:28 +00:00
|
|
|
|
g_object_unref ((GdkCursor*) cursor);
|
2010-12-13 17:36:35 +00:00
|
|
|
|
/* Remove this item from the list */
|
|
|
|
|
*(itemp) = item->next;
|
|
|
|
|
olditem = item;
|
|
|
|
|
item = g_slist_next (item);
|
|
|
|
|
g_slist_free_1 (olditem);
|
2009-01-20 02:15:59 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-12-13 17:36:35 +00:00
|
|
|
|
itemp = &(item->next);
|
|
|
|
|
item = g_slist_next (item);
|
|
|
|
|
}
|
2009-01-20 02:15:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-20 02:09:31 +00:00
|
|
|
|
/*** GdkX11Cursor ***/
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GdkX11Cursor, gdk_x11_cursor, GDK_TYPE_CURSOR)
|
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
static cairo_surface_t *gdk_x11_cursor_get_surface (GdkCursor *cursor,
|
|
|
|
|
gdouble *x_hot,
|
|
|
|
|
gdouble *y_hot);
|
2010-12-20 13:07:11 +00:00
|
|
|
|
|
2010-12-21 06:43:08 +00:00
|
|
|
|
static void
|
2010-12-20 02:09:31 +00:00
|
|
|
|
gdk_x11_cursor_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GdkX11Cursor *private = GDK_X11_CURSOR (object);
|
2010-12-20 12:55:46 +00:00
|
|
|
|
GdkDisplay *display;
|
2010-12-20 02:09:31 +00:00
|
|
|
|
|
2010-12-20 12:55:46 +00:00
|
|
|
|
display = gdk_cursor_get_display (GDK_CURSOR (object));
|
|
|
|
|
if (private->xcursor && !gdk_display_is_closed (display))
|
|
|
|
|
XFreeCursor (GDK_DISPLAY_XDISPLAY (display), private->xcursor);
|
2010-12-20 02:09:31 +00:00
|
|
|
|
|
|
|
|
|
g_free (private->name);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (gdk_x11_cursor_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-12-20 13:07:11 +00:00
|
|
|
|
gdk_x11_cursor_class_init (GdkX11CursorClass *xcursor_class)
|
2010-12-20 02:09:31 +00:00
|
|
|
|
{
|
2010-12-20 13:07:11 +00:00
|
|
|
|
GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (xcursor_class);
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (xcursor_class);
|
2010-12-20 02:09:31 +00:00
|
|
|
|
|
|
|
|
|
object_class->finalize = gdk_x11_cursor_finalize;
|
2010-12-20 13:07:11 +00:00
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
cursor_class->get_surface = gdk_x11_cursor_get_surface;
|
2010-12-20 02:09:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_cursor_init (GdkX11Cursor *cursor)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-20 02:15:59 +00:00
|
|
|
|
static Cursor
|
|
|
|
|
get_blank_cursor (GdkDisplay *display)
|
|
|
|
|
{
|
|
|
|
|
GdkScreen *screen;
|
2010-08-27 14:00:09 +00:00
|
|
|
|
Pixmap pixmap;
|
2009-01-20 02:15:59 +00:00
|
|
|
|
XColor color;
|
|
|
|
|
Cursor cursor;
|
2010-08-27 14:00:09 +00:00
|
|
|
|
cairo_surface_t *surface;
|
2010-08-06 20:41:21 +00:00
|
|
|
|
cairo_t *cr;
|
2009-01-20 02:15:59 +00:00
|
|
|
|
|
|
|
|
|
screen = gdk_display_get_default_screen (display);
|
2010-08-27 14:00:09 +00:00
|
|
|
|
surface = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen), 1, 1);
|
|
|
|
|
/* Clear surface */
|
|
|
|
|
cr = cairo_create (surface);
|
2010-08-06 20:41:21 +00:00
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_destroy (cr);
|
2009-01-20 02:15:59 +00:00
|
|
|
|
|
2010-08-27 14:00:09 +00:00
|
|
|
|
pixmap = cairo_xlib_surface_get_drawable (surface);
|
2009-01-20 02:15:59 +00:00
|
|
|
|
|
|
|
|
|
color.pixel = 0;
|
|
|
|
|
color.red = color.blue = color.green = 0;
|
2010-12-11 04:14:43 +00:00
|
|
|
|
|
|
|
|
|
if (gdk_display_is_closed (display))
|
2009-01-20 02:15:59 +00:00
|
|
|
|
cursor = None;
|
|
|
|
|
else
|
|
|
|
|
cursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
|
2010-08-27 14:00:09 +00:00
|
|
|
|
pixmap, pixmap,
|
2009-01-20 02:15:59 +00:00
|
|
|
|
&color, &color, 1, 1);
|
2010-08-27 14:00:09 +00:00
|
|
|
|
cairo_surface_destroy (surface);
|
2009-01-20 02:15:59 +00:00
|
|
|
|
|
|
|
|
|
return cursor;
|
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
GdkCursor*
|
2010-12-13 17:36:35 +00:00
|
|
|
|
_gdk_x11_display_get_cursor_for_type (GdkDisplay *display,
|
|
|
|
|
GdkCursorType cursor_type)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2010-12-20 02:09:31 +00:00
|
|
|
|
GdkX11Cursor *private;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
Cursor xcursor;
|
|
|
|
|
|
2010-12-11 04:14:43 +00:00
|
|
|
|
if (gdk_display_is_closed (display))
|
2009-01-20 02:15:59 +00:00
|
|
|
|
{
|
|
|
|
|
xcursor = None;
|
2010-12-13 17:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2009-01-20 02:15:59 +00:00
|
|
|
|
{
|
|
|
|
|
private = find_in_cache (display, cursor_type, NULL);
|
|
|
|
|
|
|
|
|
|
if (private)
|
|
|
|
|
{
|
|
|
|
|
/* Cache had it, add a ref for this user */
|
2010-12-20 02:12:33 +00:00
|
|
|
|
g_object_ref (private);
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2009-01-20 02:15:59 +00:00
|
|
|
|
return (GdkCursor*) private;
|
2010-12-13 17:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2009-01-20 02:15:59 +00:00
|
|
|
|
{
|
2010-12-13 17:36:35 +00:00
|
|
|
|
if (cursor_type != GDK_BLANK_CURSOR)
|
2009-01-20 02:15:59 +00:00
|
|
|
|
xcursor = XCreateFontCursor (GDK_DISPLAY_XDISPLAY (display),
|
|
|
|
|
cursor_type);
|
2010-12-13 17:36:35 +00:00
|
|
|
|
else
|
|
|
|
|
xcursor = get_blank_cursor (display);
|
2009-01-20 02:15:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2010-12-20 12:35:39 +00:00
|
|
|
|
private = g_object_new (GDK_TYPE_X11_CURSOR,
|
2010-12-21 17:32:34 +00:00
|
|
|
|
"cursor-type", cursor_type,
|
2010-12-20 12:45:31 +00:00
|
|
|
|
"display", display,
|
2010-12-20 12:35:39 +00:00
|
|
|
|
NULL);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
private->xcursor = xcursor;
|
2005-06-14 15:10:13 +00:00
|
|
|
|
private->name = NULL;
|
2005-06-17 17:26:24 +00:00
|
|
|
|
private->serial = theme_serial;
|
|
|
|
|
|
2009-01-20 02:15:59 +00:00
|
|
|
|
if (xcursor != None)
|
|
|
|
|
add_to_cache (private);
|
|
|
|
|
|
2010-12-20 12:35:39 +00:00
|
|
|
|
return GDK_CURSOR (private);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-22 22:11:22 +00:00
|
|
|
|
/**
|
2011-07-28 11:17:35 +00:00
|
|
|
|
* gdk_x11_cursor_get_xdisplay:
|
2011-07-28 11:27:23 +00:00
|
|
|
|
* @cursor: (type GdkX11Cursor): a #GdkCursor.
|
2002-10-22 22:11:22 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the display of a #GdkCursor.
|
|
|
|
|
*
|
2014-01-28 05:06:30 +00:00
|
|
|
|
* Return value: (transfer none): an Xlib Display*.
|
2002-10-22 22:11:22 +00:00
|
|
|
|
**/
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
Display *
|
|
|
|
|
gdk_x11_cursor_get_xdisplay (GdkCursor *cursor)
|
|
|
|
|
{
|
2005-06-18 11:25:14 +00:00
|
|
|
|
g_return_val_if_fail (cursor != NULL, NULL);
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
|
2010-12-20 12:55:46 +00:00
|
|
|
|
return GDK_DISPLAY_XDISPLAY (gdk_cursor_get_display (cursor));
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-22 22:11:22 +00:00
|
|
|
|
/**
|
2011-07-28 11:17:35 +00:00
|
|
|
|
* gdk_x11_cursor_get_xcursor:
|
2011-07-28 11:27:23 +00:00
|
|
|
|
* @cursor: (type GdkX11Cursor): a #GdkCursor.
|
2002-10-22 22:11:22 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the X cursor belonging to a #GdkCursor.
|
|
|
|
|
*
|
2014-01-28 05:06:30 +00:00
|
|
|
|
* Return value: an Xlib Cursor.
|
2002-10-22 22:11:22 +00:00
|
|
|
|
**/
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
Cursor
|
|
|
|
|
gdk_x11_cursor_get_xcursor (GdkCursor *cursor)
|
|
|
|
|
{
|
2005-06-18 11:25:14 +00:00
|
|
|
|
g_return_val_if_fail (cursor != NULL, None);
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
|
2010-12-20 02:09:31 +00:00
|
|
|
|
return ((GdkX11Cursor *)cursor)->xcursor;
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
}
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2005-06-14 15:10:13 +00:00
|
|
|
|
#if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2
|
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
static cairo_surface_t *
|
|
|
|
|
gdk_x11_cursor_get_surface (GdkCursor *cursor,
|
|
|
|
|
gdouble *x_hot,
|
|
|
|
|
gdouble *y_hot)
|
2005-06-14 15:10:13 +00:00
|
|
|
|
{
|
2013-08-06 14:21:05 +00:00
|
|
|
|
GdkDisplay *display;
|
2005-06-14 15:10:13 +00:00
|
|
|
|
Display *xdisplay;
|
2010-12-20 02:09:31 +00:00
|
|
|
|
GdkX11Cursor *private;
|
2005-06-14 15:10:13 +00:00
|
|
|
|
XcursorImages *images = NULL;
|
|
|
|
|
XcursorImage *image;
|
|
|
|
|
gint size;
|
2013-08-06 14:21:05 +00:00
|
|
|
|
cairo_surface_t *surface;
|
|
|
|
|
gint scale;
|
2005-06-14 15:10:13 +00:00
|
|
|
|
gchar *theme;
|
2005-06-14 20:43:20 +00:00
|
|
|
|
|
2010-12-20 13:07:11 +00:00
|
|
|
|
private = GDK_X11_CURSOR (cursor);
|
2013-08-06 14:21:05 +00:00
|
|
|
|
|
|
|
|
|
display = gdk_cursor_get_display (cursor);
|
|
|
|
|
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
2005-06-14 15:10:13 +00:00
|
|
|
|
|
|
|
|
|
size = XcursorGetDefaultSize (xdisplay);
|
|
|
|
|
theme = XcursorGetTheme (xdisplay);
|
|
|
|
|
|
|
|
|
|
if (cursor->type == GDK_CURSOR_IS_PIXMAP)
|
|
|
|
|
{
|
|
|
|
|
if (private->name)
|
2010-12-13 17:36:35 +00:00
|
|
|
|
images = XcursorLibraryLoadImages (private->name, theme, size);
|
2005-06-14 15:10:13 +00:00
|
|
|
|
}
|
2010-12-13 17:36:35 +00:00
|
|
|
|
else
|
2005-06-14 15:10:13 +00:00
|
|
|
|
images = XcursorShapeLoadImages (cursor->type, theme, size);
|
|
|
|
|
|
|
|
|
|
if (!images)
|
|
|
|
|
return NULL;
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2005-06-14 15:10:13 +00:00
|
|
|
|
image = images->images[0];
|
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
/* Assume the currently set cursor was defined for the screen
|
|
|
|
|
scale */
|
|
|
|
|
scale =
|
|
|
|
|
gdk_screen_get_monitor_scale_factor (gdk_display_get_default_screen (display), 0);
|
2005-06-14 15:10:13 +00:00
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
surface = gdk_window_create_similar_image_surface (NULL,
|
|
|
|
|
CAIRO_FORMAT_ARGB32,
|
|
|
|
|
image->width,
|
|
|
|
|
image->height,
|
|
|
|
|
scale);
|
|
|
|
|
|
|
|
|
|
memcpy (cairo_image_surface_get_data (surface),
|
|
|
|
|
image->pixels, 4 * image->width * image->height);
|
2005-06-15 21:22:54 +00:00
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
cairo_surface_mark_dirty (surface);
|
2005-06-14 15:10:13 +00:00
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
if (x_hot)
|
|
|
|
|
*x_hot = (double)image->xhot / scale;
|
|
|
|
|
if (y_hot)
|
|
|
|
|
*y_hot = (double)image->yhot / scale;
|
2005-06-14 20:43:20 +00:00
|
|
|
|
|
2005-06-15 18:37:18 +00:00
|
|
|
|
XcursorImagesDestroy (images);
|
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
return surface;
|
2005-06-15 18:37:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-06-17 17:26:24 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_x11_cursor_update_theme (GdkCursor *cursor)
|
2005-06-15 18:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
Display *xdisplay;
|
2010-12-20 02:09:31 +00:00
|
|
|
|
GdkX11Cursor *private;
|
2005-06-15 18:37:18 +00:00
|
|
|
|
Cursor new_cursor = None;
|
2010-12-20 16:14:04 +00:00
|
|
|
|
GdkX11Display *display_x11;
|
2005-06-14 20:43:20 +00:00
|
|
|
|
|
2010-12-20 02:09:31 +00:00
|
|
|
|
private = (GdkX11Cursor *) cursor;
|
2010-12-20 18:20:10 +00:00
|
|
|
|
display_x11 = GDK_X11_DISPLAY (gdk_cursor_get_display (cursor));
|
2010-12-20 12:55:46 +00:00
|
|
|
|
xdisplay = GDK_DISPLAY_XDISPLAY (display_x11);
|
2008-07-24 03:38:08 +00:00
|
|
|
|
|
|
|
|
|
if (!display_x11->have_xfixes)
|
|
|
|
|
return;
|
|
|
|
|
|
2005-06-17 17:26:24 +00:00
|
|
|
|
if (private->serial == theme_serial)
|
2005-06-15 18:37:18 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2005-06-17 17:26:24 +00:00
|
|
|
|
private->serial = theme_serial;
|
2005-06-15 18:37:18 +00:00
|
|
|
|
|
|
|
|
|
if (private->xcursor != None)
|
2005-06-14 20:43:20 +00:00
|
|
|
|
{
|
2009-01-24 21:29:36 +00:00
|
|
|
|
if (cursor->type == GDK_BLANK_CURSOR)
|
|
|
|
|
return;
|
|
|
|
|
|
2005-06-15 18:37:18 +00:00
|
|
|
|
if (cursor->type == GDK_CURSOR_IS_PIXMAP)
|
2010-12-13 17:36:35 +00:00
|
|
|
|
{
|
|
|
|
|
if (private->name)
|
|
|
|
|
new_cursor = XcursorLibraryLoadCursor (xdisplay, private->name);
|
|
|
|
|
}
|
2005-06-15 18:37:18 +00:00
|
|
|
|
else
|
2010-12-13 17:36:35 +00:00
|
|
|
|
new_cursor = XcursorShapeLoadCursor (xdisplay, cursor->type);
|
2005-06-15 18:37:18 +00:00
|
|
|
|
|
|
|
|
|
if (new_cursor != None)
|
2010-12-13 17:36:35 +00:00
|
|
|
|
{
|
|
|
|
|
XFixesChangeCursor (xdisplay, new_cursor, private->xcursor);
|
|
|
|
|
private->xcursor = new_cursor;
|
|
|
|
|
}
|
2005-06-14 20:43:20 +00:00
|
|
|
|
}
|
2005-06-15 18:37:18 +00:00
|
|
|
|
}
|
2005-06-14 20:43:20 +00:00
|
|
|
|
|
2005-06-17 17:26:24 +00:00
|
|
|
|
static void
|
2009-01-20 02:15:59 +00:00
|
|
|
|
update_cursor (gpointer data,
|
2010-12-13 17:36:35 +00:00
|
|
|
|
gpointer user_data)
|
2005-06-17 17:26:24 +00:00
|
|
|
|
{
|
|
|
|
|
GdkCursor *cursor;
|
|
|
|
|
|
2009-01-20 02:15:59 +00:00
|
|
|
|
cursor = (GdkCursor*)(data);
|
2005-06-17 17:26:24 +00:00
|
|
|
|
|
|
|
|
|
if (!cursor)
|
|
|
|
|
return;
|
2011-01-23 23:50:09 +00:00
|
|
|
|
|
2005-06-17 17:26:24 +00:00
|
|
|
|
_gdk_x11_cursor_update_theme (cursor);
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-15 18:37:18 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_x11_display_set_cursor_theme:
|
2011-07-28 11:27:23 +00:00
|
|
|
|
* @display: (type GdkX11Display): a #GdkDisplay
|
2005-08-25 19:22:29 +00:00
|
|
|
|
* @theme: the name of the cursor theme to use, or %NULL to unset
|
2011-01-23 23:50:09 +00:00
|
|
|
|
* a previously set value
|
2006-01-25 15:41:40 +00:00
|
|
|
|
* @size: the cursor size to use, or 0 to keep the previous size
|
2005-06-15 18:37:18 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the cursor theme from which the images for cursor
|
2011-01-23 23:50:09 +00:00
|
|
|
|
* should be taken.
|
|
|
|
|
*
|
|
|
|
|
* If the windowing system supports it, existing cursors created
|
|
|
|
|
* with gdk_cursor_new(), gdk_cursor_new_for_display() and
|
2014-01-20 22:50:09 +00:00
|
|
|
|
* gdk_cursor_new_from_name() are updated to reflect the theme
|
2010-08-12 13:43:23 +00:00
|
|
|
|
* change. Custom cursors constructed with
|
|
|
|
|
* gdk_cursor_new_from_pixbuf() will have to be handled
|
2011-01-23 23:50:09 +00:00
|
|
|
|
* by the application (GTK+ applications can learn about
|
2005-06-15 18:37:18 +00:00
|
|
|
|
* cursor theme changes by listening for change notification
|
|
|
|
|
* for the corresponding #GtkSetting).
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.8
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gdk_x11_display_set_cursor_theme (GdkDisplay *display,
|
2010-12-13 17:36:35 +00:00
|
|
|
|
const gchar *theme,
|
|
|
|
|
const gint size)
|
2005-06-15 18:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
Display *xdisplay;
|
|
|
|
|
gchar *old_theme;
|
|
|
|
|
gint old_size;
|
2005-06-14 15:10:13 +00:00
|
|
|
|
|
2005-06-15 18:37:18 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_DISPLAY (display));
|
|
|
|
|
|
|
|
|
|
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
|
|
|
|
|
|
|
|
|
old_theme = XcursorGetTheme (xdisplay);
|
|
|
|
|
old_size = XcursorGetDefaultSize (xdisplay);
|
|
|
|
|
|
2005-08-25 19:22:29 +00:00
|
|
|
|
if (old_size == size &&
|
|
|
|
|
(old_theme == theme ||
|
|
|
|
|
(old_theme && theme && strcmp (old_theme, theme) == 0)))
|
2005-06-15 18:37:18 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2005-06-17 17:26:24 +00:00
|
|
|
|
theme_serial++;
|
|
|
|
|
|
2005-06-15 18:37:18 +00:00
|
|
|
|
XcursorSetTheme (xdisplay, theme);
|
2006-01-25 15:41:40 +00:00
|
|
|
|
if (size > 0)
|
|
|
|
|
XcursorSetDefaultSize (xdisplay, size);
|
2011-01-23 23:50:09 +00:00
|
|
|
|
|
2009-01-20 02:15:59 +00:00
|
|
|
|
g_slist_foreach (cursor_cache, update_cursor, NULL);
|
2005-06-14 15:10:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
2013-08-06 14:21:05 +00:00
|
|
|
|
static cairo_surface_t *
|
|
|
|
|
gdk_x11_cursor_get_surface (GdkCursor *cursor,
|
|
|
|
|
gdouble *x_hot,
|
|
|
|
|
gdouble *y_hot)
|
2005-06-14 15:10:13 +00:00
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-15 18:37:18 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_x11_display_set_cursor_theme (GdkDisplay *display,
|
2010-12-13 17:36:35 +00:00
|
|
|
|
const gchar *theme,
|
|
|
|
|
const gint size)
|
2005-06-15 18:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GDK_IS_DISPLAY (display));
|
2005-06-17 19:27:04 +00:00
|
|
|
|
}
|
2005-06-15 18:37:18 +00:00
|
|
|
|
|
2005-06-17 19:27:04 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_x11_cursor_update_theme (GdkCursor *cursor)
|
|
|
|
|
{
|
2005-06-18 11:25:14 +00:00
|
|
|
|
g_return_if_fail (cursor != NULL);
|
2005-06-15 18:37:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-06-14 15:10:13 +00:00
|
|
|
|
#endif
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_XCURSOR
|
|
|
|
|
|
2013-08-07 10:18:38 +00:00
|
|
|
|
static void
|
|
|
|
|
get_surface_size (cairo_surface_t *surface,
|
|
|
|
|
int *width,
|
|
|
|
|
int *height)
|
|
|
|
|
{
|
|
|
|
|
double x_scale, y_scale;
|
|
|
|
|
|
|
|
|
|
x_scale = y_scale = 1;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
|
|
|
|
|
cairo_surface_get_device_scale (surface, &x_scale, &y_scale);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Assume any set scaling is icon scale */
|
|
|
|
|
*width =
|
|
|
|
|
ceil (cairo_image_surface_get_width (surface) / x_scale);
|
|
|
|
|
*height =
|
|
|
|
|
ceil (cairo_image_surface_get_height (surface) / y_scale);
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
static XcursorImage*
|
2013-08-07 10:18:38 +00:00
|
|
|
|
create_cursor_image (cairo_surface_t *source_surface,
|
2010-12-13 17:36:35 +00:00
|
|
|
|
gint x,
|
2013-08-07 10:18:38 +00:00
|
|
|
|
gint y,
|
|
|
|
|
gint scale)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
2013-08-07 10:18:38 +00:00
|
|
|
|
gint width, height;
|
2003-06-30 22:30:54 +00:00
|
|
|
|
XcursorImage *xcimage;
|
2010-08-27 12:13:03 +00:00
|
|
|
|
cairo_surface_t *surface;
|
|
|
|
|
cairo_t *cr;
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
2013-08-07 10:18:38 +00:00
|
|
|
|
get_surface_size (source_surface, &width, &height);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
2013-08-07 10:18:38 +00:00
|
|
|
|
width *= scale;
|
|
|
|
|
height *= scale;
|
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
xcimage = XcursorImageCreate (width, height);
|
2004-06-21 16:13:55 +00:00
|
|
|
|
|
2013-08-07 10:18:38 +00:00
|
|
|
|
xcimage->xhot = x * scale;
|
|
|
|
|
xcimage->yhot = y * scale;
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
2010-08-27 12:13:03 +00:00
|
|
|
|
surface = cairo_image_surface_create_for_data ((guchar *) xcimage->pixels,
|
|
|
|
|
CAIRO_FORMAT_ARGB32,
|
|
|
|
|
width,
|
|
|
|
|
height,
|
|
|
|
|
width * 4);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
2013-08-07 10:18:38 +00:00
|
|
|
|
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
|
|
|
|
|
cairo_surface_set_device_scale (surface, scale, scale);
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-08-27 12:13:03 +00:00
|
|
|
|
cr = cairo_create (surface);
|
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
2013-08-07 10:18:38 +00:00
|
|
|
|
cairo_set_source_surface (cr, source_surface, 0, 0);
|
2010-08-27 12:13:03 +00:00
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_destroy (cr);
|
|
|
|
|
cairo_surface_destroy (surface);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
|
|
|
|
return xcimage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GdkCursor *
|
2013-08-07 10:18:38 +00:00
|
|
|
|
_gdk_x11_display_get_cursor_for_surface (GdkDisplay *display,
|
|
|
|
|
cairo_surface_t *surface,
|
|
|
|
|
gdouble x,
|
|
|
|
|
gdouble y)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
|
|
|
|
XcursorImage *xcimage;
|
|
|
|
|
Cursor xcursor;
|
2010-12-20 02:09:31 +00:00
|
|
|
|
GdkX11Cursor *private;
|
2013-08-07 10:18:38 +00:00
|
|
|
|
int target_scale;
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
2010-12-11 04:14:43 +00:00
|
|
|
|
if (gdk_display_is_closed (display))
|
2010-12-13 17:36:35 +00:00
|
|
|
|
{
|
|
|
|
|
xcursor = None;
|
|
|
|
|
}
|
|
|
|
|
else
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
2013-08-07 10:18:38 +00:00
|
|
|
|
target_scale =
|
|
|
|
|
gdk_screen_get_monitor_scale_factor (gdk_display_get_default_screen (display), 0);
|
|
|
|
|
xcimage = create_cursor_image (surface, x, y, target_scale);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
xcursor = XcursorImageLoadCursor (GDK_DISPLAY_XDISPLAY (display), xcimage);
|
|
|
|
|
XcursorImageDestroy (xcimage);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-20 12:35:39 +00:00
|
|
|
|
private = g_object_new (GDK_TYPE_X11_CURSOR,
|
|
|
|
|
"cursor-type", GDK_CURSOR_IS_PIXMAP,
|
2010-12-20 12:45:31 +00:00
|
|
|
|
"display", display,
|
2010-12-20 12:35:39 +00:00
|
|
|
|
NULL);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
private->xcursor = xcursor;
|
2005-06-14 15:10:13 +00:00
|
|
|
|
private->name = NULL;
|
2005-06-17 17:26:24 +00:00
|
|
|
|
private->serial = theme_serial;
|
|
|
|
|
|
2010-12-20 12:35:39 +00:00
|
|
|
|
return GDK_CURSOR (private);
|
2005-06-14 15:10:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
GdkCursor*
|
|
|
|
|
_gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
|
|
|
|
|
const gchar *name)
|
2005-06-14 15:10:13 +00:00
|
|
|
|
{
|
|
|
|
|
Cursor xcursor;
|
|
|
|
|
Display *xdisplay;
|
2010-12-20 02:09:31 +00:00
|
|
|
|
GdkX11Cursor *private;
|
2005-06-14 15:10:13 +00:00
|
|
|
|
|
2010-12-11 04:14:43 +00:00
|
|
|
|
if (gdk_display_is_closed (display))
|
2010-12-13 17:36:35 +00:00
|
|
|
|
{
|
|
|
|
|
xcursor = None;
|
|
|
|
|
}
|
|
|
|
|
else
|
2005-06-14 15:10:13 +00:00
|
|
|
|
{
|
2009-01-20 02:15:59 +00:00
|
|
|
|
private = find_in_cache (display, GDK_CURSOR_IS_PIXMAP, name);
|
|
|
|
|
|
|
|
|
|
if (private)
|
|
|
|
|
{
|
|
|
|
|
/* Cache had it, add a ref for this user */
|
2010-12-20 02:12:33 +00:00
|
|
|
|
g_object_ref (private);
|
2009-01-20 02:15:59 +00:00
|
|
|
|
|
|
|
|
|
return (GdkCursor*) private;
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-14 15:10:13 +00:00
|
|
|
|
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
|
|
|
|
xcursor = XcursorLibraryLoadCursor (xdisplay, name);
|
|
|
|
|
if (xcursor == None)
|
2010-12-13 17:36:35 +00:00
|
|
|
|
return NULL;
|
2005-06-14 15:10:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-20 12:35:39 +00:00
|
|
|
|
private = g_object_new (GDK_TYPE_X11_CURSOR,
|
|
|
|
|
"cursor-type", GDK_CURSOR_IS_PIXMAP,
|
2010-12-20 12:45:31 +00:00
|
|
|
|
"display", display,
|
2010-12-20 12:35:39 +00:00
|
|
|
|
NULL);
|
2005-06-14 15:10:13 +00:00
|
|
|
|
private->xcursor = xcursor;
|
|
|
|
|
private->name = g_strdup (name);
|
2005-06-17 17:26:24 +00:00
|
|
|
|
private->serial = theme_serial;
|
|
|
|
|
|
2009-01-20 02:15:59 +00:00
|
|
|
|
add_to_cache (private);
|
|
|
|
|
|
2010-12-20 12:35:39 +00:00
|
|
|
|
return GDK_CURSOR (private);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
gboolean
|
|
|
|
|
_gdk_x11_display_supports_cursor_alpha (GdkDisplay *display)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
|
|
|
|
return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
gboolean
|
|
|
|
|
_gdk_x11_display_supports_cursor_color (GdkDisplay *display)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
|
|
|
|
return XcursorSupportsARGB (GDK_DISPLAY_XDISPLAY (display));
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_x11_display_get_default_cursor_size (GdkDisplay *display,
|
|
|
|
|
guint *width,
|
|
|
|
|
guint *height)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
2010-12-13 17:36:35 +00:00
|
|
|
|
*width = *height = XcursorGetDefaultSize (GDK_DISPLAY_XDISPLAY (display));
|
2003-06-30 22:30:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
2010-08-12 13:43:23 +00:00
|
|
|
|
static GdkCursor*
|
2010-08-27 13:09:49 +00:00
|
|
|
|
gdk_cursor_new_from_pixmap (GdkDisplay *display,
|
|
|
|
|
Pixmap source_pixmap,
|
2010-12-13 17:36:35 +00:00
|
|
|
|
Pixmap mask_pixmap,
|
2011-05-02 16:42:18 +00:00
|
|
|
|
const GdkRGBA *fg,
|
|
|
|
|
const GdkRGBA *bg,
|
2010-12-13 17:36:35 +00:00
|
|
|
|
gint x,
|
|
|
|
|
gint y)
|
2010-08-12 13:43:23 +00:00
|
|
|
|
{
|
2010-12-20 02:09:31 +00:00
|
|
|
|
GdkX11Cursor *private;
|
2010-08-12 13:43:23 +00:00
|
|
|
|
Cursor xcursor;
|
|
|
|
|
XColor xfg, xbg;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (fg != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (bg != NULL, NULL);
|
|
|
|
|
|
2011-05-02 16:42:18 +00:00
|
|
|
|
xfg.red = fg->red * 65535;
|
|
|
|
|
xfg.blue = fg->blue * 65535;
|
|
|
|
|
xfg.green = fg->green * 65535;
|
|
|
|
|
|
|
|
|
|
xbg.red = bg->red * 65535;
|
|
|
|
|
xbg.blue = bg->blue * 65535;
|
|
|
|
|
xbg.green = bg->green * 65535;
|
|
|
|
|
|
2011-02-21 00:44:35 +00:00
|
|
|
|
if (gdk_display_is_closed (display))
|
2010-08-12 13:43:23 +00:00
|
|
|
|
xcursor = None;
|
|
|
|
|
else
|
|
|
|
|
xcursor = XCreatePixmapCursor (GDK_DISPLAY_XDISPLAY (display),
|
2010-12-13 17:36:35 +00:00
|
|
|
|
source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
|
2010-12-20 12:35:39 +00:00
|
|
|
|
private = g_object_new (GDK_TYPE_X11_CURSOR,
|
|
|
|
|
"cursor-type", GDK_CURSOR_IS_PIXMAP,
|
2010-12-20 12:45:31 +00:00
|
|
|
|
"display", display,
|
2010-12-20 12:35:39 +00:00
|
|
|
|
NULL);
|
2010-08-12 13:43:23 +00:00
|
|
|
|
private->xcursor = xcursor;
|
|
|
|
|
private->name = NULL;
|
|
|
|
|
private->serial = theme_serial;
|
|
|
|
|
|
2010-12-20 12:35:39 +00:00
|
|
|
|
return GDK_CURSOR (private);
|
2010-08-12 13:43:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
GdkCursor *
|
2013-08-07 10:18:38 +00:00
|
|
|
|
_gdk_x11_display_get_cursor_for_surface (GdkDisplay *display,
|
|
|
|
|
cairo_surface_t *surface,
|
|
|
|
|
gdouble x,
|
|
|
|
|
gdouble y)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
|
|
|
|
GdkCursor *cursor;
|
2010-08-27 13:09:49 +00:00
|
|
|
|
cairo_surface_t *pixmap, *mask;
|
2010-08-06 18:11:45 +00:00
|
|
|
|
guint width, height, n_channels, rowstride, data_stride, i, j;
|
2003-06-30 22:30:54 +00:00
|
|
|
|
guint8 *data, *mask_data, *pixels;
|
2011-05-07 16:01:04 +00:00
|
|
|
|
GdkRGBA fg = { 0, 0, 0, 1 };
|
2011-05-02 16:42:18 +00:00
|
|
|
|
GdkRGBA bg = { 1, 1, 1, 1 };
|
2003-06-30 22:30:54 +00:00
|
|
|
|
GdkScreen *screen;
|
2010-08-06 18:11:45 +00:00
|
|
|
|
cairo_surface_t *image;
|
|
|
|
|
cairo_t *cr;
|
2013-08-07 10:18:38 +00:00
|
|
|
|
GdkPixbuf *pixbuf;
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
2013-08-07 10:18:38 +00:00
|
|
|
|
width = cairo_image_surface_get_width (surface);
|
|
|
|
|
height = cairo_image_surface_get_height (surface);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (0 <= x && x < width, NULL);
|
|
|
|
|
g_return_val_if_fail (0 <= y && y < height, NULL);
|
|
|
|
|
|
2013-08-07 10:18:38 +00:00
|
|
|
|
/* Note: This does not support scaled surfaced, if you need that you
|
|
|
|
|
want XCursor anyway */
|
|
|
|
|
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
|
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
n_channels = gdk_pixbuf_get_n_channels (pixbuf);
|
|
|
|
|
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
|
|
|
|
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
|
|
|
|
|
2010-08-06 18:11:45 +00:00
|
|
|
|
data_stride = 4 * ((width + 31) / 32);
|
|
|
|
|
data = g_new0 (guint8, data_stride * height);
|
|
|
|
|
mask_data = g_new0 (guint8, data_stride * height);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
|
|
|
|
|
for (j = 0; j < height; j++)
|
|
|
|
|
{
|
|
|
|
|
guint8 *src = pixels + j * rowstride;
|
2010-08-06 18:11:45 +00:00
|
|
|
|
guint8 *d = data + data_stride * j;
|
|
|
|
|
guint8 *md = mask_data + data_stride * j;
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
for (i = 0; i < width; i++)
|
2010-12-13 17:36:35 +00:00
|
|
|
|
{
|
|
|
|
|
if (src[1] < 0x80)
|
|
|
|
|
*d |= 1 << (i % 8);
|
|
|
|
|
|
|
|
|
|
if (n_channels == 3 || src[3] >= 0x80)
|
|
|
|
|
*md |= 1 << (i % 8);
|
|
|
|
|
|
|
|
|
|
src += n_channels;
|
|
|
|
|
if (i % 8 == 7)
|
|
|
|
|
{
|
|
|
|
|
d++;
|
|
|
|
|
md++;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-06-30 22:30:54 +00:00
|
|
|
|
}
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2013-08-07 10:18:38 +00:00
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
screen = gdk_display_get_default_screen (display);
|
2010-08-06 18:11:45 +00:00
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
pixmap = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
|
|
|
|
|
width, height);
|
2010-08-27 13:09:49 +00:00
|
|
|
|
cr = cairo_create (pixmap);
|
2010-08-06 18:11:45 +00:00
|
|
|
|
image = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_A1,
|
|
|
|
|
width, height, data_stride);
|
|
|
|
|
cairo_set_source_surface (cr, image, 0, 0);
|
|
|
|
|
cairo_surface_destroy (image);
|
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_destroy (cr);
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
|
|
|
|
mask = _gdk_x11_window_create_bitmap_surface (gdk_screen_get_root_window (screen),
|
|
|
|
|
width, height);
|
2010-08-27 13:09:49 +00:00
|
|
|
|
cr = cairo_create (mask);
|
2010-08-06 18:11:45 +00:00
|
|
|
|
image = cairo_image_surface_create_for_data (mask_data, CAIRO_FORMAT_A1,
|
|
|
|
|
width, height, data_stride);
|
|
|
|
|
cairo_set_source_surface (cr, image, 0, 0);
|
|
|
|
|
cairo_surface_destroy (image);
|
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_destroy (cr);
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2010-08-27 13:09:49 +00:00
|
|
|
|
cursor = gdk_cursor_new_from_pixmap (display,
|
|
|
|
|
cairo_xlib_surface_get_drawable (pixmap),
|
|
|
|
|
cairo_xlib_surface_get_drawable (mask),
|
|
|
|
|
&fg, &bg,
|
|
|
|
|
x, y);
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2010-08-27 13:09:49 +00:00
|
|
|
|
cairo_surface_destroy (pixmap);
|
|
|
|
|
cairo_surface_destroy (mask);
|
2013-08-07 10:18:38 +00:00
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
g_free (data);
|
|
|
|
|
g_free (mask_data);
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
return cursor;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
GdkCursor*
|
|
|
|
|
_gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
|
|
|
|
|
const gchar *name)
|
2005-06-14 20:43:20 +00:00
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
gboolean
|
|
|
|
|
_gdk_x11_display_supports_cursor_alpha (GdkDisplay *display)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
gboolean
|
|
|
|
|
_gdk_x11_display_supports_cursor_color (GdkDisplay *display)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
void
|
2010-12-28 03:19:52 +00:00
|
|
|
|
_gdk_x11_display_get_default_cursor_size (GdkDisplay *display,
|
|
|
|
|
guint *width,
|
|
|
|
|
guint *height)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
|
|
|
|
/* no idea, really */
|
2010-12-28 03:19:52 +00:00
|
|
|
|
*width = *height = 20;
|
|
|
|
|
return;
|
2003-06-30 22:30:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-12-13 17:36:35 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_x11_display_get_maximal_cursor_size (GdkDisplay *display,
|
|
|
|
|
guint *width,
|
|
|
|
|
guint *height)
|
2003-06-30 22:30:54 +00:00
|
|
|
|
{
|
|
|
|
|
GdkScreen *screen;
|
|
|
|
|
GdkWindow *window;
|
|
|
|
|
|
2003-07-05 01:54:05 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_DISPLAY (display));
|
2010-12-13 17:36:35 +00:00
|
|
|
|
|
2003-06-30 22:30:54 +00:00
|
|
|
|
screen = gdk_display_get_default_screen (display);
|
|
|
|
|
window = gdk_screen_get_root_window (screen);
|
2010-12-13 17:36:35 +00:00
|
|
|
|
XQueryBestCursor (GDK_DISPLAY_XDISPLAY (display),
|
|
|
|
|
GDK_WINDOW_XID (window),
|
|
|
|
|
128, 128, width, height);
|
2003-06-30 22:30:54 +00:00
|
|
|
|
}
|