GNOME Bugzilla – Bug 110670
cursor themes manager / gcursor
Last modified: 2005-07-22 12:52:33 UTC
gnome-control-center-2.2.0.1 After installing several funky cursor themes in /usr/share/icons, I was half-expecting them to show up in the gnome-mouse-properties capplet. Instead I get only the 4 default options. This could also be a bug against the theme capplet, I suppose.
I installed a cursor theme (blueglass) in .icons/ as per instructions in the theme, but it didn't work. I had to change the gconf option /desktop/gnome/peripherals/mouse/cursor_theme to the name of the theme and voila, it worked. However, just opening the mouse preferences applet resets the value to Bluecurve (I am using Red Hat 9).
I've noticed there is a nice little application called GCursor which does the mouse cursor theme selection pretty well. It seems that the switching takes place only when restarting the X server, which is already the case with the mouse capplet. However, Detlef tells me he's seen KDE switch mouse cursor themes on-the-fly. I suggest we should simply improve GCursor to the point where it can do the on-the-fly switching too, then get it to HIG standard and merge it into the mouse capplet. Just a simple matter of programming :)))
*** Bug 72286 has been marked as a duplicate of this bug. ***
I've just pinged Sven Herzberg (one of the gcursor devel) on IRC, should be possible to get gcursor merged in the control-center for 2.12, Cc: him. I'm updating the description
Created attachment 37871 [details] mockup shot to have cursors part of 'theme' I was thinking it might be more fitting to have this in the Theme? It seems to me it fits well with the feel of changing other things regarding theming. Just a thought.
FYI, gtk 2.8 will support online changes of cursor themes, it uses two xsettings for getting the information. See bug 308104 for the necessary gnome-settings-daemon patch, and see bug 308106 for a related metacity bug.
I'm working on this now, there'll be a patch ready for this weekend (which is the one around July, 9th 2005).
Created attachment 48655 [details] [review] First draft of a patch This patch includes: * xcursor theme list * some cleanup in the glade file * a scrolled window with a border aruond the tree view * a new "go to mouse" button in the theme manager (in the details dialog) * alphabetically sorted cursor theme list This patch leaves out the following features: * open the mouse properties when clicking on the new button the the theme chooser * be able to select the cursor size as part of the GUI * listen to changes within the cursor directories to be notified about newly installed themes * possibility to install cursor themes So, feel free to comment, but don't apply this one yet - I want to clean it up a bit and add some missing bits first.
Created attachment 48656 [details] [review] The final patch for now This patch solves everything except: * directory monitoring * cursor theme installation
Very nice, Sven. Two small proposals: a) Most cursor themes I looked at only come in one size. Therefore I thought it would be nicer to just have the treeview, and do away with the separate radio group to control the cursor size. It should be possible to write a function that reports all sizes in which a cursor theme is available; then you can simply put all available sizes in the treeview, a la "Bluecurve", "Large Bluecurve", "Huge Bluecurve". b) When I toyed around with a similar patch to gnome-mouse-properties, I found that some themes don't have a left_ptr, and then you end up with the standard leftptr in the treeview. My solution to that was to show left_ptr and I-beam, using code like below. Maybe it is not necessary, though. +static GdkPixbuf * +get_cursor_image (const gchar *theme, + gint size, + gint shape) +{ + XcursorImage *image; + guint8 *data, *p, tmp; + GdkPixbuf *pixbuf; + + image = XcursorShapeLoadImage (shape, theme, size); + + data = g_malloc (4 * image->width * image->height); + memcpy (data, image->pixels, 4 * image->width * image->height); + + for (p = data; p < data + (4 * image->width * image->height); p += 4) + { + tmp = p[0]; + p[0] = p[2]; + p[2] = tmp; + } + + pixbuf = gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, TRUE, + 8, image->width, image->height, + 4 * image->width, + (GdkPixbufDestroyNotify)g_free, NULL); + XcursorImageDestroy (image); + + return pixbuf; +} + +static void +add_theme (GtkListStore *store, + const gchar *name, + gint size, + const gchar *text) +{ + GtkTreeIter iter; + GdkPixbuf *pixbuf, *pixbuf1, *pixbuf2; + + pixbuf1 = get_cursor_image (name, size, 68 /* left_ptr */); + pixbuf2 = get_cursor_image (name, size, 152 /* xterm */); + + pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, + gdk_pixbuf_get_width (pixbuf1) + + gdk_pixbuf_get_width (pixbuf2), + MAX (gdk_pixbuf_get_height (pixbuf1), + gdk_pixbuf_get_height (pixbuf2))); + + gdk_pixbuf_fill (pixbuf, 0); + + gdk_pixbuf_composite (pixbuf1, pixbuf, + 0, 0, gdk_pixbuf_get_width (pixbuf1), + gdk_pixbuf_get_height (pixbuf1), + 0.0, 0.0, 1.0, 1.0, GDK_INTERP_BILINEAR, 255); + gdk_pixbuf_composite (pixbuf2, pixbuf, + gdk_pixbuf_get_width (pixbuf1), + 0, gdk_pixbuf_get_width (pixbuf2), + gdk_pixbuf_get_height (pixbuf2), + gdk_pixbuf_get_width (pixbuf1), + 0.0, 1.0, 1.0, GDK_INTERP_BILINEAR, 255); + g_object_unref (pixbuf1); + g_object_unref (pixbuf2); + + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, 0, pixbuf, 1, text, 2, name, 3, size, -1); + g_object_unref (pixbuf); +}
Can we get my patch into GNOME-CC before July 13th (Feature Freeze)? Changes like yours can still be fixed afterwards I think. Opinions?
Just checking: your patch works fine without the immediate-apply sweetness of GTK+ 2.8, right ?
Right. It fetches (both with and without xcursor) the currect keys from gconf, automatically selects the tree row with the corresponding value and updates the values correctly.
Here is a variant of your patch that displays size variants inside the tree.
Created attachment 48729 [details] [review] my patch
Created attachment 48730 [details] and here is how it looks
Thansk for your work on this guys, I've commited the current version of the patch. Matthias, any reason to drop the changes from Sven to gnome-theme-details.c/theme-properties.glade? 2005-07-10 Sebastien Bacher <seb128@debian.org> * gnome-mouse-properties.c: (cursor_size_from_widget), (event_box_button_press_event), (cursor_theme_changed), (cursor_font_changed), (cursor_changed), (gdk_pixbuf_from_xcursor_image), (populate_tree_model), (setup_dialog), (create_dialog): * gnome-mouse-properties.glade: new cursor theme manager for the mouse capplet, patch by Sven Herzberg <herzi@gnome-de.org> with changes by Matthias Clasen <mclasen@redhat.com> (Closes: #110670).
marking as fixed