p-e-w / plotinus

A searchable command palette in every modern GTK+ application
1.02k stars 22 forks source link

Placement is wrong under wayland #5

Closed fmoralesc closed 7 years ago

fmoralesc commented 7 years ago

It seems like Gtk can't handle the parenting of the window properly.

captura de pantalla de 2016-11-14 13-23-34

jhasse commented 7 years ago

Mutter 3.22.2 fixes "various placement issues on wayland", see https://mail.gnome.org/archives/gnome-shell-list/2016-November/msg00002.html

Can you try if this still happens?

fmoralesc commented 7 years ago

I just tried with 3.22.3 and it still happens.

trgeiger commented 7 years ago

I can confirm that this also happens under Mutter 3.24.1 screenshot from 2017-04-15 10-12-38

p-e-w commented 7 years ago

Since Wayland apparently does not support CENTER_ON_PARENT at all (you can see the same issue in many GNOME core apps, e.g. the preference dialog in Gedit), I decided to make the popup window modal.

This matches the behavior of Atom's command palette and solves this and several other Wayland issues.

fmoralesc commented 7 years ago

This seems to break placement of plotinus in Xorg, though :/

p-e-w commented 7 years ago

@fmoralesc: How? Modal windows work the same across Xorg and Wayland (at least all others do).

Can you provide a screenshot of what you are seeing?

fmoralesc commented 7 years ago

I would have supposed so, but this is what I see... captura de pantalla de 2017-04-23 17-48-44

It works perfectly in wayland, though (This is using mutter 3.24.1)

p-e-w commented 7 years ago

What desktop is this?

What happens when you open a standard modal dialog (e.g. Nautilus' "About" dialog)?

fmoralesc commented 7 years ago

This is Gnome 3.24.

The 'About' dialog is centered. I also considered whether something in my config was wrong... (There is the /org/gnome/mutter/attach-modal-dialogs key that could affect this, but it doesn't seem to make any difference here...)

captura de pantalla de 2017-04-23 18-01-38

p-e-w commented 7 years ago

Does adding back the line

window_position = Gtk.WindowPosition.CENTER_ON_PARENT;

that was removed by the commit fix the issue?

I also notice a font issue in your first screenshot. The arrow symbol that is used to separate menu hierarchy levels appears to have been substituted by a placeholder of sorts. What is your UI font?

Beautiful desktop, by the way! 👍

fmoralesc commented 7 years ago

(Thanks!) My UI font is Roboto (the Android font). With DejaVu Sans I get a clearer arrow (in Roboto it is an arrow surrounded by a circle).

With that line, it improves, I get captura de pantalla de 2017-04-23 18-19-27

It still doesn't seem to behave as a modal window.

p-e-w commented 7 years ago

Looks like this needs deeper investigation. I hope this doesn't indicate a limitation for GTK+ modules somehow. The placement is weird, it's vertically centered but not horizontally.

Thank you very much for your help so far!

fmoralesc commented 7 years ago

No problem, thanks to you for this software!

p-e-w commented 7 years ago

@fmoralesc: The Xorg issue is now fixed!

This was a tough nut to crack. Eventually I noticed that the problem disappeared when I made PopupWindow inherit from Gtk.Dialog instead of Gtk.Window (though that introduced other problems). In https://github.com/GNOME/gtk/blob/master/gtk/ui/gtkdialog.ui I then found the key missing property:

type_hint = Gdk.WindowTypeHint.DIALOG;

Of course, the whole thing still reeks of a GTK+ bug, but at least it's working now in both Wayland and X11!

fmoralesc commented 7 years ago

Awesome! I can confirm it is fixed now. Thanks!