| Index: win8/metro_driver/metro_driver_win7.cc
|
| diff --git a/win8/metro_driver/metro_driver_win7.cc b/win8/metro_driver/metro_driver_win7.cc
|
| index ace0d940e6baff899ceeb50e8d63a043e5d93f10..3a490579886269eff9cfcd61fbc238be2a24c508 100644
|
| --- a/win8/metro_driver/metro_driver_win7.cc
|
| +++ b/win8/metro_driver/metro_driver_win7.cc
|
| @@ -4,14 +4,22 @@
|
|
|
| #include "stdafx.h"
|
| #include <corewindow.h>
|
| +#include <shobjidl.h>
|
|
|
| #include "base/logging.h"
|
| #include "ui/gfx/geometry/safe_integer_conversions.h"
|
| #include "ui/gfx/win/msg_util.h"
|
|
|
| +#pragma comment(lib, "shell32.lib")
|
| +
|
| EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
| +// Even though we only create a single window, we need to keep this
|
| +// count because of the hidden window used by the UI message loop of
|
| +// the metro viewer.
|
| int g_window_count = 0;
|
|
|
| +const wchar_t kAshWin7AppId[] = L"Google.Chrome.AshWin7.1";
|
| +
|
| extern float GetModernUIScale();
|
|
|
| LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
| @@ -43,7 +51,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
| return 0;
|
| }
|
|
|
| -HWND CreateMetroTopLevelWindow() {
|
| +HWND CreateMetroTopLevelWindow(const RECT& work_area) {
|
| HINSTANCE hInst = reinterpret_cast<HINSTANCE>(&__ImageBase);
|
| WNDCLASSEXW wcex;
|
| wcex.cbSize = sizeof(wcex);
|
| @@ -52,18 +60,21 @@ HWND CreateMetroTopLevelWindow() {
|
| wcex.cbClsExtra = 0;
|
| wcex.cbWndExtra = 0;
|
| wcex.hInstance = hInst;
|
| - wcex.hIcon = 0;
|
| + wcex.hIcon = LoadIcon(::GetModuleHandle(NULL), L"IDR_MAINFRAME");
|
| wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
| wcex.hbrBackground = (HBRUSH)(COLOR_INACTIVECAPTION+1);
|
| wcex.lpszMenuName = 0;
|
| wcex.lpszClassName = L"Windows.UI.Core.CoreWindow";
|
| - wcex.hIconSm = 0;
|
| + wcex.hIconSm = LoadIcon(::GetModuleHandle(NULL), L"IDR_MAINFRAME");
|
| +
|
| +
|
|
|
| HWND hwnd = ::CreateWindowExW(0,
|
| MAKEINTATOM(::RegisterClassExW(&wcex)),
|
| L"metro_win7",
|
| - WS_POPUP | WS_VISIBLE,
|
| - 0, 0, 1600, 900,
|
| + WS_POPUP | WS_VISIBLE | WS_MINIMIZEBOX,
|
| + work_area.top, work_area.left,
|
| + work_area.right, work_area.bottom,
|
| NULL, NULL, hInst, NULL);
|
| return hwnd;
|
| }
|
| @@ -143,241 +154,241 @@ class MouseEvent : public mswr::RuntimeClass<
|
| }
|
|
|
| // IPointerEventArgs implementation.
|
| - virtual HRESULT STDMETHODCALLTYPE get_CurrentPoint(
|
| - winui::Input::IPointerPoint** point) {
|
| - return QueryInterface(winui::Input::IID_IPointerPoint,
|
| - reinterpret_cast<void**>(point));
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_KeyModifiers(
|
| - winsys::VirtualKeyModifiers* modifiers) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE GetIntermediatePoints(
|
| - winfoundtn::Collections::IVector<winui::Input::PointerPoint*>** points) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - // IPointerPoint implementation.
|
| - virtual HRESULT STDMETHODCALLTYPE get_PointerDevice(
|
| - windevs::Input::IPointerDevice** pointer_device) {
|
| - return QueryInterface(windevs::Input::IID_IPointerDevice,
|
| - reinterpret_cast<void**>(pointer_device));
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_Position(winfoundtn::Point* position) {
|
| - static float scale = GetModernUIScale();
|
| - // Scale down the points here as they are scaled up on the other side.
|
| - position->X = gfx::ToRoundedInt(CR_GET_X_LPARAM(msg_.lParam) / scale);
|
| - position->Y = gfx::ToRoundedInt(CR_GET_Y_LPARAM(msg_.lParam) / scale);
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_PointerId(uint32* pointer_id) {
|
| - // TODO(ananta)
|
| - // Implement this properly.
|
| - *pointer_id = 1;
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_Timestamp(uint64* timestamp) {
|
| - *timestamp = msg_.time;
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_Properties(
|
| - winui::Input::IPointerPointProperties** properties) {
|
| - return QueryInterface(winui::Input::IID_IPointerPointProperties,
|
| - reinterpret_cast<void**>(properties));
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_RawPosition(
|
| - winfoundtn::Point* position) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_FrameId(uint32* frame_id) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsInContact(boolean* in_contact) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - // IPointerPointProperties implementation.
|
| - virtual HRESULT STDMETHODCALLTYPE get_PointerUpdateKind(
|
| - winui::Input::PointerUpdateKind* update_kind) {
|
| - // TODO(ananta)
|
| - // There is no WM_POINTERUPDATE equivalent on Windows 7. Look into
|
| - // equivalents.
|
| - if (msg_.message == WM_LBUTTONDOWN) {
|
| - *update_kind = winui::Input::PointerUpdateKind_LeftButtonPressed;
|
| - } else if (msg_.message == WM_RBUTTONDOWN) {
|
| - *update_kind = winui::Input::PointerUpdateKind_RightButtonPressed;
|
| - } else if (msg_.message == WM_MBUTTONDOWN) {
|
| - *update_kind = winui::Input::PointerUpdateKind_MiddleButtonPressed;
|
| - } else if (msg_.message == WM_LBUTTONUP) {
|
| - *update_kind = winui::Input::PointerUpdateKind_LeftButtonReleased;
|
| - } else if (msg_.message == WM_RBUTTONUP) {
|
| - *update_kind = winui::Input::PointerUpdateKind_RightButtonReleased;
|
| - } else if (msg_.message == WM_MBUTTONUP) {
|
| - *update_kind = winui::Input::PointerUpdateKind_MiddleButtonReleased;
|
| - }
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsLeftButtonPressed(
|
| - boolean* left_button_pressed) {
|
| - *left_button_pressed = msg_.wParam & MK_LBUTTON ? true : false;
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsRightButtonPressed(
|
| - boolean* right_button_pressed) {
|
| - *right_button_pressed = msg_.wParam & MK_RBUTTON ? true : false;
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsMiddleButtonPressed(
|
| - boolean* middle_button_pressed) {
|
| - *middle_button_pressed = msg_.wParam & MK_MBUTTON ? true : false;
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsHorizontalMouseWheel(
|
| - boolean* is_horizontal_mouse_wheel) {
|
| - *is_horizontal_mouse_wheel =
|
| - (msg_.message == WM_MOUSEHWHEEL) ? true : false;
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_MouseWheelDelta(int* delta) {
|
| - if (msg_.message == WM_MOUSEWHEEL || msg_.message == WM_MOUSEHWHEEL) {
|
| - *delta = GET_WHEEL_DELTA_WPARAM(msg_.wParam);
|
| - return S_OK;
|
| - } else {
|
| - return S_FALSE;
|
| - }
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_Pressure(float* pressure) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsInverted(boolean* inverted) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsEraser(boolean* is_eraser) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_Orientation(float* orientation) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_XTilt(float* x_tilt) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_YTilt(float* y_tilt) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_Twist(float* twist) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_ContactRect(winfoundtn::Rect* rect) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_ContactRectRaw(winfoundtn::Rect* rect) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_TouchConfidence(boolean* confidence) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsPrimary(boolean* is_primary) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsInRange(boolean* is_in_range) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsCanceled(boolean* is_canceled) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsBarrelButtonPressed(
|
| - boolean* is_barrel_button_pressed) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsXButton1Pressed(
|
| - boolean* is_xbutton1_pressed) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsXButton2Pressed(
|
| - boolean* is_xbutton2_pressed) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE HasUsage(uint32 usage_page,
|
| - uint32 usage_id,
|
| - boolean* has_usage) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE GetUsageValue(uint32 usage_page,
|
| - uint32 usage_id,
|
| - int32* usage_value) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - // IPointerDevice implementation.
|
| - virtual HRESULT STDMETHODCALLTYPE get_PointerDeviceType(
|
| - windevs::Input::PointerDeviceType* device_type) {
|
| - if (msg_.message == WM_TOUCH) {
|
| - *device_type = windevs::Input::PointerDeviceType_Touch;
|
| - } else {
|
| - *device_type = windevs::Input::PointerDeviceType_Mouse;
|
| - }
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_IsIntegrated(boolean* is_integrated) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_MaxContacts(uint32* contacts) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_PhysicalDeviceRect(
|
| - winfoundtn::Rect* rect) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_ScreenRect(winfoundtn::Rect* rect) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_SupportedUsages(
|
| - winfoundtn::Collections::IVectorView<
|
| - windevs::Input::PointerDeviceUsage>** usages) {
|
| - return E_NOTIMPL;
|
| - }
|
| -
|
| - private:
|
| - MSG msg_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(MouseEvent);
|
| + virtual HRESULT STDMETHODCALLTYPE get_CurrentPoint(
|
| + winui::Input::IPointerPoint** point) {
|
| + return QueryInterface(winui::Input::IID_IPointerPoint,
|
| + reinterpret_cast<void**>(point));
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_KeyModifiers(
|
| + winsys::VirtualKeyModifiers* modifiers) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE GetIntermediatePoints(
|
| + winfoundtn::Collections::IVector<winui::Input::PointerPoint*>** points) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + // IPointerPoint implementation.
|
| + virtual HRESULT STDMETHODCALLTYPE get_PointerDevice(
|
| + windevs::Input::IPointerDevice** pointer_device) {
|
| + return QueryInterface(windevs::Input::IID_IPointerDevice,
|
| + reinterpret_cast<void**>(pointer_device));
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_Position(winfoundtn::Point* position) {
|
| + static float scale = GetModernUIScale();
|
| + // Scale down the points here as they are scaled up on the other side.
|
| + position->X = gfx::ToRoundedInt(CR_GET_X_LPARAM(msg_.lParam) / scale);
|
| + position->Y = gfx::ToRoundedInt(CR_GET_Y_LPARAM(msg_.lParam) / scale);
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_PointerId(uint32* pointer_id) {
|
| + // TODO(ananta)
|
| + // Implement this properly.
|
| + *pointer_id = 1;
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_Timestamp(uint64* timestamp) {
|
| + *timestamp = msg_.time;
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_Properties(
|
| + winui::Input::IPointerPointProperties** properties) {
|
| + return QueryInterface(winui::Input::IID_IPointerPointProperties,
|
| + reinterpret_cast<void**>(properties));
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_RawPosition(
|
| + winfoundtn::Point* position) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_FrameId(uint32* frame_id) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsInContact(boolean* in_contact) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + // IPointerPointProperties implementation.
|
| + virtual HRESULT STDMETHODCALLTYPE get_PointerUpdateKind(
|
| + winui::Input::PointerUpdateKind* update_kind) {
|
| + // TODO(ananta)
|
| + // There is no WM_POINTERUPDATE equivalent on Windows 7. Look into
|
| + // equivalents.
|
| + if (msg_.message == WM_LBUTTONDOWN) {
|
| + *update_kind = winui::Input::PointerUpdateKind_LeftButtonPressed;
|
| + } else if (msg_.message == WM_RBUTTONDOWN) {
|
| + *update_kind = winui::Input::PointerUpdateKind_RightButtonPressed;
|
| + } else if (msg_.message == WM_MBUTTONDOWN) {
|
| + *update_kind = winui::Input::PointerUpdateKind_MiddleButtonPressed;
|
| + } else if (msg_.message == WM_LBUTTONUP) {
|
| + *update_kind = winui::Input::PointerUpdateKind_LeftButtonReleased;
|
| + } else if (msg_.message == WM_RBUTTONUP) {
|
| + *update_kind = winui::Input::PointerUpdateKind_RightButtonReleased;
|
| + } else if (msg_.message == WM_MBUTTONUP) {
|
| + *update_kind = winui::Input::PointerUpdateKind_MiddleButtonReleased;
|
| + }
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsLeftButtonPressed(
|
| + boolean* left_button_pressed) {
|
| + *left_button_pressed = msg_.wParam & MK_LBUTTON ? true : false;
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsRightButtonPressed(
|
| + boolean* right_button_pressed) {
|
| + *right_button_pressed = msg_.wParam & MK_RBUTTON ? true : false;
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsMiddleButtonPressed(
|
| + boolean* middle_button_pressed) {
|
| + *middle_button_pressed = msg_.wParam & MK_MBUTTON ? true : false;
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsHorizontalMouseWheel(
|
| + boolean* is_horizontal_mouse_wheel) {
|
| + *is_horizontal_mouse_wheel =
|
| + (msg_.message == WM_MOUSEHWHEEL) ? true : false;
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_MouseWheelDelta(int* delta) {
|
| + if (msg_.message == WM_MOUSEWHEEL || msg_.message == WM_MOUSEHWHEEL) {
|
| + *delta = GET_WHEEL_DELTA_WPARAM(msg_.wParam);
|
| + return S_OK;
|
| + } else {
|
| + return S_FALSE;
|
| + }
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_Pressure(float* pressure) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsInverted(boolean* inverted) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsEraser(boolean* is_eraser) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_Orientation(float* orientation) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_XTilt(float* x_tilt) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_YTilt(float* y_tilt) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_Twist(float* twist) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_ContactRect(winfoundtn::Rect* rect) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_ContactRectRaw(winfoundtn::Rect* rect) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_TouchConfidence(boolean* confidence) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsPrimary(boolean* is_primary) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsInRange(boolean* is_in_range) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsCanceled(boolean* is_canceled) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsBarrelButtonPressed(
|
| + boolean* is_barrel_button_pressed) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsXButton1Pressed(
|
| + boolean* is_xbutton1_pressed) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsXButton2Pressed(
|
| + boolean* is_xbutton2_pressed) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE HasUsage(uint32 usage_page,
|
| + uint32 usage_id,
|
| + boolean* has_usage) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE GetUsageValue(uint32 usage_page,
|
| + uint32 usage_id,
|
| + int32* usage_value) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + // IPointerDevice implementation.
|
| + virtual HRESULT STDMETHODCALLTYPE get_PointerDeviceType(
|
| + windevs::Input::PointerDeviceType* device_type) {
|
| + if (msg_.message == WM_TOUCH) {
|
| + *device_type = windevs::Input::PointerDeviceType_Touch;
|
| + } else {
|
| + *device_type = windevs::Input::PointerDeviceType_Mouse;
|
| + }
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_IsIntegrated(boolean* is_integrated) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_MaxContacts(uint32* contacts) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_PhysicalDeviceRect(
|
| + winfoundtn::Rect* rect) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_ScreenRect(winfoundtn::Rect* rect) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_SupportedUsages(
|
| + winfoundtn::Collections::IVectorView<
|
| + windevs::Input::PointerDeviceUsage>** usages) {
|
| + return E_NOTIMPL;
|
| + }
|
| +
|
| + private:
|
| + MSG msg_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(MouseEvent);
|
| };
|
|
|
| // This class implements the winrt interfaces needed to support keyboard
|
| @@ -391,45 +402,45 @@ class KeyEvent : public mswr::RuntimeClass<
|
| : msg_(msg) {}
|
|
|
| // IKeyEventArgs implementation.
|
| - virtual HRESULT STDMETHODCALLTYPE get_VirtualKey(
|
| - winsys::VirtualKey* virtual_key) {
|
| - *virtual_key = static_cast<winsys::VirtualKey>(msg_.wParam);
|
| - return S_OK;
|
| - }
|
| -
|
| - virtual HRESULT STDMETHODCALLTYPE get_KeyStatus(
|
| - winui::Core::CorePhysicalKeyStatus* key_status) {
|
| - // As per msdn documentation for the keyboard messages.
|
| - key_status->RepeatCount = msg_.lParam & 0x0000FFFF;
|
| - key_status->ScanCode = (msg_.lParam >> 16) & 0x00FF;
|
| - key_status->IsExtendedKey = (msg_.lParam & (1 << 24));
|
| - key_status->IsMenuKeyDown = (msg_.lParam & (1 << 29));
|
| - key_status->WasKeyDown = (msg_.lParam & (1 << 30));
|
| - key_status->IsKeyReleased = (msg_.lParam & (1 << 31));
|
| - return S_OK;
|
| - }
|
| -
|
| - // ICharacterReceivedEventArgs implementation.
|
| - virtual HRESULT STDMETHODCALLTYPE get_KeyCode(uint32* key_code) {
|
| - *key_code = msg_.wParam;
|
| - return S_OK;
|
| - }
|
| -
|
| - // IAcceleratorKeyEventArgs implementation.
|
| - virtual HRESULT STDMETHODCALLTYPE get_EventType(
|
| - winui::Core::CoreAcceleratorKeyEventType* event_type) {
|
| - if (msg_.message == WM_SYSKEYDOWN) {
|
| - *event_type = winui::Core::CoreAcceleratorKeyEventType_SystemKeyDown;
|
| - } else if (msg_.message == WM_SYSKEYUP) {
|
| - *event_type = winui::Core::CoreAcceleratorKeyEventType_SystemKeyUp;
|
| - } else if (msg_.message == WM_SYSCHAR) {
|
| - *event_type = winui::Core::CoreAcceleratorKeyEventType_SystemCharacter;
|
| - }
|
| - return S_OK;
|
| - }
|
| -
|
| - private:
|
| - MSG msg_;
|
| + virtual HRESULT STDMETHODCALLTYPE get_VirtualKey(
|
| + winsys::VirtualKey* virtual_key) {
|
| + *virtual_key = static_cast<winsys::VirtualKey>(msg_.wParam);
|
| + return S_OK;
|
| + }
|
| +
|
| + virtual HRESULT STDMETHODCALLTYPE get_KeyStatus(
|
| + winui::Core::CorePhysicalKeyStatus* key_status) {
|
| + // As per msdn documentation for the keyboard messages.
|
| + key_status->RepeatCount = msg_.lParam & 0x0000FFFF;
|
| + key_status->ScanCode = (msg_.lParam >> 16) & 0x00FF;
|
| + key_status->IsExtendedKey = (msg_.lParam & (1 << 24));
|
| + key_status->IsMenuKeyDown = (msg_.lParam & (1 << 29));
|
| + key_status->WasKeyDown = (msg_.lParam & (1 << 30));
|
| + key_status->IsKeyReleased = (msg_.lParam & (1 << 31));
|
| + return S_OK;
|
| + }
|
| +
|
| + // ICharacterReceivedEventArgs implementation.
|
| + virtual HRESULT STDMETHODCALLTYPE get_KeyCode(uint32* key_code) {
|
| + *key_code = msg_.wParam;
|
| + return S_OK;
|
| + }
|
| +
|
| + // IAcceleratorKeyEventArgs implementation.
|
| + virtual HRESULT STDMETHODCALLTYPE get_EventType(
|
| + winui::Core::CoreAcceleratorKeyEventType* event_type) {
|
| + if (msg_.message == WM_SYSKEYDOWN) {
|
| + *event_type = winui::Core::CoreAcceleratorKeyEventType_SystemKeyDown;
|
| + } else if (msg_.message == WM_SYSKEYUP) {
|
| + *event_type = winui::Core::CoreAcceleratorKeyEventType_SystemKeyUp;
|
| + } else if (msg_.message == WM_SYSCHAR) {
|
| + *event_type = winui::Core::CoreAcceleratorKeyEventType_SystemCharacter;
|
| + }
|
| + return S_OK;
|
| + }
|
| +
|
| + private:
|
| + MSG msg_;
|
| };
|
|
|
| // The following classes are the emulation of the WinRT system as exposed
|
| @@ -566,7 +577,21 @@ class CoreWindowEmulation
|
| key_up_handler_(NULL),
|
| character_received_handler_(NULL) {
|
| dispatcher_ = mswr::Make<CoreDispatcherEmulation>(this);
|
| - core_hwnd_ = CreateMetroTopLevelWindow();
|
| +
|
| + // Unless we select our own AppUserModelID the shell might confuse us
|
| + // with the app launcher one and we get the wrong taskbar button and icon.
|
| + ::SetCurrentProcessExplicitAppUserModelID(kAshWin7AppId);
|
| +
|
| + RECT work_area = {0};
|
| + ::SystemParametersInfo(SPI_GETWORKAREA, 0, &work_area, 0);
|
| + if (::IsDebuggerPresent()) {
|
| + work_area.top = 0;
|
| + work_area.left = 0;
|
| + work_area.right = 1600;
|
| + work_area.bottom = 900;
|
| + }
|
| +
|
| + core_hwnd_ = CreateMetroTopLevelWindow(work_area);
|
| }
|
|
|
| ~CoreWindowEmulation() {
|
|
|