OpenTTD

Tasklist

FS#2585 - [OSX] OS' mouse pointer showing

Attached to Project: OpenTTD
Opened by alex (loupdefer) - Sunday, 25 January 2009, 15:24 GMT
Last edited by Ingo von Borstel (planetmaker) - Tuesday, 21 December 2010, 16:06 GMT
Type Bug
Category Core
Status Closed
Assigned To No-one
Operating System Mac OS X
Severity Low
Priority Low
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I couldn't find anything about this bug, so I hope it is not already known.

I use OpenTTD r15260.
When i run the game in fullscreen with another app running in the background (such as ITunes), there's an annoying mouse pointer printing on the screen (in the upper-left corner of the screenshot). It is not here in window mode, and reappear if i switch to fullscreen. It appears either if i start in fullscreen, or in window mode and then switch to fullscreen.
Also, it doesn't occur when OpenTTD is the only app running (except for the Finder).

Hope someone can fix it.

Edit : I can't achieve to get it on a screenshot, neither with the OSX features, or through the game (takes a clean screenshot, without the bug). But as it doesn't appear with the stable version, i think it is related to the nightly.
This task depends upon

This task blocks these from closing
 FS#2782 - [OSX] Port hopelessly outdated 
Closed by  Ingo von Borstel (planetmaker)
Tuesday, 21 December 2010, 16:06 GMT
Reason for closing:  Implemented
Additional comments about closing:  In r21578.
Comment by Nathanael Rebsch (dihedral) - Saturday, 31 January 2009, 19:23 GMT
which version of os x is it?
Comment by Remko Bijker (Rubidium) - Saturday, 31 January 2009, 19:34 GMT
  • Field changed: Summary (Mouse pointer printing on fullscreen → [OSX] OS' mouse pointer showing)
  • Field changed: Status (New → Confirmed)
20:29 < dihedral> appart from when the game is windowed but maximised, and i move the mouse down to the hidden dock and back into the game (after the dock appeared), then i have the default osx mouse on top of the openttd mouse, and i can get rid of the osx mouse my very quickly moving the mouse back down to the dock and back up again
Comment by magu (magu) - Friday, 13 February 2009, 18:50 GMT
I second this one. Tested and confirmed on nightly build r15459 and svn r15469 on a MacBook 1st gen running OS X 10.5.6.

All screenshots from fullscreen ended up black, so i snapped a photo with my phone which you can find attached.
   photo.jpg (158.2 KiB)
Comment by m1ss1ontomars2k4 (m1ss1ontomars2k4) - Saturday, 14 November 2009, 18:49 GMT
I don't think this is an OpenTTD-specific problem, because I get this in StarCraft as well. It happens in both games in 10.5 and 10.6 for me, with both OpenTTD 0.6.3 and r18060.
Comment by Lauri Nurmi (ln) - Wednesday, 30 December 2009, 00:43 GMT
I cannot reproduce this with 10.4.11 and r18661. Can someone else?
Comment by Brad Oliver (hoserama99) - Monday, 18 January 2010, 21:07 GMT
My hunch is that this is caused by the DivX plugin, as certain versions of it have a bug where it forces the cursor visible every time QuickTime is tickled (e.g. via MoviesTask or in the OS X event loop).

Can affected users note what (if any) QuickTime plugins they have installed?
Comment by Hai Tran (hai) - Thursday, 11 February 2010, 04:07 GMT
I do NOT seem to get that problem in Windowed or Fullscreen, starting in Windowed to Fullscreen, or starting in Fullscreen. My configuration is as follows
Macbook Pro 2.66Ghz Core 2
Snow Leopard 10.6.2
XCode 3.2.1 iPhone 3.1 SDK (Open TTD compiled in command line without any additional libraries installed)
At time of test the following apps were running, iTunes 9.03, Mail, Entourage, Text edit. No quicktime plugins.
Comment by Mathew Eis (matheweis) - Sunday, 02 May 2010, 19:28 GMT
I WAS able to reproduce the bug on a very limited basis with r19750. Built with Xcode 3.2.2 under 10.6.3. The problem occurred while unning in Windowed mode, without switching between Fullscreen. The only other applications that were running were Xcode and Terminal. I do not have any DivX plugin installed, in fact no Quicktime plugins except Flip4Mac.

I was able to reproduce the bug consistently using a method similar to what Rubidium described.
Comment by Mathew Eis (matheweis) - Monday, 03 May 2010, 00:21 GMT
I took another look at this problem this afternoon, and I believe the attached patch should fully fix this problem.
Comment by Ingo von Borstel (planetmaker) - Tuesday, 04 May 2010, 22:23 GMT
The attached patch unfortunately does not change any behaviour for me.

With 32bpp blitter I have no problem with the mouse pointer with and without patch.
With 8bpp blitter an ugly false-colour print of the mouse cursor remains on the screen where it was at the time when switching to full screen mode, both with and without patch.
Making a screenshot of that is impossible as it returns a black image.

It might be related to FS #3198 http://bugs.openttd.org/task/3198 as I get in the console:
Wed May 5 00:15:40 aeolusreloaded openttd[866] <Error>: kCGErrorFailure: CGSColorProfileCreateWithColorSpace: Invalid ICC color space(0x101af7350)
Wed May 5 00:15:40 aeolusreloaded openttd[866] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Wed May 5 00:15:40 aeolusreloaded openttd[866] <Error>: kCGErrorCannotComplete: CGSSetWindowColorSpace: Cannot create color profile
Wed May 5 00:15:57 aeolusreloaded openttd[866] <Error>: kCGErrorFailure: CGSColorProfileCreateWithColorSpace: Invalid ICC color space(0x1163061c0)
Wed May 5 00:15:57 aeolusreloaded openttd[866] <Error>: kCGErrorCannotComplete: CGSSetWindowColorSpace: Cannot create color profile

Tested on r19734.
Comment by Mathew Eis (matheweis) - Wednesday, 05 May 2010, 00:56 GMT
I think this bug is about two separate issues. The patch fixes this problem:
-----
20:29 < dihedral> appart from when the game is windowed but maximised, and i move the mouse down to the hidden dock and back into the game (after the dock appeared), then i have the default osx mouse on top of the openttd mouse, and i can get rid of the osx mouse my very quickly moving the mouse back down to the dock and back up again.
-----
More simply, it can be reproduced by putting OpenTTD in windowed mode, and moving it to be bottom of the screen so the dock is over it. When moving the mouse over the dock and back to OpenTTD, the OS cursor will not be hidden as it should.

As to the 8bpp issue, as described by Brad Oliver (hoserama99) in http://bugs.openttd.org/task/3194, 8bpp mode has been deprecated or altogether removed in a majority of video drivers starting since OS X 10.5. Does this bug occur in 8bpp mode under 10.4?
Comment by Mathew Eis (matheweis) - Wednesday, 05 May 2010, 03:38 GMT
Although, it turns out the fix for the same two problems was closely related.

The legacy document found here indicates the CGDisplayHideCursor function should be used before blitting pixels to the display via CGDisplayBaseAddress: http://developer.apple.com/legacy/mac/library/technotes/tn/tn2007.html

The attached patch should fix the problem you describe, but has some problems in Windowed mode. If you can test this patch and let me know if it fixes the full-screen problem, I'll clean it up and get them both working together.

Comment by Ingo von Borstel (planetmaker) - Wednesday, 05 May 2010, 08:03 GMT
Very nice. This 2nd version of the patch fixes also the issue with the mouse cursor on full screen with 8bpp-optimized blitter :-) and there's no double cursor either.
Comment by Mathew Eis (matheweis) - Thursday, 06 May 2010, 06:00 GMT
Alright, here's the final version of the patch. This one should fix both problems with no negative side-effects in either direction. The patch should be fully compatible with OS X 10.3 or later, and it does not use any deprecated APIs.
----------------------------
Ignore this patch; labeling it "final" was a poor choice - not only is it buggy, but in terms of "age", it is in between the v2 and v3 listed here.
Comment by Ingo von Borstel (planetmaker) - Thursday, 06 May 2010, 06:57 GMT
Something more weired goes on. I cannot reproduce my successful testing of the patch yesterday.
Of neither version :S Note though, that I don't experience a double cursor which this bug report is mainly about ;-)
Comment by urdh (urdh) - Saturday, 10 July 2010, 14:01 GMT
I can't reproduce this at all. OSX 10.6.4, r20110.
Comment by Mathew Eis (matheweis) - Friday, 08 October 2010, 09:13 GMT
Please try this patch. I am about to release a test binary with this patch for users to test.

I believe this patch to offer a final solution for:
A) mouse cursor appearing/disappearing at odd times in windowed mode (particularly near the dock)

Also, as has been discussed, 8bpp mode should be formally considered deprecated and unsupported. That being said, this patch changes the cursor manipulation in full-screen mode to the fully Apple recommended method, and if this does not fix it, I have no hope that it can ever be. (I have tested this patch with blitter = 8bpp-optimized on 10.6)
So, this is I think as good a fix as we will likely get for
B) mouse flicker under full screen 8bpp mode


If the users report no problems with this patch, I would like to consider this bug closed.
Comment by Ingo von Borstel (planetmaker) - Friday, 08 October 2010, 10:44 GMT
Right, I tested v3, v2 and 'final' again. All with 8bpp-optimized and 32bpp-anim, in windowed and full screen mode.

The 'final' version does NOT fix the mouse cursor showing twice. v2 and v3 DO fix the issue.

v2 solves the problem of the double mouse cursor fine.
v3 solves the problem of the double mouse cursor, but I do get an error in the console:
Fri Oct 8 11:43:09 aeolus openttd[96163] <Error>: Not a PNG file

I meanwhile found out more how to reproduce the mouse cursor leaving a residue when switching to full screen: it only happens if both is fulfilled: using 8bpp-optimized blitter and before switching to full screen the mouse cursor is NOT moved out of the window.

v2 does NOT change the mouse cursor residue
v3 fixes with 8bpp-optimized blitter the mouse cursor leaving an ugly residue.

Given the size of patches and that we definitely don't want additional errors, 8bpp is not supported officially on mac anyway, v2 solves THIS problem.

Note that you use a wrong style for the comments. If they're in separate lines, and not describing the function as a whole, they need to be like
/* bla blah
* blubber */

It might be worth to take v3 and use it to look into the 8bpp issue without adding this error about missing PNG.

Cheers
Comment by Mathew Eis (matheweis) - Friday, 08 October 2010, 19:15 GMT
So just to clarify, v3 fixes BOTH issues, but creates a new issue re the PNG error? I think the PNG error can be fixed.
Comment by Mathew Eis (matheweis) - Thursday, 14 October 2010, 21:38 GMT
Here is a v4 of the mouse fix; should fix both problems discussed, and has no PNG error like the v3.

Can you elaborate on the comment/code style issue?
Comment by Ingo von Borstel (planetmaker) - Sunday, 24 October 2010, 10:27 GMT
v4 exercises a jumping mouse cursor in conjunction with the "show all windows" function of OSX: select the OpenTTD window and see it jump when it's restored to the original window size.
EDIT: that's actually a separate issue. Also present in current trunk
Comment by Mathew Eis (matheweis) - Tuesday, 26 October 2010, 06:46 GMT
Does that mean it looks like v4 solves both problems?
Comment by Ingo von Borstel (planetmaker) - Saturday, 06 November 2010, 22:00 GMT
v4 does not even compile:
trunk/src/video/cocoa/fullscreen.mm:300: error: ‘QZ_HideMouse’ was not declared in this scope
Comment by Mathew Eis (matheweis) - Wednesday, 10 November 2010, 01:19 GMT
What are you compiling with/against? I tested it against a clean download of 1.0.4, and built on 10.6.
Comment by Ingo von Borstel (planetmaker) - Wednesday, 10 November 2010, 09:35 GMT
Of course I compile trunk... that's where development happens: http://hg.openttd.org/openttd/trunk.hg/shortlog
Comment by Lauri Nurmi (ln) - Sunday, 16 January 2011, 17:35 GMT
Since this fix was applied in r21578, on my Mac the system cursor has been visible together with OTTD's own one in windowed mode. (In fullscreen not.)

10.4.11

Loading...