Skip to content

Commit

Permalink
Update to build against wlroots 0.17.x
Browse files Browse the repository at this point in the history
  • Loading branch information
soreau committed Sep 15, 2023
1 parent 03b7255 commit 28cc679
Show file tree
Hide file tree
Showing 30 changed files with 161 additions and 102 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ jobs:
runs-on: ubuntu-latest
container: alpine:edge
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 hwdata
- run: apk --no-cache add curl git gcc g++ binutils pkgconf make 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
- 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
- run: (git clone https://github.com/vcrhonek/hwdata && cd hwdata && ./configure --prefix=/usr && curl http://ix.io/4Gui | git apply && make && make install)
- run: (git clone https://gitlab.freedesktop.org/emersion/libdisplay-info && cd libdisplay-info && meson build --prefix=/usr && ninja -C build install)
- run: (cd subprojects/wlroots && meson build --prefix=/usr && ninja -C build install)
- run: meson build -Dtests=enabled -Db_pch=true -Duse_system_wlroots=enabled --unity on
- run: ninja -v -Cbuild
Expand All @@ -29,6 +31,8 @@ jobs:
- 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
- run: (git clone https://github.com/vcrhonek/hwdata && cd hwdata && ./configure --prefix=/usr && make && make install)
- run: (git clone https://gitlab.freedesktop.org/emersion/libdisplay-info && cd libdisplay-info && meson build --prefix=/usr && ninja -C build install)
- run: (cd subprojects/wlroots && env CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++" LDFLAGS="-fuse-ld=lld -stdlib=libc++" meson build --prefix=/usr && ninja -C build install)
- run: env CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++" LDFLAGS="-fuse-ld=lld -stdlib=libc++" meson build -Db_pch=true -Duse_system_wlroots=enabled --unity on
- run: ninja -v -Cbuild
Expand Down
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ if get_option('use_system_wlroots').disabled()

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

elif get_option('use_system_wlroots').auto()
message( 'SEARCHING FOR WLROOTS' )
wlroots = dependency('wlroots', version: ['>=0.16.0', '<0.17.0'], required: false)
wlroots = dependency('wlroots', version: ['>=0.17.0', '<0.18.0'], required: false)
use_system_wlroots = true
if not wlroots.found()
use_system_wlroots = false
Expand Down
4 changes: 2 additions & 2 deletions plugins/protocols/foreign-toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class wayfire_foreign_toplevel
} else if (app_id_mode == "full")
{
#if WF_HAS_XWAYLAND
if (view->get_wlr_surface() && wlr_surface_is_xwayland_surface(view->get_wlr_surface()))
if (wlr_xwayland_surface *xw_surface =
wlr_xwayland_surface_try_from_wlr_surface(view->get_wlr_surface()))
{
auto xw_surface = wlr_xwayland_surface_from_wlr_surface(view->get_wlr_surface());
ev.app_id = nonull(xw_surface->instance);
}

Expand Down
3 changes: 1 addition & 2 deletions plugins/protocols/gtk-shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,8 @@ static void handle_gtk_shell_get_gtk_surface(wl_client *client, wl_resource *res
gtk_surface, handle_gtk_surface_destroy);

wlr_surface *wlr_surface = wlr_surface_from_resource(surface);
if (wlr_surface_is_xdg_surface(wlr_surface))
if (wlr_xdg_surface *xdg_surface = wlr_xdg_surface_try_from_wlr_surface(wlr_surface))
{
wlr_xdg_surface *xdg_surface = wlr_xdg_surface_from_wlr_surface(wlr_surface);
gtk_surface->on_configure.set_callback([=] (void*)
{
handle_xdg_surface_on_configure(gtk_surface);
Expand Down
2 changes: 1 addition & 1 deletion plugins/single_plugins/ipc-rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class ipc_rules_t : public wf::plugin_interface_t, public wf::per_output_tracker
{
#if WF_HAS_XWAYLAND
auto surf = view->get_wlr_surface();
if (surf && wlr_surface_is_xwayland_surface(surf))
if (surf && wlr_xwayland_surface_try_from_wlr_surface(surf))
{
return "x-or";
}
Expand Down
1 change: 1 addition & 0 deletions src/api/wayfire/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class compositor_core_t : public wf::object_base_t, public signal::provider_t
* used instead of this one
*/
wlr_backend *backend;
wlr_session *session;
wlr_renderer *renderer;
wlr_allocator *allocator;

Expand Down
3 changes: 2 additions & 1 deletion src/api/wayfire/nonstd/wlroots-full.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern "C"
#define static
#include <wlr/types/wlr_compositor.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/swapchain.h>
#include <wlr/render/allocator.h>
#include <wlr/render/gles2.h>
#include <wlr/render/egl.h>
Expand All @@ -32,7 +33,7 @@ extern "C"
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_viewporter.h>

#include <wlr/types/wlr_output_damage.h>
#include <wlr/types/wlr_damage_ring.h>
#include <wlr/types/wlr_presentation_time.h>
#include <wlr/util/region.h>
#include <wlr/types/wlr_screencopy_v1.h>
Expand Down
3 changes: 3 additions & 0 deletions src/api/wayfire/nonstd/wlroots.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ extern "C"
#include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_touch.h>
#define static
#include <wlr/types/wlr_output.h>
#undef static
#include <wlr/backend/session.h>
#include <wlr/util/box.h>
#include <wlr/util/edges.h>
#include <wayland-server.h>
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void wf::compositor_core_impl_t::init()
* 3. weston toy clients expect xdg-shell before wl_seat, i.e
* init_desktop_apis() should come before input.
* 4. GTK expects primary selection early. */
compositor = wlr_compositor_create(display, renderer);
compositor = wlr_compositor_create(display, 6, renderer);
/* Needed for subsurfaces */
wlr_subcompositor_create(display);

Expand Down
2 changes: 1 addition & 1 deletion src/core/opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void gl_call(const char *func, uint32_t line, const char *glfunc)
}

LOGE("gles2: function ", glfunc, " in ", func, " line ", line, ": ",
gl_error_string(glGetError()));
gl_error_string(err));
}

namespace OpenGL
Expand Down
12 changes: 7 additions & 5 deletions src/core/output-layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,13 @@ struct output_layout_output_t
* these cases */
on_mode.set_callback([=] (void *data)
{
handle_mode_changed();
wlr_output_event_commit *event = static_cast<wlr_output_event_commit*>(data);
if (event && event->committed & WLR_OUTPUT_STATE_MODE)
{
handle_mode_changed();
}
});
on_mode.connect(&handle->events.mode);
on_mode.connect(&handle->events.commit);
}
}

Expand Down Expand Up @@ -579,8 +583,7 @@ struct output_layout_output_t
" for output ", handle->name, ". Trying to use custom mode",
"(might not work)");

wlr_output_set_custom_mode(handle, mode.width, mode.height,
mode.refresh);
wlr_output_set_custom_mode(handle, mode.width, mode.height, 0);
}

wlr_output_commit(handle);
Expand Down Expand Up @@ -707,7 +710,6 @@ struct output_layout_output_t

/* The mirrored output was repainted, schedule repaint
* for us as well */
wlr_output_damage_whole(handle);
wlr_output_schedule_frame(handle);
});
on_mirrored_frame.connect(&wo->handle->events.commit);
Expand Down
2 changes: 1 addition & 1 deletion src/core/seat/cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void wf::cursor_t::set_cursor(std::string name)

idle_set_cursor.run_once([name, this] ()
{
wlr_xcursor_manager_set_cursor_image(xcursor, name.c_str(), cursor);
wlr_cursor_set_xcursor(cursor, xcursor, name.c_str());
});
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/seat/drag-icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ wf::drag_icon_t::drag_icon_t(wlr_drag_icon *ic) : icon(ic)

// Sometimes, the drag surface is reused between two or more drags.
// In this case, when the drag starts, the icon is already mapped.
if (!icon->mapped)
if (!icon->surface->mapped)
{
root_node->set_enabled(false);
}
Expand All @@ -147,8 +147,8 @@ wf::drag_icon_t::drag_icon_t(wlr_drag_icon *ic) : icon(ic)
wf::get_core().seat->priv->drag_icon = nullptr;
});

on_map.connect(&icon->events.map);
on_unmap.connect(&icon->events.unmap);
on_map.connect(&icon->surface->events.map);
on_unmap.connect(&icon->surface->events.unmap);
on_destroy.connect(&icon->events.destroy);


Expand All @@ -175,8 +175,8 @@ wf::point_t wf::drag_icon_t::get_position()

if (root_node->is_enabled())
{
pos.x += icon->surface->sx;
pos.y += icon->surface->sy;
pos.x += icon->surface->current.dx;
pos.y += icon->surface->current.dy;
}

return {(int)pos.x, (int)pos.y};
Expand Down
3 changes: 1 addition & 2 deletions src/core/seat/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,7 @@ bool wf::keyboard_t::handle_keyboard_key(uint32_t key, uint32_t state)

if (state == WLR_KEY_PRESSED)
{
auto session = wlr_backend_get_session(wf::get_core().backend);
if (check_vt_switch(session, key, get_modifiers()))
if (wf::get_core().session && check_vt_switch(wf::get_core().session, key, get_modifiers()))
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/view-access-interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ variant_t view_access_interface_t::get(const std::string & identifier, bool & er
{
#if WF_HAS_XWAYLAND
auto surf = _view->get_wlr_surface();
if (surf && wlr_surface_is_xwayland_surface(surf))
if (wlr_xwayland_surface_try_from_wlr_surface(surf))
{
out = std::string("x-or");
break;
Expand Down
5 changes: 3 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ int main(int argc, char *argv[])
/** TODO: move this to core_impl constructor */
core.display = display;
core.ev_loop = wl_display_get_event_loop(core.display);
core.backend = wlr_backend_autocreate(core.display);
core.backend = wlr_backend_autocreate(core.display, &core.session);

int drm_fd = wlr_backend_get_drm_fd(core.backend);
if (drm_fd < 0)
Expand All @@ -364,7 +364,8 @@ int main(int argc, char *argv[])
}
}

core.renderer = wlr_gles2_renderer_create_with_drm_fd(drm_fd);
core.renderer = wlr_gles2_renderer_create_with_drm_fd(drm_fd);
assert(core.renderer);
core.allocator = wlr_allocator_autocreate(core.backend, core.renderer);
assert(core.allocator);
core.egl = wlr_gles2_renderer_get_egl(core.renderer);
Expand Down
Loading

0 comments on commit 28cc679

Please sign in to comment.