Merge lp:~sil2100/compiz/quickfix_1141079_trunk into lp:compiz/0.9.10

Proposed by Sam Spilsbury
Status: Merged
Approved by: Łukasz Zemczak
Approved revision: 3646
Merged at revision: 3649
Proposed branch: lp:~sil2100/compiz/quickfix_1141079_trunk
Merge into: lp:compiz/0.9.10
Diff against target: 242 lines (+137/-22)
5 files modified
src/event.cpp (+21/-19)
tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp (+99/-0)
tests/xorg-gtest/include/compiz-xorg-gtest.h (+2/-1)
tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp (+1/-0)
tests/xorg-gtest/src/compiz-xorg-gtest.cpp (+14/-2)
To merge this branch: bzr merge lp:~sil2100/compiz/quickfix_1141079_trunk
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Compiz Maintainers Pending
Review via email: mp+157084@code.launchpad.net

This proposal supersedes a proposal from 2013-04-03.

Commit message

Qt is stupid since it uses the stupid X11 protocol - let's not set all the attributes (especially override_redirect) every time, only in cases when it's actually needed (LP: #1141079)

Description of the change

- Problem:

The fix introduced in revision 3606 triggers a regression with Qt menus. It seems that passing on the override_redirect state from xcreatewindow results in this regression happening. Pop-up menus in Qt apps sometimes are detected as a separate window.

- Fix:

We try not to invalidly unnecessarily pass the additional attributes to the event when there is no need. This way the override_redirect attribute is not corrupted and all is cool.

- Tests:

Attached related gtest tests.

(once this branch gets approved, please approve the raring one as well:
https://code.launchpad.net/~sil2100/compiz/quickfix_1141079/+merge/153427 )

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

I am resubmitting this for now to get a green CI result - there is a race condition which can cause multiple builds' tests to fail due to the way xorg-gtest works.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

I'm triggering a rebuild again.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/event.cpp'
--- src/event.cpp 2013-02-10 05:01:50 +0000
+++ src/event.cpp 2013-04-04 11:55:39 +0000
@@ -1285,19 +1285,20 @@
1285 * the window to the window list as we might get configure requests1285 * the window to the window list as we might get configure requests
1286 * which require us to stack other windows relative to it. Setting1286 * which require us to stack other windows relative to it. Setting
1287 * some default values if this is the case. */1287 * some default values if this is the case. */
1288 if (!XGetWindowAttributes (privateScreen.dpy, event->xcreatewindow.window, &wa))1288 if (!XGetWindowAttributes (privateScreen.dpy, event->xcreatewindow.window, &wa)) {
1289 privateScreen.setDefaultWindowAttributes (&wa);1289 privateScreen.setDefaultWindowAttributes (&wa);
12901290
1291 /* That being said, we should store as much information as possible1291 /* That being said, we should store as much information as possible
1292 * about it. There may be requests relative to this window that could1292 * about it. There may be requests relative to this window that could
1293 * use the data in the XCreateWindowEvent structure, especially the1293 * use the data in the XCreateWindowEvent structure, especially the
1294 * override redirect state */1294 * override redirect state */
1295 wa.x = event->xcreatewindow.x;1295 wa.x = event->xcreatewindow.x;
1296 wa.y = event->xcreatewindow.y;1296 wa.y = event->xcreatewindow.y;
1297 wa.width = event->xcreatewindow.width;1297 wa.width = event->xcreatewindow.width;
1298 wa.height = event->xcreatewindow.height;1298 wa.height = event->xcreatewindow.height;
1299 wa.border_width = event->xcreatewindow.border_width;1299 wa.border_width = event->xcreatewindow.border_width;
1300 wa.override_redirect = event->xcreatewindow.override_redirect;1300 wa.override_redirect = event->xcreatewindow.override_redirect;
1301 }
13011302
1302 foreach (CompWindow *w, screen->windows ())1303 foreach (CompWindow *w, screen->windows ())
1303 {1304 {
@@ -1475,16 +1476,17 @@
1475 * the window to the window list as we might get configure requests1476 * the window to the window list as we might get configure requests
1476 * which require us to stack other windows relative to it. Setting1477 * which require us to stack other windows relative to it. Setting
1477 * some default values if this is the case. */1478 * some default values if this is the case. */
1478 if (!XGetWindowAttributes (privateScreen.dpy, event->xcreatewindow.window, &wa))1479 if (!XGetWindowAttributes (privateScreen.dpy, event->xcreatewindow.window, &wa)) {
1479 privateScreen.setDefaultWindowAttributes (&wa);1480 privateScreen.setDefaultWindowAttributes (&wa);
14801481
1481 /* That being said, we should store as much information as possible1482 /* That being said, we should store as much information as possible
1482 * about it. There may be requests relative to this window that could1483 * about it. There may be requests relative to this window that could
1483 * use the data in the XCreateWindowEvent structure, especially the1484 * use the data in the XCreateWindowEvent structure, especially the
1484 * override redirect state */1485 * override redirect state */
1485 wa.x = event->xreparent.x;1486 wa.x = event->xreparent.x;
1486 wa.y = event->xreparent.y;1487 wa.y = event->xreparent.y;
1487 wa.override_redirect = event->xreparent.override_redirect;1488 wa.override_redirect = event->xreparent.override_redirect;
1489 }
14881490
1489 PrivateWindow::createCompWindow (getTopWindow ()->id (), getTopServerWindow ()->id (), wa, event->xreparent.window);1491 PrivateWindow::createCompWindow (getTopWindow ()->id (), getTopServerWindow ()->id (), wa, event->xreparent.window);
1490 break;1492 break;
14911493
=== modified file 'tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp'
--- tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp 2013-03-11 06:38:17 +0000
+++ tests/system/xorg-gtest/tests/compiz_xorg_gtest_configure_window.cpp 2013-04-04 11:55:39 +0000
@@ -212,6 +212,14 @@
212 bool VerifySetFrameExtentsResponse (Window w, int left, int right, int top, int bottom);212 bool VerifySetFrameExtentsResponse (Window w, int left, int right, int top, int bottom);
213 bool VerifyWindowSize (Window w, int x, int y, int width, int height);213 bool VerifyWindowSize (Window w, int x, int y, int width, int height);
214214
215 /* Helper functions for the Create*WindowOverrideRedirect* tests */
216 Window GrabAndCreateWindowWithAttrs (::Display *dpy,
217 XSetWindowAttributes &attr);
218 void UngrabSyncAndTestOverride (::Display *dpy,
219 Window w,
220 bool overrideAssert);
221
222
215 protected:223 protected:
216224
217 ReparentedWindow CreateWindow (::Display *);225 ReparentedWindow CreateWindow (::Display *);
@@ -720,6 +728,7 @@
720 currentHeight));728 currentHeight));
721729
722 SendSetFrameExtentsRequest (client, left, right, top, bottom);730 SendSetFrameExtentsRequest (client, left, right, top, bottom);
731
723 ASSERT_TRUE (VerifySetFrameExtentsResponse (client, left, right, top, bottom));732 ASSERT_TRUE (VerifySetFrameExtentsResponse (client, left, right, top, bottom));
724733
725 /* Map the window */734 /* Map the window */
@@ -750,3 +759,93 @@
750 currentWidth,759 currentWidth,
751 currentHeight));760 currentHeight));
752}761}
762
763
764Window
765CompizXorgSystemConfigureWindowTest::GrabAndCreateWindowWithAttrs (::Display *dpy,
766 XSetWindowAttributes &attr)
767{
768 /* NOTE: We need to ungrab the server after this function */
769 XGrabServer (dpy);
770
771 /* Create a window with our custom attributes */
772 return XCreateWindow (dpy, DefaultRootWindow (dpy),
773 0, 0, 100, 100, 0, CopyFromParent,
774 InputOutput, CopyFromParent, CWOverrideRedirect,
775 &attr);
776}
777
778void
779CompizXorgSystemConfigureWindowTest::UngrabSyncAndTestOverride (::Display *dpy,
780 Window w,
781 bool overrideAssert)
782{
783 XSync (dpy, false);
784
785 XUngrabServer (dpy);
786
787 XSync (dpy, false);
788
789 /* Check if the created window had the attributes passed correctly */
790 std::vector <long> data = WaitForWindowCreation (w);
791 EXPECT_EQ (overrideAssert, IsOverrideRedirect (data));
792}
793
794
795TEST_F (CompizXorgSystemConfigureWindowTest, CreateDestroyWindowOverrideRedirectTrue)
796{
797 ::Display *dpy = Display ();
798 XSetWindowAttributes attr;
799 attr.override_redirect = 1;
800
801 Window w = GrabAndCreateWindowWithAttrs (dpy, attr);
802
803 XDestroyWindow (dpy, w);
804
805 UngrabSyncAndTestOverride (dpy, w, true);
806}
807
808TEST_F (CompizXorgSystemConfigureWindowTest, CreateDestroyWindowOverrideRedirectFalse)
809{
810 ::Display *dpy = Display ();
811 XSetWindowAttributes attr;
812 attr.override_redirect = 0;
813
814 Window w = GrabAndCreateWindowWithAttrs (dpy, attr);
815
816 XDestroyWindow (dpy, w);
817
818 UngrabSyncAndTestOverride (dpy, w, false);
819}
820
821TEST_F (CompizXorgSystemConfigureWindowTest, CreateChangeWindowOverrideRedirectTrue)
822{
823 ::Display *dpy = Display ();
824 XSetWindowAttributes attr;
825 attr.override_redirect = 0;
826
827 Window w = GrabAndCreateWindowWithAttrs (dpy, attr);
828
829 attr.override_redirect = 1;
830 XChangeWindowAttributes (dpy, w, CWOverrideRedirect, &attr);
831
832 UngrabSyncAndTestOverride (dpy, w, true);
833
834 XDestroyWindow (dpy, w);
835}
836
837TEST_F (CompizXorgSystemConfigureWindowTest, CreateChangeWindowOverrideRedirectFalse)
838{
839 ::Display *dpy = Display ();
840 XSetWindowAttributes attr;
841 attr.override_redirect = 1;
842
843 Window w = GrabAndCreateWindowWithAttrs (dpy, attr);
844
845 attr.override_redirect = 0;
846 XChangeWindowAttributes (dpy, w, CWOverrideRedirect, &attr);
847
848 UngrabSyncAndTestOverride (dpy, w, false);
849
850 XDestroyWindow (dpy, w);
851}
753852
=== modified file 'tests/xorg-gtest/include/compiz-xorg-gtest.h'
--- tests/xorg-gtest/include/compiz-xorg-gtest.h 2013-02-23 10:47:18 +0000
+++ tests/xorg-gtest/include/compiz-xorg-gtest.h 2013-04-04 11:55:39 +0000
@@ -214,7 +214,8 @@
214 protected:214 protected:
215215
216 Atom FetchAtom (const char *);216 Atom FetchAtom (const char *);
217 void WaitForWindowCreation (Window w);217 std::vector <long> WaitForWindowCreation (Window w);
218 bool IsOverrideRedirect (std::vector <long> &data);
218219
219 virtual int GetEventMask ();220 virtual int GetEventMask ();
220221
221222
=== modified file 'tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp'
--- tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp 2013-02-14 12:12:53 +0000
+++ tests/xorg-gtest/plugins/testhelper/src/testhelper.cpp 2013-04-04 11:55:39 +0000
@@ -192,6 +192,7 @@
192192
193 std::vector <long> data;193 std::vector <long> data;
194 data.push_back (static_cast <long> (window->id ()));194 data.push_back (static_cast <long> (window->id ()));
195 data.push_back (static_cast <long> (window->overrideRedirect ()));
195 ct::SendClientMessage (screen->dpy (),196 ct::SendClientMessage (screen->dpy (),
196 ts->fetchAtom (ctm::TEST_HELPER_WINDOW_READY),197 ts->fetchAtom (ctm::TEST_HELPER_WINDOW_READY),
197 screen->root (),198 screen->root (),
198199
=== modified file 'tests/xorg-gtest/src/compiz-xorg-gtest.cpp'
--- tests/xorg-gtest/src/compiz-xorg-gtest.cpp 2013-02-23 08:23:05 +0000
+++ tests/xorg-gtest/src/compiz-xorg-gtest.cpp 2013-04-04 11:55:39 +0000
@@ -738,7 +738,7 @@
738 std::auto_ptr <ct::MessageAtoms> mMessages;738 std::auto_ptr <ct::MessageAtoms> mMessages;
739};739};
740740
741void741std::vector <long>
742ct::AutostartCompizXorgSystemTestWithTestHelper::WaitForWindowCreation (Window w)742ct::AutostartCompizXorgSystemTestWithTestHelper::WaitForWindowCreation (Window w)
743{743{
744 ::Display *dpy = Display ();744 ::Display *dpy = Display ();
@@ -758,7 +758,19 @@
758758
759 }759 }
760760
761 ASSERT_TRUE (requestAcknowledged);761 EXPECT_TRUE (requestAcknowledged);
762
763 std::vector <long> data;
764 for (int i = 0; i < 5; ++i)
765 data.push_back(static_cast <long> (event.xclient.data.l[i]));
766
767 return data;
768}
769
770bool
771ct::AutostartCompizXorgSystemTestWithTestHelper::IsOverrideRedirect (std::vector <long> &data)
772{
773 return (data[1] > 0) ? true : false;
762}774}
763775
764Atom776Atom

Subscribers

People subscribed via source and target branches