Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Custom Wayland extensions/protocols in Qt clients
Forum Updated to NodeBB v4.3 + New Features

Custom Wayland extensions/protocols in Qt clients

Scheduled Pinned Locked Moved Solved Qt 6
8 Posts 2 Posters 1.0k Views 2 Watching
  • 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.
  • ehopperdietzelE Offline
    ehopperdietzelE Offline
    ehopperdietzel
    wrote on last edited by
    #1

    Hello, I would like to know if its possible to implement custom Wayland extensions in a Qt client? Or at least a way to get access to the wl_display handle? I've searched with no luck, and I think it would be very useful.

    JKSHJ 1 Reply Last reply
    0
    • ehopperdietzelE ehopperdietzel

      Hello, I would like to know if its possible to implement custom Wayland extensions in a Qt client? Or at least a way to get access to the wl_display handle? I've searched with no luck, and I think it would be very useful.

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi, and welcome!

      @ehopperdietzel said in Custom Wayland extensions/protocols in Qt clients:

      I would like to know if its possible to implement custom Wayland extensions in a Qt client?

      Are these what you're looking for?

      • https://doc.qt.io/qt-6/qwaylandcompositorextension.html
      • https://doc.qt.io/qt-6/qtwaylandcompositor-custom-shell-example.html

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      0
      • ehopperdietzelE Offline
        ehopperdietzelE Offline
        ehopperdietzel
        wrote on last edited by
        #3

        Hi @JKSH ! Thanks for the reply ! Sadly thats not what I am looking for, the links you provided are for implementing custom Wayland extensions in Qt compositors, or custom client shells. What I need is to implement custom extensions but in a client application (not shells). And that would be possible if I could get access to the wl_display used by the client. I think maybe QGuiApplication::QNativeInterface() could return a handle to wl_display when using the wayland or wayland-egl platform plugin, but not sure since the documentation doesn't say that. I'll check it out.

        JKSHJ 1 Reply Last reply
        0
        • ehopperdietzelE ehopperdietzel

          Hi @JKSH ! Thanks for the reply ! Sadly thats not what I am looking for, the links you provided are for implementing custom Wayland extensions in Qt compositors, or custom client shells. What I need is to implement custom extensions but in a client application (not shells). And that would be possible if I could get access to the wl_display used by the client. I think maybe QGuiApplication::QNativeInterface() could return a handle to wl_display when using the wayland or wayland-egl platform plugin, but not sure since the documentation doesn't say that. I'll check it out.

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by JKSH
          #4

          @ehopperdietzel said in Custom Wayland extensions/protocols in Qt clients:

          I think maybe QGuiApplication::QNativeInterface() could return a handle to wl_display when using the wayland or wayland-egl platform plugin, but not sure since the documentation doesn't say that. I'll check it out.

          You're definitely on the right track! I believe you want to call QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("wl_display"); on the Wayland platform.

          You can examine the source code here:

          • https://code.woboq.org/qt6/qtbase/src/gui/kernel/qguiapplication.cpp.html#_ZN15QGuiApplication23platformNativeInterfaceEv
          • https://code.woboq.org/qt6/qtwayland/src/client/qwaylandnativeinterface.cpp.html#_ZN15QtWaylandClient23QWaylandNativeInterface28nativeResourceForIntegrationERK10QByteArray
          • https://code.woboq.org/qt6/qtwayland/src/client/qwaylanddisplay_p.h.html#QtWaylandClient::wl_display

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          ehopperdietzelE 1 Reply Last reply
          3
          • JKSHJ JKSH

            @ehopperdietzel said in Custom Wayland extensions/protocols in Qt clients:

            I think maybe QGuiApplication::QNativeInterface() could return a handle to wl_display when using the wayland or wayland-egl platform plugin, but not sure since the documentation doesn't say that. I'll check it out.

            You're definitely on the right track! I believe you want to call QGuiApplication::platformNativeInterface()->nativeResourceForIntegration("wl_display"); on the Wayland platform.

            You can examine the source code here:

            • https://code.woboq.org/qt6/qtbase/src/gui/kernel/qguiapplication.cpp.html#_ZN15QGuiApplication23platformNativeInterfaceEv
            • https://code.woboq.org/qt6/qtwayland/src/client/qwaylandnativeinterface.cpp.html#_ZN15QtWaylandClient23QWaylandNativeInterface28nativeResourceForIntegrationERK10QByteArray
            • https://code.woboq.org/qt6/qtwayland/src/client/qwaylanddisplay_p.h.html#QtWaylandClient::wl_display
            ehopperdietzelE Offline
            ehopperdietzelE Offline
            ehopperdietzel
            wrote on last edited by
            #5

            OMG ! I tested it and it works !! Thank you so so much !! ❤️ @JKSH

            The QPlatformNativeInterface class is defined here if someone wondered:

            #include <QtGui/6.2.4/QtGui/qpa/qplatformnativeinterface.h>
            

            Of course you should replace 6.2.4 with the version you're using.

            JKSHJ 2 Replies Last reply
            1
            • ehopperdietzelE ehopperdietzel

              OMG ! I tested it and it works !! Thank you so so much !! ❤️ @JKSH

              The QPlatformNativeInterface class is defined here if someone wondered:

              #include <QtGui/6.2.4/QtGui/qpa/qplatformnativeinterface.h>
              

              Of course you should replace 6.2.4 with the version you're using.

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              That's great news, @ehopperdietzel !

              Just note that this is all private API, so there is a small risk that it might break in a future version of Qt.

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              1
              • ehopperdietzelE ehopperdietzel

                OMG ! I tested it and it works !! Thank you so so much !! ❤️ @JKSH

                The QPlatformNativeInterface class is defined here if someone wondered:

                #include <QtGui/6.2.4/QtGui/qpa/qplatformnativeinterface.h>
                

                Of course you should replace 6.2.4 with the version you're using.

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by
                #7

                @ehopperdietzel said in Custom Wayland extensions/protocols in Qt clients:

                #include <QtGui/6.2.4/QtGui/qpa/qplatformnativeinterface.h>
                

                Of course you should replace 6.2.4 with the version you're using.

                A somewhat more portable way is:

                1. Add the "gui-private" module to your project (e.g. QT += gui-private in your .pro file)
                2. Write #include <qpa/qplatformnativeinterface.h>

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                ehopperdietzelE 1 Reply Last reply
                1
                • JKSHJ JKSH

                  @ehopperdietzel said in Custom Wayland extensions/protocols in Qt clients:

                  #include <QtGui/6.2.4/QtGui/qpa/qplatformnativeinterface.h>
                  

                  Of course you should replace 6.2.4 with the version you're using.

                  A somewhat more portable way is:

                  1. Add the "gui-private" module to your project (e.g. QT += gui-private in your .pro file)
                  2. Write #include <qpa/qplatformnativeinterface.h>
                  ehopperdietzelE Offline
                  ehopperdietzelE Offline
                  ehopperdietzel
                  wrote on last edited by
                  #8

                  @JKSH Thank you ! I didn't know that, it's way more convenient

                  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