Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to wlroots 0.18.x #2452

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b3b54cc
Port to wlroots 0.18.x
soreau Aug 26, 2024
6f86c07
xdg-toplevel: Remove log message
soreau Aug 26, 2024
cedfcc9
ipc-rules: Rename tablet variable to tablet instead of touch
soreau Aug 26, 2024
216bc6c
build: Depend on wlroots-0.18 when building against system wlroots
soreau Aug 26, 2024
db7204e
xdg-popups: Use correct destroy event
soreau Aug 26, 2024
ec85a05
xwayland: Don't attempt to restack OR surfaces
soreau Aug 27, 2024
8710952
build: use wlroots-0.18 for public api requirements
soreau Aug 27, 2024
3f81063
xdg-toplevel: Track wlroots changes
soreau Aug 27, 2024
93e9572
xdg-toplevel: Remove unnecessary change
soreau Aug 27, 2024
f1d9263
output-layout: Remove commented wlr_output_rollback call
soreau Aug 28, 2024
c19648e
ipc-input-methods: Drop vendor and product fields
soreau Aug 31, 2024
a094730
CI: Build wayland 1.23 manually
soreau Aug 28, 2024
11c1d28
CI: Build libdrm manually to satisfy required version
soreau Aug 28, 2024
9e98acd
output-layout: Rollback adaptive sync change if uncommitted
soreau Sep 8, 2024
de1d83b
xdg-shell: Use version from header definition
soreau Sep 28, 2024
a704e04
xdg-toplevel: Use destroy event from xdg-toplevel instead of xdg-surface
soreau Sep 28, 2024
b987564
output-layout: Reset wlr_output_state after each commit
soreau Sep 28, 2024
885c5ad
wlroots: Bump subproject to 0.18.1
soreau Sep 28, 2024
e62cc0b
subsurface: Fix damage issue
soreau Sep 28, 2024
15a285e
core: Track wlroots 0.18 changes
soreau Oct 5, 2024
3d3f426
main: Add legacy-wl-drm option to --help
soreau Oct 5, 2024
158ff3e
output-layout: add a helper for setting/committing output state
ammen99 Nov 18, 2024
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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ jobs:
runs-on: ubuntu-latest
container: alpine:latest
steps:
- run: apk --no-cache add git gcc g++ binutils pkgconf meson ninja musl-dev wayland-dev wayland-protocols libinput-dev libevdev-dev libxkbcommon-dev pixman-dev glm-dev libdrm-dev mesa-dev cairo-dev pango-dev eudev-dev libxml2-dev libseat-dev libxcb-dev xcb-util-wm-dev xwayland doctest doctest-dev cmake libdisplay-info-dev hwdata-dev nlohmann-json
- run: apk --no-cache add git gcc g++ binutils pkgconf meson ninja musl-dev wayland-protocols libinput-dev libevdev-dev libxkbcommon-dev pixman-dev glm-dev mesa-dev cairo-dev pango-dev eudev-dev libxml2-dev libseat-dev libxcb-dev xcb-util-wm-dev xwayland doctest doctest-dev cmake libdisplay-info-dev hwdata-dev nlohmann-json
- run: git clone https://gitlab.freedesktop.org/wayland/wayland && cd wayland && git checkout 1.23.0 && meson setup build -Ddocumentation=false -Dtests=false --prefix=/usr && ninja -C build && ninja -C build install && cd .. && rm -rf wayland
- run: git clone https://gitlab.freedesktop.org/mesa/drm && cd drm && meson setup build --prefix=/usr && ninja -C build && ninja -C build install && cd .. && rm -rf drm
- uses: actions/checkout@v1
- run: git config --global --add safe.directory /__w/wayfire/wayfire
- run: git submodule sync --recursive && git submodule update --init --force --recursive
Expand Down
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ if get_option('use_system_wlroots').disabled()

elif get_option('use_system_wlroots').enabled()
use_system_wlroots = true
wlroots = dependency('wlroots', version: ['>=0.17.0', '<0.18.0'], required: true)
wlroots = dependency('wlroots-0.18', version: ['>=0.18.0', '<0.19.0'], required: true)

elif get_option('use_system_wlroots').auto()
message( 'SEARCHING FOR WLROOTS' )
wlroots = dependency('wlroots', version: ['>=0.17.0', '<0.18.0'], required: false)
wlroots = dependency('wlroots-0.18', version: ['>=0.18.0', '<0.19.0'], required: false)
use_system_wlroots = true
if not wlroots.found()
use_system_wlroots = false
Expand Down
4 changes: 2 additions & 2 deletions plugins/cube/cube.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ class wayfire_cube : public wf::per_output_plugin_instance_t, public wf::pointer

void handle_pointer_button(const wlr_pointer_button_event& event) override
{
if (event.state == WLR_BUTTON_RELEASED)
if (event.state == WL_POINTER_BUTTON_STATE_RELEASED)
{
input_ungrabbed();
}
}

void handle_pointer_axis(const wlr_pointer_axis_event& event) override
{
if (event.orientation == WLR_AXIS_ORIENTATION_VERTICAL)
if (event.orientation == WL_POINTER_AXIS_VERTICAL_SCROLL)
{
pointer_scrolled(event.delta);
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/decor/deco-subsurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class simple_decoration_node_t : public wf::scene::node_t, public wf::pointer_in
return;
}

handle_action(layout.handle_press_event(ev.state == WLR_BUTTON_PRESSED));
handle_action(layout.handle_press_event(ev.state == WL_POINTER_BUTTON_STATE_PRESSED));
}

void handle_action(wf::decor::decoration_layout_t::action_response_t action)
Expand Down
10 changes: 4 additions & 6 deletions plugins/ipc-rules/ipc-input-methods.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ipc_rules_input_methods_t
case WLR_INPUT_DEVICE_TOUCH:
return "touch";

case WLR_INPUT_DEVICE_TABLET_TOOL:
case WLR_INPUT_DEVICE_TABLET:
return "tablet_tool";

case WLR_INPUT_DEVICE_TABLET_PAD:
Expand All @@ -55,11 +55,9 @@ class ipc_rules_input_methods_t
for (auto& device : wf::get_core().get_input_devices())
{
nlohmann::json d;
d["id"] = (intptr_t)device->get_wlr_handle();
d["name"] = nonull(device->get_wlr_handle()->name);
d["vendor"] = device->get_wlr_handle()->vendor;
d["product"] = device->get_wlr_handle()->product;
d["type"] = wlr_input_device_type_to_string(device->get_wlr_handle()->type);
d["id"] = (intptr_t)device->get_wlr_handle();
d["name"] = nonull(device->get_wlr_handle()->name);
d["type"] = wlr_input_device_type_to_string(device->get_wlr_handle()->type);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no way to get vendor/product? Maybe by asking libinput directly for libinput devices, and just setting 'unknown' or 'nil' or whatever is appropriate for others. I would like to avoid any breaking changes to the IPC if possible.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the 0.18 release notes:

"..drop wlr_input_device.{vendor,product}, these aren't super useful without the bus type. Compositors can still obtain this information from the libinput device if they want to."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could use some help finding the call(s) to get the vendor/product id from libinput.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried libinput_device_get_id_{vendor|product}(wlr_libinput_get_device_handle(device->get_wlr_handle())); but it always crashes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devices are not necessarily libinput devices (especially in the wayland backend, you won't find a libinput device). So this needs to be in a check, and in the other cases we can set 'unknown' or -1 as a value.

d["enabled"] = device->is_enabled();
response.push_back(d);
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/ipc-rules/ipc-utility-methods.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class ipc_rules_utility_methods_t
if (!headless_backend)
{
auto& core = wf::get_core();
headless_backend = wlr_headless_backend_create(core.display);
headless_backend = wlr_headless_backend_create(core.ev_loop);
wlr_multi_backend_add(core.backend, headless_backend);
wlr_backend_start(headless_backend);
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/ipc/stipc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class headless_input_backend_t
headless_input_backend_t()
{
auto& core = wf::get_core();
backend = wlr_headless_backend_create(core.display);
backend = wlr_headless_backend_create(core.ev_loop);
wlr_multi_backend_add(core.backend, backend);

wlr_pointer_init(&pointer, &pointer_impl, "stipc_pointer");
Expand Down Expand Up @@ -140,7 +140,7 @@ class headless_input_backend_t
wlr_keyboard_notify_key(&keyboard, &ev);
}

void do_button(uint32_t button, wlr_button_state state)
void do_button(uint32_t button, wl_pointer_button_state state)
{
wlr_pointer_button_event ev;
ev.pointer = &pointer;
Expand Down Expand Up @@ -479,12 +479,12 @@ class stipc_plugin_t : public wf::plugin_interface_t
input->do_key(KEY_LEFTMETA, WL_KEYBOARD_KEY_STATE_PRESSED);
}

input->do_button(button->code, WLR_BUTTON_PRESSED);
input->do_button(button->code, WL_POINTER_BUTTON_STATE_PRESSED);
}

if ((mode == "release") || (mode == "full"))
{
input->do_button(button->code, WLR_BUTTON_RELEASED);
input->do_button(button->code, WL_POINTER_BUTTON_STATE_RELEASED);
if (button->modifier)
{
input->do_key(KEY_LEFTMETA, WL_KEYBOARD_KEY_STATE_RELEASED);
Expand Down
2 changes: 1 addition & 1 deletion plugins/single_plugins/alpha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class wayfire_alpha : public wf::plugin_interface_t
return false;
}

if (ev->orientation == WLR_AXIS_ORIENTATION_VERTICAL)
if (ev->orientation == WL_POINTER_AXIS_VERTICAL_SCROLL)
{
update_alpha(view, ev->delta);

Expand Down
12 changes: 8 additions & 4 deletions plugins/single_plugins/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ class wayfire_command : public wf::plugin_interface_t
wf::signal::connection_t<wf::input_event_signal<wlr_pointer_button_event>> on_button_event =
[=] (wf::input_event_signal<wlr_pointer_button_event> *ev)
{
if ((ev->event->button == repeat.pressed_button) && (ev->event->state == WLR_BUTTON_RELEASED))
if ((ev->event->button == repeat.pressed_button) &&
(ev->event->state == WL_POINTER_BUTTON_STATE_RELEASED))
{
reset_repeat();
}
Expand All @@ -194,7 +195,8 @@ class wayfire_command : public wf::plugin_interface_t
wf::signal::connection_t<wf::input_event_signal<wlr_keyboard_key_event>> on_key_event =
[=] (wf::input_event_signal<wlr_keyboard_key_event> *ev)
{
if ((ev->event->keycode == repeat.pressed_key) && (ev->event->state == WLR_KEY_RELEASED))
if ((ev->event->keycode == repeat.pressed_key) &&
(ev->event->state == WL_KEYBOARD_KEY_STATE_RELEASED))
{
reset_repeat();
}
Expand All @@ -203,7 +205,8 @@ class wayfire_command : public wf::plugin_interface_t
wf::signal::connection_t<wf::input_event_signal<wlr_keyboard_key_event>> on_key_event_release =
[=] (wf::input_event_signal<wlr_keyboard_key_event> *ev)
{
if ((ev->event->keycode == repeat.pressed_key) && (ev->event->state == WLR_KEY_RELEASED))
if ((ev->event->keycode == repeat.pressed_key) &&
(ev->event->state == WL_KEYBOARD_KEY_STATE_RELEASED))
{
repeat.callback();
repeat.pressed_key = repeat.pressed_button = 0;
Expand All @@ -214,7 +217,8 @@ class wayfire_command : public wf::plugin_interface_t
wf::signal::connection_t<wf::input_event_signal<wlr_pointer_button_event>> on_button_event_release =
[=] (wf::input_event_signal<wlr_pointer_button_event> *ev)
{
if ((ev->event->button == repeat.pressed_button) && (ev->event->state == WLR_BUTTON_RELEASED))
if ((ev->event->button == repeat.pressed_button) &&
(ev->event->state == WL_POINTER_BUTTON_STATE_RELEASED))
{
repeat.callback();
repeat.pressed_key = repeat.pressed_button = 0;
Expand Down
4 changes: 2 additions & 2 deletions plugins/single_plugins/move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class wayfire_move : public wf::per_output_plugin_instance_t,
wf::signal::connection_t<wf::input_event_signal<wlr_pointer_button_event>> on_raw_pointer_button =
[=] (wf::input_event_signal<wlr_pointer_button_event> *ev)
{
if (ev->event->state == WLR_BUTTON_PRESSED)
if (ev->event->state == WL_POINTER_BUTTON_STATE_PRESSED)
{
last_input_press_position = get_global_input_coords();
}
Expand Down Expand Up @@ -198,7 +198,7 @@ class wayfire_move : public wf::per_output_plugin_instance_t,

void handle_pointer_button(const wlr_pointer_button_event& event) override
{
if (event.state != WLR_BUTTON_RELEASED)
if (event.state != WL_POINTER_BUTTON_STATE_RELEASED)
{
return;
}
Expand Down
3 changes: 2 additions & 1 deletion plugins/single_plugins/resize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class wayfire_resize : public wf::per_output_plugin_instance_t, public wf::point

void handle_pointer_button(const wlr_pointer_button_event& event) override
{
if ((event.state == WLR_BUTTON_RELEASED) && was_client_request && (event.button == BTN_LEFT))
if ((event.state == WL_POINTER_BUTTON_STATE_RELEASED) && was_client_request &&
(event.button == BTN_LEFT))
{
return input_pressed(event.state);
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/single_plugins/wrot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class wf_wrot : public wf::per_output_plugin_instance_t, public wf::pointer_inte

void handle_pointer_button(const wlr_pointer_button_event& event) override
{
if (event.state == WLR_BUTTON_RELEASED)
if (event.state == WL_POINTER_BUTTON_STATE_RELEASED)
{
input_released();
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/single_plugins/zoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class wayfire_zoom_screen : public wf::per_output_plugin_instance_t
return false;
}

if (ev->orientation != WLR_AXIS_ORIENTATION_VERTICAL)
if (ev->orientation != WL_POINTER_AXIS_VERTICAL_SCROLL)
{
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/tile/tile-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class tile_output_plugin_t : public wf::pointer_interaction_t, public wf::custom

void handle_pointer_button(const wlr_pointer_button_event& event) override
{
if (event.state == WLR_BUTTON_RELEASED)
if (event.state == WL_POINTER_BUTTON_STATE_RELEASED)
{
stop_controller(false);
}
Expand Down
2 changes: 1 addition & 1 deletion proto/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ server_protocols = [
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/tablet/tablet-unstable-v2.xml'],
[wl_protocol_dir, 'stable/tablet/tablet-v2.xml'],
[wl_protocol_dir, 'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml'],
[wl_protocol_dir, 'unstable/input-method/input-method-unstable-v1.xml'],
[wl_protocol_dir, 'staging/ext-session-lock/ext-session-lock-v1.xml'],
Expand Down
4 changes: 2 additions & 2 deletions src/api/wayfire/nonstd/wlroots-full.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern "C"
#include <wlr/types/wlr_damage_ring.h>
#include <wlr/types/wlr_presentation_time.h>
#include <wlr/util/region.h>
#include <wlr/util/transform.h>
#include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
Expand Down Expand Up @@ -112,7 +113,7 @@ extern "C"
#include <wlr/types/wlr_pointer_constraints_v1.h>
#endif
#include <wlr/types/wlr_cursor.h>
#if __has_include(<tablet-unstable-v2-protocol.h>)
#if __has_include(<tablet-v2-protocol.h>)
#include <wlr/types/wlr_tablet_v2.h>
#endif
#include <wlr/types/wlr_tablet_tool.h>
Expand All @@ -131,7 +132,6 @@ extern "C"
#include <wlr/types/wlr_virtual_pointer_v1.h>
#include <wlr/types/wlr_idle_notify_v1.h>
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_input_inhibitor.h>
#define delete delete_
#include <wlr/types/wlr_input_method_v2.h>
#undef delete
Expand Down
16 changes: 1 addition & 15 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void wf::compositor_core_impl_t::init()

/* Legacy DRM */
if (runtime_config.legacy_wl_drm &&
wlr_renderer_get_dmabuf_texture_formats(renderer))
wlr_renderer_get_texture_formats(renderer, WLR_BUFFER_CAP_DMABUF))
{
wlr_drm_create(display, renderer);
}
Expand Down Expand Up @@ -137,20 +137,6 @@ void wf::compositor_core_impl_t::init()
LOGE("Failed to create wlr_drm_lease_device_v1; VR will not be available!");
}

/* input-inhibit setup */
protocols.input_inhibit = wlr_input_inhibit_manager_create(display);
input_inhibit_activated.set_callback([&] (void*)
{
input->set_exclusive_focus(protocols.input_inhibit->active_client);
});
input_inhibit_activated.connect(&protocols.input_inhibit->events.activate);

input_inhibit_deactivated.set_callback([&] (void*)
{
input->set_exclusive_focus(nullptr);
});
input_inhibit_deactivated.connect(&protocols.input_inhibit->events.deactivate);

/* idle-inhibit setup */
protocols.idle_notifier = wlr_idle_notifier_v1_create(display);
protocols.idle_inhibit = wlr_idle_inhibit_v1_create(display);
Expand Down
Loading
Loading