FedoraQt / QAdwaitaDecorations

Qt decoration plugin implementing Adwaita-like client-side decorations
GNU Lesser General Public License v2.1
66 stars 6 forks source link

QMessageBox text cut off #66

Closed johnthacker closed 1 month ago

johnthacker commented 1 month ago

With QT_WAYLAND_DECORATION set to adwaita, QMessageBox text is cut off. Example from running wireshark:

adwaita decorations

With QT_WAYLAND_DECORATION=bradient wireshark:

bradient decorations

johnthacker commented 1 month ago

This is on a Fedora 40 system, using the official Fedora wireshark package wireshark-4.2.4-2.fc40.x86_64

johnthacker commented 1 month ago

quit

It's impossible to resize the dialog.

grulja commented 1 month ago

Interesting, I don't think decorations can have any impact on dialog size, it's basically just implemented painted operation. I tried with kate and didn't reproduce, not sure how I can invoke this dialog in wireshark without trying to capture something.

johnthacker commented 1 month ago

Opening an existing file, adding a comment (e.g., Edit->Packet Comments->Add New Comment), and trying to close without saving: image

Opening Wireshark with a Lua script with a syntax error. (Garbage can be placed in a plugin directory, but wireshark -X lua_script:not_a_lua_script.txt will work):

wireshark -X lua_script:WiresharkConfigVersion.cmake

image

QT_WAYLAND_DECORATION=bradient wireshark -X lua_script:WiresharkConfigVersion.cmake:

image

You can see that the buttons are smaller as well. The titlebar is taller, and there's space for the drop shadows. Perhaps the auto calculations for how much space to leave for the text is not taking the changed decorations into account.

johnthacker commented 1 month ago

Open a file, right click on a protocol name in the protocol tree and select "Wiki Protocol Page":

image

With QT_WAYLAND_DECORATION=bradient: image

grulja commented 1 month ago

I still cannot reproduce it, at least when I try this under Weston. I will try later in GNOME.

My test workflow: 1) Run weston 2) Open the terminal there and run export XDG_CURRENT_DESKTOP=GNOME 3) Run wireshark

taoky commented 1 month ago

This bug could be triggered in nested mutter:

image

grulja commented 1 month ago

I can reproduce now with nested Mutter. I didn't know it can be run this way. I will look into this.

grulja commented 1 month ago

It's a bug in Qt. I will try to fix it there.

grulja commented 1 month ago

Closing it here.

Proposed upstream fix: https://codereview.qt-project.org/c/qt/qtwayland/+/560854

grulja commented 1 month ago

It turns out the issue is not in Qt, but it's a combination of Wireshark setting all windows as maximized initially and QAdwaitaDecorations reporting wrong margins, since the window has maximized state, even though it's not maximized as it's just a QMessageBox or whatever, but I don't know how to fix it or workaround it.

johnthacker commented 1 month ago

The QMessageBox has maximized state? That seems unlikely since it's happening in cases where a default QMessageBox is being created on the stack or the QMessageBox static functions are being called, but I'm happy to change the Wireshark code if the problem is somehow there.

Certainly if I call qWarning() << "maximized" << msg_dialog.isMaximized() << msg_dialog.isFullScreen();

immediately before msg_dialog.exec();

it prints false to the console for both.

johnthacker commented 1 month ago

The Wiki page example that is cut off is from calling the static function:

    int ret = QMessageBox::question(this, mainApp->windowTitleString(tr("Wiki Page for %1").arg(proto_abbrev)),
                                    tr("<p>The Wireshark Wiki is maintained by the community.</p>"     
                                    "<p>The page you are about to load might be wonderful, "           
                                    "incomplete, wrong, or nonexistent.</p>"
                                    "<p>Proceed to the wiki?</p>"),
                                    QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); 

Which seems unlikely to set any of the visibility or flags.

grulja commented 1 month ago

You are right, I didn't realize the maximized state is for the main window and not for the QMessageBox. Ignore what I wrote and I might actually be right with the Qt issue. I reopened the Qt change.

grulja commented 1 month ago

Fixed in Mutter: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3755

johnthacker commented 1 month ago

Just wanted to confirm that the fix in Mutter works for me.