Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Window/fullscreen mouse pointer position discrepancy  (Read 3163 times)

0 Members and 2 Guests are viewing this topic.

fruitMaster

  • Newbie
  • *
  • Posts: 7
    • View Profile
Window/fullscreen mouse pointer position discrepancy
« on: August 23, 2011, 01:44:17 pm »
Hi there,

I've got a little problem here. I'm doing an in-game editor, and I've found that when the window has a titlebar, the mouse position is given relative to the top of the titlebar, while when it doesn't have one it's given relative to the window origin.

Biggest problem is having to check wether you are in fullscreen mode or not, to compensate for the titlebar or lack of it (and having to offset the mouse position an ad-hoc and non-portable distance).

Is this a known problem, and are there solutions around it?

Thanks a lot in advance

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Window/fullscreen mouse pointer position discrepancy
« Reply #1 on: August 23, 2011, 02:08:54 pm »
This is not supposed to happen.

-> OS and version of SFML, please ;)
Laurent Gomila - SFML developer

fruitMaster

  • Newbie
  • *
  • Posts: 7
    • View Profile
Window/fullscreen mouse pointer position discrepancy
« Reply #2 on: August 23, 2011, 02:32:33 pm »
OS is Mac OS X 10.6.6.

As for the SFML version, it's a snapshot of 2.0 taken about six months ago. I'll try to update it to the latest snapshot and see if it's fixed...

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Window/fullscreen mouse pointer position discrepancy
« Reply #3 on: August 23, 2011, 03:02:31 pm »
Quote from: "fruitMaster"
it's a snapshot of 2.0 taken about six months ago.
SFML 2 is still in its development phase so you should always check if the issue has already been issued and solved.
SFML / OS X developer

fruitMaster

  • Newbie
  • *
  • Posts: 7
    • View Profile
Window/fullscreen mouse pointer position discrepancy
« Reply #4 on: August 23, 2011, 07:31:48 pm »
It took a while, but I managed to update to the latest snapshot. I confirm the bug is gone in this version ;)

Btw, had to add several frameworks to get SFML compiling: IOKit, AGL and Carbon. The first two I understand, but I thought Carbon was deprecated and not really needed anymore to do anything on MacOS...?

fruitMaster

  • Newbie
  • *
  • Posts: 7
    • View Profile
Window/fullscreen mouse pointer position discrepancy
« Reply #5 on: August 23, 2011, 07:53:18 pm »
Ok, found another problem, now using the latest snapshot on MacOS 10.6.6

When setting window.ShowMouseCursor(false), the mouse is hidden even if it gets out of the window, but if you make it show by changing the focus to another app, then it doesn't autohide again when entering the SFML window.

Is this expected and should I handle this manually checking the mouseleave/enter events?

Edit: just checked on windows, and the same code displays the normal behaviour: mouse disappears when entering SFML window, and reappears when getting out of it, so I'm guessing it's an SFML bug...

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Window/fullscreen mouse pointer position discrepancy
« Reply #6 on: August 24, 2011, 03:22:15 pm »
Quote from: "fruitMaster"
Btw, had to add several frameworks to get SFML compiling: IOKit, AGL and Carbon.
you added them where ? How did you compile SFML ? If you follow the tutorial about CMake everything should be fine.

Quote from: "fruitMaster"
The first two I understand, but I thought Carbon was deprecated and not really needed anymore to do anything on MacOS...?
It's more complicated than that because Carbon is not only used for User Interface but also for input (like keyboard stuff for example) among other things.

Quote from: "fruitMaster"
When setting window.ShowMouseCursor(false), the mouse is hidden even if it gets out of the window, but if you make it show by changing the focus to another app, then it doesn't autohide again when entering the SFML window.
Ok, I'll look into this issue next week.
SFML / OS X developer

fruitMaster

  • Newbie
  • *
  • Posts: 7
    • View Profile
Window/fullscreen mouse pointer position discrepancy
« Reply #7 on: August 24, 2011, 03:53:18 pm »
Quote
you added them where ? How did you compile SFML ? If you follow the tutorial about CMake everything should be fine.


Yes, well, I generally prefer to work with full source code, so I added the SFML code to my project. It makes it easier to do builds for several combinations of windows/macos/linux, 32/64 bits, debugging on/off, etcetera

It works perfectly fine as long as you add the correct frameworks and libraries.

As for the OSX cursor problem, here's a quick patch I coded that appears to solve the issue.
http://pastebin.com/YreF20zC

 

anything