[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    kwin wobbly windows resize patch
From:       Toby Dickenson <toby () tarind ! com>
Date:       2008-11-20 23:31:37
Message-ID: 200811202331.37934 () trumpet ! tarind ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello all,

Attached is a patch for wobblywindows.cpp. This makes the window resize 
operation smoother by constraining the position of the opposite corner of the 
window. The window still wobbles in the middle while the edges remain calm.

Without this patch the opposite sides vibrate franticly during resize. 
Annoying, and making it difficult to see the new size of your window without 
waiting for the wobble to settle.

This is my first kde patch for a few years, and my first for kde4.

-- 
Toby Dickenson

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" \
content="1" /><style type="text/css"> p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'DejaVu Sans Mon'; font-size:9pt; \
font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">Hello all,</p> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;"></p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">Attached is a patch for wobblywindows.cpp. This \
makes the window resize operation smoother by constraining the position of the \
opposite corner of the window. The window still wobbles in the middle while the edges \
remain calm.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;"></p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">Without this patch the opposite sides vibrate \
franticly during resize. Annoying, and making it difficult to see the new size of \
your window without waiting for the wobble to settle.</p> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">This is my first kde patch \
for a few years, and my first for kde4.</p> <p style="-qt-paragraph-type:empty; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">-- </p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Toby \
Dickenson</p></body></html>


["wobblywindows_resize_patch.diff" (text/x-patch)]

Index: wobblywindows.cpp
===================================================================
--- wobblywindows.cpp	(revision 886607)
+++ wobblywindows.cpp	(working copy)
@@ -400,6 +400,21 @@
         kDebug(1212) << "Original Picked point -- x : " << picked.x << " - y : " << \
picked.y;  #endif
         wwi.constraint[pickedPointIndex] = true;
+
+        if (w->isUserResize())
+        {
+            if (picked.x > rect.center().x())
+                if (picked.y > rect.center().y())
+                    // picked somewhere in the bottom right, so constrain the top \
left corner too +                    wwi.constraint[0] = true;
+                else
+                    wwi.constraint[wwi.count-wwi.width] = true; // constrain bottom \
left +            else
+                if (picked.y > rect.center().y())
+                    wwi.constraint[wwi.width-1] = true;         // constrain top \
right +                else
+                    wwi.constraint[wwi.count-1] = true;         // constrain bottom \
right +        }
     }
     else if (m_moveEffectEnabled && last)
     {
@@ -1050,12 +1065,13 @@
 
         vel_sum += fabs(vel.x) + fabs(vel.y);
 
-#if defined VERBOSE_MODE
         if (wwi.constraint[i])
         {
+            wwi.position[i] = wwi.origin[i];
+#if defined VERBOSE_MODE
             kDebug(1212) << "Constraint point ** vel : " << vel.x << "," << vel.y << \
" ** move : " << vel.x*time << "," << vel.y*time; +#endif
         }
-#endif
     }
 
 #if defined VERBOSE_MODE



_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic