Bug 58255 - Ineffective check in GrabDevice()
Summary: Ineffective check in GrabDevice()
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/Input/Core (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-13 18:49 UTC by Owen Taylor
Modified: 2012-12-19 23:52 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Owen Taylor 2012-12-13 18:49:23 UTC
dix/events.c:GrabDevice has

    if (grab && grab->grabtype != grabtype)
        *status = AlreadyGrabbed;
    if (grab && !SameClient(grab, client))
        *status = AlreadyGrabbed;
    else if ((!pWin->realized) ||
             (confineTo &&
              !(confineTo->realized && BorderSizeNotEmpty(dev, confineTo))))
        *status = GrabNotViewable;
    else if ((CompareTimeStamps(time, currentTime) == LATER) ||
             (CompareTimeStamps(time, grabInfo->grabTime) == EARLIER))
        *status = GrabInvalidTime;
    else if (grabInfo->sync.frozen &&
             grabInfo->sync.other && !SameClient(grabInfo->sync.other, client))
        *status = GrabFrozen;
    else {
      [...]
        *status = GrabSuccess;
    }

there's pretty clearly a missing 'else' on the second 'if' as compared to what was intended, but fixing it will change the semantics of whether overgrabbing a core grab with a XI2 or vice-versa is allowed. The protocol for GrabDevice says:

    AlreadyGrabbed: If the device is actively grabbed by some other client.

and doesn't describe the interaction with the core protocol.
Comment 1 Peter Hutterer 2012-12-13 22:45:36 UTC
Looking at the commit that introduced this, xorg-server-1.5.99.1-782-g09f9a86, it clearly intended _not_ to allow grabs of different type to override each other. Do you have a use-case where this is necessary?
Comment 2 Jasper St. Pierre 2012-12-14 00:01:30 UTC
(In reply to comment #1)
> Do you have a use-case where this is necessary?

Nope. It might break somebody else's broken client, though, and it's not specced behavior.
Comment 3 Peter Hutterer 2012-12-14 03:38:32 UTC
http://patchwork.freedesktop.org/patch/12662/
Comment 4 Peter Hutterer 2012-12-19 23:52:07 UTC
commit dd3242c87a0a58cba055eb99c0c3fcf03153e4b8
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Dec 14 11:34:15 2012 +1000

    dix: don't allow overriding a grab with a different type of grab (#58255)


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.