Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
035c9dbf
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
035c9dbf
编写于
9月 23, 2019
作者:
F
Francisco Magdaleno
提交者:
GitHub
9月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Track "mouse leave" event (#12363)
上级
5b8d7df2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
2 deletion
+51
-2
shell/platform/windows/win32_flutter_window.cc
shell/platform/windows/win32_flutter_window.cc
+12
-0
shell/platform/windows/win32_flutter_window.h
shell/platform/windows/win32_flutter_window.h
+10
-0
shell/platform/windows/win32_window.cc
shell/platform/windows/win32_window.cc
+20
-2
shell/platform/windows/win32_window.h
shell/platform/windows/win32_window.h
+9
-0
未找到文件。
shell/platform/windows/win32_flutter_window.cc
浏览文件 @
035c9dbf
...
...
@@ -125,6 +125,12 @@ void Win32FlutterWindow::OnPointerUp(double x, double y) {
}
}
void
Win32FlutterWindow
::
OnPointerLeave
()
{
if
(
process_events_
)
{
SendPointerLeave
();
}
}
void
Win32FlutterWindow
::
OnChar
(
char32_t
code_point
)
{
if
(
process_events_
)
{
SendChar
(
code_point
);
...
...
@@ -214,6 +220,12 @@ void Win32FlutterWindow::SendPointerUp(double x, double y) {
SendPointerEventWithData
(
event
);
}
void
Win32FlutterWindow
::
SendPointerLeave
()
{
FlutterPointerEvent
event
=
{};
event
.
phase
=
FlutterPointerPhase
::
kRemove
;
SendPointerEventWithData
(
event
);
}
void
Win32FlutterWindow
::
SendChar
(
char32_t
code_point
)
{
for
(
const
auto
&
handler
:
keyboard_hook_handlers_
)
{
handler
->
CharHook
(
this
,
code_point
);
...
...
shell/platform/windows/win32_flutter_window.h
浏览文件 @
035c9dbf
...
...
@@ -53,6 +53,9 @@ class Win32FlutterWindow : public Win32Window {
// |Win32Window|
void
OnPointerUp
(
double
x
,
double
y
)
override
;
// |Win32Window|
void
OnPointerLeave
()
override
;
// |Win32Window|
void
OnChar
(
char32_t
code_point
)
override
;
...
...
@@ -105,6 +108,13 @@ class Win32FlutterWindow : public Win32Window {
// Reports mouse release to Flutter engine.
void
SendPointerUp
(
double
x
,
double
y
);
// Reports mouse left the window client area.
//
// Win32 api doesn't have "mouse enter" event. Therefore, there is no
// SendPointerEnter method. A mouse enter event is tracked then the "move"
// event is called.
void
SendPointerLeave
();
// Reports a keyboard character to Flutter engine.
void
SendChar
(
char32_t
code_point
);
...
...
shell/platform/windows/win32_window.cc
浏览文件 @
035c9dbf
...
...
@@ -98,6 +98,17 @@ LRESULT CALLBACK Win32Window::WndProc(HWND const window,
return
DefWindowProc
(
window
,
message
,
wparam
,
lparam
);
}
void
Win32Window
::
TrackMouseLeaveEvent
(
HWND
hwnd
)
{
if
(
!
tracking_mouse_leave_
)
{
TRACKMOUSEEVENT
tme
;
tme
.
cbSize
=
sizeof
(
tme
);
tme
.
hwndTrack
=
hwnd
;
tme
.
dwFlags
=
TME_LEAVE
;
TrackMouseEvent
(
&
tme
);
tracking_mouse_leave_
=
true
;
}
}
LRESULT
Win32Window
::
MessageHandler
(
HWND
hwnd
,
UINT
const
message
,
...
...
@@ -120,7 +131,6 @@ Win32Window::MessageHandler(HWND hwnd,
window
->
OnClose
();
return
0
;
break
;
case
WM_SIZE
:
width
=
LOWORD
(
lparam
);
height
=
HIWORD
(
lparam
);
...
...
@@ -133,12 +143,20 @@ Win32Window::MessageHandler(HWND hwnd,
window
->
OnFontChange
();
break
;
case
WM_MOUSEMOVE
:
window
->
TrackMouseLeaveEvent
(
hwnd
);
xPos
=
GET_X_LPARAM
(
lparam
);
yPos
=
GET_Y_LPARAM
(
lparam
);
window
->
OnPointerMove
(
static_cast
<
double
>
(
xPos
),
static_cast
<
double
>
(
yPos
));
break
;
case
WM_MOUSELEAVE
:;
window
->
OnPointerLeave
();
// Once the tracked event is received, the TrackMouseEvent function
// resets. Set to false to make sure it's called once mouse movement is
// detected again.
tracking_mouse_leave_
=
false
;
break
;
case
WM_LBUTTONDOWN
:
xPos
=
GET_X_LPARAM
(
lparam
);
yPos
=
GET_Y_LPARAM
(
lparam
);
...
...
shell/platform/windows/win32_window.h
浏览文件 @
035c9dbf
...
...
@@ -88,6 +88,9 @@ class Win32Window {
// down to up
virtual
void
OnPointerUp
(
double
x
,
double
y
)
=
0
;
// Called when the mouse leaves the window.
virtual
void
OnPointerLeave
()
=
0
;
// Called when character input occurs.
virtual
void
OnChar
(
char32_t
code_point
)
=
0
;
...
...
@@ -110,6 +113,9 @@ class Win32Window {
UINT
GetCurrentHeight
();
private:
// Activates tracking for a "mouse leave" event.
void
TrackMouseLeaveEvent
(
HWND
hwnd
);
// Stores new width and height and calls |OnResize| to notify inheritors
void
HandleResize
(
UINT
width
,
UINT
height
);
...
...
@@ -133,6 +139,9 @@ class Win32Window {
// aspects of win32 High DPI handling across different OS versions.
std
::
unique_ptr
<
Win32DpiHelper
>
dpi_helper_
=
std
::
make_unique
<
Win32DpiHelper
>
();
// Set to true to be notified when the mouse leaves the window.
bool
tracking_mouse_leave_
=
false
;
};
}
// namespace flutter
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录