KSelectionWatcher Class
ICCCM manager selection watching. More...
Header: | #include <KSelectionWatcher> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KWindowSystem) target_link_libraries(mytarget PRIVATE KF6::KWindowSystem) |
Inherits: | QObject |
Public Functions
KSelectionWatcher(xcb_atom_t selection, int screen = -1, QObject *parent = nullptr) | |
KSelectionWatcher(const char *selection, int screen = -1, QObject *parent = nullptr) | |
(since 5.8) | KSelectionWatcher(const char *selection, xcb_connection_t *c, xcb_window_t root, QObject *parent = nullptr) |
(since 5.8) | KSelectionWatcher(xcb_atom_t selection, xcb_connection_t *c, xcb_window_t root, QObject *parent = nullptr) |
xcb_window_t | owner() |
Signals
Detailed Description
This class implements watching manager selections, as described in the ICCCM section 2.8. It emits signal newOwner() when a new owner claim the selection, and emits lostOwner() when the selection ownership is given up. To find out current owner of the selection, owner() can be used.
This class is only useful on the xcb platform. On other platforms the code is only functional if the constructor overloads taking an xcb_connection_t are used. In case you inherit from this class ensure that you don't use xcb and/or XLib without verifying the platform.
Member Function Documentation
[explicit]
KSelectionWatcher::KSelectionWatcher(xcb_atom_t selection, int screen = -1, QObject *parent = nullptr)
This constructor initializes the object, but doesn't perform any operation on the selection.
selection atom representing the manager selection
screen X screen, or -1 for default
parent parent object, or nullptr if there is none
[explicit]
KSelectionWatcher::KSelectionWatcher(const char *selection, int screen = -1, QObject *parent = nullptr)
This is an overloaded function.
This constructor accepts the selection name and creates the appropriate atom for it automatically.
selection name of the manager selection
screen X screen, or -1 for default
parent parent object, or nullptr if there is none
[explicit, since 5.8]
KSelectionWatcher::KSelectionWatcher(const char *selection, xcb_connection_t *c, xcb_window_t root, QObject *parent = nullptr)
This is an overloaded function.
This constructor accepts the xcb_connection_t and root window and doesn't depend on running on the xcb platform. Otherwise this constructor behaves like the similar one without the xcb_connection_t.
selection name of the manager selection
c the xcb connection this KSelectionWatcher should use
root the root window this KSelectionWatcher should use
This function was introduced in 5.8.
[explicit, since 5.8]
KSelectionWatcher::KSelectionWatcher(xcb_atom_t selection, xcb_connection_t *c, xcb_window_t root, QObject *parent = nullptr)
This is an overloaded function.
This constructor accepts the xcb_connection_t and root window and doesn't depend on running on the xcb platform. Otherwise this constructor behaves like the similar one without the xcb_connection_t.
selection atom representing the manager selection
c the xcb connection this KSelectionWatcher should use
root the root window this KSelectionWatcher should use
This function was introduced in 5.8.
[signal]
void KSelectionWatcher::lostOwner()
This signal is emitted when the selection is given up, i.e. there's no owner. Note that the selection may be immediately claimed again, so the newOwner() signal may be emitted right after this one. It's safe to delete the instance in a slot connected to this signal.
[signal]
void KSelectionWatcher::newOwner(xcb_window_t owner)
This signal is emitted when the selection is successfully claimed by a new owner.
owner the new owner of the selection
xcb_window_t KSelectionWatcher::owner()
Return the current owner of the manager selection, if any. Note that if the event informing about the owner change is still in the input queue, newOwner() might have been emitted yet.