Bug 96602 - Shade messes up window size
Summary: Shade messes up window size
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: CVS
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 98229 102262 102610 104391 104622 108491 114192 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-08 22:20 UTC by illogic-al
Modified: 2005-10-11 18:25 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description illogic-al 2005-01-08 22:20:40 UTC
Version:           unknown (using KDE 3.3.91 (beta1), compiled sources)
Compiler:          gcc version 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)
OS:                Linux (i686) release 2.6.7-1.mm.3mdk

So far this has only happened on some, not all windows.
It happens in Quanta (cvs version) consistently and in konversation (cvs) occasionally. 
To reproduce just open up either app and then double click on the title bar (by default this is configured to shade the window) then double click again and the window will reappear, but not at the original size. 
I can add pictures if this will make things clearer.
Comment 1 Lubos Lunak 2005-01-20 18:22:31 UTC
It happens with KDevelop as well, so it's most probably KMDI's fault. The window itself is not resized at all, only the frame added by KWin, so my guess is KMDI tries some weird tricks.
Comment 2 illogic-al 2005-02-22 03:54:24 UTC
just updating info.
Comment 3 Lubos Lunak 2005-02-22 15:27:23 UTC
*** Bug 98229 has been marked as a duplicate of this bug. ***
Comment 4 Lubos Lunak 2005-03-23 13:43:28 UTC
*** Bug 102262 has been marked as a duplicate of this bug. ***
Comment 5 Maksim Orlovich 2005-03-23 15:50:30 UTC
Seli: #102138 reports that with ksirc. No kmdi there
Comment 6 Dominik Haumann 2005-03-27 19:38:10 UTC
*** Bug 102610 has been marked as a duplicate of this bug. ***
Comment 7 Andy 2005-04-04 15:35:08 UTC
Can confirm that this also happens with Kopete 0.10
(KDE 3.4 SuSE 9.2)
Comment 8 Matthieu Bedouet 2005-04-19 23:45:21 UTC
this also happens with kate , on Debian sid with kde 3.4 from experimental (kdelibs 4:3.4.0-0pre4 released Apr 19)
Comment 9 Lubos Lunak 2005-04-25 10:40:53 UTC
*** Bug 104391 has been marked as a duplicate of this bug. ***
Comment 10 Janet 2005-04-25 21:12:01 UTC
I too can confirm it most of the time with quanta and showimg ((kdelibs 4:3.4.0-0pre4, Kanotix/Debian). It mostly happens if another window of another program is open too. And it also happend with konqueror clicked to shade the first time on a newly installed Kubuntu 5.04 (afterwards nomore). 

With showimg I once reached a state where after a lot of shading and resizing the window suddenly resized correctly after a shade and I couldn't reproduce the wrong resizing in that session. But restarting the computer next day showimg couldn't restore the vertical window size again and I cannot deliberately reproduce the behaviour. 

Never have with other applications...
Comment 11 Matt Rogers 2005-04-27 00:25:44 UTC
*** Bug 104622 has been marked as a duplicate of this bug. ***
Comment 12 Christopher Neufeld 2005-04-27 00:41:10 UTC
See also the comments on bug 102295, this affects emacs and xv.
Comment 13 Andreas Pakulat 2005-05-22 18:28:42 UTC
Hi,

as this bug has been around for quite a while, with no progess that can be seen, I'd like to ask what the problem is? I mean, will kmdi be thrown out of KDE soon, so that this is irrelevant. Or is it just not reproduceable or too hard to track down? I had hoped that this would be fixed in 3.4.1, but currently it seems nobody is working on it at all...

Andreas
Comment 14 Matt Rogers 2005-05-22 19:18:11 UTC
please be patient. i don't have a lot of spare time. You find me more spare time, I can spend more time to fix the bug.
Comment 15 Janet 2005-06-06 03:54:10 UTC
Did you know this bug is reproducable for *all* program windows? I tried it in KDE 3.4.0 and 3.4.1 on Kubuntu and on Kanotix:

Shade a program window (it really doesn't matter which program) and open kcontrol and choose a new window decoration and apply it - then unshade the other window et voilà: it unshades to a vertically shrinked size. Drag it to the right size, shade it, unshade it - everything's ok. Shade it, choose other window decoration, apply it, unshade window - wrong size and so on.
Comment 16 Andreas Pagel 2005-06-06 17:06:34 UTC
This happens for me all the time for emacs windows since upgrading to KDE 3.4.1 (SuSE 9.1).  The window is restored with a height of just one line.
Comment 17 Andreas Pakulat 2005-06-07 19:23:30 UTC
Hi, from the last 2 posts, I'd suspect this not to be a kmdi but rather a kwin problem?? Maybe it's possible to open a bug with kwin on this or shift it over to kwin?

Andreas
Comment 18 Christopher Neufeld 2005-06-07 19:26:37 UTC
It was under kwin as bug 102295, the bug was closed invalid there.
Comment 19 Lubos Lunak 2005-06-08 20:07:35 UTC
SVN commit 423512 by lunakl:

An attempt to get the crazy shaded windows geometry handling right.
This fixes comment #10 in 96602, I don't know if it fixes as a whole,
but I'm quite sure people will complain again if not.
BUG: 96602



 M  +6 -11     client.cpp  
 M  +1 -2      client.h  
 M  +71 -37    geometry.cpp  
 M  +4 -3      rules.cpp  
Comment 20 David Hubner 2005-06-10 02:23:52 UTC
Compiled from:

File: kdebase-423575.tar.bz2
File: kdelibs-423572.tar.bz2

Kate still does not unshade to correct size when shaded and unshaded.
Comment 21 Lubos Lunak 2005-06-10 16:08:23 UTC
Well, I said this was a KMDI bug.
Comment 22 Lubos Lunak 2005-06-14 16:32:40 UTC
Ok, still kwin's fault after all.
Comment 23 Lubos Lunak 2005-06-14 17:35:51 UTC
SVN commit 425377 by lunakl:

Another final attempt at sorting out the shaded geometry problems.
This time at least the code should detect properly all attempts
to use shaded geometry when the normal one is needed.
BUG: 96602



 M  +1 -0      client.h  
 M  +19 -6     geometry.cpp  
 M  +1 -1      rules.cpp  


--- trunk/KDE/kdebase/kwin/client.h #425376:425377
@@ -102,6 +102,7 @@
             SizemodeMax // try not to make it larger in either direction
             };
         QSize adjustedSize( const QSize&, Sizemode mode = SizemodeAny ) const;
+        QSize adjustedSize() const;
 
         QPixmap icon() const;
         QPixmap miniIcon() const;
--- trunk/KDE/kdebase/kwin/geometry.cpp #425376:425377
@@ -1010,6 +1010,13 @@
     return sizeForClientSize( wsize, mode, false );
     }
 
+// this helper returns proper size even if the window is shaded
+// see also the comment in Client::setGeometry()
+QSize Client::adjustedSize() const
+    {
+    return sizeForClientSize( clientSize());
+    }
+
 /*!
   Calculate the appropriate frame size for the given client size \a
   wsize.
@@ -1022,6 +1029,11 @@
     {
     int w = wsize.width();
     int h = wsize.height();
+    if( w < 1 || h < 1 )
+        {
+        kdWarning() << "sizeForClientSize() with empty size!" << endl;
+        kdWarning() << kdBacktrace() << endl;
+        }
     if (w<1) w = 1;
     if (h<1) h = 1;
 
@@ -1247,7 +1259,7 @@
         xSizeHint.win_gravity = NorthWestGravity;
     if( isManaged())
         { // update to match restrictions
-        QSize new_size = adjustedSize( size());
+        QSize new_size = adjustedSize();
         if( new_size != size() && !isFullScreen())
             resizeWithChecks( new_size );
         }
@@ -1447,8 +1459,8 @@
         {
         if( h == border_top + border_bottom )
             {
-            kdDebug() << "Shaded geometry passed for size:" << endl;
-            kdDebug() << kdBacktrace() << endl;
+            kdWarning() << "Shaded geometry passed for size:" << endl;
+            kdWarning() << kdBacktrace() << endl;
             }
         }
     int newx = x();
@@ -1614,7 +1626,8 @@
     // shading. Then the frame geometry is adjusted for the shaded geometry.
     // This gets more complicated in the case the code does only something like
     // setGeometry( geometry()) - geometry() will return the shaded frame geometry.
-    // Such code is wrong and should be changed to handle the case when the window is shaded.
+    // Such code is wrong and should be changed to handle the case when the window is shaded,
+    // for example using Client::clientSize().
     if( shade_geometry_change )
         ; // nothing
     else if( isShade())
@@ -1664,7 +1677,7 @@
 
 void Client::plainResize( int w, int h, ForceGeometry_t force )
     {
-    // this code is also duplicated in Client::setGeometry()
+    // this code is also duplicated in Client::setGeometry(), and it's also commented there
     if( shade_geometry_change )
         ; // nothing
     else if( isShade())
@@ -1752,7 +1765,7 @@
             if( pending_geometry_update )
                 {
                 if( isShade())
-                    setGeometry( QRect( pos(), sizeForClientSize( clientSize())), ForceGeometrySet );
+                    setGeometry( QRect( pos(), adjustedSize()), ForceGeometrySet );
                 else
                     setGeometry( geometry(), ForceGeometrySet );
                 pending_geometry_update = false;
--- trunk/KDE/kdebase/kwin/rules.cpp #425376:425377
@@ -828,7 +828,7 @@
         workspace()->activateNextClient( this );
     // MoveResizeMode
     // Closeable
-    QSize s = adjustedSize( sizeForClientSize( clientSize())); // handle shading
+    QSize s = adjustedSize();
     if( s != size())
         resizeWithChecks( s );
     setShortcut( rules()->checkShortcut( shortcut().toString()));
Comment 24 Andreas Pakulat 2005-06-26 23:05:20 UTC
Hi,

the 2 commits from Lubos Lunak fix the problem here. I integrated both into the debian 3.4.1 packages and reinstalled only kwin with these fixes and shading works again :-)

Andreas
Comment 25 Dominik Haumann 2005-07-03 15:06:39 UTC
*** Bug 108491 has been marked as a duplicate of this bug. ***
Comment 26 David Hubner 2005-08-29 00:09:25 UTC
Can i ask if there was a reason these changes were not put into 3.4.2?
Comment 27 Lubos Lunak 2005-08-29 18:26:04 UTC
I don't consider the changes safe enough for backporting. KDE3.5 will be released quite soon.
Comment 28 Andreas Pakulat 2005-08-30 16:35:26 UTC
Could you explain a bit more? I backported them to 3.4.1 (into the debian experimental packages) myself and until now I could not encounter _any_ misbehaviour, crashes or any other error that could be related to those changes.

Of course this is just an academic discussion as 3.4.2 has already been released...

Andreas
Comment 29 David Hubner 2005-08-31 06:06:01 UTC
I assume ( not being a member of the KDE team ) that a *.*.<version> release is meant to a bugfix to direct applications as this change needed NETWM to be adapted it was done for a *.<version> release. When doing changes to KdeCore you need to be sure you have not effected any other applications that depend on it. That takes a lot of testing being such a large codebase.  
Comment 30 David Hubner 2005-08-31 06:08:32 UTC
Sorry i meant to say, that it was built apon new changes in NETVM, not that NETWM needed changing for this fix.

Its late :)
Comment 31 Lubos Lunak 2005-09-12 15:43:12 UTC
If you've tested the patches, feel free to backport them for the KDE3.4.x branch too.
Comment 32 Andreas Pakulat 2005-09-18 22:59:01 UTC
Hi,

I'm neither a kde developer (in terms of doing official kde development) nor am I a debian developer - I just write bugreports and sometimes small patches.

But Debian QT/KDE Maintainers added the fix to the KDE 3.4.2 packages :-) So no need for me to backport myself...

Andreas
Comment 33 Lubos Lunak 2005-10-11 13:47:29 UTC
*** Bug 114192 has been marked as a duplicate of this bug. ***
Comment 34 Chani 2005-10-11 18:25:57 UTC
ahh, if only I'd seen this bug on the weekend when I was bored. I'd like to see this fix in gentoo packages, but... how would I make that happen?