Skip to content

Commit 8de592c

Browse files
committed
[Misc] Formatting in Linux platform code.
1 parent b5e011b commit 8de592c

File tree

10 files changed

+385
-284
lines changed

10 files changed

+385
-284
lines changed

sources/Platform/Linux/LinuxDisplayWayland.cpp

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
#include <X11/extensions/Xrandr.h>
1313
#include <dlfcn.h>
1414

15+
1516
namespace LLGL
1617
{
1718

19+
1820
LinuxDisplayWayland::LinuxDisplayWayland(const WaylandDisplayData& data) :
19-
data_(data)
21+
data_ { data }
2022
{
2123
}
2224

@@ -25,52 +27,65 @@ bool LinuxDisplayWayland::IsPrimary() const
2527
return (this == LinuxWaylandState::GetDisplayList()[0]);
2628
}
2729

28-
UTF8String LinuxDisplayWayland::GetDeviceName() const {
29-
return data_.deviceName;
30+
UTF8String LinuxDisplayWayland::GetDeviceName() const
31+
{
32+
return UTF8String{ data_.deviceName };
3033
}
3134

32-
Offset2D LinuxDisplayWayland::GetOffset() const {
33-
return Offset2D(data_.x, data_.y);
35+
Offset2D LinuxDisplayWayland::GetOffset() const
36+
{
37+
return Offset2D{ data_.x, data_.y };
3438
}
3539

36-
float LinuxDisplayWayland::GetScale() const {
40+
float LinuxDisplayWayland::GetScale() const
41+
{
3742
return data_.scale;
3843
}
3944

40-
bool LinuxDisplayWayland::ResetDisplayMode() {
45+
bool LinuxDisplayWayland::ResetDisplayMode()
46+
{
4147
// TODO
4248
return true;
4349
}
4450

45-
bool LinuxDisplayWayland::SetDisplayMode(const DisplayMode& displayMode) {
51+
bool LinuxDisplayWayland::SetDisplayMode(const DisplayMode& displayMode)
52+
{
4653
// TODO
4754
return true;
4855
}
4956

50-
DisplayMode LinuxDisplayWayland::GetDisplayMode() const {
57+
DisplayMode LinuxDisplayWayland::GetDisplayMode() const
58+
{
5159
return data_.displayModes[data_.currentdisplayMode];
5260
}
5361

54-
std::vector<DisplayMode> LinuxDisplayWayland::GetSupportedDisplayModes() const {
62+
std::vector<DisplayMode> LinuxDisplayWayland::GetSupportedDisplayModes() const
63+
{
5564
return data_.displayModes;
5665
}
5766

58-
bool LinuxDisplayWayland::SetCursorPositionInternal(const Offset2D &position) {
67+
bool LinuxDisplayWayland::SetCursorPositionInternal(const Offset2D &position)
68+
{
5969
// TODO
6070
return true;
6171
}
6272

63-
Offset2D LinuxDisplayWayland::GetCursorPositionInternal() {
73+
Offset2D LinuxDisplayWayland::GetCursorPositionInternal()
74+
{
6475
// TODO
6576
return Offset2D(0, 0);
6677
}
6778

68-
struct wl_output* LinuxDisplayWayland::GetNative() const {
79+
struct wl_output* LinuxDisplayWayland::GetNative() const
80+
{
6981
return data_.output;
7082
}
7183

84+
7285
} // /namespace LLGL
7386

74-
#endif
87+
#endif // /LLGL_LINUX_ENABLE_WAYLAND
88+
89+
7590

7691
// ================================================================================

sources/Platform/Linux/LinuxDisplayWayland.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#ifndef LLGL_LINUX_DISPLAY_WAYLAND_H
99
#define LLGL_LINUX_DISPLAY_WAYLAND_H
1010

11+
1112
#if LLGL_LINUX_ENABLE_WAYLAND
1213

1314
#include <LLGL/Container/DynamicVector.h>
@@ -18,34 +19,32 @@
1819

1920
struct wl_output;
2021

22+
2123
namespace LLGL
2224
{
2325

2426

25-
struct WaylandDisplayData {
26-
char deviceName[128] = {};
27-
28-
std::vector<DisplayMode> displayModes;
29-
30-
wl_output* output = nullptr;
27+
struct WaylandDisplayData
28+
{
29+
char deviceName[128] = {};
3130

32-
uint32_t currentdisplayMode = 0;
31+
std::vector<DisplayMode> displayModes;
3332

34-
uint32_t name = 0;
33+
wl_output* output = nullptr;
3534

36-
// Physical width in millimeters
37-
int widthMM = 0;
35+
std::uint32_t currentdisplayMode = 0;
36+
std::uint32_t name = 0;
3837

39-
// Physical height in millimeters
40-
int heightMM = 0;
38+
int widthMM = 0; // Physical width in millimeters
39+
int heightMM = 0; // Physical height in millimeters
4140

42-
int x = 0;
43-
int y = 0;
41+
int x = 0;
42+
int y = 0;
4443

45-
int scale = 1;
44+
int scale = 1;
4645
};
4746

48-
class LinuxDisplayWayland : public LinuxDisplay
47+
class LinuxDisplayWayland final : public LinuxDisplay
4948
{
5049

5150
public:
@@ -79,14 +78,17 @@ class LinuxDisplayWayland : public LinuxDisplay
7978
wl_output* GetNative() const;
8079

8180
private:
81+
8282
WaylandDisplayData data_;
8383

8484
};
8585

86+
8687
} // /namespace LLGL
8788

8889
#endif // LLGL_LINUX_ENABLE_WAYLAND
8990

91+
9092
#endif // LLGL_LINUX_DISPLAY_WAYLAND_H
9193

9294

sources/Platform/Linux/LinuxDisplayX11.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
#ifndef LLGL_LINUX_DISPLAY_X11_H
99
#define LLGL_LINUX_DISPLAY_X11_H
1010

11+
1112
#include <memory>
1213
#include <X11/Xlib.h>
1314

1415
#include "LinuxDisplay.h"
1516

17+
1618
namespace LLGL
1719
{
1820

@@ -48,7 +50,7 @@ class LinuxSharedDisplayX11
4850

4951
};
5052

51-
class LinuxDisplayX11 : public LinuxDisplay
53+
class LinuxDisplayX11 final : public LinuxDisplay
5254
{
5355

5456
public:
@@ -83,6 +85,7 @@ class LinuxDisplayX11 : public LinuxDisplay
8385

8486
};
8587

88+
8689
} // /namespace LLGL
8790

8891

sources/Platform/Linux/LinuxWindow.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
namespace LLGL
2020
{
2121

22+
2223
static bool IsWaylandSupported()
2324
{
2425
const char* const session = getenv("XDG_SESSION_TYPE");
@@ -32,9 +33,11 @@ static bool IsWaylandSupported()
3233

3334
static bool g_isWaylandSupported = IsWaylandSupported();
3435

36+
3537
/*
3638
* Window class
3739
*/
40+
3841
std::unique_ptr<Window> Window::Create(const WindowDescriptor& desc)
3942
{
4043
#if LLGL_LINUX_ENABLE_WAYLAND
@@ -43,35 +46,33 @@ std::unique_ptr<Window> Window::Create(const WindowDescriptor& desc)
4346
return MakeUnique<LinuxWindowWayland>(desc);
4447
}
4548
else
49+
#endif // /LLGL_LINUX_ENABLE_WAYLAND
4650
{
47-
#endif
4851
return MakeUnique<LinuxWindowX11>(desc);
49-
#if LLGL_LINUX_ENABLE_WAYLAND
5052
}
51-
#endif
5253
}
5354

55+
5456
/*
5557
* Surface class
5658
*/
59+
5760
bool Surface::ProcessEvents()
5861
{
59-
#if LLGL_LINUX_ENABLE_WAYLAND
62+
#if LLGL_LINUX_ENABLE_WAYLAND
6063
if (g_isWaylandSupported)
6164
{
6265
double timeout = 0.0;
6366
LinuxWaylandState::HandleWaylandEvents(&timeout);
6467

6568
for (LinuxWindowWayland* window : LinuxWaylandState::GetWindowList())
66-
{
67-
window->ProcessEvents();
68-
}
69+
window->ProcessEventsInternal();
6970

7071
return true;
7172
}
7273
else
74+
#endif // /LLGL_LINUX_ENABLE_WAYLAND
7375
{
74-
#endif
7576
::Display* display = LinuxSharedDisplayX11::GetShared()->GetNative();
7677

7778
XEvent event;
@@ -84,16 +85,14 @@ bool Surface::ProcessEvents()
8485
if (void* userData = LinuxX11Context::Find(display, event.xany.window))
8586
{
8687
LinuxWindowX11* wnd = static_cast<LinuxWindowX11*>(userData);
87-
wnd->ProcessEvent(event);
88+
wnd->ProcessEventInternal(event);
8889
}
8990
}
9091

9192
XFlush(display);
9293

9394
return true;
94-
#if LLGL_LINUX_ENABLE_WAYLAND
9595
}
96-
#endif
9796
}
9897

9998
} // /namespace LLGL

0 commit comments

Comments
 (0)