Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2d02c70a
Unverified
Commit
2d02c70a
authored
Aug 31, 2020
by
James Clarke
Committed by
GitHub
Aug 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Windows] Fix unnecessary surface creation/destruction in startup path (#63301)
parent
6d1242dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
flutter_window.cpp
...ools/templates/app/windows.tmpl/runner/flutter_window.cpp
+4
-2
win32_window.cpp
..._tools/templates/app/windows.tmpl/runner/win32_window.cpp
+8
-4
win32_window.h
...er_tools/templates/app/windows.tmpl/runner/win32_window.h
+3
-0
No files found.
packages/flutter_tools/templates/app/windows.tmpl/runner/flutter_window.cpp
View file @
2d02c70a
...
@@ -15,9 +15,11 @@ bool FlutterWindow::OnCreate() {
...
@@ -15,9 +15,11 @@ bool FlutterWindow::OnCreate() {
return
false
;
return
false
;
}
}
// The size here is arbitrary since SetChildContent will resize it.
RECT
frame
=
GetClientArea
();
// The size here must match the window dimensions to avoid unnecessary surface creation / destruction in the startup path.
flutter_controller_
=
flutter_controller_
=
std
::
make_unique
<
flutter
::
FlutterViewController
>
(
100
,
100
,
project_
);
std
::
make_unique
<
flutter
::
FlutterViewController
>
(
frame
.
right
-
frame
.
left
,
frame
.
bottom
-
frame
.
top
,
project_
);
// Ensure that basic setup of the controller was successful.
// Ensure that basic setup of the controller was successful.
if
(
!
flutter_controller_
->
engine
()
||
!
flutter_controller_
->
view
())
{
if
(
!
flutter_controller_
->
engine
()
||
!
flutter_controller_
->
view
())
{
return
false
;
return
false
;
...
...
packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.cpp
View file @
2d02c70a
...
@@ -174,8 +174,7 @@ Win32Window::MessageHandler(HWND hwnd,
...
@@ -174,8 +174,7 @@ Win32Window::MessageHandler(HWND hwnd,
return
0
;
return
0
;
}
}
case
WM_SIZE
:
case
WM_SIZE
:
RECT
rect
;
RECT
rect
=
GetClientArea
();
GetClientRect
(
hwnd
,
&
rect
);
if
(
child_content_
!=
nullptr
)
{
if
(
child_content_
!=
nullptr
)
{
// Size and position the child window.
// Size and position the child window.
MoveWindow
(
child_content_
,
rect
.
left
,
rect
.
top
,
rect
.
right
-
rect
.
left
,
MoveWindow
(
child_content_
,
rect
.
left
,
rect
.
top
,
rect
.
right
-
rect
.
left
,
...
@@ -218,8 +217,7 @@ Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
...
@@ -218,8 +217,7 @@ Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept {
void
Win32Window
::
SetChildContent
(
HWND
content
)
{
void
Win32Window
::
SetChildContent
(
HWND
content
)
{
child_content_
=
content
;
child_content_
=
content
;
SetParent
(
content
,
window_handle_
);
SetParent
(
content
,
window_handle_
);
RECT
frame
;
RECT
frame
=
GetClientArea
();
GetClientRect
(
window_handle_
,
&
frame
);
MoveWindow
(
content
,
frame
.
left
,
frame
.
top
,
frame
.
right
-
frame
.
left
,
MoveWindow
(
content
,
frame
.
left
,
frame
.
top
,
frame
.
right
-
frame
.
left
,
frame
.
bottom
-
frame
.
top
,
true
);
frame
.
bottom
-
frame
.
top
,
true
);
...
@@ -227,6 +225,12 @@ void Win32Window::SetChildContent(HWND content) {
...
@@ -227,6 +225,12 @@ void Win32Window::SetChildContent(HWND content) {
SetFocus
(
child_content_
);
SetFocus
(
child_content_
);
}
}
RECT
Win32Window
::
GetClientArea
()
{
RECT
frame
;
GetClientRect
(
window_handle_
,
&
frame
);
return
frame
;
}
HWND
Win32Window
::
GetHandle
()
{
HWND
Win32Window
::
GetHandle
()
{
return
window_handle_
;
return
window_handle_
;
}
}
...
...
packages/flutter_tools/templates/app/windows.tmpl/runner/win32_window.h
View file @
2d02c70a
...
@@ -52,6 +52,9 @@ class Win32Window {
...
@@ -52,6 +52,9 @@ class Win32Window {
// If true, closing this window will quit the application.
// If true, closing this window will quit the application.
void
SetQuitOnClose
(
bool
quit_on_close
);
void
SetQuitOnClose
(
bool
quit_on_close
);
// Return a RECT representing the bounds of the current client area.
RECT
GetClientArea
();
protected
:
protected
:
// Processes and route salient window messages for mouse handling,
// Processes and route salient window messages for mouse handling,
// size change and DPI. Delegates handling of these to member overloads that
// size change and DPI. Delegates handling of these to member overloads that
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment