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

List:       kde-core-devel
Subject:    Re: Review Request: Fix KWindowSystem::compositingChanged signal
From:       Thomas_Lübking <thomas.luebking () gmail ! com>
Date:       2013-01-08 23:22:37
Message-ID: 20130108232237.394.47582 () vidsolbach ! de
[Download RAW message or body]

> On Jan. 8, 2013, 11:15 p.m., Xuetian Weng wrote:
> > after I apply the patch, I notice that in some random unknnow case KWindowSystem \
> > will emit the signal, while KSelectionOwner is not. (And I think KSelectionOwner \
> > is correct since I didn't do anything to kwin), and I notice some strange plasma \
> > theme change caused by this. 
> > Trying to find you why..

The XFixesSelectionNotify event fires one every selection owner event, usually it'll \
be the cnp system (when you eg. mark text)

The problem should ideally be fixed in Qt instead of working around it in KDE.
Untested patch:


diff --git a/src/gui/kernel/qapplication_x11.cpp \
b/src/gui/kernel/qapplication_x11.cpp index 3631f1d..644f0ad 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -536,6 +536,7 @@ struct qt_xfixes_selection_event_data
 {
     // which selection to filter out.
     Atom selection;
+    Window window;
 };
 
 #if defined(Q_C_CALLBACKS)
@@ -548,7 +549,7 @@ static Bool qt_xfixes_scanner(Display*, XEvent *event, XPointer \
arg)  reinterpret_cast<qt_xfixes_selection_event_data*>(arg);
     if (event->type == X11->xfixes_eventbase + XFixesSelectionNotify) {
         XFixesSelectionNotifyEvent *xfixes_event = \
                reinterpret_cast<XFixesSelectionNotifyEvent*>(event);
-        if (xfixes_event->selection == data->selection)
+        if (xfixes_event->selection == data->selection && xfixes_event->window == \
data->window)  return true;
     }
     return false;
@@ -3462,6 +3463,7 @@ int QApplication::x11ProcessEvent(XEvent* event)
         // we don't want to handle old SelectionNotify events.
         qt_xfixes_selection_event_data xfixes_event;
         xfixes_event.selection = req->selection;
+        xfixes_event.window = req->window;
         for (XEvent ev;;) {
             if (!XCheckIfEvent(X11->display, &ev, &qt_xfixes_scanner, \
(XPointer)&xfixes_event))  break;


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107983/#review25012
-----------------------------------------------------------


On Jan. 5, 2013, 5:08 p.m., Thomas Lübking wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107983/
> -----------------------------------------------------------
> 
> (Updated Jan. 5, 2013, 5:08 p.m.)
> 
> 
> Review request for kdelibs, kwin, Plasma, Aaron J. Seigo, Marco Martin, Martin \
> Gräßlin, and Fredrik Höglund. 
> 
> Description
> -------
> 
> It works fine here (tested so far KWindowSystem signal, KSelectionWatcher only with \
> kwin) with kwin (shift+alt+f12), xcompmgr, compiz & "metacity -c" and e17. Didn't \
> try xfce nor mutter. 
> Technically:
> I do not at all understand why KWindowSystem is *not* watching the root window - \
> KSelectionOwner for one is sending events to the root and this also seems the case \
> for all other WMs (at least everything now starts to cause the signal to be \
> emitted) 
> The KSelectionWatcher failure seems to be kwin specific (wrote me a cleaner \
> testcase), there'll be some X11 event processing on top that eats away the client \
> messages. So this one can be scratched from the patch, the KWindowSystem issue \
> remains. 
> 
> This addresses bug 179042.
> http://bugs.kde.org/show_bug.cgi?id=179042
> 
> 
> Diffs
> -----
> 
> kdeui/windowmanagement/kwindowsystem_x11.cpp f9b3cc1 
> 
> Diff: http://git.reviewboard.kde.org/r/107983/diff/
> 
> 
> Testing
> -------
> 
> see summary
> 
> 
> Thanks,
> 
> Thomas Lübking
> 
> 


[Attachment #3 (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/107983/">http://git.reviewboard.kde.org/r/107983/</a>
  </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On January 8th, 2013, 11:15 p.m., <b>Xuetian \
Weng</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;">after I apply the patch, I notice that in some random unknnow case \
KWindowSystem will emit the signal, while KSelectionOwner is not. (And I think \
KSelectionOwner is correct since I didn&#39;t do anything to kwin), and I notice some \
strange plasma theme change caused by this.

Trying to find you why..</pre>
 </blockquote>







</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">The \
XFixesSelectionNotify event fires one every selection owner event, usually it&#39;ll \
be the cnp system (when you eg. mark text)

The problem should ideally be fixed in Qt instead of working around it in KDE.
Untested patch:


diff --git a/src/gui/kernel/qapplication_x11.cpp \
b/src/gui/kernel/qapplication_x11.cpp index 3631f1d..644f0ad 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -536,6 +536,7 @@ struct qt_xfixes_selection_event_data
 {
     // which selection to filter out.
     Atom selection;
+    Window window;
 };
 
 #if defined(Q_C_CALLBACKS)
@@ -548,7 +549,7 @@ static Bool qt_xfixes_scanner(Display*, XEvent *event, XPointer \
arg)  reinterpret_cast&lt;qt_xfixes_selection_event_data*&gt;(arg);
     if (event-&gt;type == X11-&gt;xfixes_eventbase + XFixesSelectionNotify) {
         XFixesSelectionNotifyEvent *xfixes_event = \
                reinterpret_cast&lt;XFixesSelectionNotifyEvent*&gt;(event);
-        if (xfixes_event-&gt;selection == data-&gt;selection)
+        if (xfixes_event-&gt;selection == data-&gt;selection &amp;&amp; \
xfixes_event-&gt;window == data-&gt;window)  return true;
     }
     return false;
@@ -3462,6 +3463,7 @@ int QApplication::x11ProcessEvent(XEvent* event)
         // we don&#39;t want to handle old SelectionNotify events.
         qt_xfixes_selection_event_data xfixes_event;
         xfixes_event.selection = req-&gt;selection;
+        xfixes_event.window = req-&gt;window;
         for (XEvent ev;;) {
             if (!XCheckIfEvent(X11-&gt;display, &amp;ev, &amp;qt_xfixes_scanner, \
(XPointer)&amp;xfixes_event))  break;
</pre>
<br />








<p>- Thomas</p>


<br />
<p>On January 5th, 2013, 5:08 p.m., Thomas Lübking 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 kdelibs, kwin, Plasma, Aaron J. Seigo, Marco Martin, Martin \
Gräßlin, and Fredrik Höglund.</div> <div>By Thomas Lübking.</div>


<p style="color: grey;"><i>Updated Jan. 5, 2013, 5:08 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;">It works fine here (tested so far KWindowSystem signal, \
KSelectionWatcher only with kwin) with kwin (shift+alt+f12), xcompmgr, compiz &amp; \
&quot;metacity -c&quot; and e17. Didn&#39;t try xfce nor mutter.

Technically:
I do not at all understand why KWindowSystem is *not* watching the root window - \
KSelectionOwner for one is sending events to the root and this also seems the case \
for all other WMs (at least everything now starts to cause the signal to be emitted)

The KSelectionWatcher failure seems to be kwin specific (wrote me a cleaner \
testcase), there&#39;ll be some X11 event processing on top that eats away the client \
messages. So this one can be scratched from the patch, the KWindowSystem issue \
remains.</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;">see summary</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=179042">179042</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>kdeui/windowmanagement/kwindowsystem_x11.cpp <span style="color: \
grey">(f9b3cc1)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/107983/diff/" style="margin-left: \
3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>



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

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