wip: implemented an output listener to initialize heads

This commit is contained in:
Matthew Kosarek 2024-10-01 06:31:53 -04:00
parent e14b52c4b8
commit 6dbef63e23
13 changed files with 637 additions and 420 deletions

View File

@ -97,6 +97,7 @@ add_library(miracle-wm-implementation
src/floating_tree_container.h
src/wlr-output-management-unstable-v1_wrapper.cpp src/wlr-output-management-unstable-v1_wrapper.h
src/wlr-ouput-management-unstable-v1.h src/wlr-ouput-management-unstable-v1.cpp
src/output_listener.cpp src/output_listener.h
)
add_executable(miracle-wm

View File

@ -18,8 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef MIRACLE_WM_COMPOSITOR_STATE_H
#define MIRACLE_WM_COMPOSITOR_STATE_H
#include <memory>
#include <mir/geometry/point.h>
#include <memory>
#include <vector>
namespace miracle
{
@ -40,9 +41,11 @@ enum class WindowManagerMode
selecting
};
/// Defines the high-level state of the compositor.
struct CompositorState
{
WindowManagerMode mode = WindowManagerMode::normal;
std::vector<std::shared_ptr<Output>> output_list;
std::shared_ptr<Output> active_output;
std::shared_ptr<Container> active;
mir::geometry::Point cursor_position;

View File

@ -1255,8 +1255,8 @@ FilesystemConfiguration::ConfigDetails::ConfigDetails()
miracle_input_event_modifier_default,
KEY_W },
{ MirKeyboardAction ::mir_keyboard_action_down,
miracle_input_event_modifier_default,
KEY_S }
miracle_input_event_modifier_default,
KEY_S }
};
for (int i = 0; i < DefaultKeyCommand::MAX; i++)
{

View File

@ -15,6 +15,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "wlr-output-management-unstable-v1_wrapper.h"
#include <memory>
#define MIR_LOG_COMPONENT "miracle-main"
#include "auto_restarting_launcher.h"
@ -25,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "renderer.h"
#include "surface_tracker.h"
#include "version.h"
#include "wlr-ouput-management-unstable-v1.h"
#include <libnotify/notify.h>
#include <mir/log.h>
@ -77,6 +80,7 @@ int main(int argc, char const* argv[])
ExternalClientLauncher external_client_launcher;
miracle::AutoRestartingLauncher auto_restarting_launcher(runner, external_client_launcher);
miracle::SurfaceTracker surface_tracker;
miracle::OutputListenerMultiplexer output_listener;
auto config = std::make_shared<miracle::FilesystemConfiguration>(runner);
for (auto const& env : config->get_env_variables())
{
@ -90,7 +94,7 @@ int main(int argc, char const* argv[])
config->load(server);
options = new WindowManagerOptions {
add_window_manager_policy<miracle::Policy>(
"tiling", auto_restarting_launcher, runner, config, surface_tracker, server, compositor_state)
"tiling", auto_restarting_launcher, runner, config, surface_tracker, server, compositor_state, output_listener)
};
(*options)(server);
});
@ -108,6 +112,13 @@ int main(int argc, char const* argv[])
.enable(miral::WaylandExtensions::zwp_input_method_manager_v2)
.enable(miral::WaylandExtensions::zwlr_screencopy_manager_v1)
.enable(miral::WaylandExtensions::ext_session_lock_manager_v1);
wayland_extensions.add_extension({ .name = mir::wayland::ZwlrOutputManagerV1::interface_name,
.build = [&output_listener, &compositor_state](miral::WaylandExtensions::Context const* context)
{
auto extension = std::make_shared<miracle::WlrOutputManagementUnstableV1>(context->display(), compositor_state);
output_listener.register_listener(extension.get());
return extension;
} });
for (auto const& extension : { "zwp_pointer_constraints_v1", "zwp_relative_pointer_manager_v1" })
wayland_extensions.enable(extension);

48
src/output_listener.cpp Normal file
View File

@ -0,0 +1,48 @@
/**
Copyright (C) 2024 Matthew Kosarek
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "output_listener.h"
using namespace miracle;
void OutputListenerMultiplexer::output_created(miral::Output const& output)
{
for (auto const& listener : listeners)
listener->output_created(output);
}
void OutputListenerMultiplexer::output_updated(miral::Output const& updated, miral::Output const& original)
{
for (auto const& listener : listeners)
listener->output_updated(updated, original);
}
void OutputListenerMultiplexer::output_deleted(miral::Output const& output)
{
for (auto const& listener : listeners)
listener->output_deleted(output);
}
void OutputListenerMultiplexer::register_listener(OutputListener* listener)
{
listeners.push_back(listener);
}
void OutputListenerMultiplexer::unregister_listener(OutputListener* listener)
{
listeners.push_back(listener);
}

56
src/output_listener.h Normal file
View File

@ -0,0 +1,56 @@
/**
Copyright (C) 2024 Matthew Kosarek
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef MIRACLE_WM_OUTPUT_LISTENER_H
#define MIRACLE_WM_OUTPUT_LISTENER_H
#include <vector>
namespace miral
{
class Output;
}
namespace miracle
{
class OutputListener
{
public:
virtual void output_created(miral::Output const&) = 0;
virtual void output_updated(miral::Output const& updated, miral::Output const& original) = 0;
virtual void output_deleted(miral::Output const&) = 0;
};
class OutputListenerMultiplexer : public OutputListener
{
public:
void output_created(miral::Output const&) override;
void output_updated(miral::Output const& updated, miral::Output const& original) override;
void output_deleted(miral::Output const&) override;
void register_listener(OutputListener*);
void unregister_listener(OutputListener*);
private:
std::vector<OutputListener*> listeners;
};
}
#endif //MIRACLE_WM_OUTPUT_LISTENER_H

View File

@ -50,9 +50,11 @@ Policy::Policy(
std::shared_ptr<MiracleConfig> const& config,
SurfaceTracker& surface_tracker,
mir::Server const& server,
CompositorState& compositor_state) :
CompositorState& compositor_state,
OutputListener& output_listener) :
window_manager_tools { tools },
state { compositor_state },
output_listener { output_listener },
floating_window_manager(std::make_shared<miral::MinimalWindowManager>(tools, config->get_input_event_modifier())),
external_client_launcher { external_client_launcher },
runner { runner },
@ -209,7 +211,7 @@ bool Policy::handle_pointer_event(MirPointerEvent const* event)
state.cursor_position = { x, y };
// Select the output first
for (auto const& output : output_list)
for (auto const& output : state.output_list)
{
if (output->point_is_in_output(static_cast<int>(x), static_cast<int>(y)))
{
@ -315,10 +317,10 @@ void Policy::advise_new_window(miral::WindowInfo const& window_info)
{
mir::log_warning("create_container: output unavailable");
auto window = window_info.window();
if (!output_list.empty())
if (!state.output_list.empty())
{
// Our output is gone! Let's try to add it to a different output
output_list.front()->add_immediately(window);
state.output_list.front()->add_immediately(window);
}
else
{
@ -455,7 +457,7 @@ void Policy::advise_output_create(miral::Output const& output)
output, workspace_manager, output.extents(), window_manager_tools,
floating_window_manager, state, config, window_controller, animator);
workspace_manager.request_first_available_workspace(output_content);
output_list.push_back(output_content);
state.output_list.push_back(output_content);
if (state.active_output == nullptr)
state.active_output = output_content;
@ -469,11 +471,13 @@ void Policy::advise_output_create(miral::Output const& output)
}
orphaned_window_list.clear();
}
output_listener.output_created(output);
}
void Policy::advise_output_update(miral::Output const& updated, miral::Output const& original)
{
for (auto& output : output_list)
for (auto& output : state.output_list)
{
if (output->get_output().is_same_output(original))
{
@ -481,11 +485,13 @@ void Policy::advise_output_update(miral::Output const& updated, miral::Output co
break;
}
}
output_listener.output_updated(updated, original);
}
void Policy::advise_output_delete(miral::Output const& output)
{
for (auto it = output_list.begin(); it != output_list.end(); it++)
for (auto it = state.output_list.begin(); it != state.output_list.end(); it++)
{
auto other_output = *it;
if (other_output->get_output().is_same_output(output))
@ -502,8 +508,8 @@ void Policy::advise_output_delete(miral::Output const& output)
workspace_manager.delete_workspace(w);
};
output_list.erase(it);
if (output_list.empty())
state.output_list.erase(it);
if (state.output_list.empty())
{
// All nodes should become orphaned
for (auto& window : other_output->collect_all_windows())
@ -519,7 +525,7 @@ void Policy::advise_output_delete(miral::Output const& output)
}
else
{
state.active_output = output_list.front();
state.active_output = state.output_list.front();
for (auto& window : other_output->collect_all_windows())
{
state.active_output->add_immediately(window);
@ -530,6 +536,8 @@ void Policy::advise_output_delete(miral::Output const& output)
break;
}
}
output_listener.output_deleted(output);
}
void Policy::handle_modify_window(
@ -599,7 +607,7 @@ mir::geometry::Rectangle Policy::confirm_inherited_move(
void Policy::advise_application_zone_create(miral::Zone const& application_zone)
{
for (auto const& output : output_list)
for (auto const& output : state.output_list)
{
output->advise_application_zone_create(application_zone);
}
@ -607,7 +615,7 @@ void Policy::advise_application_zone_create(miral::Zone const& application_zone)
void Policy::advise_application_zone_update(miral::Zone const& updated, miral::Zone const& original)
{
for (auto const& output : output_list)
for (auto const& output : state.output_list)
{
output->advise_application_zone_update(updated, original);
}
@ -615,7 +623,7 @@ void Policy::advise_application_zone_update(miral::Zone const& updated, miral::Z
void Policy::advise_application_zone_delete(miral::Zone const& application_zone)
{
for (auto const& output : output_list)
for (auto const& output : state.output_list)
{
output->advise_application_zone_delete(application_zone);
}
@ -863,4 +871,4 @@ bool Policy::toggle_stacking()
return false;
return state.active->toggle_stacking();
}
}

View File

@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "output.h"
#include "surface_tracker.h"
#include "window_manager_tools_window_controller.h"
#include "output_listener.h"
#include "workspace_manager.h"
#include <memory>
@ -60,7 +60,8 @@ public:
std::shared_ptr<MiracleConfig> const&,
SurfaceTracker&,
mir::Server const&,
CompositorState&);
CompositorState&,
OutputListener&);
~Policy() override;
// Interactions with the engine
@ -124,14 +125,14 @@ public:
// Getters
[[nodiscard]] std::shared_ptr<Output> const& get_active_output() const { return state.active_output; }
[[nodiscard]] std::vector<std::shared_ptr<Output>> const& get_output_list() const { return output_list; }
[[nodiscard]] std::vector<std::shared_ptr<Output>> const& get_output_list() const { return state.output_list; }
[[nodiscard]] geom::Point const& get_cursor_position() const { return state.cursor_position; }
[[nodiscard]] CompositorState const& get_state() const { return state; }
private:
bool is_starting_ = true;
CompositorState& state;
std::vector<std::shared_ptr<Output>> output_list;
OutputListener& output_listener;
std::weak_ptr<Output> pending_output;
AllocationHint pending_allocation;
std::vector<Window> orphaned_window_list;

View File

@ -60,13 +60,24 @@ mgl::Primitive mgl::tessellate_renderable_into_rectangle(
mgl::Primitive rectangle;
rectangle.type = GL_TRIANGLE_STRIP;
auto const [tex_top, tex_bottom, tex_left, tex_right] =
tex_coords_from_rect(renderable.buffer()->size(), renderable.src_bounds());
auto const [tex_top, tex_bottom, tex_left, tex_right] = tex_coords_from_rect(renderable.buffer()->size(), renderable.src_bounds());
auto& vertices = rectangle.vertices;
vertices[0] = {{left, top, 0.0f}, {tex_left, tex_top}};
vertices[1] = {{left, bottom, 0.0f}, {tex_left, tex_bottom}};
vertices[2] = {{right, top, 0.0f}, {tex_right, tex_top}};
vertices[3] = {{right, bottom, 0.0f}, {tex_right, tex_bottom}};
vertices[0] = {
{ left, top, 0.0f },
{ tex_left, tex_top }
};
vertices[1] = {
{ left, bottom, 0.0f },
{ tex_left, tex_bottom }
};
vertices[2] = {
{ right, top, 0.0f },
{ tex_right, tex_top }
};
vertices[3] = {
{ right, bottom, 0.0f },
{ tex_right, tex_bottom }
};
return rectangle;
}

View File

@ -15,46 +15,51 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include <memory>
#include <shared_mutex>
#define MIR_LOG_COMPONENT "wlr-output-management-unstable-v1"
#include "wlr-ouput-management-unstable-v1.h"
#include "output.h"
#include "compositor_state.h"
#include <mir/log.h>
#include <cstdint>
namespace
using namespace miracle;
namespace miracle
{
class WlrOutputHeadV1;
class WlrOutputManagerV1 : public mir::wayland::ZwlrOutputManagerV1
{
public:
explicit WlrOutputManagerV1(wl_resource* resource);
std::shared_ptr<WlrOutputHeadV1> head(wl_resource* resource) const;
private:
void create_configuration(struct wl_resource* id, uint32_t serial) override;
void stop() override;
std::vector<std::shared_ptr<WlrOutputHeadV1>> heads;
};
/// This object gets broadcasted by the [WlrOutputManagerV1] for each active output.
class WlrOutputHeadV1 : public mir::wayland::ZwlrOutputHeadV1
{
public:
WlrOutputHeadV1(
std::shared_ptr<miracle::Output> const& output,
mir::wayland::ZwlrOutputManagerV1 const& parent);
miral::Output const& output,
mir::wayland::ZwlrOutputManagerV1 const& parent);
std::weak_ptr<miracle::Output> const output;
miral::Output const& output;
};
class WlrOutputManagerV1 : public mir::wayland::ZwlrOutputManagerV1
{
public:
explicit WlrOutputManagerV1(wl_resource* resource);
WlrOutputHeadV1 const* head(wl_resource* resource) const;
void advise_output_create(miral::Output const& output);
void advise_output_update(miral::Output const& updated, miral::Output const& original);
void advise_output_delete(miral::Output const& output);
private:
void create_configuration(struct wl_resource* id, uint32_t serial) override;
void stop() override;
std::vector<std::unique_ptr<WlrOutputHeadV1>> heads;
};
/// This object represents an output mode that will be broadcasted by the [WlrOutputHeadV1].
class WlrOutputModeV1 : public mir::wayland::ZwlrOutputModeV1
{
};
class WlrOutputConfigurationV1 : public mir::wayland::ZwlrOutputConfigurationV1
@ -75,7 +80,7 @@ private:
class WlrOutputConfigurationHeadV1 : public mir::wayland::ZwlrOutputConfigurationHeadV1
{
public:
WlrOutputConfigurationHeadV1(struct wl_resource* id, std::shared_ptr<WlrOutputHeadV1> const&);
WlrOutputConfigurationHeadV1(struct wl_resource* id, WlrOutputHeadV1 const*);
void set_mode(struct wl_resource* mode) override;
void set_custom_mode(int32_t width, int32_t height, int32_t refresh) override;
void set_position(int32_t x, int32_t y) override;
@ -83,13 +88,14 @@ public:
void set_scale(double scale) override;
private:
std::shared_ptr<WlrOutputHeadV1> head;
WlrOutputHeadV1 const* head;
};
WlrOutputConfigurationV1::WlrOutputConfigurationV1(wl_resource* resource, WlrOutputManagerV1* manager)
: mir::wayland::ZwlrOutputConfigurationV1(resource, Version<2>()),
manager{manager}
{}
WlrOutputConfigurationV1::WlrOutputConfigurationV1(wl_resource* resource, WlrOutputManagerV1* manager) :
mir::wayland::ZwlrOutputConfigurationV1(resource, Version<2>()),
manager { manager }
{
}
void WlrOutputConfigurationV1::enable_head(struct wl_resource* id, struct wl_resource* head)
{
@ -119,22 +125,36 @@ void WlrOutputConfigurationV1::destroy()
{
}
WlrOutputManagerV1::WlrOutputManagerV1(wl_resource* resource)
: mir::wayland::ZwlrOutputManagerV1(resource, Version<2>())
{}
std::shared_ptr<WlrOutputHeadV1> WlrOutputManagerV1::head(wl_resource* resource) const
WlrOutputManagerV1::WlrOutputManagerV1(wl_resource* resource) :
mir::wayland::ZwlrOutputManagerV1(resource, Version<2>())
{
for (auto const& head: heads)
}
WlrOutputHeadV1 const* WlrOutputManagerV1::head(wl_resource* resource) const
{
for (auto const& head : heads)
{
if (head->resource == resource)
return head;
return head.get();
}
mir::fatal_error("Unable to find head with resource: %d", resource);
mir::log_error("Unable to find head with resource: %lu", reinterpret_cast<std::uintptr_t>(resource));
return nullptr;
}
void WlrOutputManagerV1::advise_output_create(miral::Output const& output)
{
heads.push_back(std::make_unique<WlrOutputHeadV1>(output, *this));
}
void WlrOutputManagerV1::advise_output_update(miral::Output const& updated, miral::Output const& original)
{
}
void WlrOutputManagerV1::advise_output_delete(miral::Output const& output)
{
}
void WlrOutputManagerV1::create_configuration(struct wl_resource* id, uint32_t serial)
{
new WlrOutputConfigurationV1(id, this);
@ -145,24 +165,49 @@ void WlrOutputManagerV1::stop()
}
WlrOutputHeadV1::WlrOutputHeadV1(
std::shared_ptr<miracle::Output> const& output,
mir::wayland::ZwlrOutputManagerV1 const& parent)
: mir::wayland::ZwlrOutputHeadV1(parent), output{output}
miral::Output const& output,
mir::wayland::ZwlrOutputManagerV1 const& parent) :
mir::wayland::ZwlrOutputHeadV1(parent),
output { output }
{
// TODO: Register a listener on the output
}
}
void miracle::WlrOutputManagementUnstableV1::bind(wl_resource* new_zwlr_output_manager_v1)
WlrOutputManagementUnstableV1::WlrOutputManagementUnstableV1(wl_display* display, CompositorState const& state) :
mir::wayland::ZwlrOutputManagerV1::Global(display, Version<2>()),
state{state}
{
new WlrOutputManagerV1(new_zwlr_output_manager_v1);
}
void WlrOutputManagementUnstableV1::bind(wl_resource* new_zwlr_output_manager_v1)
{
active_managers.push_back(new WlrOutputManagerV1(new_zwlr_output_manager_v1));
}
void WlrOutputManagementUnstableV1::output_created(miral::Output const& output)
{
for (auto const& manager : active_managers)
manager->advise_output_create(output);
}
void WlrOutputManagementUnstableV1::output_updated(miral::Output const& updated, miral::Output const& original)
{
for (auto const& manager : active_managers)
manager->advise_output_update(updated, original);
}
void WlrOutputManagementUnstableV1::output_deleted(miral::Output const& output)
{
for (auto const& manager : active_managers)
manager->advise_output_delete(output);
}
WlrOutputConfigurationHeadV1::WlrOutputConfigurationHeadV1(
struct wl_resource* id, std::shared_ptr<WlrOutputHeadV1> const& head)
: mir::wayland::ZwlrOutputConfigurationHeadV1(id, Version<2>()),
head{head}
struct wl_resource* id, WlrOutputHeadV1 const* head) :
mir::wayland::ZwlrOutputConfigurationHeadV1(id, Version<2>()),
head { head }
{
}
@ -172,20 +217,16 @@ void WlrOutputConfigurationHeadV1::set_mode(struct wl_resource* mode)
void WlrOutputConfigurationHeadV1::set_custom_mode(int32_t width, int32_t height, int32_t refresh)
{
}
void WlrOutputConfigurationHeadV1::set_position(int32_t x, int32_t y)
{
}
void WlrOutputConfigurationHeadV1::set_transform(int32_t transform)
{
}
void WlrOutputConfigurationHeadV1::set_scale(double scale)
{
}
}

View File

@ -19,17 +19,31 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MIRACLE_WM_WLR_OUPUT_MANAGEMENT_UNSTABLE_V1_H
#include "wlr-output-management-unstable-v1_wrapper.h"
#include "output_listener.h"
#include <miral/output.h>
#include <memory>
namespace miracle
{
class WlrOutputManagementUnstableV1 : public mir::wayland::ZwlrOutputManagerV1::Global
class WlrOutputManagerV1;
class CompositorState;
class WlrOutputManagementUnstableV1 : public mir::wayland::ZwlrOutputManagerV1::Global, public OutputListener
{
private:
void bind(wl_resource *new_zwlr_output_manager_v1) override;
public:
WlrOutputManagementUnstableV1(wl_display*, CompositorState const&);
void output_created(miral::Output const& output) override;
void output_updated(miral::Output const& updated, miral::Output const& original) override;
void output_deleted(miral::Output const& output) override;
private:
void bind(wl_resource* new_zwlr_output_manager_v1) override;
std::vector<WlrOutputManagerV1*> active_managers;
CompositorState const& state;
};
}
#endif //MIRACLE_WM_WLR_OUPUT_MANAGEMENT_UNSTABLE_V1_H
#endif // MIRACLE_WM_WLR_OUPUT_MANAGEMENT_UNSTABLE_V1_H

View File

@ -27,18 +27,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <wayland-server-core.h>
#include "mir/log.h"
#include "mir/wayland/protocol_error.h"
#include "mir/wayland/client.h"
#include "mir/wayland/protocol_error.h"
namespace mir
{
namespace wayland
{
extern struct wl_interface const zwlr_output_configuration_head_v1_interface_data;
extern struct wl_interface const zwlr_output_configuration_v1_interface_data;
extern struct wl_interface const zwlr_output_head_v1_interface_data;
extern struct wl_interface const zwlr_output_manager_v1_interface_data;
extern struct wl_interface const zwlr_output_mode_v1_interface_data;
extern struct wl_interface const zwlr_output_configuration_head_v1_interface_data;
extern struct wl_interface const zwlr_output_configuration_v1_interface_data;
extern struct wl_interface const zwlr_output_head_v1_interface_data;
extern struct wl_interface const zwlr_output_manager_v1_interface_data;
extern struct wl_interface const zwlr_output_mode_v1_interface_data;
}
}
@ -46,13 +46,14 @@ namespace mw = mir::wayland;
namespace
{
struct wl_interface const* all_null_types [] {
struct wl_interface const* all_null_types[] {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr};
nullptr
};
}
// ZwlrOutputManagerV1
@ -63,23 +64,24 @@ struct mw::ZwlrOutputManagerV1::Thunks
static void create_configuration_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, uint32_t serial)
{
wl_resource* id_resolved{
wl_resource_create(client, &zwlr_output_configuration_v1_interface_data, wl_resource_get_version(resource), id)};
wl_resource* id_resolved {
wl_resource_create(client, &zwlr_output_configuration_v1_interface_data, wl_resource_get_version(resource), id)
};
if (id_resolved == nullptr)
{
wl_client_post_no_memory(client);
BOOST_THROW_EXCEPTION((std::bad_alloc{}));
BOOST_THROW_EXCEPTION((std::bad_alloc {}));
}
try
{
auto me = static_cast<ZwlrOutputManagerV1*>(wl_resource_get_user_data(resource));
me->create_configuration(id_resolved, serial);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputManagerV1::create_configuration()");
}
@ -92,11 +94,11 @@ struct mw::ZwlrOutputManagerV1::Thunks
auto me = static_cast<ZwlrOutputManagerV1*>(wl_resource_get_user_data(resource));
me->stop();
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputManagerV1::stop()");
}
@ -118,13 +120,13 @@ struct mw::ZwlrOutputManagerV1::Thunks
if (resource == nullptr)
{
wl_client_post_no_memory(client);
BOOST_THROW_EXCEPTION((std::bad_alloc{}));
BOOST_THROW_EXCEPTION((std::bad_alloc {}));
}
try
{
me->bind(resource);
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputManagerV1 global bind");
}
@ -139,8 +141,8 @@ struct mw::ZwlrOutputManagerV1::Thunks
int const mw::ZwlrOutputManagerV1::Thunks::supported_version = 2;
mw::ZwlrOutputManagerV1::ZwlrOutputManagerV1(struct wl_resource* resource, Version<2>)
: Resource{resource}
mw::ZwlrOutputManagerV1::ZwlrOutputManagerV1(struct wl_resource* resource, Version<2>) :
Resource { resource }
{
wl_resource_set_implementation(resource, Thunks::request_vtable, this, &Thunks::resource_destroyed_thunk);
}
@ -176,14 +178,15 @@ void mw::ZwlrOutputManagerV1::destroy_and_delete() const
wl_resource_destroy(resource);
}
mw::ZwlrOutputManagerV1::Global::Global(wl_display* display, Version<2>)
: wayland::Global{
wl_global_create(
display,
&zwlr_output_manager_v1_interface_data,
Thunks::supported_version,
this,
&Thunks::bind_thunk)}
mw::ZwlrOutputManagerV1::Global::Global(wl_display* display, Version<2>) :
wayland::Global {
wl_global_create(
display,
&zwlr_output_manager_v1_interface_data,
Thunks::supported_version,
this,
&Thunks::bind_thunk)
}
{
}
@ -194,28 +197,32 @@ auto mw::ZwlrOutputManagerV1::Global::interface_name() const -> char const*
struct wl_interface const* mw::ZwlrOutputManagerV1::Thunks::create_configuration_types[] {
&zwlr_output_configuration_v1_interface_data,
nullptr};
nullptr
};
struct wl_interface const* mw::ZwlrOutputManagerV1::Thunks::head_types[] {
&zwlr_output_head_v1_interface_data};
&zwlr_output_head_v1_interface_data
};
struct wl_message const mw::ZwlrOutputManagerV1::Thunks::request_messages[] {
{"create_configuration", "nu", create_configuration_types},
{"stop", "", all_null_types}};
{ "create_configuration", "nu", create_configuration_types },
{ "stop", "", all_null_types }
};
struct wl_message const mw::ZwlrOutputManagerV1::Thunks::event_messages[] {
{"head", "n", head_types},
{"done", "u", all_null_types},
{"finished", "", all_null_types}};
{ "head", "n", head_types },
{ "done", "u", all_null_types },
{ "finished", "", all_null_types }
};
void const* mw::ZwlrOutputManagerV1::Thunks::request_vtable[] {
(void*)Thunks::create_configuration_thunk,
(void*)Thunks::stop_thunk};
(void*)Thunks::stop_thunk
};
mw::ZwlrOutputManagerV1* mw::ZwlrOutputManagerV1::from(struct wl_resource* resource)
{
if (resource &&
wl_resource_instance_of(resource, &zwlr_output_manager_v1_interface_data, ZwlrOutputManagerV1::Thunks::request_vtable))
if (resource && wl_resource_instance_of(resource, &zwlr_output_manager_v1_interface_data, ZwlrOutputManagerV1::Thunks::request_vtable))
{
return static_cast<ZwlrOutputManagerV1*>(wl_resource_get_user_data(resource));
}
@ -244,11 +251,11 @@ struct mw::ZwlrOutputHeadV1::Thunks
int const mw::ZwlrOutputHeadV1::Thunks::supported_version = 2;
mw::ZwlrOutputHeadV1::ZwlrOutputHeadV1(ZwlrOutputManagerV1 const& parent)
: Resource{wl_resource_create(
wl_resource_get_client(parent.resource),
&zwlr_output_head_v1_interface_data,
wl_resource_get_version(parent.resource), 0)}
mw::ZwlrOutputHeadV1::ZwlrOutputHeadV1(ZwlrOutputManagerV1 const& parent) :
Resource { wl_resource_create(
wl_resource_get_client(parent.resource),
&zwlr_output_head_v1_interface_data,
wl_resource_get_version(parent.resource), 0) }
{
wl_resource_set_implementation(resource, Thunks::request_vtable, this, &Thunks::resource_destroyed_thunk);
}
@ -302,7 +309,7 @@ void mw::ZwlrOutputHeadV1::send_transform_event(int32_t transform) const
void mw::ZwlrOutputHeadV1::send_scale_event(double scale) const
{
wl_fixed_t scale_resolved{wl_fixed_from_double(scale)};
wl_fixed_t scale_resolved { wl_fixed_from_double(scale) };
wl_resource_post_event(resource, Opcode::scale, scale_resolved);
}
@ -404,33 +411,36 @@ void mw::ZwlrOutputHeadV1::destroy_and_delete() const
}
struct wl_interface const* mw::ZwlrOutputHeadV1::Thunks::mode_types[] {
&zwlr_output_mode_v1_interface_data};
&zwlr_output_mode_v1_interface_data
};
struct wl_interface const* mw::ZwlrOutputHeadV1::Thunks::current_mode_types[] {
&zwlr_output_mode_v1_interface_data};
&zwlr_output_mode_v1_interface_data
};
struct wl_message const mw::ZwlrOutputHeadV1::Thunks::event_messages[] {
{"name", "s", all_null_types},
{"description", "s", all_null_types},
{"physical_size", "ii", all_null_types},
{"mode", "n", mode_types},
{"enabled", "i", all_null_types},
{"current_mode", "o", current_mode_types},
{"position", "ii", all_null_types},
{"transform", "i", all_null_types},
{"scale", "f", all_null_types},
{"finished", "", all_null_types},
{"make", "2s", all_null_types},
{"model", "2s", all_null_types},
{"serial_number", "2s", all_null_types}};
{ "name", "s", all_null_types },
{ "description", "s", all_null_types },
{ "physical_size", "ii", all_null_types },
{ "mode", "n", mode_types },
{ "enabled", "i", all_null_types },
{ "current_mode", "o", current_mode_types },
{ "position", "ii", all_null_types },
{ "transform", "i", all_null_types },
{ "scale", "f", all_null_types },
{ "finished", "", all_null_types },
{ "make", "2s", all_null_types },
{ "model", "2s", all_null_types },
{ "serial_number", "2s", all_null_types }
};
void const* mw::ZwlrOutputHeadV1::Thunks::request_vtable[] {
nullptr};
nullptr
};
mw::ZwlrOutputHeadV1* mw::ZwlrOutputHeadV1::from(struct wl_resource* resource)
{
if (resource &&
wl_resource_instance_of(resource, &zwlr_output_head_v1_interface_data, ZwlrOutputHeadV1::Thunks::request_vtable))
if (resource && wl_resource_instance_of(resource, &zwlr_output_head_v1_interface_data, ZwlrOutputHeadV1::Thunks::request_vtable))
{
return static_cast<ZwlrOutputHeadV1*>(wl_resource_get_user_data(resource));
}
@ -457,11 +467,11 @@ struct mw::ZwlrOutputModeV1::Thunks
int const mw::ZwlrOutputModeV1::Thunks::supported_version = 2;
mw::ZwlrOutputModeV1::ZwlrOutputModeV1(ZwlrOutputHeadV1 const& parent)
: Resource{wl_resource_create(
wl_resource_get_client(parent.resource),
&zwlr_output_mode_v1_interface_data,
wl_resource_get_version(parent.resource), 0)}
mw::ZwlrOutputModeV1::ZwlrOutputModeV1(ZwlrOutputHeadV1 const& parent) :
Resource { wl_resource_create(
wl_resource_get_client(parent.resource),
&zwlr_output_mode_v1_interface_data,
wl_resource_get_version(parent.resource), 0) }
{
wl_resource_set_implementation(resource, Thunks::request_vtable, this, &Thunks::resource_destroyed_thunk);
}
@ -503,18 +513,19 @@ void mw::ZwlrOutputModeV1::destroy_and_delete() const
}
struct wl_message const mw::ZwlrOutputModeV1::Thunks::event_messages[] {
{"size", "ii", all_null_types},
{"refresh", "i", all_null_types},
{"preferred", "", all_null_types},
{"finished", "", all_null_types}};
{ "size", "ii", all_null_types },
{ "refresh", "i", all_null_types },
{ "preferred", "", all_null_types },
{ "finished", "", all_null_types }
};
void const* mw::ZwlrOutputModeV1::Thunks::request_vtable[] {
nullptr};
nullptr
};
mw::ZwlrOutputModeV1* mw::ZwlrOutputModeV1::from(struct wl_resource* resource)
{
if (resource &&
wl_resource_instance_of(resource, &zwlr_output_mode_v1_interface_data, ZwlrOutputModeV1::Thunks::request_vtable))
if (resource && wl_resource_instance_of(resource, &zwlr_output_mode_v1_interface_data, ZwlrOutputModeV1::Thunks::request_vtable))
{
return static_cast<ZwlrOutputModeV1*>(wl_resource_get_user_data(resource));
}
@ -532,23 +543,24 @@ struct mw::ZwlrOutputConfigurationV1::Thunks
static void enable_head_thunk(struct wl_client* client, struct wl_resource* resource, uint32_t id, struct wl_resource* head)
{
wl_resource* id_resolved{
wl_resource_create(client, &zwlr_output_configuration_head_v1_interface_data, wl_resource_get_version(resource), id)};
wl_resource* id_resolved {
wl_resource_create(client, &zwlr_output_configuration_head_v1_interface_data, wl_resource_get_version(resource), id)
};
if (id_resolved == nullptr)
{
wl_client_post_no_memory(client);
BOOST_THROW_EXCEPTION((std::bad_alloc{}));
BOOST_THROW_EXCEPTION((std::bad_alloc {}));
}
try
{
auto me = static_cast<ZwlrOutputConfigurationV1*>(wl_resource_get_user_data(resource));
me->enable_head(id_resolved, head);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationV1::enable_head()");
}
@ -561,11 +573,11 @@ struct mw::ZwlrOutputConfigurationV1::Thunks
auto me = static_cast<ZwlrOutputConfigurationV1*>(wl_resource_get_user_data(resource));
me->disable_head(head);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationV1::disable_head()");
}
@ -578,11 +590,11 @@ struct mw::ZwlrOutputConfigurationV1::Thunks
auto me = static_cast<ZwlrOutputConfigurationV1*>(wl_resource_get_user_data(resource));
me->apply();
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationV1::apply()");
}
@ -595,11 +607,11 @@ struct mw::ZwlrOutputConfigurationV1::Thunks
auto me = static_cast<ZwlrOutputConfigurationV1*>(wl_resource_get_user_data(resource));
me->test();
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationV1::test()");
}
@ -613,11 +625,11 @@ struct mw::ZwlrOutputConfigurationV1::Thunks
me->destroy();
wl_resource_destroy(resource);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationV1::destroy()");
}
@ -637,8 +649,8 @@ struct mw::ZwlrOutputConfigurationV1::Thunks
int const mw::ZwlrOutputConfigurationV1::Thunks::supported_version = 2;
mw::ZwlrOutputConfigurationV1::ZwlrOutputConfigurationV1(struct wl_resource* resource, Version<2>)
: Resource{resource}
mw::ZwlrOutputConfigurationV1::ZwlrOutputConfigurationV1(struct wl_resource* resource, Version<2>) :
Resource { resource }
{
wl_resource_set_implementation(resource, Thunks::request_vtable, this, &Thunks::resource_destroyed_thunk);
}
@ -674,34 +686,38 @@ uint32_t const mw::ZwlrOutputConfigurationV1::Error::already_used;
struct wl_interface const* mw::ZwlrOutputConfigurationV1::Thunks::enable_head_types[] {
&zwlr_output_configuration_head_v1_interface_data,
&zwlr_output_head_v1_interface_data};
&zwlr_output_head_v1_interface_data
};
struct wl_interface const* mw::ZwlrOutputConfigurationV1::Thunks::disable_head_types[] {
&zwlr_output_head_v1_interface_data};
&zwlr_output_head_v1_interface_data
};
struct wl_message const mw::ZwlrOutputConfigurationV1::Thunks::request_messages[] {
{"enable_head", "no", enable_head_types},
{"disable_head", "o", disable_head_types},
{"apply", "", all_null_types},
{"test", "", all_null_types},
{"destroy", "", all_null_types}};
{ "enable_head", "no", enable_head_types },
{ "disable_head", "o", disable_head_types },
{ "apply", "", all_null_types },
{ "test", "", all_null_types },
{ "destroy", "", all_null_types }
};
struct wl_message const mw::ZwlrOutputConfigurationV1::Thunks::event_messages[] {
{"succeeded", "", all_null_types},
{"failed", "", all_null_types},
{"cancelled", "", all_null_types}};
{ "succeeded", "", all_null_types },
{ "failed", "", all_null_types },
{ "cancelled", "", all_null_types }
};
void const* mw::ZwlrOutputConfigurationV1::Thunks::request_vtable[] {
(void*)Thunks::enable_head_thunk,
(void*)Thunks::disable_head_thunk,
(void*)Thunks::apply_thunk,
(void*)Thunks::test_thunk,
(void*)Thunks::destroy_thunk};
(void*)Thunks::destroy_thunk
};
mw::ZwlrOutputConfigurationV1* mw::ZwlrOutputConfigurationV1::from(struct wl_resource* resource)
{
if (resource &&
wl_resource_instance_of(resource, &zwlr_output_configuration_v1_interface_data, ZwlrOutputConfigurationV1::Thunks::request_vtable))
if (resource && wl_resource_instance_of(resource, &zwlr_output_configuration_v1_interface_data, ZwlrOutputConfigurationV1::Thunks::request_vtable))
{
return static_cast<ZwlrOutputConfigurationV1*>(wl_resource_get_user_data(resource));
}
@ -724,11 +740,11 @@ struct mw::ZwlrOutputConfigurationHeadV1::Thunks
auto me = static_cast<ZwlrOutputConfigurationHeadV1*>(wl_resource_get_user_data(resource));
me->set_mode(mode);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationHeadV1::set_mode()");
}
@ -741,11 +757,11 @@ struct mw::ZwlrOutputConfigurationHeadV1::Thunks
auto me = static_cast<ZwlrOutputConfigurationHeadV1*>(wl_resource_get_user_data(resource));
me->set_custom_mode(width, height, refresh);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationHeadV1::set_custom_mode()");
}
@ -758,11 +774,11 @@ struct mw::ZwlrOutputConfigurationHeadV1::Thunks
auto me = static_cast<ZwlrOutputConfigurationHeadV1*>(wl_resource_get_user_data(resource));
me->set_position(x, y);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationHeadV1::set_position()");
}
@ -775,11 +791,11 @@ struct mw::ZwlrOutputConfigurationHeadV1::Thunks
auto me = static_cast<ZwlrOutputConfigurationHeadV1*>(wl_resource_get_user_data(resource));
me->set_transform(transform);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationHeadV1::set_transform()");
}
@ -787,17 +803,17 @@ struct mw::ZwlrOutputConfigurationHeadV1::Thunks
static void set_scale_thunk(struct wl_client* client, struct wl_resource* resource, wl_fixed_t scale)
{
double scale_resolved{wl_fixed_to_double(scale)};
double scale_resolved { wl_fixed_to_double(scale) };
try
{
auto me = static_cast<ZwlrOutputConfigurationHeadV1*>(wl_resource_get_user_data(resource));
me->set_scale(scale_resolved);
}
catch(ProtocolError const& err)
catch (ProtocolError const& err)
{
wl_resource_post_error(err.resource(), err.code(), "%s", err.message());
}
catch(...)
catch (...)
{
internal_error_processing_request(client, "ZwlrOutputConfigurationHeadV1::set_scale()");
}
@ -815,8 +831,8 @@ struct mw::ZwlrOutputConfigurationHeadV1::Thunks
int const mw::ZwlrOutputConfigurationHeadV1::Thunks::supported_version = 2;
mw::ZwlrOutputConfigurationHeadV1::ZwlrOutputConfigurationHeadV1(struct wl_resource* resource, Version<2>)
: Resource{resource}
mw::ZwlrOutputConfigurationHeadV1::ZwlrOutputConfigurationHeadV1(struct wl_resource* resource, Version<2>) :
Resource { resource }
{
wl_resource_set_implementation(resource, Thunks::request_vtable, this, &Thunks::resource_destroyed_thunk);
}
@ -844,26 +860,28 @@ uint32_t const mw::ZwlrOutputConfigurationHeadV1::Error::invalid_transform;
uint32_t const mw::ZwlrOutputConfigurationHeadV1::Error::invalid_scale;
struct wl_interface const* mw::ZwlrOutputConfigurationHeadV1::Thunks::set_mode_types[] {
&zwlr_output_mode_v1_interface_data};
&zwlr_output_mode_v1_interface_data
};
struct wl_message const mw::ZwlrOutputConfigurationHeadV1::Thunks::request_messages[] {
{"set_mode", "o", set_mode_types},
{"set_custom_mode", "iii", all_null_types},
{"set_position", "ii", all_null_types},
{"set_transform", "i", all_null_types},
{"set_scale", "f", all_null_types}};
{ "set_mode", "o", set_mode_types },
{ "set_custom_mode", "iii", all_null_types },
{ "set_position", "ii", all_null_types },
{ "set_transform", "i", all_null_types },
{ "set_scale", "f", all_null_types }
};
void const* mw::ZwlrOutputConfigurationHeadV1::Thunks::request_vtable[] {
(void*)Thunks::set_mode_thunk,
(void*)Thunks::set_custom_mode_thunk,
(void*)Thunks::set_position_thunk,
(void*)Thunks::set_transform_thunk,
(void*)Thunks::set_scale_thunk};
(void*)Thunks::set_scale_thunk
};
mw::ZwlrOutputConfigurationHeadV1* mw::ZwlrOutputConfigurationHeadV1::from(struct wl_resource* resource)
{
if (resource &&
wl_resource_instance_of(resource, &zwlr_output_configuration_head_v1_interface_data, ZwlrOutputConfigurationHeadV1::Thunks::request_vtable))
if (resource && wl_resource_instance_of(resource, &zwlr_output_configuration_head_v1_interface_data, ZwlrOutputConfigurationHeadV1::Thunks::request_vtable))
{
return static_cast<ZwlrOutputConfigurationHeadV1*>(wl_resource_get_user_data(resource));
}
@ -878,35 +896,40 @@ namespace mir
namespace wayland
{
struct wl_interface const zwlr_output_manager_v1_interface_data {
mw::ZwlrOutputManagerV1::interface_name,
mw::ZwlrOutputManagerV1::Thunks::supported_version,
2, mw::ZwlrOutputManagerV1::Thunks::request_messages,
3, mw::ZwlrOutputManagerV1::Thunks::event_messages};
struct wl_interface const zwlr_output_manager_v1_interface_data {
mw::ZwlrOutputManagerV1::interface_name,
mw::ZwlrOutputManagerV1::Thunks::supported_version,
2, mw::ZwlrOutputManagerV1::Thunks::request_messages,
3, mw::ZwlrOutputManagerV1::Thunks::event_messages
};
struct wl_interface const zwlr_output_head_v1_interface_data {
mw::ZwlrOutputHeadV1::interface_name,
mw::ZwlrOutputHeadV1::Thunks::supported_version,
0, nullptr,
13, mw::ZwlrOutputHeadV1::Thunks::event_messages};
struct wl_interface const zwlr_output_head_v1_interface_data {
mw::ZwlrOutputHeadV1::interface_name,
mw::ZwlrOutputHeadV1::Thunks::supported_version,
0, nullptr,
13, mw::ZwlrOutputHeadV1::Thunks::event_messages
};
struct wl_interface const zwlr_output_mode_v1_interface_data {
mw::ZwlrOutputModeV1::interface_name,
mw::ZwlrOutputModeV1::Thunks::supported_version,
0, nullptr,
4, mw::ZwlrOutputModeV1::Thunks::event_messages};
struct wl_interface const zwlr_output_mode_v1_interface_data {
mw::ZwlrOutputModeV1::interface_name,
mw::ZwlrOutputModeV1::Thunks::supported_version,
0, nullptr,
4, mw::ZwlrOutputModeV1::Thunks::event_messages
};
struct wl_interface const zwlr_output_configuration_v1_interface_data {
mw::ZwlrOutputConfigurationV1::interface_name,
mw::ZwlrOutputConfigurationV1::Thunks::supported_version,
5, mw::ZwlrOutputConfigurationV1::Thunks::request_messages,
3, mw::ZwlrOutputConfigurationV1::Thunks::event_messages};
struct wl_interface const zwlr_output_configuration_v1_interface_data {
mw::ZwlrOutputConfigurationV1::interface_name,
mw::ZwlrOutputConfigurationV1::Thunks::supported_version,
5, mw::ZwlrOutputConfigurationV1::Thunks::request_messages,
3, mw::ZwlrOutputConfigurationV1::Thunks::event_messages
};
struct wl_interface const zwlr_output_configuration_head_v1_interface_data {
mw::ZwlrOutputConfigurationHeadV1::interface_name,
mw::ZwlrOutputConfigurationHeadV1::Thunks::supported_version,
5, mw::ZwlrOutputConfigurationHeadV1::Thunks::request_messages,
0, nullptr};
struct wl_interface const zwlr_output_configuration_head_v1_interface_data {
mw::ZwlrOutputConfigurationHeadV1::interface_name,
mw::ZwlrOutputConfigurationHeadV1::Thunks::supported_version,
5, mw::ZwlrOutputConfigurationHeadV1::Thunks::request_messages,
0, nullptr
};
}
}

View File

@ -29,225 +29,225 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "mir/fd.h"
#include <wayland-server-core.h>
#include "mir/wayland/resource.h"
#include "mir/wayland/global.h"
#include "mir/wayland/resource.h"
namespace mir
{
namespace wayland
{
class ZwlrOutputManagerV1;
class ZwlrOutputHeadV1;
class ZwlrOutputModeV1;
class ZwlrOutputConfigurationV1;
class ZwlrOutputConfigurationHeadV1;
class ZwlrOutputManagerV1;
class ZwlrOutputHeadV1;
class ZwlrOutputModeV1;
class ZwlrOutputConfigurationV1;
class ZwlrOutputConfigurationHeadV1;
class ZwlrOutputManagerV1 : public Resource
{
public:
static char const constexpr* interface_name = "zwlr_output_manager_v1";
static ZwlrOutputManagerV1* from(struct wl_resource*);
ZwlrOutputManagerV1(struct wl_resource* resource, Version<2>);
virtual ~ZwlrOutputManagerV1();
void send_head_event(struct wl_resource* head) const;
void send_done_event(uint32_t serial) const;
void send_finished_event() const;
void destroy_and_delete() const;
struct Opcode
{
static uint32_t const head = 0;
static uint32_t const done = 1;
static uint32_t const finished = 2;
};
struct Thunks;
static bool is_instance(wl_resource* resource);
class Global : public wayland::Global
class ZwlrOutputManagerV1 : public Resource
{
public:
Global(wl_display* display, Version<2>);
static char const constexpr* interface_name = "zwlr_output_manager_v1";
auto interface_name() const -> char const* override;
static ZwlrOutputManagerV1* from(struct wl_resource*);
ZwlrOutputManagerV1(struct wl_resource* resource, Version<2>);
virtual ~ZwlrOutputManagerV1();
void send_head_event(struct wl_resource* head) const;
void send_done_event(uint32_t serial) const;
void send_finished_event() const;
void destroy_and_delete() const;
struct Opcode
{
static uint32_t const head = 0;
static uint32_t const done = 1;
static uint32_t const finished = 2;
};
struct Thunks;
static bool is_instance(wl_resource* resource);
class Global : public wayland::Global
{
public:
Global(wl_display* display, Version<2>);
auto interface_name() const -> char const* override;
private:
virtual void bind(wl_resource* new_zwlr_output_manager_v1) = 0;
friend ZwlrOutputManagerV1::Thunks;
};
private:
virtual void bind(wl_resource* new_zwlr_output_manager_v1) = 0;
friend ZwlrOutputManagerV1::Thunks;
virtual void create_configuration(struct wl_resource* id, uint32_t serial) = 0;
virtual void stop() = 0;
};
private:
virtual void create_configuration(struct wl_resource* id, uint32_t serial) = 0;
virtual void stop() = 0;
};
class ZwlrOutputHeadV1 : public Resource
{
public:
static char const constexpr* interface_name = "zwlr_output_head_v1";
static ZwlrOutputHeadV1* from(struct wl_resource*);
ZwlrOutputHeadV1(ZwlrOutputManagerV1 const& parent);
virtual ~ZwlrOutputHeadV1();
void send_name_event(std::string const& name) const;
void send_description_event(std::string const& description) const;
void send_physical_size_event(int32_t width, int32_t height) const;
void send_mode_event(struct wl_resource* mode) const;
void send_enabled_event(int32_t enabled) const;
void send_current_mode_event(struct wl_resource* mode) const;
void send_position_event(int32_t x, int32_t y) const;
void send_transform_event(int32_t transform) const;
void send_scale_event(double scale) const;
void send_finished_event() const;
bool version_supports_make();
void send_make_event_if_supported(std::string const& make) const;
void send_make_event(std::string const& make) const;
bool version_supports_model();
void send_model_event_if_supported(std::string const& model) const;
void send_model_event(std::string const& model) const;
bool version_supports_serial_number();
void send_serial_number_event_if_supported(std::string const& serial_number) const;
void send_serial_number_event(std::string const& serial_number) const;
void destroy_and_delete() const;
struct Opcode
class ZwlrOutputHeadV1 : public Resource
{
static uint32_t const name = 0;
static uint32_t const description = 1;
static uint32_t const physical_size = 2;
static uint32_t const mode = 3;
static uint32_t const enabled = 4;
static uint32_t const current_mode = 5;
static uint32_t const position = 6;
static uint32_t const transform = 7;
static uint32_t const scale = 8;
static uint32_t const finished = 9;
static uint32_t const make = 10;
static uint32_t const model = 11;
static uint32_t const serial_number = 12;
public:
static char const constexpr* interface_name = "zwlr_output_head_v1";
static ZwlrOutputHeadV1* from(struct wl_resource*);
ZwlrOutputHeadV1(ZwlrOutputManagerV1 const& parent);
virtual ~ZwlrOutputHeadV1();
void send_name_event(std::string const& name) const;
void send_description_event(std::string const& description) const;
void send_physical_size_event(int32_t width, int32_t height) const;
void send_mode_event(struct wl_resource* mode) const;
void send_enabled_event(int32_t enabled) const;
void send_current_mode_event(struct wl_resource* mode) const;
void send_position_event(int32_t x, int32_t y) const;
void send_transform_event(int32_t transform) const;
void send_scale_event(double scale) const;
void send_finished_event() const;
bool version_supports_make();
void send_make_event_if_supported(std::string const& make) const;
void send_make_event(std::string const& make) const;
bool version_supports_model();
void send_model_event_if_supported(std::string const& model) const;
void send_model_event(std::string const& model) const;
bool version_supports_serial_number();
void send_serial_number_event_if_supported(std::string const& serial_number) const;
void send_serial_number_event(std::string const& serial_number) const;
void destroy_and_delete() const;
struct Opcode
{
static uint32_t const name = 0;
static uint32_t const description = 1;
static uint32_t const physical_size = 2;
static uint32_t const mode = 3;
static uint32_t const enabled = 4;
static uint32_t const current_mode = 5;
static uint32_t const position = 6;
static uint32_t const transform = 7;
static uint32_t const scale = 8;
static uint32_t const finished = 9;
static uint32_t const make = 10;
static uint32_t const model = 11;
static uint32_t const serial_number = 12;
};
struct Thunks;
static bool is_instance(wl_resource* resource);
private:
};
struct Thunks;
static bool is_instance(wl_resource* resource);
private:
};
class ZwlrOutputModeV1 : public Resource
{
public:
static char const constexpr* interface_name = "zwlr_output_mode_v1";
static ZwlrOutputModeV1* from(struct wl_resource*);
ZwlrOutputModeV1(ZwlrOutputHeadV1 const& parent);
virtual ~ZwlrOutputModeV1();
void send_size_event(int32_t width, int32_t height) const;
void send_refresh_event(int32_t refresh) const;
void send_preferred_event() const;
void send_finished_event() const;
void destroy_and_delete() const;
struct Opcode
class ZwlrOutputModeV1 : public Resource
{
static uint32_t const size = 0;
static uint32_t const refresh = 1;
static uint32_t const preferred = 2;
static uint32_t const finished = 3;
public:
static char const constexpr* interface_name = "zwlr_output_mode_v1";
static ZwlrOutputModeV1* from(struct wl_resource*);
ZwlrOutputModeV1(ZwlrOutputHeadV1 const& parent);
virtual ~ZwlrOutputModeV1();
void send_size_event(int32_t width, int32_t height) const;
void send_refresh_event(int32_t refresh) const;
void send_preferred_event() const;
void send_finished_event() const;
void destroy_and_delete() const;
struct Opcode
{
static uint32_t const size = 0;
static uint32_t const refresh = 1;
static uint32_t const preferred = 2;
static uint32_t const finished = 3;
};
struct Thunks;
static bool is_instance(wl_resource* resource);
private:
};
struct Thunks;
static bool is_instance(wl_resource* resource);
private:
};
class ZwlrOutputConfigurationV1 : public Resource
{
public:
static char const constexpr* interface_name = "zwlr_output_configuration_v1";
static ZwlrOutputConfigurationV1* from(struct wl_resource*);
ZwlrOutputConfigurationV1(struct wl_resource* resource, Version<2>);
virtual ~ZwlrOutputConfigurationV1();
void send_succeeded_event() const;
void send_failed_event() const;
void send_cancelled_event() const;
struct Error
class ZwlrOutputConfigurationV1 : public Resource
{
static uint32_t const already_configured_head = 1;
static uint32_t const unconfigured_head = 2;
static uint32_t const already_used = 3;
public:
static char const constexpr* interface_name = "zwlr_output_configuration_v1";
static ZwlrOutputConfigurationV1* from(struct wl_resource*);
ZwlrOutputConfigurationV1(struct wl_resource* resource, Version<2>);
virtual ~ZwlrOutputConfigurationV1();
void send_succeeded_event() const;
void send_failed_event() const;
void send_cancelled_event() const;
struct Error
{
static uint32_t const already_configured_head = 1;
static uint32_t const unconfigured_head = 2;
static uint32_t const already_used = 3;
};
struct Opcode
{
static uint32_t const succeeded = 0;
static uint32_t const failed = 1;
static uint32_t const cancelled = 2;
};
struct Thunks;
static bool is_instance(wl_resource* resource);
private:
virtual void enable_head(struct wl_resource* id, struct wl_resource* head) = 0;
virtual void disable_head(struct wl_resource* head) = 0;
virtual void apply() = 0;
virtual void test() = 0;
virtual void destroy() { }
};
struct Opcode
class ZwlrOutputConfigurationHeadV1 : public Resource
{
static uint32_t const succeeded = 0;
static uint32_t const failed = 1;
static uint32_t const cancelled = 2;
public:
static char const constexpr* interface_name = "zwlr_output_configuration_head_v1";
static ZwlrOutputConfigurationHeadV1* from(struct wl_resource*);
ZwlrOutputConfigurationHeadV1(struct wl_resource* resource, Version<2>);
virtual ~ZwlrOutputConfigurationHeadV1();
void destroy_and_delete() const;
struct Error
{
static uint32_t const already_set = 1;
static uint32_t const invalid_mode = 2;
static uint32_t const invalid_custom_mode = 3;
static uint32_t const invalid_transform = 4;
static uint32_t const invalid_scale = 5;
};
struct Thunks;
static bool is_instance(wl_resource* resource);
private:
virtual void set_mode(struct wl_resource* mode) = 0;
virtual void set_custom_mode(int32_t width, int32_t height, int32_t refresh) = 0;
virtual void set_position(int32_t x, int32_t y) = 0;
virtual void set_transform(int32_t transform) = 0;
virtual void set_scale(double scale) = 0;
};
struct Thunks;
static bool is_instance(wl_resource* resource);
private:
virtual void enable_head(struct wl_resource* id, struct wl_resource* head) = 0;
virtual void disable_head(struct wl_resource* head) = 0;
virtual void apply() = 0;
virtual void test() = 0;
virtual void destroy() {}
};
class ZwlrOutputConfigurationHeadV1 : public Resource
{
public:
static char const constexpr* interface_name = "zwlr_output_configuration_head_v1";
static ZwlrOutputConfigurationHeadV1* from(struct wl_resource*);
ZwlrOutputConfigurationHeadV1(struct wl_resource* resource, Version<2>);
virtual ~ZwlrOutputConfigurationHeadV1();
void destroy_and_delete() const;
struct Error
{
static uint32_t const already_set = 1;
static uint32_t const invalid_mode = 2;
static uint32_t const invalid_custom_mode = 3;
static uint32_t const invalid_transform = 4;
static uint32_t const invalid_scale = 5;
};
struct Thunks;
static bool is_instance(wl_resource* resource);
private:
virtual void set_mode(struct wl_resource* mode) = 0;
virtual void set_custom_mode(int32_t width, int32_t height, int32_t refresh) = 0;
virtual void set_position(int32_t x, int32_t y) = 0;
virtual void set_transform(int32_t transform) = 0;
virtual void set_scale(double scale) = 0;
};
}
}