Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
WinRT: mouse-pointer debugging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLudwig committed May 5, 2013
1 parent 32183f2 commit 9bd2817
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/video/windowsrt/SDL_WinRTApp.cpp
Expand Up @@ -36,6 +36,10 @@ using namespace Windows::System;
using namespace Windows::UI::Core;
using namespace Windows::UI::Input;

// Compile-time debugging options:
// To enable, uncomment; to disable, comment them out.
//#define LOG_POINTER_EVENTS 1

// HACK, DLudwig: The C-style main() will get loaded via the app's
// WinRT-styled main(), which is part of SDLmain_for_WinRT.cpp.
// This seems wrong on some level, but does seem to work.
Expand Down Expand Up @@ -386,12 +390,13 @@ WINRT_ConvertPointerUpdateKindToString(PointerUpdateKind kind)
}

static void
WINRT_LogPointerEvent(const string & header, PointerEventArgs ^ args)
WINRT_LogPointerEvent(const string & header, PointerEventArgs ^ args, Point transformedPoint)
{
PointerPoint ^ pt = args->CurrentPoint;
SDL_Log("%s: Position={%f,%f}, MouseWheelDelta=%d, FrameId=%d, PointerId=%d, PointerUpdateKind=%s\n",
SDL_Log("%s: Position={%f,%f}, Transformed Pos={%f, %f}, MouseWheelDelta=%d, FrameId=%d, PointerId=%d, PointerUpdateKind=%s\n",
header.c_str(),
pt->Position.X, pt->Position.Y,
transformedPoint.X, transformedPoint.Y,
pt->Properties->MouseWheelDelta,
pt->FrameId,
pt->PointerId,
Expand All @@ -400,8 +405,8 @@ WINRT_LogPointerEvent(const string & header, PointerEventArgs ^ args)

void SDL_WinRTApp::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)
{
#if 0
WINRT_LogPointerEvent("mouse down", args);
#if LOG_POINTER_EVENTS
WINRT_LogPointerEvent("mouse down", args, TransformCursor(args->CurrentPoint->Position));
#endif

if (m_sdlWindowData) {
Expand All @@ -414,8 +419,8 @@ void SDL_WinRTApp::OnPointerPressed(CoreWindow^ sender, PointerEventArgs^ args)

void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)
{
#if 0
WINRT_LogPointerEvent("mouse up", args);
#if LOG_POINTER_EVENTS
WINRT_LogPointerEvent("mouse up", args, TransformCursor(args->CurrentPoint->Position));
#endif

if (m_sdlWindowData) {
Expand All @@ -428,8 +433,8 @@ void SDL_WinRTApp::OnPointerReleased(CoreWindow^ sender, PointerEventArgs^ args)

void SDL_WinRTApp::OnPointerWheelChanged(CoreWindow^ sender, PointerEventArgs^ args)
{
#if 0
WINRT_LogPointerEvent("wheel changed", args);
#if LOG_POINTER_EVENTS
WINRT_LogPointerEvent("wheel changed", args, TransformCursor(args->CurrentPoint->Position));
#endif

if (m_sdlWindowData) {
Expand Down Expand Up @@ -532,6 +537,10 @@ Point SDL_WinRTApp::TransformCursor(Point rawPosition)

void SDL_WinRTApp::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
{
#if LOG_POINTER_EVENTS
WINRT_LogPointerEvent("pointer moved", args, TransformCursor(args->CurrentPoint->Position));
#endif

if (m_sdlWindowData && ! m_useRelativeMouseMode)
{
Point transformedPoint = TransformCursor(args->CurrentPoint->Position);
Expand Down

0 comments on commit 9bd2817

Please sign in to comment.