Port Xwayland data bridge to xcbutils

This spares a redundant xcb_prefetch_extension_data() during startup.
master
Vlad Zahorodnii 2020-07-28 12:33:35 +03:00
parent e7d02ad355
commit 51f926c065
5 changed files with 8 additions and 13 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;