Bug 114490 - gtk2 not using correct cursors
Summary: gtk2 not using correct cursors
Status: RESOLVED FIXED
: 115122 115211 120946 127751 (view as bug list)
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: GNOME (show other bugs)
Version: Beta 4
Hardware: Other All
: P5 - None : Major
Target Milestone: ---
Assignee: Federico Mena Quintero
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-31 17:34 UTC by Kirk Coombs
Modified: 2005-11-09 07:34 UTC (History)
12 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
gtk+-default-cursor.patch (308 bytes, patch)
2005-09-09 13:56 UTC, Stanislav Brabec
Details | Diff
XcursorSetTheme-default-cursor.patch (406 bytes, patch)
2005-09-12 12:54 UTC, Stanislav Brabec
Details | Diff
XcursorSetTheme-default-cursor.patch (410 bytes, patch)
2005-09-12 13:37 UTC, Stanislav Brabec
Details | Diff
xorg-x11-114490-xcursor-reset-theme-name.diff (2.29 KB, patch)
2005-09-12 16:02 UTC, Federico Mena Quintero
Details | Diff
Wrong cursor shown in unthemes QT app (636 bytes, image/png)
2005-09-14 13:32 UTC, Dennis Conrad
Details
Cursor I get when moving the cursor over area shown in attachment 49901 (863 bytes, image/gif)
2005-09-14 16:43 UTC, Dennis Conrad
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kirk Coombs 2005-08-31 17:34:10 UTC
As of Beta 4, in both KDE and GNOME firefox is using the ugly cursors you would
expect in FVWM...the little-side-pointing-hand theme.
Comment 1 Wolfgang Rosenauer 2005-08-31 17:51:37 UTC
I can't follow how cursor themes can be influenced by Firefox. So moving to
gnome-maintainers for checking.
Comment 2 Wolfgang Rosenauer 2005-09-01 08:50:59 UTC
I can confirm this but within Firefox itself nothing changed IMHO.
So this might be a GTK "feature"?

Could someone please comment on this?
Comment 3 Silviu Marin-Caea 2005-09-01 18:47:55 UTC
Only over the Firefox window the cursor is the ugly default X-Window theme (the
black cursor).  I tried running Gimp (as GTK application) and it does not have
that problem.
Comment 4 Wolfgang Rosenauer 2005-09-01 19:01:56 UTC
You're right. But the very same package compiled on 9.3 running on 9.3 doesn't
show this behaviour. So nothing Firefox code specific is involved here IMHO.
Comment 5 JP Rosevear 2005-09-02 20:09:30 UTC
Could be related to the yast2 changes for bug 74309.

Adding kde-maintainers too since it occurs there as well.
Comment 6 Robert O'Callahan 2005-09-05 00:19:47 UTC
Mozilla just uses standard GTK calls to set the cursor: gdk_window_set_cursor. I
have no idea what could cause that to not use the theme. Maybe a GTK person can
give us a clue...
Comment 7 Robert O'Callahan 2005-09-05 00:22:27 UTC
the cursor passed to gdk_window_set_cursor is obtained by gdk_cursor_new.
Comment 8 Robert O'Callahan 2005-09-05 03:40:13 UTC
I used gdb to verify that XCreateFontCursor is being called with type
XC_sb_h_double_arrow. That ends up bypassing the Xcursor theme code ecause
Xcursor thinks there is no cursor theme.

So why's that? Initially Xcursor has the right theme ("crystalwhite" on this
box). It gets that by calling XGetDefault(dpy, "Xcursor", "theme_core"). But
later Mozilla calls gtk_settings_get_default(). This call creates a new settings
object, calls gtk_rc_reparse_all_for_settings which I assume parses various
gtkrc's, and then calls settings_update_cursor_theme.
settings_update_cursor_theme tries to get the theme name by looking up the
gtk-cursor-theme-name in the settings, but it's not there, so it thinks there is
no theme *and sets it to NULL in Xcursor*. Net effect: calling
gtk_settings_get_default() has destroyed the Xcursor theme setting so from then
on all cursors are set to the default X cursors.

So I guess there are two problems:
1) GTK and Xcursor should agree on how the cursor theme name is configured.
2) In the interim gtk-cursor-theme-name should be set in some gtkrc. I'm not
sure how that works.
Comment 9 Robert O'Callahan 2005-09-05 03:48:59 UTC
I tried to implement option 2 but I can't figure out how to get the setting to
apply.
Comment 10 Robert O'Callahan 2005-09-05 03:56:23 UTC
The GTK settings code that reads the cursor theme setting and uses it to
override the Xcursor theme setting was added in mid-June, so that's why this bug
has appeared.
Comment 11 Robert O'Callahan 2005-09-05 04:12:27 UTC
I'm not sure why other GNOME apps still work. Maybe they use
gdk_cursor_new_from_name, GIMP seems to set the Xcursor theme to NULL too, but
somehow it's not affected. Maybe it's already acquired all the cursors it needs
by the time it overrides the Xcursor theme.
Comment 12 Robert O'Callahan 2005-09-05 04:23:56 UTC
Anyway, I'm a bit out of my depth here. Someone out there must know how to set
GTK settings properly and should be able to fix this. I added

gtk-cursor-theme-name = "crystalwhite"

to a fresh ~/.gtkrc-2.0 and it didn't work.
Comment 13 Wolfgang Rosenauer 2005-09-05 07:12:46 UTC
hmm, the gtk 2.8.3 release notes read:
* Fix problems with the handling of initial settings
  for font options and cursor themes [Frederic Crozat, 
  Joe Markus Clarke, Owen Taylor, Kjartan Maraas]
Comment 14 Wolfgang Rosenauer 2005-09-05 08:44:47 UTC
If the theme is chosen within the gnome-control-center it works.
So somehow GNOME/GTK doesn't inherit the X theme correctly IMHO. 
Another thing is that gtkrc-2.0 seems to be ignored.
Raise severity
Comment 15 Wolfgang Rosenauer 2005-09-05 09:14:39 UTC
Maybe we should make sure that gtk-cursor-theme is configured to some theme for
the release.

For the future it would be nice to have some GTK guy tell us which component is
doing wrong. GTK or Firefox. As other GTK applications don't have such a problem
it might be possible that Firefox doesn't use the "recommended" way for cursors.
Comment 16 Federico Mena Quintero 2005-09-05 13:29:59 UTC
Settings in your ~/.gtkrc-2.0 usually get overriden by the settings from
gnome-settings-daemon.

Anyway, the right solution is to figure out what is different in Firefox's
behavior.  Could someone trace GTK+'s initialization of cursors in both Firefox
and a non-problematic app?  See e.g. these changes:

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.
Comment 17 Wolfgang Rosenauer 2005-09-07 18:58:23 UTC
*** Bug 115211 has been marked as a duplicate of this bug. ***
Comment 18 Robert O'Callahan 2005-09-08 04:39:58 UTC
Aargh, I dropped off the CC list somehow.

Federico, see comment #8. It's pretty simple. Mozilla calls
gtk_settings_get_default(). GTK finds no setting for "gtk-cursor-theme-name", so
it tells Xcursor to use no theme, hence the bug.

I don't know why other GTK apps aren't affected but I think it's pretty clear
this is either a GTK bug or a bug in our configuration that we haven't set
gtk-cursor-theme-name anywhere.
Comment 19 Robert O'Callahan 2005-09-08 04:40:40 UTC
Should I email Clasen and ask him how it's supposed to work?
Comment 20 Wolfgang Rosenauer 2005-09-08 04:41:33 UTC
I see at least two issues here:
1. my gtkrc-2.0 setting is ignored even if gnome-settings-daemon is not running
2. if there is no setting for gtk-cursor-theme-name anywhere GTK shouldn't
   overwrite the Xcursors

Andreas, it would be nice to have this fixed but we need help from GTK group here.
Comment 21 Stanislav Brabec 2005-09-08 08:44:51 UTC
Looks like a gtk, problem. Trying pure gtk application gtk-demo (gtk2-devel),
with gnome-settings-daemon cursors are OK. Without it, default cursor is OK, but
other cursors are bad, too. In firefox, the default cursor is affected, because
it uses gtk function to set it to the default.
Comment 22 JP Rosevear 2005-09-08 11:58:11 UTC
*** Bug 115122 has been marked as a duplicate of this bug. ***
Comment 23 Federico Mena Quintero 2005-09-08 15:00:08 UTC
Wait, does Firefox explicitly call gtk_settings_get_default()?  That's not
right.  It should be calling gtk_settings_get_for_screen().

I don't have beta4 yet, so I can't test this on my box.  Could you please
confirm what happens in these scenarios:

- GNOME session, run Firefox and a normal GTK+ app
- KDE session, run Firefox and a normal GTK+ app
- plain X server (with fvwm?), run Firefox and a normal GTK+ app

What I want to know is what happens if gnome-settings-daemon is not running. 
I'm not sure if a KDE session will set all the cursor-related XSETTINGS.
Comment 24 Stanislav Brabec 2005-09-08 15:03:27 UTC
But it does not explain, why gtk-demo has bad cursors, too.
Comment 25 Wolfgang Rosenauer 2005-09-08 15:12:20 UTC
Yes, it calls gtk_settings_get_default()
see: http://lxr.mozilla.org/aviary101branch/search?string=gtk_settings_get_default
(no match for gtk_settings_get_for_screen)

I can't make your tests at the moment since I have only VNC access to a 10.0rc1
here.
But I'm pretty sure that someone else from the audience can give you the results.
Comment 26 Federico Mena Quintero 2005-09-08 15:35:49 UTC
See also https://bugs.freedesktop.org/show_bug.cgi?id=4244

It talks about the possibility of making XcursorSetTheme(dpy, NULL) set the
default theme, rather than no theme.
Comment 27 Federico Mena Quintero 2005-09-08 16:42:51 UTC
I'll take on this.
Comment 28 Robert O'Callahan 2005-09-08 21:12:33 UTC
(In reply to comment #23)
> Wait, does Firefox explicitly call gtk_settings_get_default()?  That's not
> right.  It should be calling gtk_settings_get_for_screen().

gtk_settings_get_default() just calls gtk_settings_get_for_screen(), passing
gdk_screen_get_default(). And that's exactly what Firefox would do if we called
gtk_settings_get_for_screen(). Anyway gtk_settings_get_for_screen() is what
triggers this bug so this is a separate issue.

> - KDE session, run Firefox and a normal GTK+ app

Fails in both (Firefox and GIMP). I don't have a full beta4 install so I can't
test the others yet. It's tricky to test because cursors acquired before the
first gtk_settings_get_for_screen() call are correct ... so as Stanislav said,
in lots of GTK apps, at least the default cursor looks right, and maybe others
too if the app acquires them at startup. That's why I thought other GTK apps
were working. But if you start GIMP, create a document, and choose the "move
layers and selections" tool, you get the default X left-pointing hand cursor.
Comment 29 Stanislav Brabec 2005-09-09 13:56:22 UTC
Created attachment 49406 [details]
gtk+-default-cursor.patch

Patch for gtk2. This patch fixes gtk-demo, but not firefox.

I am not sure, whether it is correct (e. g. if it works, if you want to reset
theme.

Alternative could be:

if (!theme)
  theme = g_getenv ("XCURSOR_THEME");
Comment 30 Federico Mena Quintero 2005-09-10 01:40:43 UTC
About comment #29 - I'd rather fix it in Xcursor itself, as per comment #26, if
it turns out that that's the real bug.

I'm downloading the xorg-x11 sources to see just how Xcursor operates.  I have
no idea what its defaults are, or if the defaults are even configurable. 
Doesn't the X server always start up with the default/ugly cursors, and you
always need to do XcursorSetTheme("foo") to load a pretty set of cursors?
Comment 31 Federico Mena Quintero 2005-09-10 01:50:53 UTC
Looks like you can set a default cursor theme by sticking this in your
/etc/X11/Xresources:

  Xcursor.theme: theme_name
  Xcursor.size: some_size

So probably the XcursorSetTheme(dpy, NULL) is about resetting to *that*, instead
of to the ugly cursors.
Comment 32 Robert O'Callahan 2005-09-11 01:51:58 UTC
FWIW I agree.
Comment 33 Wolfgang Rosenauer 2005-09-11 07:29:10 UTC
Stefan, does this make sense? Can we populate /etc/X11/Xresources with the
cursor theme in /etc/sysconfig/windowmanager?
Comment 34 Stefan Dirsch 2005-09-11 07:56:35 UTC
Looks like the wrong approach to me. AFAIK the according XCURSOR environment 
variables should be set and used instead. 
Comment 35 Wolfgang Rosenauer 2005-09-11 15:09:53 UTC
Who can/will change this?
Comment 36 Stefan Dirsch 2005-09-11 15:13:44 UTC
Probably the GNOME/KDE session startup.
Comment 37 Robert O'Callahan 2005-09-12 01:06:31 UTC
See comment #8. Xcursor *is* getting the default theme correctly from X
resources. That code just needs to be used again to re-get the default theme
when XcursorSetTheme(NULL) is called.
Comment 38 Stanislav Brabec 2005-09-12 12:54:00 UTC
Created attachment 49604 [details]
XcursorSetTheme-default-cursor.patch

Proposed patch for xorg-x11. Not yet tested. I will report result later.
Comment 39 Stanislav Brabec 2005-09-12 13:37:07 UTC
Created attachment 49612 [details]
XcursorSetTheme-default-cursor.patch

Typo fix.
Comment 40 Federico Mena Quintero 2005-09-12 14:43:08 UTC
I'm using a slightly different patch; will attach it in a second.
Comment 41 Stanislav Brabec 2005-09-12 15:21:21 UTC
Package rebuilt and tested: My XcursorSetTheme-default-cursor.patch fixes
gtk-demo cursors, but firefox still uses default cursor.
Comment 42 Jason Kasper 2005-09-12 15:41:49 UTC
FWIW, gaim and xchat also suffer from this problem.  And it's not all cursors 
that are messed up.  What I'm seeing is that only the text cursor and the 
hyperlink cursor are messed up--defaulting to the ugly core cursors.
Comment 43 Federico Mena Quintero 2005-09-12 16:02:43 UTC
Created attachment 49650 [details]
xorg-x11-114490-xcursor-reset-theme-name.diff

This patch seems to give me correct cursors in all applications.  I've
submitted it upstream to see what the maintainer says.
Comment 44 Federico Mena Quintero 2005-09-12 16:20:56 UTC
To summarize:

1. The XCURSOR_* environment variables take precedence over the Xcursor.*
xresources.

2. We only set the env. vars.; that's correct behavior.

3. The patch makes the Xcursor library fall back to the configuration values
(env. vars. or Xresources) if you call XcursorSetTheme(dpy, NULL).
Comment 45 Andreas Jaeger 2005-09-12 16:36:38 UTC
Egbert, Matthias, Stefan, is the patch in #43 correct?
Comment 46 Matthias Hopf 2005-09-12 16:55:50 UTC
I'm not completely fluently in libXcursor, but the patch seems to be good.

It changes a structure size in xcursorint.h, but as this is internal it should
change the ABI. Correct?

Some things are a bit cumbersome (malloc + strcpy instead of strdup), but so is
the original code, so this perfectly matches the original code.

Stefan, please apply and create a package for testing.
Comment 47 Matthias Hopf 2005-09-12 16:56:37 UTC
Read that: it *shouldn't* change the ABI...
Comment 48 Federico Mena Quintero 2005-09-12 17:48:12 UTC
KeithP reviewed my patch and committed it upstream, so perhaps it's good for our
package as well :)
Comment 49 Stefan Dirsch 2005-09-12 18:22:48 UTC
My feelings are somewhat mixed. I would like to hear a comment by Egbert first,
before I want to submit a package which applies this patch. A build for testing
is currently running.
Comment 50 Stefan Dirsch 2005-09-12 19:40:14 UTC
You can find packages for testing here:  
  
~sndirsch/pkgs: 
xorg-x11-libs-6.8.2-99.i586.rpm   
xorg-x11-libs-6.8.2-99.x86_64.rpm 
xorg-x11-libs-6.8.2-99.ppc.rpm 
 
Comment 53 Egbert Eich 2005-09-13 08:58:44 UTC
The patch looks OK. It's rather trivial.
Comment 54 Stefan Dirsch 2005-09-13 09:12:36 UTC
But I wonder why Keith didn't want to submit it to X.Org CVS (yet).

"I've committed Federico's patch to xlibs/Xcursor, but not to xorg/lib/Xcursor.
 For that, I believe we need to push it through the release queue."

JFYI, xlibs tree isn't used by anyone ...

Anyway, we need test results first!
Comment 55 Dennis Conrad 2005-09-13 09:19:53 UTC
FYI: Works in RC2.
Comment 56 Stefan Dirsch 2005-09-13 09:26:32 UTC
Interesting. The X11 patch isn't applied for RC2. So this means we don't need it
at all?
Comment 57 Dennis Conrad 2005-09-13 09:34:33 UTC
Okay, this is embarrassing, but my mistake:

It does *not* work in RC2.  Update just didn't touch the patched package and I
didn't see it at once because the version and build number is the same.

Sorry for the confusion!
Comment 58 Stefan Dirsch 2005-09-13 09:52:16 UTC
Ok. Did you try my new patched packages mentioned in comment #50?
Comment 59 Dennis Conrad 2005-09-13 10:14:09 UTC
Yes, I did.  With the patches packages it works for me.  Minor glitch with QT
windows when moving the cursur over the "dashed" resize area.  As soon as you
reach the window border or go back into the window itself, the cursor works again.

Comment 60 Federico Mena Quintero 2005-09-13 16:46:00 UTC
Dennis: what's that glitch in Qt windows?  Is that on a KDE or GNOME session?
Comment 61 Dennis Conrad 2005-09-14 13:32:16 UTC
Frederico,

I can't take a screenshot of the cursor, but a screenshot of the affected area
is attached.  It only seems to happen with unthemed QT applications, so I'n not
sure whom to blame in this case :-)
Comment 62 Dennis Conrad 2005-09-14 13:32:50 UTC
Created attachment 49901 [details]
Wrong cursor shown in unthemes QT app
Comment 63 Federico Mena Quintero 2005-09-14 15:39:07 UTC
Dennis: is that a Qt app on a KDE or a GNOME session?  Which cursor do you get
in the drag area?
Comment 64 Dennis Conrad 2005-09-14 16:42:26 UTC
Sorry, it's a GNOME session.  I get the standard X cursor looking like the one 
I will attach in a second.
Comment 65 Dennis Conrad 2005-09-14 16:43:31 UTC
Created attachment 49922 [details]
Cursor I get when moving the cursor over area shown in attachment 49901 [details]
Comment 66 Stefan Dirsch 2005-09-27 13:03:48 UTC
New xorg-x11 package with the patch applied has now been submitted for 10.0 and
STABLE. Reassigning to Frederico for further investigation.
Comment 67 Stefan Dirsch 2005-09-30 12:35:22 UTC
Andreas, could you create a SWAMP entry for this?

Description: 
- fixes cursor theme in Firefox (#114490)
Comment 68 Andreas Jaeger 2005-09-30 14:02:12 UTC
Maintenance-Tracker-2489
Comment 69 Wolfgang Rosenauer 2005-09-30 14:08:00 UTC
Prior to this update my whole GNOME session and GTK apps were using the
incorrect cursors. Not only Firefox.
Comment 70 Wolfgang Rosenauer 2005-10-07 09:14:07 UTC
*** Bug 120946 has been marked as a duplicate of this bug. ***
Comment 71 Jozef Sakalos 2005-10-08 09:19:58 UTC
I just installed stable sl10.0-gm and I found this has not been fixed. 
 
Is there any workaround/patch? 
Comment 72 Stefan Dirsch 2005-10-08 09:56:05 UTC
An update via YOU will be available soon (xorg-x11-libs). 
Comment 73 Anja Stock 2005-10-10 14:14:07 UTC
released
Comment 74 Hans Meier 2005-10-21 06:09:12 UTC
Not everything's fixed with that patch though - when placing the mouse cursor over a flash animation within the browser, there's still the old X11 hand.
Comment 75 JP Rosevear 2005-11-04 20:21:32 UTC
*** Bug 127751 has been marked as a duplicate of this bug. ***
Comment 76 Hans Meier 2005-11-07 07:23:59 UTC
Since the bug is not 100% fixed (old cursor theme's still present when you hover over flash animations), I'm reopening the bug.
Comment 77 Stephan Kulow 2005-11-07 10:44:11 UTC
the flash cursor is not the "old X11 hand", it's a custom cursor of flash. And as you might know it's binary only.
Comment 78 Hans Meier 2005-11-09 07:34:22 UTC
You're right, I've just had a look at it in Suse 9.3.