alex-ong / NESTrisOCR

OCR for statistics in NESTris
24 stars 7 forks source link

Cleanup OSX classes to not use fake hwnd #6

Closed timotheeg closed 5 years ago

timotheeg commented 5 years ago

The osx Quartz classes were using a hackish data structure that was pretending to be "like" the hwnd of win32. The data structure contained the window ID, position, and size of the desired window.

This PR refactors both osx classes such that the window manager now only returns and cares about hwnd as window IDs, while the Capture class is the one that will fetch and use the position of the window.

The resulting code for osx is now much more like its win32 counterpart.

The PR also fixes OSX for cases where the window moves. Since hwnd was containing the window position, the change from getWindow() to checkWindow(), which was no longer updating hwnd, caused capture areas to have incorrect offsets when the window moved.