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

Override redirect Popup menu type window under Xwayland can not be displayed on the second XMapWindow. #2172

Open
wengxt opened this issue Dec 17, 2024 · 3 comments

Comments

@wengxt
Copy link

wengxt commented Dec 17, 2024

What Happened?

For override redirect window that has popup menu ewmh window type, if it's mapped and unmapped once, any following map will not be able to make window visible.

Steps to Reproduce

  1. Minimum test code
#include <iostream>
#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <unistd.h>
int main() {
    
    Display* display = XOpenDisplay(nullptr);
    Window w = XCreateSimpleWindow(display, DefaultRootWindow(display), 100, 100, 100, 100, 0, 0, 0);
    XSetWindowAttributes a;
    a.override_redirect = True;
    XChangeWindowAttributes(display, w, CWOverrideRedirect, &a);
    auto windowType = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);

    auto popup = XInternAtom(display, "_NET_WM_WINDOW_TYPE_POPUP_MENU", False);
    XChangeProperty(display, w, windowType, XA_ATOM, 32, PropModeReplace, (const unsigned char *)&popup, 1);
    XSelectInput(display, w, ExposureMask);
    XMapRaised(display, w);
    XFlush(display);
    sleep(3);
    XUnmapWindow(display, w);
    XFlush(display);
    sleep(3);
    XMapRaised(display, w);
    XFlush(display);
    XEvent event;
    while (XNextEvent(display, &event) == 0) {
        std::cout << event.type << std::endl;

    }
    return 0;
}
  1. g++ main.cpp -lX11
  2. ./a.out

Expected Behavior

The code maps a window for 3 seconds, then unmap it for 3 seconds. And map again.
On the second map, the window is not visible.

This only happens when using Secure Session, Classic Session is work as expected.

Video under secure session:

secure-session.mp4

Video under classic session:

classic-session.mp4

OS Version

8.x (Circe)

Session Type

Secure Session (Wayland)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

VirtualBox

@leolost2605
Copy link
Member

This might be a mutter bug: https://gitlab.gnome.org/GNOME/mutter/-/issues/2732

@wengxt
Copy link
Author

wengxt commented Dec 17, 2024

@leolost2605 I tried gnome-shell on the exact same system, and doesn't have the same issue. (gnome-shell --version shows 46.0)

Also, the app in https://gitlab.gnome.org/GNOME/mutter/-/issues/2732 is an gtk app, very likely is running under native wayland, not the Xwayland in this report.

@leolost2605
Copy link
Member

Hmm I admit I didn't take a very close look at the bug report I linked because I didn't think that this is Gala specific since we don't do a whole lot of the low level stuff...

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