Skip to content

Commit

Permalink
frontend_wayland/WpViewporter: Better name for dirty()
Browse files Browse the repository at this point in the history
We change this to `changed_since_last_resolve()`.
  • Loading branch information
RAOF committed Jul 9, 2024
1 parent 3b1c117 commit 754df0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/server/frontend_wayland/wl_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@ void mf::WlSurface::commit(WlSurfaceState const& state)
}

bool needs_buffer_submission =
state.scale || // If the scale has changed, or...
state.viewport || // ...we've added a viewport, or...
(viewport && viewport.value().dirty()); // ...the viewport has changed...
// ...then we'll need to submit a new frame, even if the client hasn't
// attached a new buffer.
state.scale || // If the scale has changed, or...
state.viewport || // ...we've added a viewport, or...
(viewport && viewport.value().changed_since_last_resolve()); // ...the viewport has changed...
// ...then we'll need to submit a new frame, even if the client hasn't
// attached a new buffer.

auto const executor_send_frame_callbacks = [executor = wayland_executor, weak_self = mw::make_weak(this)]()
{
Expand Down
9 changes: 5 additions & 4 deletions src/server/frontend_wayland/wp_viewporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ mf::Viewport::~Viewport()
{
}

auto mf::Viewport::dirty() -> bool
auto mf::Viewport::changed_since_last_resolve() -> bool
{
return std::exchange(dirty_, false);
return viewport_changed;
}

namespace
Expand Down Expand Up @@ -165,6 +165,7 @@ auto mf::Viewport::resolve_viewport(int32_t scale, geom::Size buffer_size) const
}
}();

viewport_changed = false;
return std::make_pair(src_bounds, logical_size);
}

Expand Down Expand Up @@ -200,7 +201,7 @@ void mf::Viewport::set_source(double x, double y, double width, double height)
{
source = geometry::RectangleD{{x, y}, {width, height}};
}
dirty_ = true;
viewport_changed = true;
}

void mf::Viewport::set_destination(int32_t width, int32_t height)
Expand Down Expand Up @@ -233,5 +234,5 @@ void mf::Viewport::set_destination(int32_t width, int32_t height)
destination = geometry::Size{width, height};
}

dirty_ = true;
viewport_changed = true;
}
6 changes: 3 additions & 3 deletions src/server/frontend_wayland/wp_viewporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ class Viewport : public wayland::Viewport
~Viewport() override;

/**
* Have the source or destination values changed since the last call to dirty()?
* Have the source or destination values changed since the last `resolve_viewport`?
*/
auto dirty() -> bool;
auto changed_since_last_resolve() -> bool;

/**
* Combine the viewport parameters with submitted buffer and scale to produce final parameters
Expand All @@ -68,7 +68,7 @@ class Viewport : public wayland::Viewport
void set_source(double x, double y, double width, double height) override;
void set_destination(int32_t width, int32_t height) override;

bool dirty_;
bool mutable viewport_changed;
wayland::Weak<wayland::Surface> surface;
std::optional<geometry::RectangleD> source;
std::optional<geometry::Size> destination;
Expand Down

0 comments on commit 754df0c

Please sign in to comment.