+2005-06-17 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/x11/gdkprivate-x11.h:
+ * gdk/x11/gdkcursor-x11.c: Handle cursor theme changes
+ for cached cursors which are not associated with a window
+ at the time of the theme change, by storing a serial
+ number in each cursor, and updating the theme_serial
+ counter whenever the cursor theme changes.
+
+ * gdk/x11/gdkcursor-x11.c (_gdk_x11_cursor_update_theme):
+ Private function to update a cursor to the current
+ cursor theme if necessary.
+
+ * gdk/x11/gdkmain-x11.c (gdk_pointer_grab):
+ * gdk/x11/gdkwindow-x11.c (gdk_window_set_cursor): Call
+ _gdk_x11_cursor_update_theme() here.
+
2005-06-17 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
+2005-06-17 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/x11/gdkprivate-x11.h:
+ * gdk/x11/gdkcursor-x11.c: Handle cursor theme changes
+ for cached cursors which are not associated with a window
+ at the time of the theme change, by storing a serial
+ number in each cursor, and updating the theme_serial
+ counter whenever the cursor theme changes.
+
+ * gdk/x11/gdkcursor-x11.c (_gdk_x11_cursor_update_theme):
+ Private function to update a cursor to the current
+ cursor theme if necessary.
+
+ * gdk/x11/gdkmain-x11.c (gdk_pointer_grab):
+ * gdk/x11/gdkwindow-x11.c (gdk_window_set_cursor): Call
+ _gdk_x11_cursor_update_theme() here.
+
2005-06-17 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
+2005-06-17 Matthias Clasen <mclasen@redhat.com>
+
+ * gdk/x11/gdkprivate-x11.h:
+ * gdk/x11/gdkcursor-x11.c: Handle cursor theme changes
+ for cached cursors which are not associated with a window
+ at the time of the theme change, by storing a serial
+ number in each cursor, and updating the theme_serial
+ counter whenever the cursor theme changes.
+
+ * gdk/x11/gdkcursor-x11.c (_gdk_x11_cursor_update_theme):
+ Private function to update a cursor to the current
+ cursor theme if necessary.
+
+ * gdk/x11/gdkmain-x11.c (gdk_pointer_grab):
+ * gdk/x11/gdkwindow-x11.c (gdk_window_set_cursor): Call
+ _gdk_x11_cursor_update_theme() here.
+
2005-06-17 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gdkalias.h"
+static guint theme_serial = 0;
/**
* gdk_cursor_new_for_display:
private->display = display;
private->xcursor = xcursor;
private->name = NULL;
+ private->serial = theme_serial;
+
cursor = (GdkCursor *) private;
cursor->type = cursor_type;
cursor->ref_count = 1;
private->display = display;
private->xcursor = xcursor;
private->name = NULL;
+ private->serial = theme_serial;
+
cursor = (GdkCursor *) private;
cursor->type = GDK_CURSOR_IS_PIXMAP;
cursor->ref_count = 1;
return pixbuf;
}
-static void
-update_cursor (gpointer key,
- gpointer value,
- gpointer data)
+void
+_gdk_x11_cursor_update_theme (GdkCursor *cursor)
{
Display *xdisplay;
- GdkCursor *cursor;
GdkCursorPrivate *private;
Cursor new_cursor = None;
- if (!GDK_IS_WINDOW (value))
+ private = (GdkCursorPrivate *) cursor;
+ xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
+
+ if (private->serial == theme_serial)
return;
- cursor = _gdk_x11_window_get_cursor (GDK_WINDOW (value));
+ private->serial = theme_serial;
- if (!cursor)
- return;
-
- private = (GdkCursorPrivate *) cursor;
- xdisplay = (Display *)data;
-
if (private->xcursor != None)
{
if (cursor->type == GDK_CURSOR_IS_PIXMAP)
}
}
+static void
+update_cursor (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ GdkCursor *cursor;
+
+ if (!GDK_IS_WINDOW (value))
+ return;
+
+ cursor = _gdk_x11_window_get_cursor (GDK_WINDOW (value));
+
+ if (!cursor)
+ return;
+
+ _gdk_x11_cursor_update_theme (cursor);
+}
+
/**
* gdk_x11_display_set_cursor_theme:
* @display: a #GdkDisplay
old_theme && strcmp (old_theme, theme) == 0)
return;
+ theme_serial++;
+
XcursorSetTheme (xdisplay, theme);
XcursorSetDefaultSize (xdisplay, size);
- g_hash_table_foreach (display_x11->xid_ht,
- update_cursor, xdisplay);
+ g_hash_table_foreach (display_x11->xid_ht, update_cursor, NULL);
}
#else
private->display = display;
private->xcursor = xcursor;
private->name = NULL;
+ private->serial = theme_serial;
+
cursor = (GdkCursor *) private;
cursor->type = GDK_CURSOR_IS_PIXMAP;
cursor->ref_count = 1;
private->display = display;
private->xcursor = xcursor;
private->name = g_strdup (name);
+ private->serial = theme_serial;
+
cursor = (GdkCursor *) private;
cursor->type = GDK_CURSOR_IS_PIXMAP;
cursor->ref_count = 1;
if (!cursor)
xcursor = None;
else
- xcursor = cursor_private->xcursor;
-
+ {
+ _gdk_x11_cursor_update_theme (cursor);
+ xcursor = cursor_private->xcursor;
+ }
xevent_mask = 0;
for (i = 0; i < _gdk_nenvent_masks; i++)
Cursor xcursor;
GdkDisplay *display;
gchar *name;
+ guint serial;
};
struct _GdkVisualPrivate
GType _gdk_gc_x11_get_type (void);
-gboolean _gdk_x11_have_render (GdkDisplay *display);
+gboolean _gdk_x11_have_render (GdkDisplay *display);
GdkGC *_gdk_x11_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
PangoRenderer *_gdk_x11_renderer_get (GdkDrawable *drawable,
GdkGC *gc);
+void _gdk_x11_cursor_update_theme (GdkCursor *cursor);
+
extern GdkDrawableClass _gdk_x11_drawable_class;
extern gboolean _gdk_use_xshm;
extern const int _gdk_nenvent_masks;
if (!cursor)
xcursor = None;
else
- xcursor = cursor_private->xcursor;
+ {
+ _gdk_x11_cursor_update_theme (cursor);
+ xcursor = cursor_private->xcursor;
+ }
if (!GDK_WINDOW_DESTROYED (window))
{