GitLab will be down for maintenance this Sunday 13th June, from approx 7-11am UTC. This is for a PostgreSQL migration. See the tracker issue for more informations.

Commit 4488c0a1 authored by Povilas Kanapickas's avatar Povilas Kanapickas
Browse files

grab: Test active pointer grab without button events after implicit grab

parent 83f097af
Pipeline #270819 passed with stages
in 2 minutes and 17 seconds
......@@ -247,6 +247,70 @@ TEST_F(PointerGrabTest, ImplicitGrabToActiveGrab)
ASSERT_EQ(server.GetState(), xorg::testing::Process::RUNNING);
}
TEST_F(PointerGrabTest, ImplicitGrabToActiveGrabReleaseEventNotInMask)
{
XORG_TESTCASE("Create a window with the button masks set.\n"
"Create a pointer device\n"
"Activate implicit pointer grab by clicking into the window.\n"
"While the implicit grab is active, grab the pointer, but without release mask\n"
"Release the button, check event is received\n");
::Display *dpy = Display();
Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
XSelectInput(dpy, win, ButtonPressMask|ButtonReleaseMask);
XSync(dpy, False);
Dev(0).ButtonDown(1);
ASSERT_EVENT(XEvent, e_press, dpy, ButtonPress);
ASSERT_EQ(Success, XGrabPointer(dpy, win, True, EnterWindowMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime));
XSync(dpy, False);
Dev(0).ButtonUp(1);
ASSERT_EVENT(XEvent, e_release, dpy, ButtonRelease);
ASSERT_TRUE(NoEventPending(dpy));
}
TEST_F(PointerGrabTest, XiImplicitGrabToActiveGrabReleaseEventNotInMask)
{
XORG_TESTCASE("Create a window with the button masks set.\n"
"Create a pointer device\n"
"Activate implicit pointer grab by clicking into the window.\n"
"While the implicit grab is active, grab the pointer, but without release mask\n"
"Release the button, check event is not received\n"
"Note the difference to the core grab case in which the event is received.\n");
::Display *dpy = Display();
Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
SelectXI2Events(dpy, XIAllMasterDevices, win,
{ XI_ButtonPress, XI_ButtonRelease });
XSync(dpy, False);
Dev(0).ButtonDown(1);
ASSERT_EVENT(XIDeviceEvent, press, dpy, GenericEvent, xi2_opcode, XI_ButtonPress);
ASSERT_TRUE(NoEventPending(dpy));
EventMaskBuilder mask{VIRTUAL_CORE_POINTER_ID, { XI_Enter }};
ASSERT_EQ(Success, XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID,
win, CurrentTime, None,
GrabModeAsync, GrabModeAsync,
False, mask.GetMask()));
XSync(dpy, False);
Dev(0).ButtonUp(1);
ASSERT_TRUE(NoEventPending(dpy));
}
TEST_F(PointerGrabTest, ImplicitGrabToActiveGrabDeactivated)
{
XORG_TESTCASE("Create a window with the button masks set.\n"
......@@ -893,6 +957,74 @@ TEST_F(TouchGrabTest, ActivePointerGrabOverPointerSelection)
XCloseDisplay(dpy2);
}
TEST_F(TouchGrabTest, CoreImplicitGrabToActiveGrabReleaseEventNotInMask)
{
XORG_TESTCASE("Create a window with the button masks set.\n"
"Activate implicit pointer grab by touching on the window.\n"
"While the implicit grab is active, grab the pointer, but without release mask\n"
"End the touch, check button release event is received\n");
::Display *dpy = Display();
Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
XSelectInput(dpy, win, ButtonPressMask|ButtonReleaseMask);
XSync(dpy, False);
TouchDev().TouchBegin(200, 200, 0);
ASSERT_EVENT(XEvent, e_press, dpy, ButtonPress);
ASSERT_TRUE(NoEventPending(dpy));
ASSERT_EQ(Success, XGrabPointer(dpy, win, True, EnterWindowMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime));
XSync(dpy, False);
TouchDev().TouchUpdate(282, 282, 0);
ASSERT_TRUE(NoEventPending(dpy));
TouchDev().TouchEnd(282, 282, 0);
ASSERT_EVENT(XEvent, e_release, dpy, ButtonRelease);
ASSERT_TRUE(NoEventPending(dpy));
}
TEST_F(TouchGrabTest, ImplicitGrabToActiveGrabReleaseEventNotInMask)
{
XORG_TESTCASE("Create a window with the button masks set.\n"
"Activate implicit pointer grab by touching on the window.\n"
"While the implicit grab is active, grab the pointer, but without release mask\n"
"End the touch, check button release event is not received\n"
"Note the difference to the core grab case in which the event is received.\n");
::Display *dpy = Display();
Window win = CreateWindow(dpy, DefaultRootWindow(dpy));
SelectXI2Events(dpy, XIAllMasterDevices, win,
{ XI_ButtonPress, XI_ButtonRelease });
XSync(dpy, False);
TouchDev().TouchBegin(200, 200, 0);
ASSERT_EVENT(XIDeviceEvent, press, dpy, GenericEvent, xi2_opcode, XI_ButtonPress);
ASSERT_TRUE(NoEventPending(dpy));
EventMaskBuilder mask{VIRTUAL_CORE_POINTER_ID, { XI_Enter }};
ASSERT_EQ(Success, XIGrabDevice(dpy, VIRTUAL_CORE_POINTER_ID,
win, CurrentTime, None,
GrabModeAsync, GrabModeAsync,
False, mask.GetMask()));
XSync(dpy, False);
TouchDev().TouchUpdate(282, 282, 0);
TouchDev().TouchEnd(282, 282, 0);
ASSERT_TRUE(NoEventPending(dpy));
}
TEST_F(TouchGrabTest, PassiveTouchGrabPassedToTouchClient)
{
XORG_TESTCASE("Client 1: register for passive touch grab on roow window\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment