Skip to content

Commit

Permalink
xdg-popup: include popup's own position in the calculation (#2170)
Browse files Browse the repository at this point in the history
Fixes #2141
  • Loading branch information
ammen99 authored Mar 2, 2024
1 parent 27ddca3 commit 80569f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/view/view-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,6 @@ wf::pointf_t wf::place_popup_at(wlr_surface *parent, wlr_surface *popup, wf::poi
// Get the {0, 0} of the parent view in output coordinates
popup_offset += popup_parent->get_surface_root_node()->to_global({0, 0});

auto xdg_surface = wlr_xdg_surface_try_from_wlr_surface(parent);
if (xdg_surface)
{
// substract shadows etc; test app: d-feet
popup_offset.x -= xdg_surface->current.geometry.x;
popup_offset.y -= xdg_surface->current.geometry.y;
}

// Apply transformers to the popup position
auto node = popup_parent->get_surface_root_node()->parent();
while (node != popup_parent->get_transformed_node().get())
Expand Down
5 changes: 2 additions & 3 deletions src/view/xdg-shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <wayfire/debug.hpp>
#include "view/view-impl.hpp"
#include "wayfire/core.hpp"
#include "surface-impl.hpp"
#include "wayfire/geometry.hpp"
#include "wayfire/output.hpp"
#include "wayfire/scene-operations.hpp"
Expand Down Expand Up @@ -166,8 +165,8 @@ void wayfire_xdg_popup::update_position()

// Offset relative to the parent surface
wf::pointf_t popup_offset = wf::place_popup_at(popup->parent, popup->base->surface, {
popup->current.geometry.x * 1.0,
popup->current.geometry.y * 1.0,
popup->current.geometry.x * 1.0 - popup->base->current.geometry.x,
popup->current.geometry.y * 1.0 - popup->base->current.geometry.y,
});

this->move(popup_offset.x, popup_offset.y);
Expand Down

0 comments on commit 80569f4

Please sign in to comment.