Until now UE4 does not use the "real" relative mouse movement which SDL2 provides already in the version 2.0.4. That means SDL2 is calculating internal the rel. mouse movement and provides it via the SDL_MOUSEMOTION event using xrel and yrel. Here some code fragments:
Luckily SDL2 provides with 2.0.4 the real rel mouse movement with
{
...
}
In that part the relative mouse mode is switched on. Using the SDL2 method our function would now look like this:
Create a particle asset
Open it
Right click in the area where you can add additional components etc.
The effect is the mouse pointer will jump around, try right click couple of times you will see definitely.
I figured out that xrel and yrel get really high values then the mouse pointer crosses window borders. That means, if you right click to open a popup menu sometimes
it jumps because it crosses the border of the popup window.
Here is a simple SDL2 application where you can see how xrel and yrel jumps to high values:
MOTION: abs=(420, 257) rel=(-1, 0)MOTION: abs=(419, 257) rel=(-1, 0)MOTION: abs=(417, 257) rel=(-2, 0)MOTION: abs=(639, 104) rel=(222, -153)MOTION: abs=(638, 104) rel=(-1, 0)MOTION: abs=(637, 104) rel=(-1, 0)MOTION: abs=(636, 104) rel=(-1, 0)MOTION: abs=(635, 105) rel=(-1, 1)
I think you can already see which part is strange. Because at some place a right click causes to enable SetHighPrecisionMouseMode(Enable = true, ...)
the bUsingHighPrecisionMouseInput = true and in the motion event the
if(bUsingHighPrecisionMouseInput) { MessageHandler->OnRawMouseMove(motionEvent.xrel, motionEvent.yrel); }
Gets active and causes jumps. Actually that happens all over the place. Sometimes the mouse pointer is doing some weird stuff. I think fixing this issue would make UE4Editor on Linux feel more as it feels like on windows. I couldn't see any jumps there, if feels nice and stiff. This issue prevents us from using it and causes an issue in the 3d viewport not being able to rotate,scale or move infinite. It will stop as soon as the hidden pointer stop at the border.
I hope this helps and/or you can forward this message to icculus. He knows already but I don't know if he found a solution or about the priority of this issue.
SDL_MouseMotionEvent motionEvent = Event.motion; ... if(bUsingHighPrecisionMouseInput) { MessageHandler->OnRawMouseMove(motionEvent.xrel, motionEvent.yrel); } else { MessageHandler->OnMouseMove(); }As mentioned xrel and yrel are not using the XInput2 extension which causes to stop giving values when the cursor reaches the end of the window.
Luckily SDL2 provides with 2.0.4 the real rel mouse movement with
SDL_SetRelativeMouseMode(Enable ? SDL_TRUE : SDL_FALSE);
The relative mouse movement stuff on windows/mac and linux is done in this method:
void FLinuxApplication::SetHighPrecisionMouseMode( const bool Enable, const TSharedPtr< FGenericWindow >& InWindow )
{
...
}
In that part the relative mouse mode is switched on. Using the SDL2 method our function would now look like this:
void FLinuxApplication::SetHighPrecisionMouseMode( const bool Enable, const TSharedPtr< FGenericWindow >& InWindow ) { MessageHandler->OnCursorSet(); bUsingHighPrecisionMouseInput = Enable; // Add this new line. SDL_SetRelativeMouseMode(Enable ? SDL_TRUE : SDL_FALSE); }Doing that the issue becomes more visible which is actually happening without it too somehow. Best and easy to see that issue is
Create a particle asset
Open it
Right click in the area where you can add additional components etc.
The effect is the mouse pointer will jump around, try right click couple of times you will see definitely.
I figured out that xrel and yrel get really high values then the mouse pointer crosses window borders. That means, if you right click to open a popup menu sometimes
it jumps because it crosses the border of the popup window.
Here is a simple SDL2 application where you can see how xrel and yrel jumps to high values:
#include <SDL.h> #include <stdio.h> int main(int argc, char **argv) { SDL_Init(SDL_INIT_EVERYTHING); SDL_Window* window1 = SDL_CreateWindow(“Window 1”, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, 0); SDL_Window* window2 = SDL_CreateWindow(“Window 2”, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, 0); while(true) { SDL_Event e; if(SDL_PollEvent(&e)) { if(e.type == SDL_QUIT) { break; } else if(e.type == SDL_KEYDOWN) { break; } else if(e.type == SDL_MOUSEMOTION) { printf("MOTION: abs=(%d, %d) rel=(%d, %d)\n", (int)e.motion.x, (int)e.motion.y, (int)e.motion.xrel, (int)e.motion.yrel); } } } SDL_DestroyWindow(window1); SDL_DestroyWindow(window2); SDL_Quit(); return 0; }Here are some values of this example when you cross from one window to the other
MOTION: abs=(420, 257) rel=(-1, 0)MOTION: abs=(419, 257) rel=(-1, 0)MOTION: abs=(417, 257) rel=(-2, 0)MOTION: abs=(639, 104) rel=(222, -153)MOTION: abs=(638, 104) rel=(-1, 0)MOTION: abs=(637, 104) rel=(-1, 0)MOTION: abs=(636, 104) rel=(-1, 0)MOTION: abs=(635, 105) rel=(-1, 1)
I think you can already see which part is strange. Because at some place a right click causes to enable SetHighPrecisionMouseMode(Enable = true, ...)
the bUsingHighPrecisionMouseInput = true and in the motion event the
if(bUsingHighPrecisionMouseInput) { MessageHandler->OnRawMouseMove(motionEvent.xrel, motionEvent.yrel); }
Gets active and causes jumps. Actually that happens all over the place. Sometimes the mouse pointer is doing some weird stuff. I think fixing this issue would make UE4Editor on Linux feel more as it feels like on windows. I couldn't see any jumps there, if feels nice and stiff. This issue prevents us from using it and causes an issue in the 3d viewport not being able to rotate,scale or move infinite. It will stop as soon as the hidden pointer stop at the border.
I hope this helps and/or you can forward this message to icculus. He knows already but I don't know if he found a solution or about the priority of this issue.
Comments
Post a Comment