Skip to content

Commit 6146dcb

Browse files
committed
move everything to libinput namespace
1 parent 7cc37d0 commit 6146dcb

17 files changed

Lines changed: 126 additions & 126 deletions

src/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ pkg_search_module(LIBINPUT REQUIRED libinput)
33
pkg_search_module(LIBUDEV REQUIRED libudev)
44

55
add_library(libinput-cpp STATIC
6-
libinput-cpp/LibinputDevice.cpp
7-
libinput-cpp/LibinputEvent.cpp
8-
libinput-cpp/LibinputGestureEvent.cpp
9-
libinput-cpp/LibinputKeyboardEvent.cpp
10-
libinput-cpp/LibinputPathContext.cpp
11-
libinput-cpp/LibinputPointerEvent.cpp
12-
libinput-cpp/LibinputTouchEvent.cpp
6+
libinput-cpp/Device.cpp
7+
libinput-cpp/Event.cpp
8+
libinput-cpp/GestureEvent.cpp
9+
libinput-cpp/KeyboardEvent.cpp
10+
libinput-cpp/PathContext.cpp
11+
libinput-cpp/PointerEvent.cpp
12+
libinput-cpp/TouchEvent.cpp
1313
libinput-cpp/UdevDevice.cpp
1414
)
1515
target_link_libraries(libinput-cpp PUBLIC
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,39 @@
1616
along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
#include "LibinputDevice.h"
19+
#include "Device.h"
2020
#include "UdevDevice.h"
2121
#include <libinput.h>
2222

23-
namespace InputActions
23+
namespace InputActions::libinput
2424
{
2525

26-
LibinputDevice::LibinputDevice(libinput_device *device)
26+
Device::Device(libinput_device *device)
2727
: m_device(device)
2828
{
2929
}
3030

31-
LibinputDevice::~LibinputDevice()
31+
Device::~Device()
3232
{
3333
libinput_device_unref(m_device);
3434
}
3535

36-
void LibinputDevice::configTapSetEnabled(bool value)
36+
void Device::configTapSetEnabled(bool value)
3737
{
3838
libinput_device_config_tap_set_enabled(m_device, value ? LIBINPUT_CONFIG_TAP_ENABLED : LIBINPUT_CONFIG_TAP_DISABLED);
3939
}
4040

41-
QString LibinputDevice::name() const
41+
QString Device::name() const
4242
{
4343
return libinput_device_get_name(m_device);
4444
}
4545

46-
QString LibinputDevice::sysName() const
46+
QString Device::sysName() const
4747
{
4848
return libinput_device_get_sysname(m_device);
4949
}
5050

51-
QSizeF LibinputDevice::size() const
51+
QSizeF Device::size() const
5252
{
5353
double width;
5454
double height;
@@ -59,7 +59,7 @@ QSizeF LibinputDevice::size() const
5959
return {width, height};
6060
}
6161

62-
UdevDevice LibinputDevice::udevDevice() const
62+
UdevDevice Device::udevDevice() const
6363
{
6464
return {libinput_device_get_udev_device(m_device)};
6565
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424

2525
struct libinput_device;
2626

27-
namespace InputActions
27+
namespace InputActions::libinput
2828
{
2929

3030
class UdevDevice;
3131

32-
class LibinputDevice
32+
class Device
3333
{
3434
public:
35-
LibinputDevice(libinput_device *device);
36-
~LibinputDevice();
35+
Device(libinput_device *device);
36+
~Device();
3737

3838
libinput_device *raw() { return m_device; }
3939

@@ -63,7 +63,7 @@ class LibinputDevice
6363
void configTapSetEnabled(bool value);
6464

6565
private:
66-
Q_DISABLE_COPY_MOVE(LibinputDevice);
66+
Q_DISABLE_COPY_MOVE(Device);
6767

6868
libinput_device *m_device;
6969
};
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@
1616
along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
#include "LibinputEvent.h"
20-
#include "LibinputGestureEvent.h"
21-
#include "LibinputKeyboardEvent.h"
22-
#include "LibinputPointerEvent.h"
23-
#include "LibinputTouchEvent.h"
19+
#include "Event.h"
20+
#include "GestureEvent.h"
21+
#include "KeyboardEvent.h"
22+
#include "PointerEvent.h"
23+
#include "TouchEvent.h"
2424

25-
namespace InputActions
25+
namespace InputActions::libinput
2626
{
2727

28-
LibinputEvent::LibinputEvent(libinput_event *event)
28+
Event::Event(libinput_event *event)
2929
: m_event(event)
3030
{
3131
}
3232

33-
LibinputEvent::LibinputEvent(LibinputEvent &&other)
33+
Event::Event(Event &&other)
3434
{
3535
*this = std::move(other);
3636
}
3737

38-
LibinputEvent::~LibinputEvent()
38+
Event::~Event()
3939
{
4040
if (!m_event) {
4141
return;
@@ -44,52 +44,52 @@ LibinputEvent::~LibinputEvent()
4444
libinput_event_destroy(m_event);
4545
}
4646

47-
libinput_event_type LibinputEvent::type() const
47+
libinput_event_type Event::type() const
4848
{
4949
return libinput_event_get_type(m_event);
5050
}
5151

52-
std::optional<LibinputGestureEvent> LibinputEvent::gestureEvent() const
52+
std::optional<GestureEvent> Event::gestureEvent() const
5353
{
5454
auto *event = libinput_event_get_gesture_event(m_event);
5555
if (!event) {
5656
return {};
5757
}
5858

59-
return LibinputGestureEvent(event);
59+
return GestureEvent(event);
6060
}
6161

62-
std::optional<LibinputKeyboardEvent> LibinputEvent::keyboardEvent() const
62+
std::optional<KeyboardEvent> Event::keyboardEvent() const
6363
{
6464
auto *event = libinput_event_get_keyboard_event(m_event);
6565
if (!event) {
6666
return {};
6767
}
6868

69-
return LibinputKeyboardEvent(event);
69+
return KeyboardEvent(event);
7070
}
7171

72-
std::optional<LibinputPointerEvent> LibinputEvent::pointerEvent() const
72+
std::optional<PointerEvent> Event::pointerEvent() const
7373
{
7474
auto *event = libinput_event_get_pointer_event(m_event);
7575
if (!event) {
7676
return {};
7777
}
7878

79-
return LibinputPointerEvent(event);
79+
return PointerEvent(event);
8080
}
8181

82-
std::optional<LibinputTouchEvent> LibinputEvent::touchEvent() const
82+
std::optional<TouchEvent> Event::touchEvent() const
8383
{
8484
auto *event = libinput_event_get_touch_event(m_event);
8585
if (!event) {
8686
return {};
8787
}
8888

89-
return LibinputTouchEvent(event);
89+
return TouchEvent(event);
9090
}
9191

92-
LibinputEvent &LibinputEvent::operator=(LibinputEvent &&other)
92+
Event &Event::operator=(Event &&other)
9393
{
9494
std::swap(m_event, other.m_event);
9595
return *this;
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,48 @@
2222
#include <libinput.h>
2323
#include <optional>
2424

25-
namespace InputActions
25+
namespace InputActions::libinput
2626
{
2727

28-
class LibinputGestureEvent;
29-
class LibinputKeyboardEvent;
30-
class LibinputPointerEvent;
31-
class LibinputTouchEvent;
28+
class GestureEvent;
29+
class KeyboardEvent;
30+
class PointerEvent;
31+
class TouchEvent;
3232

33-
class LibinputEvent
33+
class Event
3434
{
3535
public:
36-
LibinputEvent(libinput_event *event);
37-
LibinputEvent(LibinputEvent &&);
38-
~LibinputEvent();
36+
Event(libinput_event *event);
37+
Event(Event &&);
38+
~Event();
3939

4040
libinput_event_type type() const;
4141

4242
/**
4343
* @return The gesture event or std::nullopt if this event is not a gesture event. The returned object becomes invalid when its parent is deleted.
4444
* @see libinput_event_get_gesture_event
4545
*/
46-
std::optional<LibinputGestureEvent> gestureEvent() const;
46+
std::optional<GestureEvent> gestureEvent() const;
4747
/**
4848
* @return The keyboard event or std::nullopt if this event is not a keyboard event. The returned object becomes invalid when its parent is deleted.
4949
* @see libinput_event_get_keyboard_event
5050
*/
51-
std::optional<LibinputKeyboardEvent> keyboardEvent() const;
51+
std::optional<KeyboardEvent> keyboardEvent() const;
5252
/**
5353
* @return The pointer event or std::nullopt if this event is not a pointer event. The returned object becomes invalid when its parent is deleted.
5454
* @see libinput_event_get_pointer_event
5555
*/
56-
std::optional<LibinputPointerEvent> pointerEvent() const;
56+
std::optional<PointerEvent> pointerEvent() const;
5757
/**
5858
* @return The touch event or std::nullopt if this event is not a touch event. The returned object becomes invalid when its parent is deleted.
5959
* @see libinput_event_get_touch_event
6060
*/
61-
std::optional<LibinputTouchEvent> touchEvent() const;
61+
std::optional<TouchEvent> touchEvent() const;
6262

63-
LibinputEvent &operator=(LibinputEvent &&);
63+
Event &operator=(Event &&);
6464

6565
private:
66-
Q_DISABLE_COPY(LibinputEvent);
66+
Q_DISABLE_COPY(Event);
6767

6868
libinput_event *m_event{};
6969
};
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,43 @@
1616
along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
#include "LibinputGestureEvent.h"
19+
#include "GestureEvent.h"
2020
#include <libinput.h>
2121

22-
namespace InputActions
22+
namespace InputActions::libinput
2323
{
2424

25-
LibinputGestureEvent::LibinputGestureEvent(libinput_event_gesture *event)
25+
GestureEvent::GestureEvent(libinput_event_gesture *event)
2626
: m_event(event)
2727
{
2828
}
2929

30-
int LibinputGestureEvent::fingerCount() const
30+
int GestureEvent::fingerCount() const
3131
{
3232
return libinput_event_gesture_get_finger_count(m_event);
3333
}
3434

35-
bool LibinputGestureEvent::cancelled() const
35+
bool GestureEvent::cancelled() const
3636
{
3737
return libinput_event_gesture_get_cancelled(m_event) == 1;
3838
}
3939

40-
qreal LibinputGestureEvent::angleDelta() const
40+
qreal GestureEvent::angleDelta() const
4141
{
4242
return libinput_event_gesture_get_angle_delta(m_event);
4343
}
4444

45-
qreal LibinputGestureEvent::scale() const
45+
qreal GestureEvent::scale() const
4646
{
4747
return libinput_event_gesture_get_scale(m_event);
4848
}
4949

50-
QPointF LibinputGestureEvent::delta() const
50+
QPointF GestureEvent::delta() const
5151
{
5252
return {libinput_event_gesture_get_dx(m_event), libinput_event_gesture_get_dy(m_event)};
5353
}
5454

55-
QPointF LibinputGestureEvent::deltaUnaccelerated() const
55+
QPointF GestureEvent::deltaUnaccelerated() const
5656
{
5757
return {libinput_event_gesture_get_dx_unaccelerated(m_event), libinput_event_gesture_get_dy_unaccelerated(m_event)};
5858
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
struct libinput_event_gesture;
2424

25-
namespace InputActions
25+
namespace InputActions::libinput
2626
{
2727

28-
class LibinputGestureEvent
28+
class GestureEvent
2929
{
3030
public:
31-
LibinputGestureEvent(libinput_event_gesture *event);
31+
GestureEvent(libinput_event_gesture *event);
3232

3333
/**
3434
* @see libinput_event_gesture_get_finger_count

src/libinput-cpp/LibinputKeyboardEvent.cpp renamed to src/libinput-cpp/KeyboardEvent.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
#include "LibinputKeyboardEvent.h"
19+
#include "KeyboardEvent.h"
2020
#include <libinput.h>
2121

22-
namespace InputActions
22+
namespace InputActions::libinput
2323
{
2424

25-
LibinputKeyboardEvent::LibinputKeyboardEvent(libinput_event_keyboard *event)
25+
KeyboardEvent::KeyboardEvent(libinput_event_keyboard *event)
2626
: m_event(event)
2727
{
2828
}
2929

30-
uint32_t LibinputKeyboardEvent::key() const
30+
uint32_t KeyboardEvent::key() const
3131
{
3232
return libinput_event_keyboard_get_key(m_event);
3333
}
3434

35-
bool LibinputKeyboardEvent::state() const
35+
bool KeyboardEvent::state() const
3636
{
3737
return libinput_event_keyboard_get_key_state(m_event) == LIBINPUT_KEY_STATE_PRESSED;
3838
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
struct libinput_event_keyboard;
2424

25-
namespace InputActions
25+
namespace InputActions::libinput
2626
{
2727

28-
class LibinputKeyboardEvent
28+
class KeyboardEvent
2929
{
3030
public:
31-
LibinputKeyboardEvent(libinput_event_keyboard *event);
31+
KeyboardEvent(libinput_event_keyboard *event);
3232

3333
/**
3434
* @see libinput_event_keyboard_get_key

0 commit comments

Comments
 (0)