takinoy / xfce4-windowck-plugin

Xfce panel plugin which allows to put the maximized window title on the panel.
http://goodies.xfce.org/projects/panel-plugins/xfce4-windowck-plugin
GNU General Public License v3.0
116 stars 26 forks source link

Port to GTK3 #72

Closed qarkai closed 3 years ago

qarkai commented 4 years ago

Fixes #66.

There are a lot of deprecation warnings. It's subject for another PR.

qarkai commented 4 years ago

Fixed all #if 0.

zlamalp commented 4 years ago

Hi @qarkai, I can confirm that it works on ubuntu 20.04, thank you for your work.

qarkai commented 4 years ago

Hi @zlamalp, thanks for testing.

invidian commented 4 years ago

Just installed it on Arch Linux and it works well so far :+1:

nkichukov commented 3 years ago

Works here on GNU/Gentoo Linux, thanks a lot!

This was the last GTK2 plugin I was using, so now it is all GTK3, thus consistent color schema.

I've seen some issues with the ebuild that configures the package, if I do not use the provided 'autogen.sh' it would attempt a build against gtk2, which is also present on my system.

However running ./autogen.sh adds in the correct includes and libs for gtk3, so I have modified the ebuild to use that instead. Not sure if others have had this issue and if the patches need to handle gtk3 explicitly.

Also, for 'window title' when setting Width under Appearance to be 'at most' some 'number' I only get 3 dots. But running this with the 'Fixed to' setting is something that produces the expected results, so I have a workaround.

Once again, great job! Hope to see this pushed to master and with some additional '--enable-gtk3' configure switches to see this in the next release.

mskalski commented 3 years ago

Hi, thanks for great work

Unfortunately on Ubuntu 20.04 "Window Title" plugin crashes when options "Control maximized windows" is selected and "Show plugin on desktop" enabled in situation when threre is no maximized window.

"Window buttons" plugin works well with these settings enabled.

qarkai commented 3 years ago

@mskalski Looks like it connected to https://github.com/cedl38/xfce4-windowck-plugin/issues/46#issuecomment-461101401 Does GTK2 version of plugin crashes? Did you try https://github.com/cedl38/xfce4-windowck-plugin/pull/71?

mskalski commented 3 years ago

It works with GTK-2 as I'm using 0.4.4 version of windowck-plugins grabbed somewhere few years ago, I think using instructions from https://askubuntu.com/questions/1071484/ubuntu-18-04-how-to-install-xfce4-windowck-plugin.

Here is contents of control file in debian package xfce4-windowck-plugin_0.4.4-1mx15+1_amd64.deb I used to install it on Ubuntu 18.04:

Package: xfce4-windowck-plugin
Version: 0.4.4-1mx15+1
Architecture: amd64
Bugs: mailto: <stevep@mxlinux.org>
Maintainer: Steven Pusser <stevep@mxlinux.org>
Installed-Size: 322
Depends: libatk1.0-0 (>= 1.12.4), libc6 (>= 2.4), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 1.0.2), libdbus-glib-1-2 (>= 0.78), libfontconfig1 (>= 2.11), libfreetype6 (>= 2.2.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libg
lib2.0-0 (>= 2.41.1), libgtk2.0-0 (>= 2.18.0), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0), libpangoft2-1.0-0 (>= 1.14.0), libwnck22 (>= 2.30.0-3), libxfce4ui-1-0 (>= 4.8.0), libxfce4util7 (>= 4.
9.0), libxfconf-0-2 (>= 4.6.0), xfce4-panel (>= 4.11), xfce4-panel (<< 4.13)
Section: xfce
Priority: optional
Multi-Arch: same
Homepage: http://goodies.xfce.org/projects/panel-plugins/xfce4-windowck-plugin
Description: Xfce panel plugin puts window buttons and title on panel
Original-Maintainer: Cedric Leporcq <cedl38@gmail.com>
mskalski commented 3 years ago

@mskalski Looks like it connected to #46 (comment) Does GTK2 version of plugin crashes? Did you try #71?

I just tried it and unfortunately fix from #71 is not correct, as all processes displaying windows are still running.

diff --git a/panel-plugin/title/windowck-title.c b/panel-plugin/title/windowck-title.c
index 39f93b8..5c43af0 100644
--- a/panel-plugin/title/windowck-title.c
+++ b/panel-plugin/title/windowck-title.c
@@ -123,6 +123,7 @@ static void on_name_changed (WnckWindow *controlwindow, WindowckPlugin *wckp)
     const gchar *title_text;

     if (controlwindow
+       && wnck_window_get_pid(controlwindow)  // if active window has been closed, pid is 0
         && ((wnck_window_get_window_type (controlwindow) != WNCK_WINDOW_DESKTOP)
             || wckp->prefs->show_on_desktop))
     {

When panel is run on console, these messages are displayed and plugin crashes:

(wrapper-2.0:21240): Wnck-CRITICAL **: 17:02:26.788: wnck_workspace_get_screen: assertion 'WNCK_IS_WORKSPACE (space)' failed

(wrapper-2.0:21240): Wnck-CRITICAL **: 17:02:26.789: wnck_screen_get_active_workspace: assertion 'WNCK_IS_SCREEN (screen)' failed

(wrapper-2.0:21240): Wnck-CRITICAL **: 17:02:26.789: wnck_screen_get_windows_stacked: assertion 'WNCK_IS_SCREEN (screen)' failed
xfce4-panel-Message: 17:02:27.063: Plugin windowck-plugin-14 has been automatically restarted after crash.
invidian commented 3 years ago

Some changes are required to get this PR working with XFCE 4.16. See https://github.com/invidian/xfce4-windowck-plugin/compare/v0.4.8...master.

qarkai commented 3 years ago

@invidian It's subject for different PR.

JoveYu commented 3 years ago

@qarkai can you help port to xfce4 4.16

qarkai commented 3 years ago

@JoveYu Isn't https://github.com/invidian/xfce4-windowck-plugin/compare/v0.4.8...master enough for this?

JoveYu commented 3 years ago

@qarkai it works on archlinux with xfce4 4.16, thanks you

qarkai commented 3 years ago

@cedl38 Is there anything you wait from me to start review?

mskalski commented 3 years ago

One question: This MR assumes complete switching to XFCE 4.16, which is based on GTK3. But there is not the case for older version (still supported) of Xubuntu 18.04. @qarkai Would you consider to leave some conditional compilation to still support XFCE 4.12 (based on GTK2)?

This could be determined at configure time.

mskalski commented 3 years ago

I managed to find error (yes, #71 has a clue what's wrong) regarding crash with Show on Desktop option turned on, but I think it should be made as another PR. Simple fix is just to not to call is_window_on_active_workspace_and_no_other_maximized_windows_above() or check for failures inside this function:

 static gboolean is_window_on_active_workspace_and_no_other_maximized_windows_above(WnckWindow *window)
 {
     WnckWorkspace *workspace = wnck_window_get_workspace(window);
-    WnckScreen *screen = wnck_workspace_get_screen(workspace);
-    if (wnck_screen_get_active_workspace(screen) != workspace) {
+    WnckScreen *screen = workspace ? wnck_workspace_get_screen(workspace) : NULL;
+    if (!screen || wnck_screen_get_active_workspace(screen) != workspace)
         return FALSE;
-    }
+
     GList *windows = wnck_screen_get_windows_stacked(screen);
     GList *top_window = g_list_last(windows);

But IMHO Show on Desktop option handling should be redesigned, as this should mean "Show title widget even when there is no any controlled window (even on desktop)".

takinoy commented 3 years ago

@cedl38 Is there anything you wait from me to start review?

@qarkai thank a lot for your work, I'm very happy that there is some interest to port it to gtk3. Unfortunately I don't have time to focus on this project and also I didn't use xfce at this time.

qarkai commented 3 years ago

Merged to upstream.

qarkai commented 2 years ago

@mskalski could you create issue and/or merge request in https://gitlab.xfce.org/panel-plugins/xfce4-windowck-plugin for this bug?