File indexing completed on 2024-05-12 05:32:34

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2019 Roman Gilg <subdiff@gmail.com>
0006     SPDX-FileCopyrightText: 2021 David Edmundson <davidedmundson@kde.org>
0007     SPDX-FileCopyrightText: 2021 David Redondo <kde@david-redondo.de>
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 #include "drag.h"
0011 
0012 #include "atoms.h"
0013 
0014 namespace KWin
0015 {
0016 namespace Xwl
0017 {
0018 
0019 Drag::Drag(QObject *parent)
0020     : QObject(parent)
0021 {
0022 }
0023 
0024 Drag::~Drag()
0025 {
0026 }
0027 
0028 void Drag::sendClientMessage(xcb_window_t target, xcb_atom_t type, xcb_client_message_data_t *data)
0029 {
0030     xcb_client_message_event_t event{
0031         XCB_CLIENT_MESSAGE, // response_type
0032         32, // format
0033         0, // sequence
0034         target, // window
0035         type, // type
0036         *data, // data
0037     };
0038     static_assert(sizeof(event) == 32, "Would leak stack data otherwise");
0039 
0040     xcb_connection_t *xcbConn = kwinApp()->x11Connection();
0041     xcb_send_event(xcbConn,
0042                    0,
0043                    target,
0044                    XCB_EVENT_MASK_NO_EVENT,
0045                    reinterpret_cast<const char *>(&event));
0046     xcb_flush(xcbConn);
0047 }
0048 
0049 } // namespace Xwl
0050 } // namespace KWin
0051 
0052 #include "moc_drag.cpp"