mono / xwt

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

FrameBox heights wrong when turning Xwt-Gtk3 widgets to Gtk3 #843

Open directhex opened 6 years ago

directhex commented 6 years ago
using System;
using Xwt;

class xwt3test
{
    [STAThread]
    static void Main () {
        Application.Initialize("Xwt.GtkBackend.GtkEngine, Xwt.Gtk3, Version=1.0.0.0");
        var mainWindow = new Gtk.Window("Xwt/Gtk Demo Application")
        {
            Title = "Xwt Demo Application",
            WidthRequest = 500,
            HeightRequest = 400
        };
        Gtk.VBox vbox1 = new Gtk.VBox();
        Xwt.VBox infoBox = new Xwt.VBox()
        {
            CanGetFocus = false
        };
        Xwt.FrameBox mbox = new Xwt.FrameBox(infoBox)
        {
            CanGetFocus = false
        };
        vbox1.PackStart((Gtk.Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget(mbox), false, false, 0);
        infoBox.PackStart(new Label("test1"));
        infoBox.PackStart(new Label("test2"));
        infoBox.PackStart(new Label("test3"));
        infoBox.PackStart(new Label("test4"));
        infoBox.PackStart(new Label("test5"));
        mainWindow.Add(vbox1);
        mainWindow.ShowAll();
        Application.Run();
        mainWindow.Dispose();
    }
}

Results in:

screenshot from 2018-07-27 13-41-58

A pure Xwt approach is fine, i.e.

using System;
using Xwt;

class xwt3test
{
    [STAThread]
    static void Main () {
        Application.Initialize("Xwt.GtkBackend.GtkEngine, Xwt.Gtk3, Version=1.0.0.0");
        var mainWindow = new Window()
        {
            Title = "Xwt Demo Application",
            Width = 500,
            Height = 400
        };
        Xwt.VBox infoBox = new Xwt.VBox()
        {
            CanGetFocus = false
        };
        Xwt.FrameBox mbox = new Xwt.FrameBox(infoBox)
        {
            CanGetFocus = false
        };
        infoBox.PackStart(new Label("test1"));
        infoBox.PackStart(new Label("test2"));
        infoBox.PackStart(new Label("test3"));
        infoBox.PackStart(new Label("test4"));
        infoBox.PackStart(new Label("test5"));
        mainWindow.Content = mbox;
        mainWindow.Show();
        Application.Run();
        mainWindow.Dispose();
    }
}

leads to

screenshot from 2018-07-27 13-45-27

This is why the text in Help/About in MonoDevelop-Gtk3 is broken.

directhex commented 6 years ago

It's the Xwt.FrameBox - putting the Xwt.VBox directly into the Gtk.VBox is fine, putting the Xwt.FrameBox containing the Xwt.VBox into the Gtk.VBox causes the compression issue above.