Skip to content

Commit

Permalink
Track wlroots 0.17 changes (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
soreau authored Nov 25, 2023
1 parent a86e02e commit 9a3d548
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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 glibmm-dev libseat-dev hwdata nlohmann-json
- 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 glibmm-dev libseat-dev libdisplay-info-dev hwdata-dev nlohmann-json
- name: Wayfire
uses: actions/checkout@v2
with:
Expand All @@ -24,7 +24,7 @@ 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 glibmm-dev libseat-dev libxcb-dev xcb-util-wm-dev xwayland hwdata nlohmann-json
- 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 glibmm-dev libseat-dev libxcb-dev xcb-util-wm-dev xwayland libdisplay-info-dev hwdata-dev nlohmann-json
- name: Wayfire
uses: actions/checkout@v2
with:
Expand Down
21 changes: 8 additions & 13 deletions src/background-view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,22 +335,21 @@ class wayfire_background_view : public wf::plugin_interface_t
void set_view_for_output(wayfire_toplevel_view view, wlr_surface *surface, wf::output_t *o)
{
std::shared_ptr<unmappable_view_t> new_view;
if (wlr_surface_is_xdg_surface(surface))
if (wlr_xdg_surface *surf = wlr_xdg_surface_try_from_wlr_surface(surface))
{
auto toplevel = wlr_xdg_surface_from_wlr_surface(surface)->toplevel;
auto toplevel = surf->toplevel;
wlr_xdg_toplevel_set_size(toplevel, o->get_screen_size().width, o->get_screen_size().height);
new_view = unmappable_view_t::create<wayfire_background_view_xdg>(toplevel, o);
new_view->on_unmap.connect(&toplevel->base->events.unmap);
new_view->on_unmap.connect(&toplevel->base->surface->events.unmap);
}

#if WF_HAS_XWAYLAND
else if (wlr_surface_is_xwayland_surface(surface))
else if (wlr_xwayland_surface *surf = wlr_xwayland_surface_try_from_wlr_surface(surface))
{
auto xw = wlr_xwayland_surface_from_wlr_surface(surface);
wlr_xwayland_surface_configure(xw, o->get_layout_geometry().x, o->get_layout_geometry().y,
wlr_xwayland_surface_configure(surf, o->get_layout_geometry().x, o->get_layout_geometry().y,
o->get_layout_geometry().width, o->get_layout_geometry().height);
new_view = unmappable_view_t::create<wayfire_background_view_xwl>(xw, o);
new_view->on_unmap.connect(&xw->events.unmap);
new_view = unmappable_view_t::create<wayfire_background_view_xwl>(surf, o);
new_view->on_unmap.connect(&surf->surface->events.unmap);
}
#endif
else
Expand Down Expand Up @@ -391,11 +390,7 @@ class wayfire_background_view : public wf::plugin_interface_t

#if WF_HAS_XWAYLAND
wlr_surface *wlr_surface = ev->surface;
wlr_xwayland_surface *xwayland_surface = nullptr;
if (wlr_surface && wlr_surface_is_xwayland_surface(wlr_surface))
{
xwayland_surface = wlr_xwayland_surface_from_wlr_surface(wlr_surface);
}
wlr_xwayland_surface *xwayland_surface = wlr_xwayland_surface_try_from_wlr_surface(wlr_surface);

if (xwayland_surface)
{
Expand Down
15 changes: 6 additions & 9 deletions src/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class wayfire_bench_screen : public wf::per_output_plugin_instance_t
double max_fps = 0;
double widget_xc;
uint32_t last_time = wf::get_current_time();
double current_fps;
double widget_radius;
wf::wl_timer<false> timer;
wf::simple_texture_t bench_tex;
Expand Down Expand Up @@ -83,9 +82,9 @@ class wayfire_bench_screen : public wf::per_output_plugin_instance_t

last_frame_times.push_back(elapsed);

render_bench();

reset_timeout();

render_bench();
}

void reset_timeout()
Expand Down Expand Up @@ -118,7 +117,7 @@ class wayfire_bench_screen : public wf::per_output_plugin_instance_t
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size(cr, font_size);

cairo_text_extents(cr, "234.5", &text_extents);
cairo_text_extents(cr, "1000.0", &text_extents);

widget_xc = text_extents.width / 2 + text_extents.x_bearing + WIDGET_PADDING;
text_y = text_extents.height + WIDGET_PADDING;
Expand Down Expand Up @@ -230,14 +229,11 @@ class wayfire_bench_screen : public wf::per_output_plugin_instance_t
last_frame_times.begin(), last_frame_times.end(), 0.0);
average /= last_frame_times.size();

current_fps = 1000 / average;
double current_fps = 1000 / average;

if (current_fps > max_fps)
{
max_fps = current_fps;
} else
{
max_fps -= 1;
}

sprintf(fps_buf, "%.1f", current_fps);
Expand Down Expand Up @@ -295,9 +291,10 @@ class wayfire_bench_screen : public wf::per_output_plugin_instance_t
{
if (!output->render->get_scheduled_damage().empty())
{
output->render->damage(cairo_geometry);
compute_timing();
}

output->render->damage(cairo_geometry, false);
};

wf::effect_hook_t overlay_hook = [=] ()
Expand Down
8 changes: 8 additions & 0 deletions src/water.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ class wayfire_water_screen : public wf::per_output_plugin_instance_t, public wf:

if (!hook_set)
{
output->render->add_effect(&damage_hook, wf::OUTPUT_EFFECT_DAMAGE);
output->render->add_post(&render);
hook_set = true;
}
Expand All @@ -266,6 +267,11 @@ class wayfire_water_screen : public wf::per_output_plugin_instance_t, public wf:
animation.animate(animation, 0);
};

wf::effect_hook_t damage_hook = [=] ()
{
output->render->damage_whole();
};

wf::post_hook_t render = [=] (const wf::framebuffer_t& source,
const wf::framebuffer_t& destination)
{
Expand Down Expand Up @@ -396,6 +402,7 @@ class wayfire_water_screen : public wf::per_output_plugin_instance_t, public wf:
if (!button_down && !timer.is_connected() && !animation.running())
{
hook_set = false;
output->render->rem_effect(&damage_hook);
output->render->rem_post(&render);
OpenGL::render_begin();
buffer[0].release();
Expand All @@ -414,6 +421,7 @@ class wayfire_water_screen : public wf::per_output_plugin_instance_t, public wf:
timer.disconnect();
if (hook_set)
{
output->render->rem_effect(&damage_hook);
output->render->rem_post(&render);
}

Expand Down

0 comments on commit 9a3d548

Please sign in to comment.