mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
Handle cursor theme changes for cached cursors which are not associated
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.
This commit is contained in:
parent
c96795ffb3
commit
beb73ece8f
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
2005-06-17 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
|
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
2005-06-17 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
|
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
2005-06-17 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
|
* gdk/gdkcairo.c (gdk_cairo_set_source_pixbuf): Fix
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||||
#include "gdkalias.h"
|
#include "gdkalias.h"
|
||||||
|
|
||||||
|
static guint theme_serial = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gdk_cursor_new_for_display:
|
* gdk_cursor_new_for_display:
|
||||||
@ -134,6 +135,8 @@ gdk_cursor_new_for_display (GdkDisplay *display,
|
|||||||
private->display = display;
|
private->display = display;
|
||||||
private->xcursor = xcursor;
|
private->xcursor = xcursor;
|
||||||
private->name = NULL;
|
private->name = NULL;
|
||||||
|
private->serial = theme_serial;
|
||||||
|
|
||||||
cursor = (GdkCursor *) private;
|
cursor = (GdkCursor *) private;
|
||||||
cursor->type = cursor_type;
|
cursor->type = cursor_type;
|
||||||
cursor->ref_count = 1;
|
cursor->ref_count = 1;
|
||||||
@ -238,6 +241,8 @@ gdk_cursor_new_from_pixmap (GdkPixmap *source,
|
|||||||
private->display = display;
|
private->display = display;
|
||||||
private->xcursor = xcursor;
|
private->xcursor = xcursor;
|
||||||
private->name = NULL;
|
private->name = NULL;
|
||||||
|
private->serial = theme_serial;
|
||||||
|
|
||||||
cursor = (GdkCursor *) private;
|
cursor = (GdkCursor *) private;
|
||||||
cursor->type = GDK_CURSOR_IS_PIXMAP;
|
cursor->type = GDK_CURSOR_IS_PIXMAP;
|
||||||
cursor->ref_count = 1;
|
cursor->ref_count = 1;
|
||||||
@ -390,26 +395,20 @@ gdk_cursor_get_image (GdkCursor *cursor)
|
|||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
update_cursor (gpointer key,
|
_gdk_x11_cursor_update_theme (GdkCursor *cursor)
|
||||||
gpointer value,
|
|
||||||
gpointer data)
|
|
||||||
{
|
{
|
||||||
Display *xdisplay;
|
Display *xdisplay;
|
||||||
GdkCursor *cursor;
|
|
||||||
GdkCursorPrivate *private;
|
GdkCursorPrivate *private;
|
||||||
Cursor new_cursor = None;
|
Cursor new_cursor = None;
|
||||||
|
|
||||||
if (!GDK_IS_WINDOW (value))
|
|
||||||
return;
|
|
||||||
|
|
||||||
cursor = _gdk_x11_window_get_cursor (GDK_WINDOW (value));
|
|
||||||
|
|
||||||
if (!cursor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
private = (GdkCursorPrivate *) cursor;
|
private = (GdkCursorPrivate *) cursor;
|
||||||
xdisplay = (Display *)data;
|
xdisplay = GDK_DISPLAY_XDISPLAY (private->display);
|
||||||
|
|
||||||
|
if (private->serial == theme_serial)
|
||||||
|
return;
|
||||||
|
|
||||||
|
private->serial = theme_serial;
|
||||||
|
|
||||||
if (private->xcursor != None)
|
if (private->xcursor != None)
|
||||||
{
|
{
|
||||||
@ -426,6 +425,24 @@ update_cursor (gpointer key,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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:
|
* gdk_x11_display_set_cursor_theme:
|
||||||
* @display: a #GdkDisplay
|
* @display: a #GdkDisplay
|
||||||
@ -468,11 +485,12 @@ gdk_x11_display_set_cursor_theme (GdkDisplay *display,
|
|||||||
old_theme && strcmp (old_theme, theme) == 0)
|
old_theme && strcmp (old_theme, theme) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
theme_serial++;
|
||||||
|
|
||||||
XcursorSetTheme (xdisplay, theme);
|
XcursorSetTheme (xdisplay, theme);
|
||||||
XcursorSetDefaultSize (xdisplay, size);
|
XcursorSetDefaultSize (xdisplay, size);
|
||||||
|
|
||||||
g_hash_table_foreach (display_x11->xid_ht,
|
g_hash_table_foreach (display_x11->xid_ht, update_cursor, NULL);
|
||||||
update_cursor, xdisplay);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@ -607,6 +625,8 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
|||||||
private->display = display;
|
private->display = display;
|
||||||
private->xcursor = xcursor;
|
private->xcursor = xcursor;
|
||||||
private->name = NULL;
|
private->name = NULL;
|
||||||
|
private->serial = theme_serial;
|
||||||
|
|
||||||
cursor = (GdkCursor *) private;
|
cursor = (GdkCursor *) private;
|
||||||
cursor->type = GDK_CURSOR_IS_PIXMAP;
|
cursor->type = GDK_CURSOR_IS_PIXMAP;
|
||||||
cursor->ref_count = 1;
|
cursor->ref_count = 1;
|
||||||
@ -652,6 +672,8 @@ gdk_cursor_new_from_name (GdkDisplay *display,
|
|||||||
private->display = display;
|
private->display = display;
|
||||||
private->xcursor = xcursor;
|
private->xcursor = xcursor;
|
||||||
private->name = g_strdup (name);
|
private->name = g_strdup (name);
|
||||||
|
private->serial = theme_serial;
|
||||||
|
|
||||||
cursor = (GdkCursor *) private;
|
cursor = (GdkCursor *) private;
|
||||||
cursor->type = GDK_CURSOR_IS_PIXMAP;
|
cursor->type = GDK_CURSOR_IS_PIXMAP;
|
||||||
cursor->ref_count = 1;
|
cursor->ref_count = 1;
|
||||||
|
@ -194,8 +194,10 @@ gdk_pointer_grab (GdkWindow * window,
|
|||||||
if (!cursor)
|
if (!cursor)
|
||||||
xcursor = None;
|
xcursor = None;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_gdk_x11_cursor_update_theme (cursor);
|
||||||
xcursor = cursor_private->xcursor;
|
xcursor = cursor_private->xcursor;
|
||||||
|
}
|
||||||
|
|
||||||
xevent_mask = 0;
|
xevent_mask = 0;
|
||||||
for (i = 0; i < _gdk_nenvent_masks; i++)
|
for (i = 0; i < _gdk_nenvent_masks; i++)
|
||||||
|
@ -76,6 +76,7 @@ struct _GdkCursorPrivate
|
|||||||
Cursor xcursor;
|
Cursor xcursor;
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
guint serial;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkVisualPrivate
|
struct _GdkVisualPrivate
|
||||||
@ -171,6 +172,8 @@ void _gdk_input_init (GdkDisplay *display);
|
|||||||
PangoRenderer *_gdk_x11_renderer_get (GdkDrawable *drawable,
|
PangoRenderer *_gdk_x11_renderer_get (GdkDrawable *drawable,
|
||||||
GdkGC *gc);
|
GdkGC *gc);
|
||||||
|
|
||||||
|
void _gdk_x11_cursor_update_theme (GdkCursor *cursor);
|
||||||
|
|
||||||
extern GdkDrawableClass _gdk_x11_drawable_class;
|
extern GdkDrawableClass _gdk_x11_drawable_class;
|
||||||
extern gboolean _gdk_use_xshm;
|
extern gboolean _gdk_use_xshm;
|
||||||
extern const int _gdk_nenvent_masks;
|
extern const int _gdk_nenvent_masks;
|
||||||
|
@ -2877,7 +2877,10 @@ gdk_window_set_cursor (GdkWindow *window,
|
|||||||
if (!cursor)
|
if (!cursor)
|
||||||
xcursor = None;
|
xcursor = None;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_gdk_x11_cursor_update_theme (cursor);
|
||||||
xcursor = cursor_private->xcursor;
|
xcursor = cursor_private->xcursor;
|
||||||
|
}
|
||||||
|
|
||||||
if (!GDK_WINDOW_DESTROYED (window))
|
if (!GDK_WINDOW_DESTROYED (window))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user