# SDL\_ShowCursor issue

**URL:** <https://discourse.libsdl.org/t/sdl-showcursor-issue/17588>\
**Category:** SDL Development\
**Created:** [August 23, 2010, 5:53pm UTC](https://discourse.libsdl.org/t/sdl-showcursor-issue/17588 "2010-08-23T17:53:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Magnotti](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/f04885/32.png) [@John\_Magnotti](https://discourse.libsdl.org/u/John_Magnotti)\
**Post date:** [August 23, 2010, 5:53pm UTC](https://discourse.libsdl.org/t/sdl-showcursor-issue/17588/1 "2010-08-23T17:53:04Z")

</div>

I’m working on a touchscreen application and wanted to hide the mouse  
cursor, but the mouse position always gets corrupted, going to 0,0. has  
anybody managed to hide the cursor but still use mouse coordinates?

I’m using full screen mode and openGL on windows.

Thanks,

John

---

<div class="post-metadata">

**Author:** ![Alex\_Barry](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/alex_barry/32/515_2.png) [@Alex\_Barry](https://discourse.libsdl.org/u/Alex_Barry)\
**Post date:** [August 23, 2010, 7:58pm UTC](https://discourse.libsdl.org/t/sdl-showcursor-issue/17588/2 "2010-08-23T19:58:41Z")

</div>

SDL’s hide mouse shouldn’t reset or change the mouse position. What version  
are you using?On Mon, Aug 23, 2010 at 1:53 PM, John Magnotti \<john.magnotti at [gmail.com](http://gmail.com)\>wrote:

> I’m working on a touchscreen application and wanted to hide the mouse  
> cursor, but the mouse position always gets corrupted, going to 0,0. has  
> anybody managed to hide the cursor but still use mouse coordinates?
> 
> I’m using full screen mode and openGL on windows.
> 
> Thanks,
> 
> John
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

---

<div class="post-metadata">

**Author:** ![John\_Magnotti](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/f04885/32.png) [@John\_Magnotti](https://discourse.libsdl.org/u/John_Magnotti)\
**Post date:** [August 23, 2010, 11:30pm UTC](https://discourse.libsdl.org/t/sdl-showcursor-issue/17588/3 "2010-08-23T23:30:56Z")

</div>

I’m using version 1.2, I don’t recall the minor version, can check later. If  
it helps, I “fixed” the problem by calling SDL\_WarpMouse(…) and sending  
the mouse to the middle of the screen each time I got a timer event. I’m not  
sure why it works, unless somehow the mouse points were getting messed up  
and clipped to 0,0 (to avoid going negative or something). It may be  
important that I’m using dual monitors, although the problem existed whether  
I extended the viewport or duplicated it. I couldn’t test with just one  
monitor b/c the setup requires that I run the software on my laptop and  
people make responses on a separate touch-screen monitor.

JohnOn Mon, Aug 23, 2010 at 2:58 PM, Alex Barry \<alex.barry at [gmail.com](http://gmail.com)\> wrote:

> SDL’s hide mouse shouldn’t reset or change the mouse position. What  
> version are you using?
> 
> On Mon, Aug 23, 2010 at 1:53 PM, John Magnotti \<@John\_Magnotti\>wrote:
> 
> > I’m working on a touchscreen application and wanted to hide the mouse  
> > cursor, but the mouse position always gets corrupted, going to 0,0. has  
> > anybody managed to hide the cursor but still use mouse coordinates?
> > 
> > I’m using full screen mode and openGL on windows.
> > 
> > Thanks,
> > 
> > John
> > 
> > * * *
> > 
> > SDL mailing list  
> > SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> > [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

---

<div class="post-metadata">

**Author:** ![Alex\_Barry](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/alex_barry/32/515_2.png) [@Alex\_Barry](https://discourse.libsdl.org/u/Alex_Barry)\
**Post date:** [August 23, 2010, 11:37pm UTC](https://discourse.libsdl.org/t/sdl-showcursor-issue/17588/4 "2010-08-23T23:37:12Z")

</div>

Well, if your mouse is not in the window, SDL will generate the coordinates  
0,0 for the mouse.  
Otherwise, I would have to say that it is likely a programming error. My  
suggestion would be to not hide the mouse and see if you get similar  
results.On Mon, Aug 23, 2010 at 7:30 PM, John Magnotti \<john.magnotti at [gmail.com](http://gmail.com)\>wrote:

> I’m using version 1.2, I don’t recall the minor version, can check later.  
> If it helps, I “fixed” the problem by calling SDL\_WarpMouse(…) and sending  
> the mouse to the middle of the screen each time I got a timer event. I’m not  
> sure why it works, unless somehow the mouse points were getting messed up  
> and clipped to 0,0 (to avoid going negative or something). It may be  
> important that I’m using dual monitors, although the problem existed whether  
> I extended the viewport or duplicated it. I couldn’t test with just one  
> monitor b/c the setup requires that I run the software on my laptop and  
> people make responses on a separate touch-screen monitor.
> 
> John
> 
> On Mon, Aug 23, 2010 at 2:58 PM, Alex Barry \<@Alex\_Barry\> wrote:
> 
> > SDL’s hide mouse shouldn’t reset or change the mouse position. What  
> > version are you using?
> > 
> > On Mon, Aug 23, 2010 at 1:53 PM, John Magnotti \<john.magnotti at [gmail.com](http://gmail.com)\>wrote:
> > 
> > > I’m working on a touchscreen application and wanted to hide the mouse  
> > > cursor, but the mouse position always gets corrupted, going to 0,0. has  
> > > anybody managed to hide the cursor but still use mouse coordinates?
> > > 
> > > I’m using full screen mode and openGL on windows.
> > > 
> > > Thanks,
> > > 
> > > John
> > > 
> > > * * *
> > > 
> > > SDL mailing list  
> > > SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> > > [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
> > 
> > * * *
> > 
> > SDL mailing list  
> > SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> > [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

---

<div class="post-metadata">

**Author:** ![John\_Magnotti](https://discourse.libsdl.org/letter_avatar_proxy/v4/letter/j/f04885/32.png) [@John\_Magnotti](https://discourse.libsdl.org/u/John_Magnotti)\
**Post date:** [August 23, 2010, 11:50pm UTC](https://discourse.libsdl.org/t/sdl-showcursor-issue/17588/5 "2010-08-23T23:50:10Z")

</div>

That is the weird part, if I don’t hide the cursor, everything works  
fine. It may well be a programming issue, but I will probably stick to  
just using WarpMouse until I have more time to dig out what is  
happening. It’s just really weird that I can do the exact same thing  
(i.e., execute the same touch responses on the touch screen) and it  
only fails if I hide the cursor. Comment out the call and it works as  
intended.

Thanks for your help, though.

JohnOn Mon, Aug 23, 2010 at 6:37 PM, Alex Barry \<alex.barry at [gmail.com](http://gmail.com)\> wrote:

> Well, if your mouse is not in the window, SDL will generate the coordinates  
> 0,0 for the mouse.  
> Otherwise, I would have to say that it is likely a programming error.? My  
> suggestion would be to not hide the mouse and see if you get similar  
> results.
> 
> On Mon, Aug 23, 2010 at 7:30 PM, John Magnotti \<@John\_Magnotti\> wrote:
> 
> > I’m using version 1.2, I don’t recall the minor version, can check later.  
> > If it helps, I “fixed” the problem by calling SDL\_WarpMouse(…) and sending  
> > the mouse to the middle of the screen each time I got a timer event. I’m not  
> > sure why it works, unless somehow the mouse points were getting messed up  
> > and clipped to 0,0 (to avoid going negative or something). It may be  
> > important that I’m using dual monitors, although the problem existed whether  
> > I extended the viewport or duplicated it. I couldn’t test with just one  
> > monitor b/c the setup requires that I run the software on my laptop and  
> > people make responses on a separate touch-screen monitor.
> > 
> > John
> > 
> > On Mon, Aug 23, 2010 at 2:58 PM, Alex Barry \<alex.barry at [gmail.com](http://gmail.com)\> wrote:
> > 
> > > SDL’s hide mouse shouldn’t reset or change the mouse position.? What  
> > > version are you using?
> > > 
> > > On Mon, Aug 23, 2010 at 1:53 PM, John Magnotti \<@John\_Magnotti\> wrote:
> > > 
> > > > I’m working on a touchscreen application and wanted to hide the mouse  
> > > > cursor, but the mouse position always gets corrupted, going to 0,0. has  
> > > > anybody managed to hide the cursor but still use mouse coordinates?  
> > > > I’m using full screen mode and openGL on windows.  
> > > > Thanks,  
> > > > John
> > > > 
> > > > * * *
> > > > 
> > > > SDL mailing list  
> > > > SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> > > > [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
> > > 
> > > * * *
> > > 
> > > SDL mailing list  
> > > SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> > > [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
> > 
> > * * *
> > 
> > SDL mailing list  
> > SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> > [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
