Skip to content

Commit 375afbb

Browse files
committed
Temporary debug loggin
1 parent ac16fc8 commit 375afbb

File tree

4 files changed

+118
-17
lines changed

4 files changed

+118
-17
lines changed

shell/platform/windows/key_event_handler.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,25 @@ namespace flutter {
3030
// These have to be in sync with the framework's RawKeyEventDataWindows
3131
// modifiers definition.
3232
// https://github.com/flutter/flutter/blob/19ff596979e407c484a32f4071420fca4f4c885f/packages/flutter/lib/src/services/raw_keyboard_windows.dart#L203
33-
static constexpr int kShift = 1 << 0;
34-
static constexpr int kShiftLeft = 1 << 1;
35-
static constexpr int kShiftRight = 1 << 2;
36-
static constexpr int kControl = 1 << 3;
37-
static constexpr int kControlLeft = 1 << 4;
38-
static constexpr int kControlRight = 1 << 5;
39-
static constexpr int kAlt = 1 << 6;
40-
static constexpr int kAltLeft = 1 << 7;
41-
static constexpr int kAltRight = 1 << 8;
42-
static constexpr int kWinLeft = 1 << 9;
43-
static constexpr int kWinRight = 1 << 10;
44-
static constexpr int kCapsLock = 1 << 11;
45-
static constexpr int kNumLock = 1 << 12;
46-
static constexpr int kScrollLock = 1 << 13;
33+
constexpr int kShift = 1 << 0;
34+
constexpr int kShiftLeft = 1 << 1;
35+
constexpr int kShiftRight = 1 << 2;
36+
constexpr int kControl = 1 << 3;
37+
constexpr int kControlLeft = 1 << 4;
38+
constexpr int kControlRight = 1 << 5;
39+
constexpr int kAlt = 1 << 6;
40+
constexpr int kAltLeft = 1 << 7;
41+
constexpr int kAltRight = 1 << 8;
42+
constexpr int kWinLeft = 1 << 9;
43+
constexpr int kWinRight = 1 << 10;
44+
constexpr int kCapsLock = 1 << 11;
45+
constexpr int kNumLock = 1 << 12;
46+
constexpr int kScrollLock = 1 << 13;
4747

4848
// A sentinel value for the extra data on key events synthesized by this code.
4949
// This is used to prevent sending a synthesized event to the framework a second
5050
// time.
51-
static constexpr int kSynthesizedEvent = 0xbaddecaf;
51+
constexpr int kSynthesizedEvent = 0xbaddecaf;
5252

5353
namespace {
5454
/// Calls GetKeyState() an all modifier keys and packs the result in an int,
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include "flutter/shell/platform/windows/testing/win32_window_test.h"
2+
3+
namespace flutter {
4+
namespace testing {
5+
6+
Win32WindowTest::Win32WindowTest() : Win32Window(){};
7+
8+
Win32WindowTest::~Win32WindowTest() = default;
9+
10+
void Win32WindowTest::OnDpiScale(unsigned int dpi){};
11+
12+
void Win32WindowTest::OnResize(unsigned int width, unsigned int height) {}
13+
14+
void Win32WindowTest::OnPointerMove(double x, double y) {}
15+
16+
void Win32WindowTest::OnPointerDown(double x, double y, UINT button) {}
17+
18+
void Win32WindowTest::OnPointerUp(double x, double y, UINT button) {}
19+
20+
void Win32WindowTest::OnPointerLeave() {}
21+
22+
void Win32WindowTest::OnSetCursor() {}
23+
24+
void Win32WindowTest::OnText(const std::u16string& text) {}
25+
26+
void Win32WindowTest::OnKey(int key,
27+
int scancode,
28+
int action,
29+
char32_t character) {}
30+
31+
void Win32WindowTest::OnScroll(double delta_x, double delta_y) {}
32+
33+
void Win32WindowTest::OnFontChange() {}
34+
35+
UINT Win32WindowTest::GetDpi() {
36+
return GetCurrentDPI();
37+
}
38+
39+
} // namespace testing
40+
} // namespace flutter
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include <windowsx.h>
6+
7+
#include "flutter/shell/platform/windows/win32_window.h"
8+
9+
namespace flutter {
10+
namespace testing {
11+
12+
/// Test class for the Win32Window base class. Used to access protected methods
13+
/// for testing.
14+
class Win32WindowTest : public Win32Window {
15+
public:
16+
Win32WindowTest();
17+
virtual ~Win32WindowTest();
18+
19+
// Prevent copying.
20+
Win32WindowTest(Win32WindowTest const&) = delete;
21+
Win32WindowTest& operator=(Win32WindowTest const&) = delete;
22+
23+
// Wrapper for GetCurrentDPI() which is a protected method.
24+
UINT GetDpi();
25+
26+
// |Win32Window|
27+
void OnDpiScale(unsigned int dpi) override;
28+
29+
// |Win32Window|
30+
void OnResize(unsigned int width, unsigned int height) override;
31+
32+
// |Win32Window|
33+
void OnPointerMove(double x, double y) override;
34+
35+
// |Win32Window|
36+
void OnPointerDown(double x, double y, UINT button) override;
37+
38+
// |Win32Window|
39+
void OnPointerUp(double x, double y, UINT button) override;
40+
41+
// |Win32Window|
42+
void OnPointerLeave() override;
43+
44+
// |Win32Window|
45+
void OnSetCursor() override;
46+
47+
// |Win32Window|
48+
void OnText(const std::u16string& text) override;
49+
50+
// |Win32Window|
51+
void OnKey(int key, int scancode, int action, char32_t character) override;
52+
53+
// |Win32Window|
54+
void OnScroll(double delta_x, double delta_y) override;
55+
56+
// |Win32Window|
57+
void OnFontChange() override;
58+
};
59+
60+
} // namespace testing
61+
} // namespace flutter

shell/platform/windows/win32_window.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "flutter/shell/platform/windows/win32_window.h"
66

77
#include <cstring>
8+
#include <iostream>
89

910
#include "win32_dpi_utils.h"
1011

@@ -119,8 +120,7 @@ Win32Window::HandleMessage(UINT const message,
119120
LPARAM extraInfo = GetMessageExtraInfo();
120121
if (extraInfo == 0xbaddecaf) {
121122
// Don't pass messages that we synthesized to the framework again.
122-
std::cerr << "Found Extra Info synthesized key for scancode " << scancode << " ("
123-
<< character << ")" << std::endl;
123+
std::cerr << "Found Extra Info for synthesized key" << std::endl;
124124
}
125125

126126
switch (message) {

0 commit comments

Comments
 (0)