Mouse relative mode

Sorry if I ask something wrong.

I believe that mouse relative mode is disabled (at least in windows,
SDL_SendMouseMotion is always called with a 0 as relative flag and the data from
the raw input are simply discared)
Am I right. And if so, is there a plane to activate it.
In this case, can I help to ? Or are they some tricky points I might not be
aware of that prevent from a simple fix ?

Cl?ment

2009/1/20 Cl?ment Forest <Clement.Forest at digital-trainers.com>

Sorry if I ask something wrong.

I believe that mouse relative mode is disabled (at least in windows,
SDL_SendMouseMotion is always called with a 0 as relative flag and the data
from
the raw input are simply discared)
Am I right. And if so, is there a plane to activate it.
In this case, can I help to ? Or are they some tricky points I might not be
aware of that prevent from a simple fix ?

Cl?ment


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

In version 1.3. You have to use SDL_SetRelativeMouseMode(int index, SDL_bool
enabled) to change the mode the mouse is working in. All pointing devices
are assumed to be working in absolute coordinates cause it’s a major help
when someone has multiple pionting devices and uses them all for one cursor.

Best wishes–
– Szymon “Wilku” Wilczek
"The dreamer dies, but never dies the dream, Though Death shall call the
whirlwind to his aid, Enlist men’s passions, trick their hearts with hate,
Still shall the Vision live! Say nevermore, That dreams are fragile things"

Szymon Wilczek <kazeuser gmail.com> writes:

In version 1.3. You have to use SDL_SetRelativeMouseMode(int index, SDL_bool
enabled) to change the mode the mouse is working in. All pointing devices are
assumed to be working in absolute coordinates cause it’s a major help when
someone has multiple pionting devices and uses them all for one cursor.Best
wishes-- – Szymon “Wilku” Wilczek"The dreamer dies, but never dies the dream,
Though Death shall call the whirlwind to his aid, Enlist men’s passions, trick
their hearts with hate, Still shall the Vision live! Say nevermore, That dreams
are fragile things"

OK,

Thanks for your answer.

I plane to use an extra mouse as a tracking device and my point was to retrieve
the relative movement sent by the mouse driver.
I am using SDL embedded into a Gtk application under windows, and while I do set
the relative mode for my mouse, I can not benefit from the hiding of the cursor
(at least I didn’t find how).
I was pointing out that the way the driver mouse events are processed discards
the exact value of the mouse relative movements. I thought that, when the mouse
is in relative mode, SDL_SendMouseEvent should be called with the relative
argument set to 1 but it appears that it is not the case (at least in windows)
and that that relative movement information if recomputed using the
GetMousePosition function that, in my case, lead to incorrect results when the
cursor touches the screen border.
Therefore my question is:
Why isn’t the SDL_SendMouseEvent function called with the correct relative value
when the corresponding mouse is flagged as running in relative mode ?

Thanks again,

Cl?ment

2009/1/21 Cl?ment Forest <Clement.Forest at digital-trainers.com>

Szymon Wilczek <kazeuser gmail.com> writes:

In version 1.3. You have to use SDL_SetRelativeMouseMode(int index,
SDL_bool
enabled) to change the mode the mouse is working in. All pointing devices
are
assumed to be working in absolute coordinates cause it’s a major help when
someone has multiple pionting devices and uses them all for one cursor.Best
wishes-- – Szymon “Wilku” Wilczek"The dreamer dies, but never dies the
dream,
Though Death shall call the whirlwind to his aid, Enlist men’s passions,
trick
their hearts with hate, Still shall the Vision live! Say nevermore, That
dreams
are fragile things"

OK,

Thanks for your answer.

I plane to use an extra mouse as a tracking device and my point was to
retrieve
the relative movement sent by the mouse driver.
I am using SDL embedded into a Gtk application under windows, and while I
do set
the relative mode for my mouse, I can not benefit from the hiding of the
cursor
(at least I didn’t find how).
I was pointing out that the way the driver mouse events are processed
discards
the exact value of the mouse relative movements. I thought that, when the
mouse
is in relative mode, SDL_SendMouseEvent should be called with the relative
argument set to 1 but it appears that it is not the case (at least in
windows)
and that that relative movement information if recomputed using the
GetMousePosition function that, in my case, lead to incorrect results when
the
cursor touches the screen border.
Therefore my question is:
Why isn’t the SDL_SendMouseEvent function called with the correct relative
value
when the corresponding mouse is flagged as running in relative mode ?

Thanks again,

Cl?ment


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Well actuallIy I remember that when I analyzed the API the parameter wasn’t
used (I may be wrong, cause I don’t remember clearly, I’ll check it out
later). And besides it is possible to check the mode the mouse is working in
SDL_Mouse, so after the mouse event was proccessed. Well, many mouses is a
funny issue, cause REAL many mouses work only in a very new X11 and windows
doesn’t have any support for it, so we have to emulate it with calculating
stuff on the system cursor. So sorry for any problems regarding mistakes, if
I find any better way to implement it I’ll do it right away;)

Best wishes–
– Szymon “Wilku” Wilczek
"The dreamer dies, but never dies the dream, Though Death shall call the
whirlwind to his aid, Enlist men’s passions, trick their hearts with hate,
Still shall the Vision live! Say nevermore, That dreams are fragile things"

Szymon Wilczek <kazeuser gmail.com> writes:

In version 1.3. You have to use SDL_SetRelativeMouseMode(int index, SDL_bool
enabled) to change the mode the mouse is working in. All pointing devices are
assumed to be working in absolute coordinates cause it’s a major help when
someone has multiple pionting devices and uses them all for one cursor.Best
wishes-- – Szymon “Wilku” Wilczek"The dreamer dies, but never dies the dream,
Though Death shall call the whirlwind to his aid, Enlist men’s passions, trick
their hearts with hate, Still shall the Vision live! Say nevermore, That dreams
are fragile things"

Well, actually, my goal is more to retrieve the exact relative mouse movement
than to actually simulate a correct multi mice behaviour.
Here is the modifications I have made to the SDL_win32event.c file. Do they
appear acceptable to you ?

Cl?ment

Index: SDL_win32events.c===================================================================

— SDL_win32events.c (revision 4408)

+++ SDL_win32events.c (working copy)

@@ -26,6 +26,7 @@

#endif

#include “SDL_config.h”
+#include “SDL_mouse.h”

#include “SDL_win32video.h”
#include “SDL_syswm.h”
@@ -240,28 +241,35 @@

                 break;
             }
         }

-/* FIXME: Doesn’t this defeat the point of using raw input? */

  •        GetCursorPos(&point);
    
  •        ScreenToClient(hwnd, &point);
    
  •        SDL_GetWindowSize(data->windowID, &w, &h);
    
  •        if (point.x >= 0 && point.y >= 0 && point.x < w && point.y < h) {
    
  •            SDL_SetMouseFocus(index, data->windowID);
    
  •        } else {
    
  •            SDL_SetMouseFocus(index, 0);
    
  •            /* FIXME: Should we be doing anything else here? */
    
  •            break;
    
  •        }
    
  •        /* if the message was sent by a tablet we have to send also
    

pressure */

  •   	/* are we in relative mode ? */
    
  •   	i = SDL_GetRelativeMouseMode(index);
    
  •   	/* if so, get the relative motion, else, proceed as usual */
    
  •   	if(i) {
    
  •   		point.x = raw->data.mouse.lLastX;
    
  •   		point.y = raw->data.mouse.lLastY;
    
  •   	} else {
    
  •   		/* FIXME: Doesn't this defeat the point of using raw input? */
    
  •   	    GetCursorPos(&point);
    
  •   		ScreenToClient(hwnd, &point);
    
  •   		SDL_GetWindowSize(data->windowID, &w, &h);
    
  •           if (point.x >= 0 && point.y >= 0 && point.x < w && point.y < h)
    

{

  •   	        SDL_SetMouseFocus(index, data->windowID);
    
  •   		} else {
    
  •   			SDL_SetMouseFocus(index, 0);
    
  •   	       /* FIXME: Should we be doing anything else here? */
    
  •   		    break;
    
  •   		}
    
  •   	}
    
  •       /* if the message was sent by a tablet we have to send also
    

pressure */
if (index == tablet) {

  •            SDL_SendMouseMotion(index, 0, point.x, point.y, pressure);
    
  •            SDL_SendMouseMotion(index, i, point.x, point.y, pressure);
           } else {
    
  •            SDL_SendMouseMotion(index, 0, point.x, point.y, 0);
    
  •            SDL_SendMouseMotion(index, i, point.x, point.y, 0);
           }
           /* we're sending mouse buttons messages to check up if sth changed
    

*/
if (flags & RI_MOUSE_LEFT_BUTTON_DOWN) {

      /* if the message was sent by a tablet we have to send also

pressure */
if (index == tablet) {

  •            SDL_SendMouseMotion(index, 0, point.x, point.y, pressure);
    
  •            SDL_SendMouseMotion(index, i, point.x, point.y, pressure);
          } else {
    
  •            SDL_SendMouseMotion(index, 0, point.x, point.y, 0);
    
  •            SDL_SendMouseMotion(index, i, point.x, point.y, 0);
          }
          /* we're sending mouse buttons messages to check up if sth changed
    

*/
if (flags & RI_MOUSE_LEFT_BUTTON_DOWN) {

Why did you remove the pressure argument?On Wed, Jan 21, 2009 at 8:22 AM, Cl?ment Forest <Clement.Forest at digital-trainers.com> wrote:


http://codebad.com/

Donny Viszneki <donny.viszneki gmail.com> writes:

Why did you remove the pressure argument?

It has not been removed, I just added an argument for the relative mode.

Cl?ment

Oh, ha, sorry…On Wed, Jan 21, 2009 at 10:56 AM, Cl?ment Forest <Clement.Forest at digital-trainers.com> wrote:

Donny Viszneki <donny.viszneki gmail.com> writes:

Why did you remove the pressure argument?

It has not been removed, I just added an argument for the relative mode.

Cl?ment


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/