[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: Re: Review Request: Fix close window decoration on double click on menu button
From: Thomas_Lübking <thomas.luebking () web ! de>
Date: 2012-02-18 14:38:03
Message-ID: 20120218143803.32295.77188 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On Feb. 16, 2012, 11:19 p.m., Thomas Lübking wrote:
> > kwin/libkdecorations/kcommondecoration.cpp, line 712
> > <http://git.reviewboard.kde.org/r/103995/diff/1/?file=49555#file49555line712>
> >
> > Those are by default 400ms - what if the user thinks "didn't work" and clicks \
> > again in this time?
> > (It's really much time, do we have a testwidget like winblows had around?)
>
> Martin Gräßlin wrote:
> Yes it is a long time. But has been that way for Aurorae for quite some time and \
> AFAIR we have not received any bug reports. But I'll think about finding a better \
> solution.
My preferred solution for this conflict is usually a "strong click", ie. \
QToolButton::DelayedPopup (so the concept is not strange and as mentioned there \
commonly used by eg. browser backward buttons) either on press (and a timer/slot) or \
release (and time.elapsed) - the latter is probably less common, but needs no \
callback.
It has the advance of implicitly eating time from the double click while and \
therefore the time to feedback can be considerably shorter \
(QStyle::SH_ToolButton_PopupDelay) since it's "stolen" from the doubleclick interval.
Ie. if you press the button and hold it for ~150ms that is counted as a strong click \
and the menu is opened and it's far easier to release the button within 150ms then to \
coordinate a second complete click within 300ms (my doubleclick time, i can do up to \
150 but it's becoming nasty on cpu load and async X11 ./. sync timers ;-)
(And tbh and in case that's not clear - i personally don't like the idea that the \
menu either triggers a menu or closes the window depending on whether you maybe had \
too much coffee ;-) Just that Win3.11 did it doesn't mean it's sane. Does Win7 btw. \
still expose this behaviour?)
> On Feb. 16, 2012, 11:19 p.m., Thomas Lübking wrote:
> > kwin/libkdecorations/kcommondecoration.cpp, line 738
> > <http://git.reviewboard.kde.org/r/103995/diff/1/?file=49555#file49555line738>
> >
> > This means that a "slow" click would close the window as well unless the popup \
> > has grabbed the pointer, does it?
> > Try "kwin --nograb" ;-P
> >
> > (Ie. this is a timebomb since pointer grabbing is an implementation detail which \
> > might be absent on wayland or so)
>
> Martin Gräßlin wrote:
> no, the timer starts on the press, so no matter how slow you click the menu opens \
> after 400 msec.
I maybe should apply the patch, but my impresssion was that the code relies on the \
_present_ fact that the button will not receive a mouse release event when the menu \
is opened (because if it would, t would not be NULL (?) and not isActive() either \
(?), so this block would be entered and good bye my window)
- Thomas
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103995/#review10690
-----------------------------------------------------------
On Feb. 16, 2012, 4:28 p.m., Martin Gräßlin wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103995/
> -----------------------------------------------------------
>
> (Updated Feb. 16, 2012, 4:28 p.m.)
>
>
> Review request for kwin.
>
>
> Description
> -------
>
> Currently decorations based on KCommonDecoration require three mouse clicks on the \
> menu button to close it. The reason is: 1. mouse click: opens menu
> 2. mouse click: hides menu
> 3. mouse click: double click which reaches the decoration
>
> This patch incorporates some ideas from fixing the same issue in Aurorae 3 today: \
> using a timer on mouse press with doubleClickInterval and show the menu only after \
> the interval passed. This slightly delays the appearance of the menu, because of \
> that right click behaves in the normal way to open the menu.
> Given that this used to be broken for years and introduces a slight change in \
> behavior I am not sure whether this is also 4.8 material.
>
> This addresses bug 157184.
> http://bugs.kde.org/show_bug.cgi?id=157184
>
>
> Diffs
> -----
>
> kwin/libkdecorations/kcommondecoration.h d207da8
> kwin/libkdecorations/kcommondecoration.cpp 480a437
>
> Diff: http://git.reviewboard.kde.org/r/103995/diff/
>
>
> Testing
> -------
>
> clicked a lot on the menu button in Oxygen and everything seems fine.
>
>
> Thanks,
>
> Martin Gräßlin
>
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/103995/">http://git.reviewboard.kde.org/r/103995/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On February 16th, 2012, 11:19 p.m., <b>Thomas \
Lübking</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/103995/diff/1/?file=49555#file49555line712" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kwin/libkdecorations/kcommondecoration.cpp</a> <span style="font-weight: \
normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KCommonDecoration::slotKeepAbove()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">712</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> \
<span class="n">t</span><span class="o">-></span><span \
class="n">setInterval</span><span class="p">(</span><span \
class="n">QApplication</span><span class="o">::</span><span \
class="n">doubleClickInterval</span><span class="p">());</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Those are by default \
400ms - what if the user thinks "didn't work" and clicks again in this \
time?
(It's really much time, do we have a testwidget like winblows had around?)</pre>
</blockquote>
<p>On February 17th, 2012, 7:06 a.m., <b>Martin Gräßlin</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yes it is a long time. \
But has been that way for Aurorae for quite some time and AFAIR we have not received \
any bug reports. But I'll think about finding a better solution.</pre> \
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">My \
preferred solution for this conflict is usually a "strong click", ie. \
QToolButton::DelayedPopup (so the concept is not strange and as mentioned there \
commonly used by eg. browser backward buttons) either on press (and a timer/slot) or \
release (and time.elapsed) - the latter is probably less common, but needs no \
callback.
It has the advance of implicitly eating time from the double click while and \
therefore the time to feedback can be considerably shorter \
(QStyle::SH_ToolButton_PopupDelay) since it's "stolen" from the \
doubleclick interval.
Ie. if you press the button and hold it for ~150ms that is counted as a strong click \
and the menu is opened and it's far easier to release the button within 150ms \
then to coordinate a second complete click within 300ms (my doubleclick time, i can \
do up to 150 but it's becoming nasty on cpu load and async X11 ./. sync timers \
;-)
(And tbh and in case that's not clear - i personally don't like the idea that \
the menu either triggers a menu or closes the window depending on whether you maybe \
had too much coffee ;-) Just that Win3.11 did it doesn't mean it's sane. Does \
Win7 btw. still expose this behaviour?)</pre> <br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On February 16th, 2012, 11:19 p.m., <b>Thomas \
Lübking</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="http://git.reviewboard.kde.org/r/103995/diff/1/?file=49555#file49555line738" \
style="color: black; font-weight: bold; text-decoration: \
underline;">kwin/libkdecorations/kcommondecoration.cpp</a> <span style="font-weight: \
normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KCommonDecoration::slotKeepAbove()</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">720</font></th> <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">if</span> \
<span class="p">(</span><span class="n">closing</span><span \
class="p">)</span></pre></td> <th bgcolor="#e9eaa8" style="border-left: 1px solid \
#C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font \
size="2">730</font></th> <td bgcolor="#fdfebc" width="50%"><pre style="font-size: \
8pt; line-height: 140%; margin: 0; "> <span class="k">if</span> <span \
class="p">(</span><span class="n">t</span> <span class="o">&&</span> <span \
class="o">!</span><span class="n">t</span><span class="o">-></span><span \
class="n">isActive</span><span class="p">())</span> <span \
class="p">{</span></pre></td> </tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This means that a \
"slow" click would close the window as well unless the popup has grabbed \
the pointer, does it?
Try "kwin --nograb" ;-P
(Ie. this is a timebomb since pointer grabbing is an implementation detail which \
might be absent on wayland or so)</pre> </blockquote>
<p>On February 17th, 2012, 7:06 a.m., <b>Martin Gräßlin</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">no, the timer starts on \
the press, so no matter how slow you click the menu opens after 400 msec.</pre> \
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I maybe \
should apply the patch, but my impresssion was that the code relies on the _present_ \
fact that the button will not receive a mouse release event when the menu is opened \
(because if it would, t would not be NULL (?) and not isActive() either (?), so this \
block would be entered and good bye my window)</pre> <br />
<p>- Thomas</p>
<br />
<p>On February 16th, 2012, 4:28 p.m., Martin Gräßlin wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for kwin.</div>
<div>By Martin Gräßlin.</div>
<p style="color: grey;"><i>Updated Feb. 16, 2012, 4:28 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Currently decorations based on KCommonDecoration require three mouse \
clicks on the menu button to close it. The reason is: 1. mouse click: opens menu
2. mouse click: hides menu
3. mouse click: double click which reaches the decoration
This patch incorporates some ideas from fixing the same issue in Aurorae 3 today: \
using a timer on mouse press with doubleClickInterval and show the menu only after \
the interval passed. This slightly delays the appearance of the menu, because of that \
right click behaves in the normal way to open the menu.
Given that this used to be broken for years and introduces a slight change in \
behavior I am not sure whether this is also 4.8 material.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">clicked a lot on the menu button in Oxygen and everything seems \
fine.</pre> </td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=157184">157184</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>kwin/libkdecorations/kcommondecoration.h <span style="color: \
grey">(d207da8)</span></li>
<li>kwin/libkdecorations/kcommondecoration.cpp <span style="color: \
grey">(480a437)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/103995/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
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