forked from AuroraMiddleware/gtk
Add support for pixmap cursors -mig
This commit is contained in:
parent
a7f427d7d9
commit
a51d944e25
10
gdk/gdk.h
10
gdk/gdk.h
@ -268,8 +268,14 @@ void gdk_window_set_events (GdkWindow *window,
|
||||
|
||||
/* Cursors
|
||||
*/
|
||||
GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
|
||||
void gdk_cursor_destroy (GdkCursor *cursor);
|
||||
GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
|
||||
GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
|
||||
GdkPixmap *mask,
|
||||
GdkColor *fg,
|
||||
GdkColor *bg,
|
||||
int x,
|
||||
int y);
|
||||
void gdk_cursor_destroy (GdkCursor *cursor);
|
||||
|
||||
|
||||
/* GCs
|
||||
|
@ -38,6 +38,37 @@ gdk_cursor_new (GdkCursorType cursor_type)
|
||||
return cursor;
|
||||
}
|
||||
|
||||
GdkCursor*
|
||||
gdk_cursor_new_from_pixmap (GdkPixmap *source, GdkPixmap *mask, GdkColor *fg, GdkColor *bg, int x, int y)
|
||||
{
|
||||
GdkCursorPrivate *private;
|
||||
GdkCursor *cursor;
|
||||
Pixmap source_pixmap, mask_pixmap;
|
||||
Cursor xcursor;
|
||||
XColor xfg, xbg;
|
||||
|
||||
source_pixmap = ((GdkPixmapPrivate *) source)->xwindow;
|
||||
mask_pixmap = ((GdkPixmapPrivate *) mask)->xwindow;
|
||||
|
||||
xfg.pixel = fg->pixel;
|
||||
xfg.red = fg->red;
|
||||
xfg.blue = fg->blue;
|
||||
xfg.green = fg->green;
|
||||
xbg.pixel = bg->pixel;
|
||||
xbg.red = bg->red;
|
||||
xbg.blue = bg->blue;
|
||||
xbg.green = bg->green;
|
||||
|
||||
xcursor = XCreatePixmapCursor (gdk_display, source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
|
||||
private = g_new (GdkCursorPrivate, 1);
|
||||
private->xdisplay = gdk_display;
|
||||
private->xcursor = xcursor;
|
||||
cursor = (GdkCursor *) private;
|
||||
cursor->type = GDK_CURSOR_IS_PIXMAP;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_cursor_destroy (GdkCursor *cursor)
|
||||
{
|
||||
|
@ -273,7 +273,8 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
#include <gdk/gdkcursors.h>
|
||||
GDK_LAST_CURSOR
|
||||
GDK_LAST_CURSOR,
|
||||
GDK_CURSOR_IS_PIXMAP = -1
|
||||
} GdkCursorType;
|
||||
|
||||
/* Event types.
|
||||
|
@ -38,6 +38,37 @@ gdk_cursor_new (GdkCursorType cursor_type)
|
||||
return cursor;
|
||||
}
|
||||
|
||||
GdkCursor*
|
||||
gdk_cursor_new_from_pixmap (GdkPixmap *source, GdkPixmap *mask, GdkColor *fg, GdkColor *bg, int x, int y)
|
||||
{
|
||||
GdkCursorPrivate *private;
|
||||
GdkCursor *cursor;
|
||||
Pixmap source_pixmap, mask_pixmap;
|
||||
Cursor xcursor;
|
||||
XColor xfg, xbg;
|
||||
|
||||
source_pixmap = ((GdkPixmapPrivate *) source)->xwindow;
|
||||
mask_pixmap = ((GdkPixmapPrivate *) mask)->xwindow;
|
||||
|
||||
xfg.pixel = fg->pixel;
|
||||
xfg.red = fg->red;
|
||||
xfg.blue = fg->blue;
|
||||
xfg.green = fg->green;
|
||||
xbg.pixel = bg->pixel;
|
||||
xbg.red = bg->red;
|
||||
xbg.blue = bg->blue;
|
||||
xbg.green = bg->green;
|
||||
|
||||
xcursor = XCreatePixmapCursor (gdk_display, source_pixmap, mask_pixmap, &xfg, &xbg, x, y);
|
||||
private = g_new (GdkCursorPrivate, 1);
|
||||
private->xdisplay = gdk_display;
|
||||
private->xcursor = xcursor;
|
||||
cursor = (GdkCursor *) private;
|
||||
cursor->type = GDK_CURSOR_IS_PIXMAP;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_cursor_destroy (GdkCursor *cursor)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user