Skip to content

Commit

Permalink
Workaround for picoe/Eto#2601
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanfish committed Mar 16, 2024
1 parent f903747 commit 3186ffd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions NAPS2.Lib.Gtk/EtoForms/Gtk/GtkEtoPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public override IMemoryImage DrawHourglass(ImageContext imageContext, IMemoryIma

public override void SetFrame(Control container, Control control, Point location, Size size, bool inOverlay)
{
var overlay = (GTK.Overlay) container.ToNative();
var overlay = (GTK.Overlay) ((GTK.EventBox) container.ToNative()).Child;
var widget = control.ToNative();
if (inOverlay)
{
Expand All @@ -90,7 +90,7 @@ public override Control CreateContainer()

public override void AddToContainer(Control container, Control control, bool inOverlay)
{
var overlay = (GTK.Overlay) container.ToNative();
var overlay = (GTK.Overlay) ((GTK.EventBox) container.ToNative()).Child;
var widget = control.ToNative();
if (inOverlay)
{
Expand All @@ -108,7 +108,7 @@ public override void AddToContainer(Control container, Control control, bool inO

public override void RemoveFromContainer(Control container, Control control)
{
var overlay = (GTK.Overlay) container.ToNative();
var overlay = (GTK.Overlay) ((GTK.EventBox) container.ToNative()).Child;
var widget = control.ToNative();
overlay.Remove(widget);
var panel = (GTK.Fixed) overlay.Children[0];
Expand All @@ -118,7 +118,7 @@ public override void RemoveFromContainer(Control container, Control control)

public override void SetContainerSize(Window _window, Control container, Size size, int padding)
{
var overlay = (GTK.Overlay) container.ToNative();
var overlay = (GTK.Overlay) ((GTK.EventBox) container.ToNative()).Child;
if (!_window.Resizable)
{
// This ensures the window has the appropriate margins, otherwise with resizable=false it changes to fit
Expand Down
3 changes: 2 additions & 1 deletion NAPS2.Lib.Gtk/EtoForms/Gtk/GtkListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public GtkListView(ListViewBehavior<T> behavior)
}
_scrolledWindow.Add(eventBox);
_scrolledWindow.StyleContext.AddClass("listview");
Control = _scrolledWindow.ToEto();
}

private void OnButtonPress(object o, ButtonPressEventArgs args)
Expand All @@ -83,7 +84,7 @@ private void OnChildActivated(object o, ChildActivatedArgs args)

public ScrolledWindow NativeControl => _scrolledWindow;

public Control Control => _scrolledWindow.ToEto();
public Control Control { get; }

public ContextMenu? ContextMenu { get; set; }

Expand Down

0 comments on commit 3186ffd

Please sign in to comment.