Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions example/windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
// Version
//

#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else
#define VERSION_AS_NUMBER 1,0,0
#define VERSION_AS_NUMBER 1,0,0,0
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING FLUTTER_VERSION
#else
#define VERSION_AS_STRING "1.0.0"
#endif
Expand Down
7 changes: 7 additions & 0 deletions lib/src/window_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,13 @@ class WindowManager {
'isFullScreen': isFullScreen,
};
await _channel.invokeMethod('setFullScreen', arguments);
// (Windows) Force refresh the app so it 's back to the correct size
// (see GitHub issue #311)
if (!isFullScreen && Platform.isWindows) {
final size = await getSize();
setSize(size + const Offset(1, 1));
setSize(size);
}
}

/// This will make a window maintain an aspect ratio.
Expand Down
5 changes: 0 additions & 5 deletions windows/window_manager_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,6 @@ std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc(HWND hWnd,
// This must always be first or else the one of other two ifs will execute
// when window is in full screen and we don't want that
if (wParam && window_manager->IsFullScreen()) {
NCCALCSIZE_PARAMS* sz = reinterpret_cast<NCCALCSIZE_PARAMS*>(lParam);
sz->rgrc[0].bottom -= 3;
return 0;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're at it, can we add one more condition to ignore WM_NCCALCSIZE handling?

It won't break the plugin; we are implementing our in-house fullscreen mechanism in package:media_kit; and it will be great to have it compatible with package:window_manager.

Suggested change
if (!(GetWindowLongPtr(hWnd, GWL_STYLE) & WS_OVERLAPPEDWINDOW))
return 0;
}

Expand All @@ -132,9 +130,6 @@ std::optional<LRESULT> WindowManagerPlugin::HandleWindowProc(HWND hWnd,
sz->rgrc[0].right -= 8;
sz->rgrc[0].bottom -= 9;
}
// This cuts the app at the bottom by one pixel but that's necessary to
// prevent jitter when resizing the app
sz->rgrc[0].bottom += 1;
return 0;
}

Expand Down