xwayland: Call handleXfixesNotify() directly from Selection

This commit is contained in:
Vlad Zahorodnii 2020-08-06 10:46:01 +03:00
parent 17a1640e62
commit c86d3b717a
3 changed files with 5 additions and 28 deletions

View file

@ -10,7 +10,6 @@
#include "clipboard.h"
#include "dnd.h"
#include "selection.h"
#include "xcbutils.h"
#include "xwayland.h"
#include "abstract_client.h"
@ -92,29 +91,9 @@ bool DataBridge::filterEvent(xcb_generic_event_t *event)
if (m_dnd && m_dnd->filterEvent(event)) {
return true;
}
if (event->response_type == Xcb::Extensions::self()->fixesSelectionNotifyEvent()) {
return handleXfixesNotify((xcb_xfixes_selection_notify_event_t *)event);
}
return false;
}
bool DataBridge::handleXfixesNotify(xcb_xfixes_selection_notify_event_t *event)
{
Selection *selection = nullptr;
if (event->selection == atoms->clipboard) {
selection = m_clipboard;
} else if (event->selection == atoms->xdnd_selection) {
selection = m_dnd;
}
if (!selection) {
return false;
}
return selection->handleXfixesNotify(event);
}
DragEventReply DataBridge::dragMoveFilter(Toplevel *target, const QPoint &pos)
{
if (!m_dnd) {

View file

@ -12,10 +12,6 @@
#include <QObject>
#include <QPoint>
#include <xcb/xcb.h>
struct xcb_xfixes_selection_notify_event_t;
namespace KWayland
{
namespace Client
@ -75,8 +71,6 @@ public:
private:
void init();
bool handleXfixesNotify(xcb_xfixes_selection_notify_event_t *event);
Clipboard *m_clipboard = nullptr;
Dnd *m_dnd = nullptr;

View file

@ -12,8 +12,9 @@
#include "transfer.h"
#include "atoms.h"
#include "x11client.h"
#include "workspace.h"
#include "x11client.h"
#include "xcbutils.h"
#include <xcb/xcb_event.h>
#include <xcb/xfixes.h>
@ -124,6 +125,9 @@ bool Selection::filterEvent(xcb_generic_event_t *event)
case XCB_CLIENT_MESSAGE:
return handleClientMessage(reinterpret_cast<xcb_client_message_event_t *>(event));
default:
if (event->response_type == Xcb::Extensions::self()->fixesSelectionNotifyEvent()) {
return handleXfixesNotify(reinterpret_cast<xcb_xfixes_selection_notify_event_t *>(event));
}
return false;
}
}