Author Topic: Relative mouse movement repaired (I hope)  (Read 4065 times)

0 Members and 1 Guest are viewing this topic.

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Relative mouse movement repaired (I hope)
« on: January 11, 2021, 10:08:05 am »
The _MOUSEMOVEMENTX and _MOUSEMOVEMENTY commands should now function correctly in both 32 and 64 bit windows, as of development build 5a300c7.

On windows the mouse will be read even when it is outside the window (which I'm led to believe is these commands' major advantage), Linux unfortunately will only provide data when the mouse is over the window.
« Last Edit: January 11, 2021, 10:09:07 am by luke »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Relative mouse movement repaired (I hope)
« Reply #1 on: January 11, 2021, 10:11:57 am »
Oh so the _MOUSEMOVEMENT keeps reporting relative movements outside the QB64 screen.

I never knew what I've been missing. ;-))
« Last Edit: January 11, 2021, 10:13:26 am by bplus »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Relative mouse movement repaired (I hope)
« Reply #2 on: January 11, 2021, 11:15:31 am »
Hi. Great news. Could you please tell me, just for my information, where func__mousemovementx is located? I found a call to it in qbx.cpp, but I didn't find this function itself ... Thank you.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Relative mouse movement repaired (I hope)
« Reply #3 on: January 11, 2021, 12:04:20 pm »
@luke I downloaded the above version from Github, compiled a new IDE from /source/qb64.bas and tried _Mousemovement and I have to confirm that it really works properly now (it automatically compiled into a 64-bit version). So it works in a 64-bit IDE. I assume that if I wanted to compile an EXE into 32 bits, I would have to create a virtual 32-bit operating system (or restart my computer to 32 OS, if I had two systems on disk) and then it would compile into a 32-bit version. It is so?

Great work, Luke!

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Relative mouse movement repaired (I hope)
« Reply #4 on: January 11, 2021, 12:33:12 pm »
Downloaded and ran my test program. Worked fine.

Offline luke

  • Administrator
  • Seasoned Forum Regular
  • Posts: 324
    • View Profile
Re: Relative mouse movement repaired (I hope)
« Reply #5 on: January 12, 2021, 02:17:24 am »
Hi. Great news. Could you please tell me, just for my information, where func__mousemovementx is located? I found a call to it in qbx.cpp, but I didn't find this function itself ... Thank you.

func__mousemovementx is defined at libqb.cpp:18087, but all it does is read a value from a message queue. You're likely more interested in where the message is generated, in which case I refer you to this commit: https://github.com/QB64Team/qb64/commit/5a300c7c7a7ffcc515edc5e8f9b9ceaa6ffe4ae8

The change in gui.cpp is in a handler for a freeglut mouse motion callback; this is used on Linux & Mac, but only works when the mouse is in the window. The change in freeglut_main.c is a Windows-specific handler for the WM_INPUT message, which allows tracking the mouse no matter where it is on screen.

@lukeI assume that if I wanted to compile an EXE into 32 bits, I would have to create a virtual 32-bit operating system (or restart my computer to 32 OS, if I had two systems on disk) and then it would compile into a 32-bit version. It is so?
If you look at the contents of the repository before running the setup script, you'll see both an internal\c\mingw32 and internal\c\mingw64 folder, which are 32 and 64 bit versions of the C++ compiler. The setup program renames the appropriate folder to internal\c\c_compiler, but you could manually rename mingw32 to c_compiler and setup_win.bat will produce a 32 bit QB64 that builds 32 bit programs.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: Relative mouse movement repaired (I hope)
« Reply #6 on: January 12, 2021, 06:53:39 am »
I am very happy with the fix, thank you for the fix on my behalf!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Relative mouse movement repaired (I hope)
« Reply #7 on: January 12, 2021, 12:43:34 pm »
@luke Thank you for the detailed answer. I will look at it. :)