Add UWP implementation for cursor methods

This commit is contained in:
Brad Hughes 2016-04-18 19:05:45 -04:00
parent 97f953f0a5
commit ee6872dc68
2 changed files with 41 additions and 0 deletions

View file

@ -30,6 +30,11 @@
#include "winutil.h"
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#include <agile.h>
using namespace Windows::UI::Core;
#endif
#include "modules/render/drawbgfx.h"
#include "modules/render/drawnone.h"
#include "modules/render/drawd3d.h"
@ -385,6 +390,8 @@ win_window_info::~win_window_info()
POINT win_window_info::s_saved_cursor_pos = { -1, -1 };
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
void win_window_info::capture_pointer()
{
RECT bounds;
@ -419,6 +426,35 @@ void win_window_info::show_pointer()
ShowCursor(FALSE);
}
#else
CoreCursor^ win_window_info::s_cursor = nullptr;
void win_window_info::capture_pointer()
{
platform_window<Platform::Agile<CoreWindow^>>()->SetPointerCapture();
}
void win_window_info::release_pointer()
{
platform_window<Platform::Agile<CoreWindow^>>()->ReleasePointerCapture();
}
void win_window_info::hide_pointer()
{
auto window = platform_window<Platform::Agile<CoreWindow^>>();
win_window_info::s_cursor = window->PointerCursor;
window->PointerCursor = nullptr;
}
void win_window_info::show_pointer()
{
auto window = platform_window<Platform::Agile<CoreWindow^>>();
window->PointerCursor = win_window_info::s_cursor;
}
#endif
//============================================================
// winwindow_process_events_periodic
// (main thread)

View file

@ -143,6 +143,11 @@ private:
void set_fullscreen(int fullscreen);
static POINT s_saved_cursor_pos;
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
static Windows::UI::Core::CoreCursor^ s_cursor;
#endif
running_machine & m_machine;
};