Move xwayland surface association logic to X11Window
This commit is contained in:
parent
2d275e16ec
commit
005b098707
5 changed files with 34 additions and 37 deletions
|
@ -649,7 +649,22 @@ void X11Window::destroyNotifyEvent(xcb_destroy_notify_event_t *e)
|
|||
*/
|
||||
void X11Window::clientMessageEvent(xcb_client_message_event_t *e)
|
||||
{
|
||||
Window::clientMessageEvent(e);
|
||||
if (e->type == atoms->wl_surface_serial) {
|
||||
m_surfaceSerial = (uint64_t(e->data.data32[1]) << 32) | e->data.data32[0];
|
||||
if (auto w = waylandServer()) {
|
||||
if (KWaylandServer::XwaylandSurfaceV1Interface *xwaylandSurface = w->xwaylandShell()->findSurface(m_surfaceSerial)) {
|
||||
setSurface(xwaylandSurface->surface());
|
||||
}
|
||||
}
|
||||
} else if (e->type == atoms->wl_surface_id) {
|
||||
m_pendingSurfaceId = e->data.data32[0];
|
||||
if (auto w = waylandServer()) {
|
||||
if (auto s = KWaylandServer::SurfaceInterface::get(m_pendingSurfaceId, w->xWaylandConnection())) {
|
||||
setSurface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (e->window != window()) {
|
||||
return; // ignore frame/wrapper
|
||||
}
|
||||
|
@ -1319,23 +1334,4 @@ void Window::propertyNotifyEvent(xcb_property_notify_event_t *e)
|
|||
}
|
||||
}
|
||||
|
||||
void Window::clientMessageEvent(xcb_client_message_event_t *e)
|
||||
{
|
||||
if (e->type == atoms->wl_surface_serial) {
|
||||
m_surfaceSerial = (uint64_t(e->data.data32[1]) << 32) | e->data.data32[0];
|
||||
if (auto w = waylandServer()) {
|
||||
if (KWaylandServer::XwaylandSurfaceV1Interface *xwaylandSurface = w->xwaylandShell()->findSurface(m_surfaceSerial)) {
|
||||
setSurface(xwaylandSurface->surface());
|
||||
}
|
||||
}
|
||||
} else if (e->type == atoms->wl_surface_id) {
|
||||
m_pendingSurfaceId = e->data.data32[0];
|
||||
if (auto w = waylandServer()) {
|
||||
if (auto s = KWaylandServer::SurfaceInterface::get(m_pendingSurfaceId, w->xWaylandConnection())) {
|
||||
setSurface(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -531,7 +531,6 @@ void Window::setSurface(KWaylandServer::SurfaceInterface *surface)
|
|||
return;
|
||||
}
|
||||
m_surface = surface;
|
||||
m_pendingSurfaceId = 0;
|
||||
Q_EMIT surfaceChanged();
|
||||
}
|
||||
|
||||
|
|
15
src/window.h
15
src/window.h
|
@ -728,8 +728,6 @@ public:
|
|||
bool skipsCloseAnimation() const;
|
||||
void setSkipCloseAnimation(bool set);
|
||||
|
||||
quint64 surfaceSerial() const;
|
||||
quint32 pendingSurfaceId() const;
|
||||
KWaylandServer::SurfaceInterface *surface() const;
|
||||
void setSurface(KWaylandServer::SurfaceInterface *surface);
|
||||
|
||||
|
@ -1494,7 +1492,6 @@ protected:
|
|||
void setWindowHandles(xcb_window_t client);
|
||||
void detectShape(xcb_window_t id);
|
||||
virtual void propertyNotifyEvent(xcb_property_notify_event_t *e);
|
||||
virtual void clientMessageEvent(xcb_client_message_event_t *e);
|
||||
Xcb::Property fetchWmClientLeader() const;
|
||||
void readWmClientLeader(Xcb::Property &p);
|
||||
void getWmClientLeader();
|
||||
|
@ -1839,8 +1836,6 @@ private:
|
|||
mutable QVector<QRectF> m_shapeRegion;
|
||||
mutable bool m_shapeRegionIsValid = false;
|
||||
bool m_skipCloseAnimation;
|
||||
quint32 m_pendingSurfaceId = 0;
|
||||
quint64 m_surfaceSerial = 0;
|
||||
QPointer<KWaylandServer::SurfaceInterface> m_surface;
|
||||
// when adding new data members, check also copyToDeleted()
|
||||
qreal m_opacity = 1.0;
|
||||
|
@ -2206,16 +2201,6 @@ inline const ClientMachine *Window::clientMachine() const
|
|||
return m_clientMachine;
|
||||
}
|
||||
|
||||
inline quint64 Window::surfaceSerial() const
|
||||
{
|
||||
return m_surfaceSerial;
|
||||
}
|
||||
|
||||
inline quint32 Window::pendingSurfaceId() const
|
||||
{
|
||||
return m_pendingSurfaceId;
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
inline T *Window::findInList(const QList<T *> &list, std::function<bool(const U *)> func)
|
||||
{
|
||||
|
|
|
@ -5024,6 +5024,8 @@ void X11Window::associate()
|
|||
// the associated surface item has processed the new surface state.
|
||||
connect(surface(), &KWaylandServer::SurfaceInterface::mapped, this, handleMapped, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
m_pendingSurfaceId = 0;
|
||||
}
|
||||
|
||||
QWindow *X11Window::findInternalWindow() const
|
||||
|
|
|
@ -294,6 +294,9 @@ public:
|
|||
|
||||
static void cleanupX11();
|
||||
|
||||
quint64 surfaceSerial() const;
|
||||
quint32 pendingSurfaceId() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void closeWindow() override;
|
||||
void updateCaption() override;
|
||||
|
@ -306,7 +309,7 @@ private:
|
|||
void configureNotifyEvent(xcb_configure_notify_event_t *e);
|
||||
void configureRequestEvent(xcb_configure_request_event_t *e);
|
||||
void propertyNotifyEvent(xcb_property_notify_event_t *e) override;
|
||||
void clientMessageEvent(xcb_client_message_event_t *e) override;
|
||||
void clientMessageEvent(xcb_client_message_event_t *e);
|
||||
void enterNotifyEvent(xcb_enter_notify_event_t *e);
|
||||
void leaveNotifyEvent(xcb_leave_notify_event_t *e);
|
||||
void focusInEvent(xcb_focus_in_event_t *e);
|
||||
|
@ -502,6 +505,8 @@ private:
|
|||
|
||||
bool m_unmanaged = false;
|
||||
bool m_outline = false;
|
||||
quint32 m_pendingSurfaceId = 0;
|
||||
quint64 m_surfaceSerial = 0;
|
||||
};
|
||||
|
||||
inline xcb_window_t X11Window::wrapperId() const
|
||||
|
@ -599,6 +604,16 @@ inline bool X11Window::hiddenPreview() const
|
|||
return mapping_state == Kept;
|
||||
}
|
||||
|
||||
inline quint64 X11Window::surfaceSerial() const
|
||||
{
|
||||
return m_surfaceSerial;
|
||||
}
|
||||
|
||||
inline quint32 X11Window::pendingSurfaceId() const
|
||||
{
|
||||
return m_pendingSurfaceId;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Q_DECLARE_METATYPE(KWin::X11Window *)
|
||||
Q_DECLARE_METATYPE(QList<KWin::X11Window *>)
|
||||
|
|
Loading…
Reference in a new issue