wewinsize.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * wewinsize.exe <client width> <client height> - resizes live WE's -playInWindow window from inside Wine the way a
  3. * user drag does on Windows: SetWindowPos on the WPEOverlappedWallpaper window (WE 2.8.42 sub_14011E9D0, style
  4. * 0xCF0000), outer size from AdjustWindowRectEx so the client area gets the requested size. WE's WM_SIZE
  5. * (sub_14011E8E0) then hands the client rect to the wallpaper, which moves its render window and resizes the
  6. * swap chain and scene (sub_140115B90 -> sub_14017F1B0). Prints the client rect it ends up with.
  7. */
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <windows.h>
  11. int main (int argc, char** argv) {
  12. if (argc < 3) {
  13. fprintf (stderr, "usage: wewinsize.exe <client width> <client height>\n");
  14. return 2;
  15. }
  16. HWND window = FindWindowW (L"WPEOverlappedWallpaper", NULL);
  17. if (window == NULL) {
  18. fprintf (stderr, "no WPEOverlappedWallpaper window\n");
  19. return 1;
  20. }
  21. RECT rect = { 0, 0, atoi (argv[1]), atoi (argv[2]) };
  22. AdjustWindowRectEx (&rect, (DWORD) GetWindowLongW (window, GWL_STYLE), FALSE, (DWORD) GetWindowLongW (window, GWL_EXSTYLE));
  23. SetWindowPos (window, NULL, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
  24. RECT client;
  25. POINT origin = { 0, 0 };
  26. GetClientRect (window, &client);
  27. ClientToScreen (window, &origin);
  28. printf ("%ld %ld %ld %ld\n", origin.x, origin.y, client.right, client.bottom);
  29. return 0;
  30. }