Skip to content

Commit

Permalink
Fix output tracking (outputs are not identified by scale) (#3582)
Browse files Browse the repository at this point in the history
Drive-by fix
  • Loading branch information
tarek-y-ismail authored Sep 5, 2024
2 parents 8b942e9 + b6b0300 commit b56aa20
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/server/frontend_wayland/fractional_scale_v1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void mf::FractionalScaleV1::output_entered(mir::graphics::DisplayConfigurationOu

void mf::FractionalScaleV1::output_left(mir::graphics::DisplayConfigurationOutput const& config)
{
surface_outputs.erase({config.id, config.scale});
surface_outputs.erase(config.id);
recompute_scale();
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/frontend_wayland/fractional_scale_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "fractional-scale-v1_wrapper.h"
#include "mir/graphics/display_configuration.h"
#include <set>
#include <unordered_map>
#include <utility>

namespace mir
Expand All @@ -42,7 +42,7 @@ class FractionalScaleV1 : public wayland::FractionalScaleV1
private:
// Houses a set of outputs the surface occupies
using Id = mir::graphics::DisplayConfigurationOutputId;
std::set<std::pair<Id, float>> surface_outputs;
std::unordered_map<Id, float> surface_outputs;

void recompute_scale();
};
Expand Down
12 changes: 10 additions & 2 deletions src/server/frontend_wayland/wayland_surface_observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,20 @@ void mf::WaylandSurfaceObserver::input_consumed(ms::Surface const*, std::shared_

void mf::WaylandSurfaceObserver::entered_output(ms::Surface const*, graphics::DisplayConfigurationOutputId const& id)
{
impl->window.value().handle_enter_output(id);
run_on_wayland_thread_unless_window_destroyed(
[id](Impl* impl, WindowWlSurfaceRole*)
{
impl->window.value().handle_enter_output(id);
});
}

void mf::WaylandSurfaceObserver::left_output(ms::Surface const*, graphics::DisplayConfigurationOutputId const& id)
{
impl->window.value().handle_leave_output(id);
run_on_wayland_thread_unless_window_destroyed(
[id](Impl* impl, WindowWlSurfaceRole*)
{
impl->window.value().handle_leave_output(id);
});
}

void mf::WaylandSurfaceObserver::run_on_wayland_thread_unless_window_destroyed(
Expand Down

0 comments on commit b56aa20

Please sign in to comment.