mate-desktop / mate-panel

MATE panel
https://mate-desktop.org
GNU General Public License v2.0
185 stars 118 forks source link

wncklet: center preview windows #1342

Closed balazs-endresz closed 1 year ago

balazs-endresz commented 1 year ago

Fixes #1315

Instead of randomly positioning the preview windows over the window list applet this centers them properly.

I've tested it on Ubuntu 22.04, with all orientations, 2x scaling, many windows opened (so that previews are not cut off at the edges), and at least plugging in a secondary monitor didn't cause any issues either.

One thing that might be worth pointing out is gtk_window_set_position + GTK_WIN_POS_MOUSE followed by gtk_window_get_position returned incorrect coordinates: e.g. it was zero for the first about 40 pixels. So this gets the mouse position differently. This newer method is actually also used in panel_toplevel_contains_pointer.

The tooltips are still not aligned properly but I think that could be done in a follow up. Maybe even in libwnck instead. I might give that a try at some point.

lukefromdc commented 1 year ago

To fix these warnings, line 336 can be changed to: gdk_window_get_origin (gtk_widget_get_window (gtk_widget_get_parent (GTK_WIDGET(tl))), &x_offset, &y_offset);

and line 360 changed to: GList* children = gtk_container_get_children (GTK_CONTAINER(tl));

This builds with only deprecation warnings, runs fine, and doesn't depend on the compiler to figure out how to fix a pointer issue

balazs-endresz commented 1 year ago

Thanks, I've just added those in.

balazs-endresz commented 1 year ago

And I forgot to test this with grouping enabled. I'll add another PR soon, that shouldn't be too difficult to fix now.