Skip to content

Commit ded1b89

Browse files
committed
toplevel: use proper functions for querying position on panel
Fixes #217
1 parent 37fc1db commit ded1b89

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

src/panel/widgets/window-list/toplevel.cpp

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -307,27 +307,17 @@ class WayfireToplevel::impl
307307
void send_rectangle_hint()
308308
{
309309
Gtk::Widget *widget = &this->button;
310-
311-
int x = 0, y = 0;
312-
int width = button.get_allocated_width();
313-
int height = button.get_allocated_height();
314-
315-
while (widget)
310+
auto panel = WayfirePanelApp::get().panel_for_wl_output(window_list->output->wo);
311+
if (panel)
316312
{
317-
x += widget->get_allocation().get_x();
318-
y += widget->get_allocation().get_y();
319-
widget = widget->get_parent();
320-
}
313+
int x, y;
314+
widget->translate_coordinates(panel->get_window(), 0, 0, x, y);
321315

322-
auto panel =
323-
WayfirePanelApp::get().panel_for_wl_output(window_list->output->wo);
324-
if (!panel)
325-
{
326-
return;
316+
int width = button.get_allocated_width();
317+
int height = button.get_allocated_height();
318+
zwlr_foreign_toplevel_handle_v1_set_rectangle(handle,
319+
panel->get_wl_surface(), x, y, width, height);
327320
}
328-
329-
zwlr_foreign_toplevel_handle_v1_set_rectangle(handle,
330-
panel->get_wl_surface(), x, y, width, height);
331321
}
332322

333323
int32_t max_width = 0;

0 commit comments

Comments
 (0)