wengxt / gnome-shell-extension-kimpanel

KDE kimpanel protocol for gnome shell
GNU General Public License v2.0
139 stars 26 forks source link

使用 wayland 后端异常退出的 SDL2 程序会使得 kimpanel 失去焦点 #65

Closed taoky closed 2 years ago

taoky commented 2 years ago

最小复现样例:

#include <SDL2/SDL.h>
#include <assert.h>
#include <stdio.h>

int main(int argc, char* argv[]) {
    SDL_Window *window;
    SDL_Init(SDL_INIT_VIDEO);

    window = SDL_CreateWindow(
            "An SDL2 window",
            SDL_WINDOWPOS_UNDEFINED,
            SDL_WINDOWPOS_UNDEFINED,
            640,
            480,
            SDL_WINDOW_SHOWN
    );

    if (window == NULL) {
        printf("Could not create window: %s\n", SDL_GetError());
        return 1;
    }

    SDL_Delay(2000);
    assert(0);  // Simulate a crash

    SDL_DestroyWindow(window);
    SDL_Quit();
    return 0;
}

使用 gcc test.c -lSDL2 编译后在 SDL_VIDEODRIVER=x11 下不会使得 kimpanel 失去焦点,但在 SDL_VIDEODRIVER=wayland 下当程序触发 assert 退出后,kimpanel 会失去焦点,无法在其他窗口中输入文字,在打开 GNOME 的 Activities 后的搜索框中用 kimpanel 输入后可以恢复正常。

大概影响不大(SDL2 程序目前即使在 wayland 下默认也是以 x11 后端打开),不过对于有在 SDL2 wayland 后端下调试程序的需求的人来说会稍微有点烦人。

此外,journalctl -f /usr/bin/gnome-shell 在执行以上程序后一段时间有可能出现以下的 log:

Aug 30 20:15:28 hostname gnome-shell[1450744]: Window manager warning: last_user_time (739209140) is greater than comparison timestamp (739208988).  This most likely represents a buggy client sending inaccurate timestamps in messages such as _NET_ACTIVE_WINDOW.  Trying to work around...
Aug 30 20:15:28 hostname gnome-shell[1450744]: Window manager warning: W1646 appears to be one of the offending windows with a timestamp of 739209140.  Working around...

不确定是否与这个问题有关。

版本信息:

wengxt commented 2 years ago

大概率是这个问题 https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4776