Fix T42489 / T52936

Authored by LazyDodo (LazyDodo) on Oct 4 2017, 4:46 PM.



This patch band-aids (not super happy with the solution, but also don't really see a nicer way) the issues with minimized windows in T42489 / T52936

Problem seems to be coming from the initial layout of the window, if the window is too small or has a bogus width and height, the layout engine kinda goes wonky. (haven't looked into why, but it's easy to guess what could go wrong there) , on top of that on windows you do not get sane values for `GetClientRect` on minimized windows. This patch band-aids the issue by checking if the newly created window has a valid size and only overwrite the stored values if that is the case.

Diff Detail

rB Blender
LazyDodo (LazyDodo) created this revision.

Added missing space in comment

Changes in ghost seems fine to me. Some suggestion on blender side, but i'm not really expert in this area.


Should it be more explicit check here? Like

if (GHOST_GetWindowState(win->ghostwin) == GHOST_kWindowStateMinimized) {

Or at least avoid calling GHOST_Get{Width,Height}Rectangle twice.


tested with

if (GHOST_GetWindowState(win->ghostwin) != GHOST_kWindowStateMinimized) {

and while this works equally well, it might change behavior on platforms that do give sane values for non visible windows.

Your call really, i have no strong preference here.


But why would we want to update size of invisible windows to begin with? :)

It's not my call, i'll leave the call to someome more familiar here :P Both ways are fine to me.

Seems fine generally. We could also add an assert in GHOST_GetClientBounds for this.


We do a similar test in ghost_event_proc, I prefer to do the same here.

/* win32: gives undefined window size when minimized */
if (state != GHOST_kWindowStateMinimized) {
LazyDodo (LazyDodo) marked an inline comment as done.

updated with feedback

This revision is now accepted and ready to land.Oct 4 2017, 7:34 PM
This revision was automatically updated to reflect the committed changes.