zipplet / windowsizer

Window resizer tool for Windows programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve window size detection for automatic scaling

zipplet opened this issue · comments

Window size detection does not work with many games, nonsense sizes will be detected like this (example from VisualArts RealLive):

Loading settings from: D:\Games\visualnovel\Kanon\windowsizer.ini
Window find method: PID only
Display resolution: 2560 x 1440
*** Launching program ***
Program started, PID = 23312
Will lock window size
NeedToFindWindow!
FindWindow failed
NeedToFindWindow!
Border size [autodetect]: 6 x 49 <- NONSENSE BORDER HEIGHT
Original window size: 2560 x 1440 <- NONSENSE WINDOW SIZE
Original window client size: 2554 x 1391

This leads to an unnecessary number of profiles needing a forced border size to be scaled correctly like the following:

; -----------------------------------------------------------------------------
; Advanced options to tweak windowsizer for difficult programs and edge cases
; -----------------------------------------------------------------------------
[tweaks]

; Manually specify a border size or autodetect the border size of the window?
; 1 = autodetect, 0 = manually specify
autodetectbordersize=0

; If not autodetecting the border size, specify it below in pixels. The window
; size is calculated like this:
; Window width = client width + border width
; Window height = client height + border height
; The border width/height includes the frame, titlebar and menu.
borderwidth=6
borderheight=29

It also means that you can't specify a scale factor (e.g. 200%), you need to manually define a window size when autodetection fails.

Improve the logic behind window size / border size detection to prevent this.