Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard focus does not work when using zink #30

Open
LaserEyess opened this issue Nov 5, 2023 · 3 comments
Open

Keyboard focus does not work when using zink #30

LaserEyess opened this issue Nov 5, 2023 · 3 comments

Comments

@LaserEyess
Copy link

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
#include <gtk/gtk.h>
#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
Copy link
Author

@wmww
Copy link
Owner

wmww commented Nov 7, 2023

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 #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.

@wmww wmww closed this as completed Nov 7, 2023
@LaserEyess
Copy link
Author

LaserEyess commented Nov 8, 2023

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

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

@wmww wmww reopened this Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants