diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 915b7e0..bcf0fa9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: @@ -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 hwdata nlohmann-json - name: Wayfire uses: actions/checkout@v2 with: diff --git a/src/background-view.cpp b/src/background-view.cpp index c7bd293..3de74dd 100644 --- a/src/background-view.cpp +++ b/src/background-view.cpp @@ -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 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(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(xw, o); - new_view->on_unmap.connect(&xw->events.unmap); + new_view = unmappable_view_t::create(surf, o); + new_view->on_unmap.connect(&surf->surface->events.unmap); } #endif else @@ -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) { diff --git a/src/bench.cpp b/src/bench.cpp index 95ff3f2..e33799c 100644 --- a/src/bench.cpp +++ b/src/bench.cpp @@ -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 timer; wf::simple_texture_t bench_tex; @@ -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() @@ -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; @@ -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); @@ -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 = [=] () diff --git a/src/water.cpp b/src/water.cpp index d89c758..a3da9e5 100644 --- a/src/water.cpp +++ b/src/water.cpp @@ -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; } @@ -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) { @@ -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(); @@ -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); }