Differencing panel windows (Qt::setWindowTitle?)

120 views
Skip to first unread message

Jesús J. Guerrero Botella

unread,
Mar 28, 2012, 7:46:40 AM3/28/12
to razo...@googlegroups.com
Hello.

I haven't much experience with Qt, leave alone Qt4, so, please, bear with me.

I don't know if this is the right place for development questions, but I haven't found another way. So, if you know a better place, please, kindly direct into the right direction.

Fvwm and other WM's have a matching mechanism so you can apply special properties (mostly hints, but also some others) to a given window. The problem with razor-panel is that all their children are called the same, as I illustrate right below this line:

$ xprop|grep -i ^WM_NAME -A2
WM_NAME(STRING) = "Configure panel"
WM_LOCALE_NAME(STRING) = "es_ES.utf8"
WM_CLASS(STRING) = "razor-panel", "Razor-panel"
$ xprop|grep -i ^WM_NAME -A2
WM_NAME(STRING) = "Add plugins"
WM_LOCALE_NAME(STRING) = "es_ES.utf8"
WM_CLASS(STRING) = "razor-panel", "Razor-panel"
$ xprop|grep -i ^WM_NAME -A2
WM_NAME(STRING) = "razor-panel"
WM_LOCALE_NAME(STRING) = "es_ES.utf8"
WM_CLASS(STRING) = "razor-panel", "Razor-panel"

You see these are the properties for the config window, the add plugin window, and the panel itself. The problem in the case of fvwm (this might also be true for some others) is that they can only match based on a fuzzy criteria, and not something strict like, let's say, (Class=razor-panel AND Title=razor-panel). So, it's more like (Class=razor-panel OR Title=razor-panel), and that means that all the three windows (and many more) are matched, which is undesired.

I know this is not, directly, a razorqt problem, so I am not expecting that the razorqt dev(s) will "fix" this upstream (that'd be nice, though :)). I might try luck and think about a patch to add that to fvwm (just for the record, I am not affiliated with it in any way), but, as a simple solution, I thought that giving the razor panel a proper name that's not the WM_CLASS property could be useful in this case, and under some other circumstances (I bet the same happens under other WMs as well).

The problem at hand is that, due to my lack of experience with qt, I am having some difficulties finding the proper way to do this. I've tried using setWindowTitle in many places, but it doesn't seem to have an effect. The problem could be that I am putting it in the wrong place, or simply that there's something else setting the Window Title in an indirect manner. 

This is the last thing I've tried:

diff -U3 -r razorqt-0.4.1.orig/razorqt-panel/panel/main.cpp razorqt-0.4.1/razorqt-panel/panel/main.cpp
--- razorqt-0.4.1.orig/razorqt-panel/panel/main.cpp     2012-03-28 00:04:17.076675398 +0200
+++ razorqt-0.4.1/razorqt-panel/panel/main.cpp  2012-03-28 13:06:58.303347580 +0200
@@ -50,6 +50,7 @@
     RazorPanel panel;
     a.setPanel(&panel);
+    panel.setWindowTitle("Main Panel");
     panel.show();
     return a.exec();
Sólo en razorqt-0.4.1/razorqt-panel/panel: main.cpp~
diff -U3 -r razorqt-0.4.1.orig/razorqt-panel/panel/razorpanel.cpp razorqt-0.4.1/razorqt-panel/panel/razorpanel.cpp
--- razorqt-0.4.1.orig/razorqt-panel/panel/razorpanel.cpp       2012-03-28 00:04:17.076675398 +0200
+++ razorqt-0.4.1/razorqt-panel/panel/razorpanel.cpp    2012-03-28 13:11:54.466691049 +0200
@@ -117,8 +117,8 @@
     setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
     setAttribute(Qt::WA_X11NetWmWindowTypeDock);
     setAttribute(Qt::WA_AlwaysShowToolTips);
-
-    setObjectName("RazorPanel");
+    setWindowTitle("Main Panel");
+    //setObjectName("RazorPanel");
 }
I duplicated it in some other places but the properties for the razor-panel window (the panel, that is) do not seem to change, according to xprop and FvwmIdent. Of course, I recompile and restart the session on each try.

Can you suggest where to look at? Is this the right method to use at all if I want to set the WM_NAME string?

Thank you for reading, and for any input :) 

Alec Moskvin

unread,
Mar 28, 2012, 3:45:11 PM3/28/12
to razo...@googlegroups.com
On Wednesday 28 March 2012 04:46:40, Jesús J. Guerrero Botella wrote:
> Hello.
>
> I haven't much experience with Qt, leave alone Qt4, so, please, bear with
> me.
>
> I don't know if this is the right place for development questions, but I
> haven't found another way. So, if you know a better place, please, kindly
> direct into the right direction.

This is the right place :)

> Fvwm and other WM's have a matching mechanism so you can apply special
> properties (mostly hints, but also some others) to a given window. The
> problem with razor-panel is that all their children are called the same, as
> I illustrate right below this line:
>
> $ xprop|grep -i ^WM_NAME -A2
> > WM_NAME(STRING) = "Configure panel"
> > WM_LOCALE_NAME(STRING) = "es_ES.utf8"
> > WM_CLASS(STRING) = "razor-panel", "Razor-panel"
> > $ xprop|grep -i ^WM_NAME -A2
> > WM_NAME(STRING) = "Add plugins"
> > WM_LOCALE_NAME(STRING) = "es_ES.utf8"
> > WM_CLASS(STRING) = "razor-panel", "Razor-panel"
> > $ xprop|grep -i ^WM_NAME -A2
> > WM_NAME(STRING) = "razor-panel"
> > WM_LOCALE_NAME(STRING) = "es_ES.utf8"
> > WM_CLASS(STRING) = "razor-panel", "Razor-panel"
>
>
> You see these are the properties for the config window, the add plugin
> window, and the panel itself. The problem in the case of fvwm (this might
> also be true for some others) is that they can only match based on a fuzzy
> criteria, and not something strict like, let's say, (Class=razor-panel AND
> Title=razor-panel). So, it's more like (Class=razor-panel OR
> Title=razor-panel), and that means that all the three windows (and many
> more) are matched, which is undesired.

Just to clarify, since I don't use fvwm and I'm not sure if I understand
you correctly...

From your previous post I understand that fvwm does not handle EWMH
hints, and you need to create your own rules so that, for example, the
panel does not have window borders.

When you add the rule

Style razor-panel !Title, !Borders, ...

it matches it as "If a window has WM_NAME=razor-panel or
WM_CLASS=razor-panel, then apply the following rules ..."

You're trying to set the window title (which is shown as WM_NAME) which
is not the same as WM_CLASS, so that you could make a rule which applies
to the panel but not to panel dialogs.

Am I understanding it correctly?

If my understanding of your problem correctly, that should have worked.
I get:

$ xprop | grep -A2 ^WM_NAME
WM_NAME(STRING) = "Razor Panel"
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"


WM_CLASS(STRING) = "razor-panel", "Razor-panel"

$ xprop | grep -A2 ^WM_NAME
WM_NAME(STRING) = "Configure panel"
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"


WM_CLASS(STRING) = "razor-panel", "Razor-panel"

Here's the change I made:

diff --git razorqt-panel/panel/razorpanel.cpp razorqt-panel/panel/razorpanel.cpp
index 3f867b6..903734c 100644
--- razorqt-panel/panel/razorpanel.cpp
+++ razorqt-panel/panel/razorpanel.cpp
@@ -118,6 +118,7 @@ RazorPanel::RazorPanel(QWidget *parent) :


setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
setAttribute(Qt::WA_X11NetWmWindowTypeDock);
setAttribute(Qt::WA_AlwaysShowToolTips);

+ setWindowTitle("Razor Panel");

Jesús J. Guerrero Botella

unread,
Mar 28, 2012, 6:01:45 PM3/28/12
to razo...@googlegroups.com
Hi again.


El miércoles 28 de marzo de 2012 21:45:11 UTC+2, amoskvin escribió:
On Wednesday 28 March 2012 04:46:40, Jesús J. Guerrero Botella wrote:
[...] 

> You see these are the properties for the config window, the add plugin
> window, and the panel itself. The problem in the case of fvwm (this might
> also be true for some others) is that they can only match based on a fuzzy
> criteria, and not something strict like, let's say, (Class=razor-panel AND
> Title=razor-panel). So, it's more like (Class=razor-panel OR
> Title=razor-panel), and that means that all the three windows (and many
> more) are matched, which is undesired.

Just to clarify, since I don't use fvwm and I'm not sure if I understand
you correctly...

From your previous post I understand that fvwm does not handle EWMH
hints, and you need to create your own rules so that, for example, the
panel does not have window borders.

Fvwm is peculiar in many ways, and the defaults are very distinct of nowadays standards. I just happen to know how to use it, I've had for a very long time, and that's why I am using it still, even though I am often not in agreement with some decisions they make. Not that that matters.

When you add the rule

  Style razor-panel !Title, !Borders, ...

it matches it as "If a window has WM_NAME=razor-panel or
WM_CLASS=razor-panel, then apply the following rules ..."

You're trying to set the window title (which is shown as WM_NAME) which
is not the same as WM_CLASS, so that you could make a rule which applies
to the panel but not to panel dialogs.

Am I understanding it correctly?


100%
 

If my understanding of your problem correctly, that should have worked.

Yep, that line in razorpanel.cpp does the trick, and I am sure I have patched this same thing. But... The problem was probably in a mixture of me-being-tired, a commented epatch line in muy custom ebuild and the handful of different things I've tried in razorpanel.cpp and main.cpp. At some point I messed the thing and was probably operating with the unpatched version of the panel, which of course didn't fix anything for me. But yes, it WORKS, as you say it should. The good thing now is that I can have my panel adjusted as I wish, while the auxiliary dialogs will remain accessible as normal windows. As it should be. So, thank you.

Do you think this could have a use upstream? I don't have a problem with patching it myself on every release if needed. :)

Alec Moskvin

unread,
Mar 28, 2012, 6:56:16 PM3/28/12
to razo...@googlegroups.com

Jesús J. Guerrero Botella

unread,
Mar 29, 2012, 2:20:39 AM3/29/12
to razo...@googlegroups.com

Thank you so much. See you around.

---
Jesús Guerrero Botella

> --
> You received this message because you are subscribed to the Google
> Groups "Razor-qt" group.
> For more options, visit this group at
> http://groups.google.com/group/razor-qt?hl=en

Petr Vanek

unread,
Mar 29, 2012, 3:18:35 AM3/29/12
to razo...@googlegroups.com
Jesus, can you document your investigation for fwvm in our wiki, please?


or just expand the appropriate section if it's required.

thanks,
petr

Jesús J. Guerrero Botella

unread,
Mar 29, 2012, 4:32:48 AM3/29/12
to razo...@googlegroups.com
2012/3/29 Petr Vanek <pe...@scribus.info>:

> Jesus, can you document your investigation for fwvm in our wiki, please?
>
> https://github.com/Razor-qt/razor-qt/wiki/Window-Managers
>
> or just expand the appropriate section if it's required.
>

Yes, of course. I was already giving it a thought. I have updated it
now. Please, when you have the time, take a quick look and let me know
if you think it's clearly explained for the average user.

https://github.com/Razor-qt/razor-qt/wiki/Window-Managers

¨Thank you for everything.
--
Jesús Guerrero Botella

Reply all
Reply to author
Forward
0 new messages