Repository: flutter
Issue: [Windows] Consider adding initial screen center position
Labels: c: new feature,engine,platform-windows,a: quality,c: proposal,a: desktop,P3,team-windows,triaged-windows

Change win32_window.cpp CreateAndShow onto something like this:

New code (edited on March 3rd 2024):
```c++
bool Win32Window::Create(const std::wstring& title,
                         const Point& origin,
                         const Size& size) {
  Destroy();

  const wchar_t* window_class =
      WindowClassRegistrar::GetInstance()->GetWindowClass();

  const POINT target_point = {static_cast<LONG>(origin.x),
                              static_cast<LONG>(origin.y)};
  HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
  UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
  double scale_factor = dpi / 96.0;

  // Get screen sizes to calculate offsets including windows taskbar height
  int screenWidth = GetSystemMetrics(SM_CXSCREEN);
  int screenHeight = GetSystemMetrics(SM_CYSCREEN);

  // Calculate window offset from the left side of the screen depending on current
  // system scale factor
  int left = static_cast<int>((screenWidth / 2) - Scale(size.width / 2, scale_factor));

  // Calculate window offset from top upper side of the screen depending on current
  // system scale factor
  int top =  static_cast<int>((screenHeight / 2) - Scale(size.height / 2, scale_factor));

  HWND window = CreateWindow(
      window_class, title.c_str(), WS_OVERLAPPEDWINDOW,
      left, top,
      Scale(size.width, scale_factor), Scale(size.height, scale_factor),
      nullptr, nullptr, GetModuleHandle(nullptr), this);

  if (!window) {
    return false;
  }

  UpdateTheme(window);

  return OnCreate();
}
```

Old code:
```
bool Win32Window::CreateAndShow(const std::wstring& title,
                                const Point& origin,
                                const Size& size) {
  Destroy();

  const wchar_t* window_class =
      WindowClassRegistrar::GetInstance()->GetWindowClass();

  const POINT target_point = {static_cast<LONG>(origin.x),
                              static_cast<LONG>(origin.y)};
  HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST);
  UINT dpi = FlutterDesktopGetDpiForMonitor(monitor);
  double scale_factor = dpi / 96.0;

  // Get screen sizes to calculate offsets
  int screenWidth = GetSystemMetrics(SM_CXFULLSCREEN);
  int screenHeight = GetSystemMetrics(SM_CYFULLSCREEN);

  // Calculate window offset from the left side of the screen depending on current
  // system scale factor
  int left = Scale(screenWidth / 2, scale_factor) - Scale(size.width / 2, scale_factor);

  // Calculate window offset from top upper side of the screen depending on current
  // system scale factor 
  int top = Scale(screenHeight / 2, scale_factor) - Scale(size.height / 2, scale_factor);

  HWND window = CreateWindow(
    window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE,
    left, top,
    Scale(size.width, scale_factor), Scale(size.height, scale_factor),
    nullptr, nullptr, GetModuleHandle(nullptr), this);

  if (!window) {
    return false;
  }

  return OnCreate();
}
```
To prevent such situations when user has upper tabbar and cannot move application's window (especially useful when window' flags are WS_CAPTION or WS_POPUP and resizing is not even present)
![image](https://user-images.githubusercontent.com/63228361/125187683-78a49f80-e239-11eb-9107-7e72574bbb25.png)