1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
using Gtk;
using GtkLayerShell;
int main(string[] argv) {
var app = new Gtk.Application(
"com.github.wmww.gtk4-layer-shell.vala-example",
GLib.ApplicationFlags.FLAGS_NONE
);
app.activate.connect(() => {
var window = new Gtk.ApplicationWindow(app);
GtkLayerShell.init_for_window(window);
GtkLayerShell.auto_exclusive_zone_enable(window);
GtkLayerShell.set_margin(window, GtkLayerShell.Edge.TOP, 10);
GtkLayerShell.set_margin(window, GtkLayerShell.Edge.BOTTOM, 10);
GtkLayerShell.set_anchor(window, GtkLayerShell.Edge.BOTTOM, true);
var button = new Gtk.Button.with_label("Hello, World!");
button.clicked.connect(() => {
window.close();
});
window.set_child(button);
window.present();
});
return app.run(argv);
}
|