KWin
Loading...
Searching...
No Matches
src
backends
x11
common
ge_event_mem_mover.h
Go to the documentation of this file.
1
/*
2
KWin - the KDE window manager
3
This file is part of the KDE project.
4
5
SPDX-FileCopyrightText: 2018 Martin Flöser <mgraesslin@kde.org>
6
7
SPDX-License-Identifier: GPL-2.0-or-later
8
*/
9
#pragma once
10
11
#include <xcb/xcb.h>
12
13
#include <cstring>
14
15
namespace
KWin
16
{
17
18
class
GeEventMemMover
19
{
20
public
:
21
GeEventMemMover
(xcb_generic_event_t *event)
22
: m_event(reinterpret_cast<
xcb_ge_generic_event_t
*>(event))
23
{
24
// xcb event structs contain stuff that wasn't on the wire, the full_sequence field
25
// adds an extra 4 bytes and generic events cookie data is on the wire right after the standard 32 bytes.
26
// Move this data back to have the same layout in memory as it was on the wire
27
// and allow casting, overwriting the full_sequence field.
28
memmove((
char
*)m_event + 32, (
char
*)m_event + 36, m_event->
length
* 4);
29
}
30
~GeEventMemMover
()
31
{
32
// move memory layout back, so that Qt can do the same without breaking
33
memmove((
char
*)m_event + 36, (
char
*)m_event + 32, m_event->
length
* 4);
34
}
35
36
xcb_ge_generic_event_t
*
operator->
()
const
37
{
38
return
m_event;
39
}
40
41
private
:
42
xcb_ge_generic_event_t
*m_event;
43
};
44
45
}
KWin::GeEventMemMover
Definition
ge_event_mem_mover.h:19
KWin::GeEventMemMover::~GeEventMemMover
~GeEventMemMover()
Definition
ge_event_mem_mover.h:30
KWin::GeEventMemMover::operator->
xcb_ge_generic_event_t * operator->() const
Definition
ge_event_mem_mover.h:36
KWin::GeEventMemMover::GeEventMemMover
GeEventMemMover(xcb_generic_event_t *event)
Definition
ge_event_mem_mover.h:21
KWin
Definition
activation_test.cpp:20
xcb_ge_generic_event_t
Definition
events.cpp:59
xcb_ge_generic_event_t::length
uint32_t length
Definition
events.cpp:63
Generated on Sat Feb 17 2024 01:42:09 for KWin by
1.10.0