Skip to content

Commit 9020ed2

Browse files
wrap the gtk Box override around a gtk4 version check
1 parent fb8704b commit 9020ed2

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

lgi/override/Gtk.lua

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,6 @@ if Gtk.Container then
219219
end
220220
end
221221

222-
-------------------------------- Gtk.Box overrides.
223-
Gtk.Box._container_add = Gtk.Box.append
224222

225223
-------------------------------- Gtk.Builder overrides.
226224
Gtk.Builder._attribute = {}
@@ -634,6 +632,25 @@ Gtk._constant.PRINT_OUTPUT_URI = 'output-uri'
634632
-- Gtk-cairo integration helpers.
635633
cairo.Context._method.should_draw_window = Gtk.cairo_should_draw_window
636634

635+
-------------------------------- Gtk-4 overrides
636+
637+
638+
if Gtk._version == '4.0' then
639+
640+
--- CONTAINER CLASSES
641+
--- GTK4 Has removed the Container abstract class.
642+
--- This means Boxes, Grids and other layout widgets
643+
--- Must now add children using their own specific methods.
644+
645+
--- Gtk.Box overrides
646+
647+
--- widgets on a the array part of the constructor of a Box
648+
--- will be `append()`-ed
649+
--- in order of appearance.
650+
Gtk.Box._container_add = Gtk.Box.append
651+
652+
end
653+
637654
--------------------------------- Gtk-2 workarounds
638655
if Gtk._version == '2.0' then
639656
-- Get rid of Gtk.Bin internal 'child' field, which gets in the way

0 commit comments

Comments
 (0)