After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 110670 - cursor themes manager / gcursor
cursor themes manager / gcursor
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Mouse
2.2.x
Other Linux
: Normal minor
: ---
Assigned To: Sven Herzberg
Control-Center Maintainers
: 72286 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-04-13 13:29 UTC by Toby Woodwark
Modified: 2005-07-22 12:52 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
mockup shot to have cursors part of 'theme' (74.19 KB, image/png)
2005-02-24 03:00 UTC, Derek Buranen
  Details
First draft of a patch (43.10 KB, patch)
2005-07-05 02:03 UTC, Sven Herzberg
none Details | Review
The final patch for now (31.71 KB, patch)
2005-07-05 04:08 UTC, Sven Herzberg
none Details | Review
my patch (28.64 KB, patch)
2005-07-06 16:22 UTC, Matthias Clasen
committed Details | Review
and here is how it looks (30.66 KB, image/png)
2005-07-06 16:23 UTC, Matthias Clasen
  Details

Description Toby Woodwark 2003-04-13 13:29: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.
Comment 1 Martin Norbäck 2003-05-04 20:15:21 UTC
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).
Comment 2 Matthias Warkus 2004-06-26 12:27:57 UTC
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 :)))
Comment 3 Sebastien Bacher 2005-01-13 01:32:51 UTC
*** Bug 72286 has been marked as a duplicate of this bug. ***
Comment 4 Sebastien Bacher 2005-01-13 13:22:39 UTC
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
Comment 5 Derek Buranen 2005-02-24 03:00:08 UTC
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.
Comment 6 Matthias Clasen 2005-06-18 03:37:43 UTC
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.
Comment 7 Sven Herzberg 2005-07-04 23:32:01 UTC
I'm working on this now, there'll be a patch ready for this weekend (which is
the one around July, 9th 2005).
Comment 8 Sven Herzberg 2005-07-05 02:03:28 UTC
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.
Comment 9 Sven Herzberg 2005-07-05 04:08:09 UTC
Created attachment 48656 [details] [review]
The final patch for now

This patch solves everything except:
* directory monitoring
* cursor theme installation
Comment 10 Matthias Clasen 2005-07-05 13:23:00 UTC
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);
+}
Comment 11 Sven Herzberg 2005-07-06 10:52:24 UTC
Can we get my patch into GNOME-CC before July 13th (Feature Freeze)? Changes
like yours can still be fixed afterwards I think. Opinions?
Comment 12 Matthias Clasen 2005-07-06 14:56:59 UTC
Just checking: your patch works fine without the immediate-apply sweetness of 
GTK+ 2.8, right ?
Comment 13 Sven Herzberg 2005-07-06 15:38:21 UTC
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.
Comment 14 Matthias Clasen 2005-07-06 16:21:41 UTC
Here is a variant of your patch that displays size variants inside the tree.
Comment 15 Matthias Clasen 2005-07-06 16:22:18 UTC
Created attachment 48729 [details] [review]
my patch
Comment 16 Matthias Clasen 2005-07-06 16:23:15 UTC
Created attachment 48730 [details]
and here is how it looks
Comment 17 Sebastien Bacher 2005-07-10 11:02:29 UTC
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).

Comment 18 Sebastien Bacher 2005-07-22 12:52:33 UTC
marking as fixed