Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,13 @@ set_package_properties(Pixman PROPERTIES
PURPOSE "Required for building wlroots backend."
)

set(WLROOTS_MIN_VERSION "0.17.0")
set(WLROOTS_MIN_VERSION "0.18.0")
find_package(wlroots ${WLROOTS_MIN_VERSION})
set_package_properties(wlroots PROPERTIES
TYPE REQUIRED
PURPOSE "Required for building wlroots backend."
)

if (${wlroots_VERSION} VERSION_GREATER_EQUAL 0.18)
set(WLR_HAVE_SESSION_CREATE_LOOP 1)
set(WLR_HAVE_UTIL_TRANSFORM_HEADER 1)
set(WLR_HAVE_NEW_PIXEL_COPY_API 1)
set(WLR_HAVE_BACKEND_CREATE_WITH_LOOP 1)
set(WLR_HAVE_WL_POINTER_ENUMS 1)
endif()

find_package(X11)
set_package_properties(X11 PROPERTIES
DESCRIPTION "X11 libraries"
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"DEBUG_SHARED_LINKER_FLAGS": "-Wl,--fatal-warnings",
"DEBUG_MODULE_LINKER_FLAGS": "-Wl,--fatal-warnings",
"NOUNDEF_LINKER_FLAGS": "-Wl,--no-undefined",
"DEBUG_CXX_FLAGS_CLANG": "$env{DEBUG_CXX_FLAGS} -fno-operator-names -Wno-gnu-zero-variadic-macro-arguments -Wno-cast-align -Werror -Wno-error=deprecated-declarations -Wno-error=unused-lambda-capture",
"DEBUG_CXX_FLAGS_CLANG": "$env{DEBUG_CXX_FLAGS} -fno-operator-names -Wno-gnu-zero-variadic-macro-arguments -Wno-cast-align -Werror -Wno-error=deprecated-declarations -Wno-error=unused-lambda-capture -Wno-missing-field-initializers",
"DEBUG_CXX_FLAGS_GCC": "$env{DEBUG_CXX_FLAGS} -Wsuggest-override -Wlogical-op -Wmissing-include-dirs -Wno-missing-field-initializers -Werror -Wno-error=unknown-pragmas -Wno-error=deprecated-declarations -Wno-error=missing-include-dirs"
}
},
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/Findwlroots.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#==============================================================================

find_package(PkgConfig)
pkg_check_modules(PKG_wlroots QUIET wlroots)
pkg_search_module(PKG_wlroots wlroots-0.19 wlroots-0.18)

set(wlroots_VERSION ${PKG_wlroots_VERSION})
set(wlroots_INCLUDE_DIRS ${PKG_wlroots_INCLUDE_DIRS})
Expand Down
8 changes: 0 additions & 8 deletions como/base/backend/wlroots/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,12 @@ class backend
// TODO(romangg): Make this dependent on KWIN_CORE debug verbosity.
wlr_log_init(WLR_DEBUG, nullptr);

#if WLR_HAVE_BACKEND_CREATE_WITH_LOOP
auto wlloop = wl_display_get_event_loop(frontend.server->display->native());
if (headless) {
native = wlr_headless_backend_create(wlloop);
} else {
native = wlr_backend_autocreate(wlloop, &wlroots_session);
}
#else
if (headless) {
native = wlr_headless_backend_create(frontend.server->display->native());
} else {
native = wlr_backend_autocreate(frontend.server->display->native(), &wlroots_session);
}
#endif

destroyed->receiver = this;
destroyed->event.notify = handle_destroy<type>;
Expand Down
12 changes: 1 addition & 11 deletions como/base/backend/wlroots/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void add_new_output(Backend& backend, wlr_output* native)

if (!wl_list_empty(&native->modes)) {
auto mode = wlr_output_preferred_mode(native);
#if WLR_HAVE_NEW_PIXEL_COPY_API

wlr_output_state state;
wlr_output_state_init(&state);
wlr_output_state_set_mode(&state, mode);
Expand All @@ -43,16 +43,6 @@ void add_new_output(Backend& backend, wlr_output* native)
if (!wlr_output_commit_state(native, &state)) {
throw std::runtime_error("wlr_output_commit_state failed");
}
#else
wlr_output_set_mode(native, mode);
wlr_output_enable(native, true);
if (!wlr_output_test(native)) {
throw std::runtime_error("wlr_output_test failed");
}
if (!wlr_output_commit(native)) {
throw std::runtime_error("wlr_output_commit failed");
}
#endif
}

auto output = new wlroots::output(native, &backend);
Expand Down
72 changes: 0 additions & 72 deletions como/base/backend/wlroots/output.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ extern "C" {
namespace como::base::backend::wlroots
{

#if WLR_HAVE_NEW_PIXEL_COPY_API
struct output_state {
output_state()
: native{std::make_unique<wlr_output_state>()}
Expand All @@ -43,7 +42,6 @@ struct output_state {
private:
std::unique_ptr<wlr_output_state> native;
};
#endif

template<typename Output>
void output_handle_destroy(wl_listener* listener, void* /*data*/)
Expand Down Expand Up @@ -148,7 +146,6 @@ class output : public base::wayland::output<typename Backend::frontend_type>
return wlr_output_get_gamma_size(native);
}

#if WLR_HAVE_NEW_PIXEL_COPY_API
void update_dpms(base::dpms_mode mode) override
{
output_state state;
Expand Down Expand Up @@ -214,65 +211,14 @@ class output : public base::wayland::output<typename Backend::frontend_type>
next_state = std::make_unique<output_state>();
}
}
#else
void update_dpms(base::dpms_mode mode) override
{
auto set_on = mode == base::dpms_mode::on;
wlr_output_enable(native, set_on);

if (set_on) {
wlr_output_commit(native);
wayland::output_set_dpms_on(*this, *backend->frontend);
return;
}

if (!wlr_output_test(native)) {
qCWarning(KWIN_CORE) << "Failed test commit on disabling output for DPMS.";
wlr_output_enable(native, true);
return;
}

get_render(this->render)->disable();
wlr_output_commit(native);
wayland::output_set_dmps_off(mode, *this, *backend->frontend);
}

bool change_backend_state(Wrapland::Server::output_state const& state) override
{
wlr_output_enable(native, state.enabled);

if (state.enabled) {
set_native_mode(native, state.mode.id);
wlr_output_set_transform(native, static_cast<wl_output_transform>(state.transform));
wlr_output_enable_adaptive_sync(native, state.adaptive_sync);
}

return wlr_output_test(native);
}

bool set_gamma_ramp(gamma_ramp const& gamma) override
{
wlr_output_set_gamma(native, gamma.size(), gamma.red(), gamma.green(), gamma.blue());

if (!wlr_output_test(native)) {
qCWarning(KWIN_CORE) << "Failed test commit on set gamma ramp call.";
// TODO(romangg): Set previous gamma.
return false;
}
return true;
}
#endif

wlr_output* native;
#if WLR_HAVE_NEW_PIXEL_COPY_API
std::unique_ptr<output_state> next_state;
#endif
Backend* backend;

private:
base::event_receiver<output> destroy_rec;

#if WLR_HAVE_NEW_PIXEL_COPY_API
static void set_native_mode(wlr_output const& output, output_state& state, int mode_index)
{
// TODO(romangg): Determine target mode more precisly with semantic properties instead of
Expand All @@ -289,24 +235,6 @@ class output : public base::wayland::output<typename Backend::frontend_type>
count++;
}
}
#else
void set_native_mode(wlr_output* output, int mode_index)
{
// TODO(romangg): Determine target mode more precisly with semantic properties instead of
// index.
wlr_output_mode* wlr_mode;
auto count = 0;

wl_list_for_each(wlr_mode, &output->modes, link)
{
if (count == mode_index) {
wlr_output_set_mode(output, wlr_mode);
return;
}
count++;
}
}
#endif

template<typename AbstractRenderOutput>
render_t* get_render(std::unique_ptr<AbstractRenderOutput>& output)
Expand Down
5 changes: 0 additions & 5 deletions como/base/config-como.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
#cmakedefine01 HAVE_SCHED_RESET_ON_FORK
#cmakedefine01 HAVE_ACCESSIBILITY
#cmakedefine01 HAVE_EPOXY_GLX
#cmakedefine01 WLR_HAVE_SESSION_CREATE_LOOP
#cmakedefine01 WLR_HAVE_UTIL_TRANSFORM_HEADER
#cmakedefine01 WLR_HAVE_NEW_PIXEL_COPY_API
#cmakedefine01 WLR_HAVE_BACKEND_CREATE_WITH_LOOP
#cmakedefine01 WLR_HAVE_WL_POINTER_ENUMS

#if HAVE_BREEZE_DECO
#define BREEZE_KDECORATION_PLUGIN_ID "${BREEZE_KDECORATION_PLUGIN_ID}"
Expand Down
4 changes: 0 additions & 4 deletions como/base/seat/backend/wlroots/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ void session::take_control(wl_display* display)

// TODO(romangg): assert instead?
if (!native) {
#if WLR_HAVE_SESSION_CREATE_LOOP
native = wlr_session_create(wl_display_get_event_loop(display));
#else
native = wlr_session_create(display);
#endif
if (!native) {
// TODO(romangg): error handling?
qCCritical(KWIN_CORE) << "Could not take control.";
Expand Down
4 changes: 2 additions & 2 deletions como/base/x11/user_interaction_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class user_interaction_filter : public event_filter
public:
user_interaction_filter(event_filter_manager& manager, std::function<void(void)> callback)
: event_filter(
manager,
QVector<int>{XCB_KEY_PRESS, XCB_KEY_RELEASE, XCB_BUTTON_PRESS, XCB_BUTTON_RELEASE})
manager,
QVector<int>{XCB_KEY_PRESS, XCB_KEY_RELEASE, XCB_BUTTON_PRESS, XCB_BUTTON_RELEASE})
, callback{callback}
{
assert(callback);
Expand Down
20 changes: 10 additions & 10 deletions como/base/x11/xcb/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ class property : public wrapper<property_data,
public:
explicit property(xcb_connection_t* con)
: wrapper<property_data, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t>(
con)
con)
, m_type(XCB_ATOM_NONE)
{
}
property(property const& other)
: wrapper<property_data, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t>(
other)
other)
, m_type(other.m_type)
{
}
Expand All @@ -50,14 +50,14 @@ class property : public wrapper<property_data,
uint32_t long_offset,
uint32_t long_length)
: wrapper<property_data, uint8_t, xcb_window_t, xcb_atom_t, xcb_atom_t, uint32_t, uint32_t>(
con,
window,
_delete,
window,
prop,
type,
long_offset,
long_length)
con,
window,
_delete,
window,
prop,
type,
long_offset,
long_length)
, m_type(type)
{
}
Expand Down
31 changes: 7 additions & 24 deletions como/input/backend/wlroots/pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,14 @@ void handle_button(struct wl_listener* listener, void* data)
auto pointer = event_receiver_struct->receiver;
auto wlr_event = reinterpret_cast<wlr_pointer_button_event*>(data);

auto event = button_event
{
auto event = button_event{
wlr_event->button,
#if WLR_HAVE_WL_POINTER_ENUMS
wlr_event->state == WL_POINTER_BUTTON_STATE_RELEASED ? button_state::released
: button_state::pressed,
#else
wlr_event->state == WLR_BUTTON_RELEASED ? button_state::released
: button_state::pressed,
#endif
{
pointer,
wlr_event->time_msec,
},
wlr_event->state == WL_POINTER_BUTTON_STATE_RELEASED ? button_state::released
: button_state::pressed,
{
pointer,
wlr_event->time_msec,
},
};

Q_EMIT pointer->button_changed(event);
Expand All @@ -111,7 +105,6 @@ void handle_axis(struct wl_listener* listener, void* data)

auto get_source = [](auto wlr_source) {
switch (wlr_source) {
#if WLR_HAVE_WL_POINTER_ENUMS
case WL_POINTER_AXIS_SOURCE_WHEEL:
return axis_source::wheel;
case WL_POINTER_AXIS_SOURCE_FINGER:
Expand All @@ -120,16 +113,6 @@ void handle_axis(struct wl_listener* listener, void* data)
return axis_source::continuous;
case WL_POINTER_AXIS_SOURCE_WHEEL_TILT:
return axis_source::wheel_tilt;
#else
case WLR_AXIS_SOURCE_WHEEL:
return axis_source::wheel;
case WLR_AXIS_SOURCE_FINGER:
return axis_source::finger;
case WLR_AXIS_SOURCE_CONTINUOUS:
return axis_source::continuous;
case WLR_AXIS_SOURCE_WHEEL_TILT:
return axis_source::wheel_tilt;
#endif
default:
return axis_source::unknown;
}
Expand Down
6 changes: 3 additions & 3 deletions como/input/idle.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ class idle
public:
idle()
: qobject{std::make_unique<idle_qobject>(
[this](auto& listener) { add_listener(listener); },
[this](auto& listener) { remove_listener(listener); },
[this] { report_activity(); })}
[this](auto& listener) { add_listener(listener); },
[this](auto& listener) { remove_listener(listener); },
[this] { report_activity(); })}
, countdown{std::make_unique<QTimer>()}
{
singleton_interface::idle_qobject = qobject.get();
Expand Down
32 changes: 16 additions & 16 deletions como/input/wayland/fake/pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ class pointer : public input::pointer
this->redirect.pointer->process_motion_absolute({pos, {this, 0}});
});

QObject::connect(
device,
&Wrapland::Server::FakeInputDevice::pointerButtonPressRequested,
this,
[this](auto button) {
// TODO: Fix time
this->redirect.pointer->process_button({button, button_state::pressed, {this, 0}});
});
QObject::connect(
device,
&Wrapland::Server::FakeInputDevice::pointerButtonReleaseRequested,
this,
[this](auto button) {
// TODO: Fix time
this->redirect.pointer->process_button({button, button_state::released, {this, 0}});
});
QObject::connect(device,
&Wrapland::Server::FakeInputDevice::pointerButtonPressRequested,
this,
[this](auto button) {
// TODO: Fix time
this->redirect.pointer->process_button(
{button, button_state::pressed, {this, 0}});
});
QObject::connect(device,
&Wrapland::Server::FakeInputDevice::pointerButtonReleaseRequested,
this,
[this](auto button) {
// TODO: Fix time
this->redirect.pointer->process_button(
{button, button_state::released, {this, 0}});
});
QObject::connect(device,
&Wrapland::Server::FakeInputDevice::pointerAxisRequested,
this,
Expand Down
Loading