[Merge] ~mitya57/compiz:s390x-test into compiz:master

Sam Spilsbury smspillaz at gmail.com
Tue Aug 11 23:03:09 UTC 2020


Hi :-)

It has been a long time since I have worked with this code, but my hunch is as follows:

1. The test is checking that a window denied focus will not be stacked above some other window.
2. It does this by setting the user time on the incoming window to zero, then attempting to raise it.
3. The test is only failing on PowerPC and a key difference there is that PowerPC is MSB-First.

XChangeProperty stores bytes directly, so any internal byte-swapping performed does matter. Having a look at the code (https://git.launchpad.net/~mitya57/compiz/tree/tests/system/xorg-gtest/tests/compiz_xorg_gtest_test_window_stacking.cpp?h=lp1882792#n83), there are three parts where we use XChangeProperty:

    void MakeDock (Display *dpy, Window w)
    {
	Atom _NET_WM_WINDOW_TYPE = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE", false);
	Atom _NET_WM_WINDOW_TYPE_DOCK = XInternAtom (dpy, "_NET_WM_WINDOW_TYPE_DOCK", false);

	XChangeProperty (dpy,
			 w,
			 _NET_WM_WINDOW_TYPE,
			 XA_ATOM,
			 32,
			 PropModeReplace,
			 reinterpret_cast <const unsigned char *> (&_NET_WM_WINDOW_TYPE_DOCK),
			 1);
    }

    void SetUserTime (Display *dpy, Window w, Time time)
    {
	Atom _NET_WM_USER_TIME = XInternAtom (dpy, "_NET_WM_USER_TIME", false);
	unsigned int value = (unsigned int) time;

	XChangeProperty (dpy, w,
			 _NET_WM_USER_TIME,
			 XA_CARDINAL, 32, PropModeReplace,
			 (unsigned char *) &value, 1);
    }

    void SetClientLeader (Display *dpy, Window w, Window leader)
    {
	Atom WM_CLIENT_LEADER = XInternAtom (dpy, "WM_CLIENT_LEADER", false);

	XChangeProperty (dpy, w,
			 WM_CLIENT_LEADER,
			 XA_WINDOW, 32, PropModeReplace,
			 (unsigned char *) &leader, 1);
    }



Looking at the documentation, the fifth argument is the number of bytes in the data. Particularly for SetUserTime, we pass an unsigned int and tell the server that it is 32 bytes. unsigned int has an implementation-dependent size, with 16 bits at minimum. I guess if it is 16 bits on s390x and 32 bits on other platforms, this would cause a problem, since XChangeProperty would be reading and swapping an extra two bytes.

Probably a quick fix might be to try and change the "unsigned int value" to "uint32_t value". This is all a hunch though.
-- 
https://code.launchpad.net/~mitya57/compiz/+git/compiz/+merge/389101
Your team Compiz Maintainers is subscribed to branch compiz:master.



More information about the Ubuntu-reviews mailing list