Commit 51f926c0 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Port Xwayland data bridge to xcbutils

This spares a redundant xcb_prefetch_extension_data() during startup.
parent e7d02ad3
......@@ -521,6 +521,11 @@ int Extensions::fixesCursorNotifyEvent() const
return m_fixes.eventBase + XCB_XFIXES_CURSOR_NOTIFY;
}
int Extensions::fixesSelectionNotifyEvent() const
{
return m_fixes.eventBase + XCB_XFIXES_SELECTION_NOTIFY;
}
bool Extensions::isShapeInputAvailable() const
{
return m_shape.version >= 0x11; // 1.1
......
......@@ -1269,6 +1269,7 @@ public:
return m_fixes.version > 0;
}
int fixesCursorNotifyEvent() const;
int fixesSelectionNotifyEvent() const;
bool isFixesRegionAvailable() const;
bool isSyncAvailable() const {
return m_sync.present;
......
......@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "clipboard.h"
#include "dnd.h"
#include "selection.h"
#include "xcbutils.h"
#include "xwayland.h"
#include "abstract_client.h"
......@@ -102,7 +103,7 @@ bool DataBridge::filterEvent(xcb_generic_event_t *event)
if (m_dnd && m_dnd->filterEvent(event)) {
return true;
}
if (event->response_type - Xwayland::self()->xfixes()->first_event == XCB_XFIXES_SELECTION_NOTIFY) {
if (event->response_type == Xcb::Extensions::self()->fixesSelectionNotifyEvent()) {
return handleXfixesNotify((xcb_xfixes_selection_notify_event_t *)event);
}
return false;
......
......@@ -312,9 +312,7 @@ void Xwayland::destroyX11Connection()
m_app->removeNativeX11EventFilter();
xcb_disconnect(m_app->x11Connection());
m_xcbConnectionFd = -1;
m_xfixes = nullptr;
m_app->setX11Connection(nullptr);
m_app->setX11DefaultScreen(nullptr);
......@@ -334,9 +332,6 @@ void Xwayland::continueStartupWithX()
return;
}
xcb_prefetch_extension_data(xcbConn, &xcb_xfixes_id);
m_xfixes = xcb_get_extension_data(xcbConn, &xcb_xfixes_id);
// create selection owner for WM_S0 - magic X display number expected by XWayland
KSelectionOwner owner("WM_S0", xcbConn, m_app->x11RootWindow());
owner.claim(true);
......
......@@ -26,8 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QProcess>
#include <QSocketNotifier>
#include <xcb/xproto.h>
namespace KWin
{
class ApplicationWaylandAbstract;
......@@ -46,10 +44,6 @@ public:
Xwayland(ApplicationWaylandAbstract *app, QObject *parent = nullptr);
~Xwayland() override;
const xcb_query_extension_reply_t *xfixes() const {
return m_xfixes;
}
/**
* Returns the associated Xwayland process or @c null if the Xwayland server is inactive.
*/
......@@ -110,7 +104,6 @@ private:
int m_displayFileDescriptor = -1;
int m_xcbConnectionFd = -1;
QProcess *m_xwaylandProcess = nullptr;
const xcb_query_extension_reply_t *m_xfixes = nullptr;
DataBridge *m_dataBridge = nullptr;
QSocketNotifier *m_socketNotifier = nullptr;
ApplicationWaylandAbstract *m_app;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment