mono / xwt

A cross-platform UI toolkit for creating desktop applications with .NET and Mono
MIT License
1.36k stars 241 forks source link

Problems with Window.ScreenBounds, Decorations, Window.Size #480

Open sevoku opened 9 years ago

sevoku commented 9 years ago

I think we have some problems with the Window sizing and Decorations. At least on Gtk the backend bounds do not include the decorations and GetMetrics takes only the menu and not the decorations (size difference between Gtk.Window and Gdk.Window) into account. As I understand, ScreenBounds (and X, Y, Width, Height) should include all decorations and Size only the client (without decorations/menu, but its bound to / is always the same as ScreenBounds.Size). And the backend implementations are inconsistent.

I think we need some clearance here. ScreenBounds should always contain ALL decorations and we should add a Bounds (or maybe ClientBounds) property which includes only the content. The default X,Y,Widht,Heigh should include the decorations, too (directly bound to ScreenBounds, like before).

sevoku commented 9 years ago

After some more investigation, I found that the Coordinates test (https://github.com/mono/xwt/blob/master/Testing/Tests/WidgetTests.cs#L304) can not be passed, cause the padding includes the inner padding between client side and the content. But ScreenBounds contain additionally the decorations. So the test should use the proposed ClientBounds as a reference (still taking the Padding property into account)

I think GetMetrics should return a WidgetSpacing instead of the Size of the decoration. So all sides of the window (not only the top) can be handled by Window.AdjustSize (https://github.com/mono/xwt/blob/master/Xwt/Xwt/Window.cs#L197)