locked
MouseMoved VS PointerMoved, Position and glitch problem

    Question

  • OK, correct my if I wrong.

    1. I have a system that manage mouse pointer in three way

    • None      : perfect for games or video playback
    • Desktop : The actual windows native pointer. Take edge in consideration (charm inc concept)
    • CoreX     : My personal pointer, that refer to a polygon. Perfect for game, without take edge in consideration

    2. This pointer was initialized like

    • None, CoreX : CoreWindow::GetForCurrentThread()->PointerCursor = nullptr;
    • Desktop        : CoreWindow::GetForCurrentThread()->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0);

    3. 2 event was used to get position

    • MouseDevice::GetForCurrentView()->MouseMoved (Active in the three way, Only give mouse delta)
    • Window->PointerMoved (Active only if PointerCursor was not null, Give real coordinate "BEST")

    4. For the moment, data was stored by MouseMoved.

    //***************************************************************************
    // Output         : void
    // Class name     : CRXCore8
    // Function name  : OnPointerPressed
    // Description    : Active L'évenments que la souris a bouger
    // Input          : MouseDevice^ sender
    // Input          : MouseEventArgs^ args
    //***************************************************************************
    void CRXCore8::OnMouseMoved(MouseDevice^ sender, MouseEventArgs^ args)
    {
    	//Point Pointer = CoreWindow::GetForCurrentThread()->PointerPosition;
    	XMFLOAT3 TmpPos = m_pInput->GetMouse()->GetMousePos();
    	XMFLOAT3 NewPos = XMFLOAT3(TmpPos.x + (float)args->MouseDelta.X, TmpPos.y + (float)args->MouseDelta.Y, 0.0f);
    	
    	CRDWChar TmpStr2;
    	TmpStr2.Format(L"OnMouseMouve : %d, %d\n", args->MouseDelta.X, args->MouseDelta.Y);
    	m_pInput->GetOutputWindow()->AddString(TmpStr2.Str());
    
    	m_pInput->GetMouse()->SetMousePos(NewPos);
    }

    I Also set cursor at beginning

    //***************************************************************************
    // Output         : void
    // Class name     : CRXCore8
    // Function name  : Run
    // Description    : Execute l'application
    //***************************************************************************
    void CRXCore8::Run()
    {
    	Point PointerPosition = CoreWindow::GetForCurrentThread()->PointerPosition;
    	m_pInput->GetMouse()->SetMousePos(XMFLOAT3(PointerPosition.X, PointerPosition.Y, 0.0f));
    ...
    }

    Problem

    Now I have some switch cursor problem.

    • When I'm switch Desktop to CoreX, everything is fine because I can set my own cursor position.
    • When I'm switch CoreX to Desktop, Cursor was offset  because SetCursorPos doesn't work anymore.

    Now if I overlap CoreX and Desktop Pointer, everything glitch. Position was fine at beginning, but OldPos+NewDelta was not egal to PointerPosition.


    I have try to make an invisible custom pointer to pass everything by real pointer position, but

    1. I didn't have any resource inside my project and it crash my application
    2. I need to disable charm and corner, but how?

    Any Ideas??





    Friday, November 21, 2014 8:02 PM

Answers

  • See this for more information: Developing mouse controls, you should be able to get what you need.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, November 26, 2014 7:36 AM
    Moderator

All replies

  • Hi Fleuve,

    I could only suggest you some of the questions, "I need to disable charm and corner, but how?", I don't think it's possible, system manage that, you could disable the corner by setting on Taskbar properties, but looks like you cannot disable the charm.

    As I know Windows Store App runs in a sandbox mode in your operation system, you cannot disable the charm or other system level setting via your app.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, November 24, 2014 5:48 AM
    Moderator
  • Thanks, for reply!

    I've nearly solve the solution, but waiting if Microsoft gonna update with a SetCursorPos soon. What I've done is :

    Update Mouse from Mouse Delta with None cursor and Homemade Cursor (Cursor =  nullptr)

    (NEW) Update Mouse from Mouse Coordinate with Windows Native Cursor (Cursor = Arrow)

    Like this I got two mouse sensibility (Delta vs Coordinate) and charms was disable when cursor = nullptr.

    Still missing OnMouseEnter and OnMouseLeaving to fix, but really need SetCursorPos function to complete the trick(imposible without)

    Then I've no choice to not switch cursor inside my program (to hide glitch effect and unrefresh cursor position)


    Wednesday, November 26, 2014 1:33 AM
  • See this for more information: Developing mouse controls, you should be able to get what you need.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, November 26, 2014 7:36 AM
    Moderator