Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can not catch XCB_VISIBILITY_NOTIFY event in Qt6
Forum Updated to NodeBB v4.3 + New Features

Can not catch XCB_VISIBILITY_NOTIFY event in Qt6

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 180 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eric Yin
    wrote last edited by
    #1

    I'm able to receive event XCB_VISIBILITY_NOTIFY in Qt5 with NativeEvent and xcb connection:

    xcb_connection_t *c= QX11Info::connection();
    const uint32_t eventMask = 0x1FBFFFF;//XCB_EVENT_MASK_VISIBILITY_CHANGE|XCB_EVENT_MASK_EXPOSURE;
    xcb_change_window_attributes(c,findSubset->winId(),XCB_CW_EVENT_MASK, &eventMask);
    

    but in Qt6, i can not make it work: QX11Info is not there any more and I tried:

    xcb_connect(nullptr, nullptr);

    QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("connection");

    none works.

    1 Reply Last reply
    0
    • JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote last edited by JoeCFD
      #2

      In Qt6, the QX11Info class has been removed, and the XCB event handling approach has shifted to rely on QAbstractNativeEventFilter and native interfaces provided by QGuiApplication.

      Try to check your issue out in grok or deepseek.
      Use something like:

        auto *x11App = QGuiApplication::nativeInterface<QNativeInterface::QX11Application>();
      if (!x11App) {
              qWarning() << "Failed to get QX11Application interface";
              return -1;
          }
          xcb_connection_t *connection = x11App->connection();
          if (!connection) {
              qWarning() << "Failed to get XCB connection";
              return -1;
          }
      
      1 Reply Last reply
      1
      • E Offline
        E Offline
        Eric Yin
        wrote last edited by
        #3

        ok, thanks, your solutions work and I'm able to get the xcb connection.
        And I'm able to use xcb_change_window_attributes() (with above code using XCB_CW_EVENT_MASK) to turn on/off receiving native events for a Window (for example XCB_FOCUS_IN), but except the XCB_VISIBILITY_NOTIFY event. I just can not receive this event. is it related to something changed in Qt6?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved