Skip to content

Commit

Permalink
Use a regular member function instead of constructor; update symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
hbatagelo committed Nov 21, 2023
1 parent 94dea2d commit 9e426e3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
3 changes: 2 additions & 1 deletion debian/libmiral6.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -424,4 +424,5 @@ libmiral.so.6 libmiral6 #MINVER#
MIRAL_4.1@MIRAL_4.1 4.1.0
(c++)"miral::WaylandExtensions::zwp_input_method_v1@MIRAL_4.1" 4.1.0
(c++)"miral::WaylandExtensions::zwp_input_panel_v1@MIRAL_4.1" 4.1.0
(c++)"miral::X11Support::X11Support(bool)@MIRAL_4.2" 4.1.0
MIRAL_4.2@MIRAL_4.2 4.2.0
(c++)"miral::X11Support::default_to_enabled()@MIRAL_4.2" 4.2.0
12 changes: 10 additions & 2 deletions include/miral/miral/x11_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace mir { class Server; }

namespace miral
{
/// Add a user configuration option for X11 support.
/// Add user configuration options for X11 support.
/// \remark Since MirAL 2.4
class X11Support
{
Expand All @@ -32,11 +32,19 @@ class X11Support
void operator()(mir::Server& server) const;

X11Support();
explicit X11Support(bool x11_enabled);
~X11Support();
X11Support(X11Support const&);
auto operator=(X11Support const&) -> X11Support&;

/**
* Set X11 support as enabled by default.
*
* \return A reference to the modified miral::X11Support object with
* the updated default configuration.
* \remark Since MirAL 4.2
*/
auto default_to_enabled() -> X11Support&;

private:
struct Self;
std::shared_ptr<Self> self;
Expand Down
3 changes: 1 addition & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(MIRPLATFORM_ABI 27)

set(MIRAL_VERSION_MAJOR 4)
set(MIRAL_VERSION_MINOR 1)
set(MIRAL_VERSION_MINOR 2)
set(MIRAL_VERSION_PATCH 0)
set(MIRAL_VERSION ${MIRAL_VERSION_MAJOR}.${MIRAL_VERSION_MINOR}.${MIRAL_VERSION_PATCH})

Expand Down Expand Up @@ -51,4 +51,3 @@ set(MIR_SERVER_GRAPHICS_PLATFORM_ABI ${MIR_SERVER_GRAPHICS_PLATFORM_ABI} PARENT_
set(MIR_SERVER_INPUT_PLATFORM_ABI ${MIR_SERVER_INPUT_PLATFORM_ABI} PARENT_SCOPE)
set(MIR_SERVER_GRAPHICS_PLATFORM_VERSION ${MIR_SERVER_GRAPHICS_PLATFORM_VERSION} PARENT_SCOPE)
set(MIR_INPUT_PLATFORM_VERSION_SCRIPT ${MIR_INPUT_PLATFORM_VERSION_SCRIPT} PARENT_SCOPE)

2 changes: 1 addition & 1 deletion src/miral/symbols.map
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ global:
MIRAL_4.2 {
global:
extern "C++" {
miral::X11Support::X11Support*;
miral::X11Support::default_to_enabled*;
};

} MIRAL_4.1;
15 changes: 9 additions & 6 deletions src/miral/x11_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ namespace mo = mir::options;

struct miral::X11Support::Self
{
bool x11_enabled;
bool x11_enabled{false};
};

miral::X11Support::X11Support() : miral::X11Support{false}
{
}

miral::X11Support::X11Support(bool x11_enabled) : self{std::make_shared<Self>(x11_enabled)}
miral::X11Support::X11Support() : self{std::make_shared<Self>()}
{
}

Expand Down Expand Up @@ -99,3 +95,10 @@ void miral::X11Support::operator()(mir::Server& server) const
miral::X11Support::~X11Support() = default;
miral::X11Support::X11Support(X11Support const&) = default;
auto miral::X11Support::operator=(X11Support const&) -> X11Support& = default;

auto miral::X11Support::default_to_enabled() -> X11Support&
{
self->x11_enabled = true;

return *this;
}
4 changes: 2 additions & 2 deletions tests/miral/external_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ struct ExternalClient : miral::TestServer
}

miral::ExternalClientLauncher external_client;
miral::X11Support x11_disabled_by_default;
miral::X11Support x11_enabled_by_default{true};
miral::X11Support x11_disabled_by_default{};
miral::X11Support x11_enabled_by_default{miral::X11Support{}.default_to_enabled()};

std::string const output = tmpnam(nullptr);

Expand Down

0 comments on commit 9e426e3

Please sign in to comment.