summaryrefslogtreecommitdiff
path: root/magnifier
diff options
context:
space:
mode:
authorCarlos Eduardo Rodrigues Diógenes <cerdiogenes@gmail.com>2007-10-14 21:22:57 +0000
committerCarlos Eduardo Rodrigues Diógenes <carlosd@src.gnome.org>2007-10-14 21:22:57 +0000
commit2015af0c1f8be3e0195748f2f07c1a39d62172fd (patch)
tree9266037b27757e74718f7656be64bee3f850fa8d /magnifier
parent12dfdda7b663a9de68833e02caa447df6fc47ec8 (diff)
Replaced the private gdk_pixbuf_get_option by g_object_get_data. Also
2007-10-14 Carlos Eduardo Rodrigues Diógenes <cerdiogenes@gmail.com> * magnifier/magnifier.c: (magnifier_set_cursor_from_pixbuf): Replaced the private gdk_pixbuf_get_option by g_object_get_data. * magnifier/x11/gmag-cursor.c: Also modify the code to replace the private gdk_pixbuf_get_set_option by g_object_set_data. svn path=/trunk/; revision=636
Diffstat (limited to 'magnifier')
-rw-r--r--magnifier/magnifier.c6
-rw-r--r--magnifier/x11/gmag-cursor.c34
2 files changed, 28 insertions, 12 deletions
diff --git a/magnifier/magnifier.c b/magnifier/magnifier.c
index 86c60aa..9ca1fe0 100644
--- a/magnifier/magnifier.c
+++ b/magnifier/magnifier.c
@@ -301,8 +301,10 @@ magnifier_set_cursor_from_pixbuf (Magnifier *magnifier,
g_object_unref (gc);
magnifier->priv->cursor = pixmap;
magnifier->priv->cursor_mask = mask;
- xhot_string = gdk_pixbuf_get_option (cursor_pixbuf,"x_hot");
- yhot_string = gdk_pixbuf_get_option (cursor_pixbuf,"y_hot");
+
+ xhot_string = g_object_get_data (cursor_pixbuf, "x_hot");
+ yhot_string = g_object_get_data (cursor_pixbuf, "y_hot");
+
if (xhot_string)
magnifier->cursor_hotspot.x = atoi (xhot_string);
if (yhot_string)
diff --git a/magnifier/x11/gmag-cursor.c b/magnifier/x11/gmag-cursor.c
index 1793beb..544f2be 100644
--- a/magnifier/x11/gmag-cursor.c
+++ b/magnifier/x11/gmag-cursor.c
@@ -25,6 +25,8 @@
#include "magnifier.h"
#include "magnifier-private.h"
+#include <stdlib.h>
+
#include <X11/Xlib.h>
#include <X11/extensions/Xfixes.h>
@@ -61,23 +63,25 @@ gmag_cursor_get_source_pixbuf (Magnifier *magnifier)
{
XFixesCursorImage *cursor_image = XFixesGetCursorImage (dpy);
GdkPixbuf *cursor_pixbuf = NULL;
- gchar s[6];
+ gchar *s1, *s2;
if (cursor_image) {
+ s1 = (char *) malloc (sizeof (char) * 6);
+ s2 = (char *) malloc (sizeof (char) * 6);
gmag_cursor_cursor_convert_to_rgba (magnifier, cursor_image);
cursor_pixbuf = gdk_pixbuf_new_from_data (
(guchar *) cursor_image->pixels, GDK_COLORSPACE_RGB,
TRUE, 8, cursor_image->width, cursor_image->height,
cursor_image->width * 4,
gmag_cursor_free_cursor_pixels, cursor_image);
- gdk_pixbuf_set_option (cursor_pixbuf, "x_hot",
- g_ascii_dtostr (
- s, 6,
- (gdouble) cursor_image->xhot));
- gdk_pixbuf_set_option (cursor_pixbuf, "y_hot",
- g_ascii_dtostr (
- s, 6,
- (gdouble) cursor_image->yhot));
+ g_object_set_data (G_OBJECT (cursor_pixbuf), "x_hot",
+ g_ascii_dtostr (
+ s1, 6,
+ (gdouble) cursor_image->xhot));
+ g_object_set_data (G_OBJECT (cursor_pixbuf), "y_hot",
+ g_ascii_dtostr (
+ s2, 6,
+ (gdouble) cursor_image->yhot));
}
return cursor_pixbuf;
@@ -105,13 +109,23 @@ void
gmag_cursor_events_handler (Magnifier *magnifier, XEvent *ev)
{
XFixesCursorNotifyEvent *cev = NULL;
+ gchar *s1, *s2;
if (magnifier->priv->use_source_cursor) {
GdkPixbuf *cursor_pixbuf =
gmag_cursor_get_source_pixbuf (magnifier);
magnifier_set_cursor_from_pixbuf (magnifier,
cursor_pixbuf);
- if (cursor_pixbuf) g_object_unref (cursor_pixbuf);
+ s1 = g_object_get_data (G_OBJECT (cursor_pixbuf),
+ "x_hot");
+ s2 = g_object_get_data (G_OBJECT (cursor_pixbuf),
+ "y_hot");
+ if (s1) {
+ g_free (s1);
+ g_free (s2);
+ }
+ if (cursor_pixbuf)
+ g_object_unref (cursor_pixbuf);
} else {
if (cev)
magnifier_set_cursor_pixmap_by_name (