CrimsonAS / gtkplatform

Run Qt applications using gtk+ as a windowing system.

Home Page:https://crimson.no

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with Mudlet

vadi2 opened this issue · comments

This project is quite interesting to me as I've always had a beef with the non-GTK+ native look on a gnome desktop. Trying to run Mudlet with it doesn't quite work though.

Here's Mudlet built with Qt 5.9 default rendering:

workspace 1_059

And here it is with this plugin enabled:

workspace 1_058

Mudlet sources are available here, though we don't do anything special the the default Qt-specific flags.

Thanks for the report. Note that I have done no testing at all on Unity at present, so your mileage may vary. Can you clarify what exactly the problems are, as I'm not familiar with this software.

My guess is:

  • The status bar is missing
  • Your main window appears to have an empty menubar
  • It seems like the real menu off the background window is missing

Is this correct? Any other problems?

Hi! Status bar is okay, I just didn't hover over an icon. The main window does appears to have an empty menubar though.

The most glaring issue is the widget rendering which doesn't look much like GTK+.

The console says this:

$  QT_QPA_PLATFORM=gtk ./mudlet
Added  0x5654fbcd8a40
Application is running under X11. While this may work, it is experimental.
Run under Wayland for best results.
Showing  QWidgetWindow(0x5654fbd179c0, name="QSplashScreenClassWindow")  as a transient window without a transient parent, positioning will almost certainly be incorrect (if it works at all!)

Ah, ok. I'm not working so much on the contents of the window, but more on the behaviour of it. See the "Q: Why is this any better than a theme for Qt which looks like a gtk+ theme?" question on the README.

To get the contents looking more native, you'll need a style. There's one for Adwaita which works quite well in GNOME Shell, and there is an old style for gtk2 that used gtk itself to render things. Unfortunately (for fairly good reasons), gtk+ removed those APIs, so the latter 's not an option anymore.

I don't know if I'll be approaching that part myself, as I'm fairly happy with the Adwaita theme for the things I have that need to look native (vs providing their own UI but I'd be happy to try help someone else (you?) explore that road if they wanted to.

I'll leave this open to fix the menubar issues at least.

Ah I see. What about at least keeping fusion for the style then instead of the current blocky style?

My best bet about the empty menus is that the GtkMenuBar needs to be hidden (using gtk_widget_hide) when it is empty, in src/qgtkmenubar.cpp. Can you try this, and see if it makes a difference?

diff --git a/src/qgtkmenubar.cpp b/src/qgtkmenubar.cpp
index 1702699..da22528 100644
--- a/src/qgtkmenubar.cpp
+++ b/src/qgtkmenubar.cpp
@@ -108,9 +108,19 @@ void QGtkMenuBar::regenerate()
     }
     g_list_free(children);
 
+    int childCount = 0;
+
     for (QGtkMenu *menu : m_items) {
-        if (menu)
+        if (menu) {
             gtk_menu_shell_append(GTK_MENU_SHELL(m_menubar.get()), GTK_WIDGET(menu->gtkMenuItem().get()));
+            childCount++;
+        }
+    }
+
+    if (childCount == 0) {
+        gtk_widget_hide(GTK_WIDGET(m_menubar.get()));
+    } else {
+        gtk_widget_show(GTK_WIDGET(m_menubar.get()));
     }
 }
 

Will you have a chance to look at trying this? Otherwise I'll close it. I can't reproduce this under GNOME Shell, so I'm reliant on someone else giving it a shot.

I don't think it worked, and the widget style it uses isn't fusion either when I use -platform gtk:

selection_074

For fusion, please try playing around in the QGtkTheme part I linked, i.e. try remove Adwaita from the list, and see if that has an impact. For menus, I'll have to do a bit more thinking - I'm not sure why it would be staying visible there.

Ubuntu is switching to Gnome Shell next release though, so while Unity will still be around for a while, its future is questionable. Might not be worth the effort to fix this for it.

[this is a mass update]

This is polite notice that gtkplatform is effectively end of life. Due to this, I've decided to archive the project.

I (and I think, the other contributors) have not been using it in quite some time, and I don't see that situation changing any time soon. In addition, none of us really have the time that it takes to do what it takes to keep the lights on, and this situation is going to get a lot harder soon with the impending arrival of Qt 6 and gtk 4 on the horizon.

Should anyone wish to take it over, you have my blessing to do so :)