mirror of
https://invent.kde.org/plasma/layer-shell-qt.git
synced 2025-07-14 02:54:31 -04:00
Compare commits
5 Commits
work/zzag/
...
master
Author | SHA1 | Date | |
---|---|---|---|
7a074a3684 | |||
8b54edb695 | |||
ffa33fef9f | |||
3522070454 | |||
80d5e3c935 |
@ -4,13 +4,13 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(layershellqt)
|
||||
set(PROJECT_VERSION "6.3.80")
|
||||
set(PROJECT_VERSION "6.4.80")
|
||||
set(PROJECT_VERSION_MAJOR 6)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
||||
set(QT_MIN_VERSION "6.7.0")
|
||||
set(KF6_MIN_VERSION "6.10.0")
|
||||
set(QT_MIN_VERSION "6.8.0")
|
||||
set(KF6_MIN_VERSION "6.14.0")
|
||||
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
|
@ -32,6 +32,7 @@ public:
|
||||
Window::KeyboardInteractivity keyboardInteractivity = Window::KeyboardInteractivityOnDemand;
|
||||
Window::Layer layer = Window::LayerTop;
|
||||
QMargins margins;
|
||||
QSize desiredSize = QSize(0, 0);
|
||||
Window::ScreenConfiguration screenConfiguration = Window::ScreenFromQWindow;
|
||||
bool closeOnDismissed = true;
|
||||
};
|
||||
@ -97,6 +98,21 @@ QMargins Window::margins() const
|
||||
return d->margins;
|
||||
}
|
||||
|
||||
void Window::setDesiredSize(const QSize &size)
|
||||
{
|
||||
if (size == d->desiredSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
d->desiredSize = size;
|
||||
Q_EMIT desiredSizeChanged();
|
||||
}
|
||||
|
||||
QSize Window::desiredSize() const
|
||||
{
|
||||
return d->desiredSize;
|
||||
}
|
||||
|
||||
void Window::setKeyboardInteractivity(KeyboardInteractivity interactivity)
|
||||
{
|
||||
if (d->keyboardInteractivity != interactivity) {
|
||||
|
@ -86,6 +86,9 @@ public:
|
||||
void setMargins(const QMargins &margins);
|
||||
QMargins margins() const;
|
||||
|
||||
void setDesiredSize(const QSize &size);
|
||||
QSize desiredSize() const;
|
||||
|
||||
void setKeyboardInteractivity(KeyboardInteractivity interactivity);
|
||||
KeyboardInteractivity keyboardInteractivity() const;
|
||||
|
||||
@ -127,6 +130,7 @@ Q_SIGNALS:
|
||||
void exclusionZoneChanged();
|
||||
void exclusiveEdgeChanged();
|
||||
void marginsChanged();
|
||||
void desiredSizeChanged();
|
||||
void keyboardInteractivityChanged();
|
||||
void layerChanged();
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
namespace LayerShellQt
|
||||
{
|
||||
QWaylandLayerShellIntegration::QWaylandLayerShellIntegration()
|
||||
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(6)
|
||||
: QWaylandShellIntegrationTemplate<QWaylandLayerShellIntegration>(5)
|
||||
, m_xdgActivation(new QWaylandXdgActivationV1)
|
||||
{
|
||||
}
|
||||
|
@ -44,7 +44,11 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
||||
setAnchor(m_interface->anchors());
|
||||
connect(m_interface, &Window::anchorsChanged, this, [this]() {
|
||||
setAnchor(m_interface->anchors());
|
||||
setDesiredSize(m_window->windowContentGeometry().size());
|
||||
if (m_interface->desiredSize().isNull()) {
|
||||
setDesiredSize(m_window->windowContentGeometry().size());
|
||||
} else {
|
||||
setDesiredSize(m_interface->desiredSize());
|
||||
}
|
||||
});
|
||||
|
||||
setExclusiveZone(m_interface->exclusionZone());
|
||||
@ -61,12 +65,22 @@ QWaylandLayerSurface::QWaylandLayerSurface(QWaylandLayerShellIntegration *shell,
|
||||
setMargins(m_interface->margins());
|
||||
});
|
||||
|
||||
connect(m_interface, &Window::desiredSizeChanged, this, [this]() {
|
||||
if (!m_interface->desiredSize().isNull()) {
|
||||
setDesiredSize(m_interface->desiredSize());
|
||||
}
|
||||
});
|
||||
|
||||
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
||||
connect(m_interface, &Window::keyboardInteractivityChanged, this, [this]() {
|
||||
setKeyboardInteractivity(m_interface->keyboardInteractivity());
|
||||
});
|
||||
|
||||
setDesiredSize(window->windowContentGeometry().size());
|
||||
if (m_interface->desiredSize().isNull()) {
|
||||
setDesiredSize(window->windowContentGeometry().size());
|
||||
} else {
|
||||
setDesiredSize(m_interface->desiredSize());
|
||||
}
|
||||
}
|
||||
|
||||
QWaylandLayerSurface::~QWaylandLayerSurface()
|
||||
@ -74,11 +88,6 @@ QWaylandLayerSurface::~QWaylandLayerSurface()
|
||||
destroy();
|
||||
}
|
||||
|
||||
bool QWaylandLayerSurface::isExposed() const
|
||||
{
|
||||
return m_configured && !m_waitingForRearrange;
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
|
||||
{
|
||||
if (m_interface->closeOnDismissed()) {
|
||||
@ -86,15 +95,6 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_closed()
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_rearranged(uint32_t serial)
|
||||
{
|
||||
qDebug() << serial << m_arrangeSerial;
|
||||
if (m_arrangeSerial == serial) {
|
||||
qDebug() << "unset rearrange";
|
||||
m_waitingForRearrange = false;
|
||||
}
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height)
|
||||
{
|
||||
ack_configure(serial);
|
||||
@ -103,6 +103,7 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint
|
||||
if (!m_configured) {
|
||||
m_configured = true;
|
||||
applyConfigure();
|
||||
sendExpose();
|
||||
} else {
|
||||
// Later configures are resizes, so we have to queue them up for a time when we
|
||||
// are not painting to the window.
|
||||
@ -130,7 +131,6 @@ void QWaylandLayerSurface::applyConfigure()
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
||||
m_configuring = false;
|
||||
#endif
|
||||
window()->updateExposure();
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
||||
@ -146,16 +146,6 @@ void QWaylandLayerSurface::setDesiredSize(const QSize &size)
|
||||
effectiveSize.setHeight(0);
|
||||
}
|
||||
set_size(effectiveSize.width(), effectiveSize.height());
|
||||
|
||||
static quint32 token = 0;
|
||||
m_waitingForRearrange = true;
|
||||
m_arrangeSerial = ++token;
|
||||
set_arrange_token(m_arrangeSerial);
|
||||
window()->updateExposure();
|
||||
if (!window()->isExposed()) {
|
||||
window()->commit(); // FIXME: ugly
|
||||
}
|
||||
qDebug() << "request reposition" << m_arrangeSerial;
|
||||
}
|
||||
|
||||
void QWaylandLayerSurface::setAnchor(uint anchor)
|
||||
@ -198,12 +188,16 @@ void QWaylandLayerSurface::setWindowGeometry(const QRect &geometry)
|
||||
return;
|
||||
}
|
||||
|
||||
setDesiredSize(geometry.size());
|
||||
if (m_interface->desiredSize().isNull()) {
|
||||
setDesiredSize(geometry.size());
|
||||
}
|
||||
}
|
||||
#else
|
||||
void QWaylandLayerSurface::setWindowSize(const QSize &size)
|
||||
{
|
||||
setDesiredSize(size);
|
||||
if (m_interface->desiredSize().isNull()) {
|
||||
setDesiredSize(size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -28,7 +28,10 @@ public:
|
||||
QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, QtWaylandClient::QWaylandWindow *window);
|
||||
~QWaylandLayerSurface() override;
|
||||
|
||||
bool isExposed() const override;
|
||||
bool isExposed() const override
|
||||
{
|
||||
return m_configured;
|
||||
}
|
||||
void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
|
||||
|
||||
void setDesiredSize(const QSize &size);
|
||||
@ -54,7 +57,6 @@ private:
|
||||
void sendExpose();
|
||||
void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;
|
||||
void zwlr_layer_surface_v1_closed() override;
|
||||
void zwlr_layer_surface_v1_rearranged(uint32_t token) override;
|
||||
|
||||
QWaylandLayerShellIntegration *m_shell;
|
||||
LayerShellQt::Window *m_interface;
|
||||
@ -66,8 +68,6 @@ private:
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
|
||||
bool m_configuring = false;
|
||||
#endif
|
||||
quint32 m_arrangeSerial = 0;
|
||||
bool m_waitingForRearrange = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="6">
|
||||
<interface name="zwlr_layer_shell_v1" version="5">
|
||||
<description summary="create surfaces that are layers of the desktop">
|
||||
Clients can use this interface to assign the surface_layer role to
|
||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
@ -100,7 +100,7 @@
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="6">
|
||||
<interface name="zwlr_layer_surface_v1" version="5">
|
||||
<description summary="layer metadata interface">
|
||||
An interface that may be implemented by a wl_surface, for surfaces that
|
||||
are designed to be rendered as a layer of a stacked desktop-like
|
||||
@ -203,21 +203,85 @@
|
||||
<arg name="left" type="int"/>
|
||||
</request>
|
||||
|
||||
<enum name="keyboard_interactivity">
|
||||
<description summary="types of keyboard interaction possible for a layer shell surface">
|
||||
Types of keyboard interaction possible for layer shell surfaces. The
|
||||
rationale for this is twofold: (1) some applications are not interested
|
||||
in keyboard events and not allowing them to be focused can improve the
|
||||
desktop experience; (2) some applications will want to take exclusive
|
||||
keyboard focus.
|
||||
</description>
|
||||
|
||||
<entry name="none" value="0">
|
||||
<description summary="no keyboard focus is possible">
|
||||
This value indicates that this surface is not interested in keyboard
|
||||
events and the compositor should never assign it the keyboard focus.
|
||||
|
||||
This is the default value, set for newly created layer shell surfaces.
|
||||
|
||||
This is useful for e.g. desktop widgets that display information or
|
||||
only have interaction with non-keyboard input devices.
|
||||
</description>
|
||||
</entry>
|
||||
<entry name="exclusive" value="1">
|
||||
<description summary="request exclusive keyboard focus">
|
||||
Request exclusive keyboard focus if this surface is above the shell surface layer.
|
||||
|
||||
For the top and overlay layers, the seat will always give
|
||||
exclusive keyboard focus to the top-most layer which has keyboard
|
||||
interactivity set to exclusive. If this layer contains multiple
|
||||
surfaces with keyboard interactivity set to exclusive, the compositor
|
||||
determines the one receiving keyboard events in an implementation-
|
||||
defined manner. In this case, no guarantee is made when this surface
|
||||
will receive keyboard focus (if ever).
|
||||
|
||||
For the bottom and background layers, the compositor is allowed to use
|
||||
normal focus semantics.
|
||||
|
||||
This setting is mainly intended for applications that need to ensure
|
||||
they receive all keyboard events, such as a lock screen or a password
|
||||
prompt.
|
||||
</description>
|
||||
</entry>
|
||||
<entry name="on_demand" value="2" since="4">
|
||||
<description summary="request regular keyboard focus semantics">
|
||||
This requests the compositor to allow this surface to be focused and
|
||||
unfocused by the user in an implementation-defined manner. The user
|
||||
should be able to unfocus this surface even regardless of the layer
|
||||
it is on.
|
||||
|
||||
Typically, the compositor will want to use its normal mechanism to
|
||||
manage keyboard focus between layer shell surfaces with this setting
|
||||
and regular toplevels on the desktop layer (e.g. click to focus).
|
||||
Nevertheless, it is possible for a compositor to require a special
|
||||
interaction to focus or unfocus layer shell surfaces (e.g. requiring
|
||||
a click even if focus follows the mouse normally, or providing a
|
||||
keybinding to switch focus between layers).
|
||||
|
||||
This setting is mainly intended for desktop shell components (e.g.
|
||||
panels) that allow keyboard interaction. Using this option can allow
|
||||
implementing a desktop shell that can be fully usable without the
|
||||
mouse.
|
||||
</description>
|
||||
</entry>
|
||||
</enum>
|
||||
|
||||
<request name="set_keyboard_interactivity">
|
||||
<description summary="requests keyboard events">
|
||||
Set to 1 to request that the seat send keyboard events to this layer
|
||||
surface. For layers below the shell surface layer, the seat will use
|
||||
normal focus semantics. For layers above the shell surface layers, the
|
||||
seat will always give exclusive keyboard focus to the top-most layer
|
||||
which has keyboard interactivity set to true.
|
||||
Set how keyboard events are delivered to this surface. By default,
|
||||
layer shell surfaces do not receive keyboard events; this request can
|
||||
be used to change this.
|
||||
|
||||
This setting is inherited by child surfaces set by the get_popup
|
||||
request.
|
||||
|
||||
Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||
you do not want to receive them, set the input region on your surface
|
||||
to an empty region.
|
||||
|
||||
Events is double-buffered, see wl_surface.commit.
|
||||
Keyboard interactivity is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="keyboard_interactivity" type="uint"/>
|
||||
<arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/>
|
||||
</request>
|
||||
|
||||
<request name="get_popup">
|
||||
@ -302,6 +366,7 @@
|
||||
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
||||
</enum>
|
||||
|
||||
@ -338,13 +403,5 @@
|
||||
</description>
|
||||
<arg name="edge" type="uint"/>
|
||||
</request>
|
||||
|
||||
<request name="set_arrange_token" since="6">
|
||||
<arg name="token" type="uint"/>
|
||||
</request>
|
||||
|
||||
<event name="rearranged" since="6">
|
||||
<arg name="token" type="uint"/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
||||
|
Reference in New Issue
Block a user