Bug 173544 - Windows-specific settings does not store in a case-sensitive way
Summary: Windows-specific settings does not store in a case-sensitive way
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 219317 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-26 00:05 UTC by D.J. Capelis
Modified: 2014-01-16 18:37 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
the bug (92.15 KB, image/png)
2009-02-02 16:34 UTC, Becheru Petru-Ioan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description D.J. Capelis 2008-10-26 00:05:23 UTC
Version:            (using KDE 4.1.2)
Compiler:          gcc (GCC) 4.2.4 (Gentoo 4.2.4 p1.0) CFLAGS="-O2 -march=native -pipe -fstack-protector"
OS:                Linux
Installed from:    Gentoo Packages

The windows-specific settings appears to force the text inputted into the "Window class (application type):" field to lower-case.

Steps to replicate:
Create new window-specific settings:
1) Set window class to [Oo]kular (the app switches back and forth between Okular and okular, it's incredibly frustrating.  Also, the app seems to always show up with an insanely small default size, which is why I'm trying to do this workaround in the first place.)
2) Set type "Regular Expression"
3) Under the Geometry tab, check "Maximized Horizontally" and "Maximized Vertically"
4) Set them to "Apply initially"
5) Check the box all the way to the right for each of these.
6) Hit okay
7) Hit apply
8) Watch this rule only take effect half the time the application starts, get really frustrated (this step is optional)
9) Go back and edit the rule to see what's wrong
10) Observe that the text in the field "Window class (application type):" now reads "[oo]kular" instead of "[Oo]kular" like you had set it to only moment ago.

Probably an errant thing inserted to the code a long time ago based on the idea that kwin maybe did case-insensitive matching at one point?  It certainly is a case-sensitive match now...
Comment 1 Vivia Nikolaidou 2008-10-28 23:07:11 UTC
Confirmed on KUbuntu Hardy
Comment 2 lucas 2008-11-20 14:47:47 UTC
Please expand on step 8, I cannot reproduce the behavior.

As for step 10 the class name is always lowercase in KWin so it makes sense that it removes uppercase characters.
Comment 3 Vivia Nikolaidou 2008-11-20 15:32:53 UTC
(In reply to comment #2)

> As for step 10 the class name is always lowercase in KWin so it makes sense
> that it removes uppercase characters.

Why are you saying that the class name is always lowercase?

More steps for you to reproduce:

1) Open aMSN
2) On Window-specific settings, click New
3) Click Detect for the window properties
4) Click the aMSN's window
5) The class name is "Amsn (amsn Amsn)"
According to what you said, it should be "amsn" instead, but it is not. I want to configure my aMSN to never appear on the taskbar and it only works when it wants to. Usually it reappears on the taskbar after I log in.

I confirmed this with xterm, firefox and konqueror: all class names start with an uppercase letter.

However, this is just a minor annoyance - one more window on the taskbar. The following issue is a lot more annoying:

I have the translucency plugin active, so I want to force aMSN webcam windows to have 100% opacity even when they are not active.

6) Start a webcam session on aMSN
7) Click another New on Window-specific settings
8) Click Detect
9) Click the aMSN webcam window
10)The class name is "AmsnWebcam"

The only way that I can think of is to enter "ebcam" and "substring match" on "whole window class", but for some reason my webcam windows are still 70% opaque when inactive.
Comment 4 D.J. Capelis 2008-11-21 01:57:41 UTC
For some reason I can't quite figure out, half the time okular starts, the first letter is an uppercase 'O' when you detect the window class, the rest of the time it starts it's a lowercase 'o'.

You have to start it several times in a row to observe the bug.  I'm not sure exactly what causes it and the differing window classes seems to probably be okular's fault, but kwin should still be able to catch this type of thing with a regex anyways.
Comment 5 Becheru Petru-Ioan 2009-02-02 16:34:09 UTC
Created attachment 30871 [details]
the bug

Bug Confirmed with kde 4.2.0
My case: i added a top right panel that windows can cover(the one with the yellow clock). Then from systemsettings->Window Behavior i added a new window-setting that would make the panel Above All: In the "Window class(application type)" input text box I writed "[Pp]lasma [Pp]lasma" and then I selected in the Preferences tab the Keep above checkboxes; then Ok and Apply. It worked! BUT after reboot the panel was NOT above normal windows so I checked my setting: the "Window class(application type)" input text box contains now "[pp]lasma [pp]lasma"(the screen shot attached) ... initially it was "[Pp]lasma [Pp]lasma".. I can confirm that the big letter "P" was transformed in the lower case version "p".
Comment 6 Martin Flöser 2009-12-19 16:25:24 UTC
*** Bug 219317 has been marked as a duplicate of this bug. ***
Comment 7 Thomas Lübking 2010-10-10 19:48:11 UTC
no idea what you ppl. rule around there, but the class matching _is_ case insensitive (have a look at rules.cpp, where it's read "toLower" and toplevel.cpp:303 as well as a comment in options.cpp)

so whatever this bug is, it's not about the case.
my attempt to force "xterm [Xx]Term" to desktop 2 worked w/o any problem.

please attach your rules of interest for inspection of the problem, but the bug as layed out (using the case regexp is pointless in the first place) i'll just mark this as worksforme
Comment 8 David 2014-01-15 17:38:12 UTC
This issue has reappeared in Kubuntu 13.10 with KDE 4.11.2

Everything was working fine in Kubuntu 13.04 (KDE 4.10)

Please reopen
Comment 9 Thomas Lübking 2014-01-15 19:01:54 UTC
we first need to figure what the problem actually is then, because case does absolutely not matter and never has (see comment #7)
Comment 10 David 2014-01-16 17:56:47 UTC
Comment #7 is 3 years old, and the regression happened after it. Have you looked at those files recently?

I took a quick glance and rules.cpp concerns loading the saved config, and is where we are seeing the rules themselves become lowercase only. 
In toplevel.cpp I see that windowRole and resourceClass get lowercased, but I don't know if resourceClass is a windows's class or if that's something like X resources.  I don't even see the comment in options.cpp

I do not know in what file the rules are actually applied.

In any case my rules for Konsole windows don't work anymore, and they did in 4.10. What extra info would you like?
Comment 11 Thomas Lübking 2014-01-16 18:37:48 UTC
....(In reply to comment #10)
> In any case my rules for Konsole windows don't work anymore, and they did in
> 4.10. What extra info would you like?

~/.kde/share/config/kwinrulesrc and "xprop" for the konsole window.
In case the cule includes the titlestring, iirc there was a recent change to its structure in konsole and tracking titles (in case it doesn't match initially) was never supported, see
https://git.reviewboard.kde.org/r/114647/

Ultimately this may also be related to https://git.reviewboard.kde.org/r/114963/ (the extra \0 byte - substring matching might do in this case)

matching is and was not case sensitive - you apparently found the toLower() bits.