Bug 43101 - XTestFakeMotionEvent no longer works on multiple screen displays
Summary: XTestFakeMotionEvent no longer works on multiple screen displays
Status: RESOLVED MOVED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: All All
: medium major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard: 2011BRB_Reviewed
Keywords: regression
Depends on:
Blocks:
 
Reported: 2011-11-19 21:20 UTC by Karl Runge
Modified: 2018-12-13 22:26 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Karl Runge 2011-11-19 21:20:17 UTC
It appears that sometime in the 2009 time frame the XTEST interface:

XTestFakeMotionEvent(dpy, screen, x, y, delay)

on a multiple screen display stopped flipping to the one specified
by the screen argument.  The current behavior is that it stays on
the screen that has the current focus and does the motion there (i.e.
as though screen = -1 were specified.)

The following program can be used on a multiple screen display to
reproduce the problem:

/*
    cc -o flip_screens flip_screens.c -L /usr/X11R6/lib -lX11 -lXtst
 */

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XTest.h>

int main() {
	int i, s;
	Display *dpy = XOpenDisplay(NULL);
	if (!dpy) {
		printf("XOpenDisplay failed.\n");
		return 1;
	}
	for (i=0; i < 10; i++) {
		for (s=0; s < 2; s++) {
			int n = 200+10*i;
			printf("flipping to screen: %d ...\n", s);
			XTestFakeMotionEvent(dpy, s, n, n, CurrentTime);
			XFlush(dpy);
			sleep(1);
		}
	}
	XCloseDisplay(dpy);
	return 0;
}
Comment 1 Jeremy Huddleston Sequoia 2011-11-20 21:24:13 UTC
Can you bisect it further than "in the 2009 time frame"?  Even version deltas would be more helpful in narrowing down the regression
Comment 2 Karl Runge 2011-11-21 07:12:37 UTC
(In reply to comment #1)
> Can you bisect it further than "in the 2009 time frame"?  Even version deltas
> would be more helpful in narrowing down the regression

Unfortunately, I'm not able to build Xorg any more, so I can only
give you some field reports.

I have an old lenny machine and XTestFakeEventMotion works properly on:

# /usr/bin/Xorg -version

X.Org X Server 1.4.2
Release Date: 11 June 2008
X Protocol Version 11, Revision 0
Build Operating System: Linux Debian (xorg-server 2:1.4.2-10.lenny3)
Current Operating System: Linux corvus 2.6.26-2-686 #1 SMP Sat Jun 11 14:54:10 U
TC 2011 i686
Build Date: 25 September 2010  12:05:44PM

I can't find a good upper bound with machines I have access to.
I think this post does a better job than I can:

https://bugs.launchpad.net/ubuntu/+source/gnome-panel/+bug/339783

That at least gives a date (Apr 24 2009) and an Ubuntu release, so
I think one could map that into Xorg version numbers.
Comment 3 Karl Runge 2011-11-21 10:40:44 UTC
I have Ubuntu 9.04 on a test machine. I booted it and verified that
the XTestFakeMotionEvent bug reported here does occur for the following
version of Xorg:

X.Org X Server 1.6.0
Release Date: 2009-2-25
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24-23-server i686 Ubuntu
Current Operating System: Linux fred-desktop 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686
Build Date: 09 April 2009  02:10:02AM
xorg-server 2:1.6.0-0ubuntu14 (buildd@rothera.buildd) 
        Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
Comment 4 Antoine Martin 2016-09-06 09:23:31 UTC
This bug is still present in the latest Xorg versions.

The code in ProcXTestFakeInput gets the screen using miPointerGetScreen.

for (i = 0; i < nevents; i++)
        mieqProcessDeviceEvent(dev, &xtest_evlist[i], miPointerGetScreen(inputInfo.pointer));

But it should honour the screen set in the request instead, and only use miPointerGetScreen when the screen value is negative.

I've tested this by hard-coding the screen to the value:
screen = screenInfo.screens[1];
And as expected, all events are sent to the second screen.

What is the proper way of fixing this?
Comment 5 GitLab Migration User 2018-12-13 22:26:10 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/419.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.