Bug 69478

Summary: Enable option "GrabDevice" by default for non-seat0 seats
Product: xorg Reporter: Laércio de Sousa <lbsousajr>
Component: Server/GeneralAssignee: Peter Hutterer <peter.hutterer>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: peter.hutterer
Version: 7.7 (2012.06)   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Enable option "GrabDevice" by default for non-seat0 seats
none
Enable option "GrabDevice" by default for non-seat0 seats (driver-independent) none

Description Laércio de Sousa 2013-09-17 16:43:04 UTC
Currently systemd-multi-seat-x wrapper is still needed in some multiseat setups.
When -seat option is passed with an argument different from seat0, systemd-multi-seat-x does the following:

1. pass option -sharevts to real X server;

2. create a special xorg.conf file with the following content (or similar):

Section "ServerFlags"
    Option "DontVTSwitch" "true"
EndSection

Section "InputClass"
    Identifier "Force input devices to seat"
    Option "GrabDevice" "true"
EndSection

The purpose of this bug is to enable "GrabDevice" option by default if seat is not seat0 (no need of Option "GrabDevice" "true" in xorg.conf).

See also: https://bugs.freedesktop.org/show_bug.cgi?id=69477
Comment 1 Laércio de Sousa 2013-09-17 16:45:03 UTC
Created attachment 86002 [details]
Enable option "GrabDevice" by default for non-seat0 seats
Comment 2 Peter Hutterer 2013-09-18 01:49:44 UTC
tbh, i'd rather have this handled in the server than in the driver which shouldn't need to care what seat it is on.The option GrabDevice is now available in the drivers that matter, so you can merge it in for non-seat-0 devices directly in config/udev.c:device_added.

since this is changing the default: is there any setup other than seat-0 where not grabbing the device is preferable?
Comment 3 Laércio de Sousa 2013-09-18 15:08:35 UTC
(In reply to comment #2)
> tbh, i'd rather have this handled in the server than in the driver which
> shouldn't need to care what seat it is on.The option GrabDevice is now
> available in the drivers that matter, so you can merge it in for non-seat0
> devices directly in config/udev.c:device_added.

OK. Thanks for the advice!

I've drafted the following construction to put somewhere in server:



XF86ConfInputClassPtr nonSeat0;

if (ServerIsNotSeat0()) {
    nonSeat0->identifier = "Force input devices to seat";
    nonSeat0->option_lst = xf86AddNewOption(nonSeat0->option_lst,
                                            "GrabDevice",
                                            "true");
    xf86configptr->conf_inputclass_lst = (XF86ConfInputClassPtr)
        xf86addListItem((glp) xf86configptr->conf_inputclass_lst,
                        (glp) nonSeat0);
}



but now I'm not sure where's the best place to put it (xf86Config.c, xf86Xinput.c, etc.), so that it will be only executed once, and won't pollute xf86configptr->conf_inputclass_lst with multiple copies of the same InputClass on every NewInputDeviceRequest() call.
Comment 4 Laércio de Sousa 2013-09-18 20:02:26 UTC
Forget it! I've found a much simpler solution. Just add the following to config/udev.c:device_added, before NewInputDeviceRequest() call:

if (ServerIsNotSeat0())
    input_options = input_option_new(input_options, "GrabDevice", true);
Comment 5 Peter Hutterer 2013-09-18 22:33:03 UTC
That's the one :)

make it "on" instead of true because it's supposed to be a const char, but otherwise fine.
Comment 6 Laércio de Sousa 2013-09-19 13:23:45 UTC
Created attachment 86146 [details] [review]
Enable option "GrabDevice" by default for non-seat0 seats (driver-independent)

This patch replaces the former one for evdev. This one applies directly to xserver/config/udev.c, so it should work equally for any relevant input driver.
Comment 7 Laércio de Sousa 2013-09-19 13:46:53 UTC
Since it's not an evdev-related bug anymore, should we change the "Component" field in bug report header above?
Comment 8 Peter Hutterer 2013-10-06 22:54:39 UTC
commit c73c36b537f996574628e69681833ea37dec2b6e
Author: Laércio de Sousa <lbsousajr@gmail.com>
Date:   Wed Sep 18 13:42:17 2013 -0300

    xserver: enable InputClass option "GrabDevice" by default for non-seat0 seats (#69478)
Comment 9 Laércio de Sousa 2013-10-07 10:19:01 UTC
Thank you very much, Peter!

Now, could you (or anyone else) please review my other patch (see bug #69477)? That one fills the last remaing gap for systemd-multi-seat-x deprecation.

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.