wmww / gtk4-layer-shell

A library to create panels and other desktop components for Wayland using the Layer Shell protocol and GTK4
MIT License
128 stars 4 forks source link

Keyboard focus does not work when using zink #30

Open LaserEyess opened 8 months ago

LaserEyess commented 8 months ago

I'm running into a strange issue that I can't really figure out how to debug. Admittedly, this is probably (by definition) a zink bug, but I'm not sure where to begin debugging it. I'm also going to report this to mesa.

Using this code:

Minimal reproducible code ```c #include #include "gtk4-layer-shell.h" // modified from gtk4-layer-shell/examples/simple-example.c static void activate (GtkApplication* app, void *_data) { (void)_data; // Create a normal GTK window however you like GtkWindow *gtk_window = GTK_WINDOW (gtk_application_window_new (app)); // Before the window is first realized, set it up to be a layer surface gtk_layer_init_for_window (gtk_window); gtk_layer_set_layer (gtk_window, GTK_LAYER_SHELL_LAYER_TOP); gtk_layer_set_keyboard_mode (gtk_window, GTK_LAYER_SHELL_KEYBOARD_MODE_ON_DEMAND); // NONE is default // Set up a widget GtkWidget *entry = gtk_entry_new(); gtk_window_set_child (gtk_window, entry); gtk_window_present (gtk_window); gtk_window_set_default_size(gtk_window, 200, 200); } int main (int argc, char **argv) { GtkApplication * app = gtk_application_new ("com.github.wmww.gtk4-layer-shell.example", G_APPLICATION_DEFAULT_FLAGS); const char* accels[] = {"Escape", NULL}; gtk_application_set_accels_for_action(app, "window.close", accels); g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); int status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); return status; } ```

and MESA_LOADER_DRIVER_OVERRIDE=zink, keyboard focus does not work properly. With either MODE_ON_DEMAND or MODE_EXCLUSIVE. I tested this on sway master as of today. My normal driver is radeonsi.

Some logs:

LaserEyess commented 8 months ago

Mesa issue: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10102

wmww commented 8 months ago

If you were using a released version of this library it had a nasty use-after-free bug that could have been causing lots of weird problems (see https://github.com/wmww/gtk4-layer-shell/pull/27 for details). I've just released v1.0.2 which includes a fix. Please re-open if this crash persists on v1.0.2, thanks.

LaserEyess commented 8 months ago

I tested this on 14b5bf95734b9fb33270e5ef55c127ef519089ac, but even at git master it didn't work.

@wmww I can't reopen the issue but it very much still is an issue