Merge lp:~rhansen/lightdm/multiseat into lp:lightdm

Proposed by Richard Hansen on 2013-08-05
Status: Rejected
Rejected by: Robert Ancell on 2014-09-10
Proposed branch: lp:~rhansen/lightdm/multiseat
Merge into: lp:lightdm
Prerequisite: lp:~rhansen/lightdm/multiseat-logging
Diff against target: 301 lines (+85/-11)
8 files modified
data/lightdm.conf (+13/-0)
src/seat-unity.c (+18/-4)
src/seat-xlocal.c (+16/-4)
src/seat-xremote.c (+6/-2)
src/seat.c (+7/-0)
src/seat.h (+2/-0)
src/x-server-local.c (+21/-1)
src/x-server-local.h (+2/-0)
To merge this branch: bzr merge lp:~rhansen/lightdm/multiseat
Reviewer Review Type Date Requested Status
Laércio de Sousa (community) Disapprove on 2014-05-27
Robert Ancell 2013-08-05 Needs Fixing on 2013-08-12
Alberts Muktupāvels (community) Approve on 2013-08-07
PS Jenkins bot 2013-08-08 Pending
Review via email: mp+178511@code.launchpad.net

Description of the change

This branch adds basic logind multiseat support. Specifically, with some manual configuration, it makes it possible to do steps 3 and 4 of <http://www.freedesktop.org/wiki/Software/systemd/writing-display-managers/>.

See bug #1085841.

This branch does not add automatic multiseat support (see bug #1190581).

This resubmission is similar to the original submission except:
  * the code has been rebased onto lightdm 1.7.9
  * the logging changes have been cleaned up a bit and moved to a separate branch
  * the xserver-seat setting was renamed to xdg-seat

To post a comment you must log in.
Alberts Muktupāvels (muktupavels) wrote :

I don't see any regression with these changes, only improvements. With lightdm from ppa I don't need use pulseaudio in system-wide mode.

At least in my case xorg requires patching otherwise second seat doesn't find video card - https://code.launchpad.net/~albertsmuktupavels/xorg-server/fix-no-devices-detected-for-seats-other-than-seat0/+merge/178795

Still needs at least one seat with autologin enabled. Otherwise it is not possible to login in both seats, only in one of them.

review: Approve
Richard Hansen (rhansen) wrote :

> Still needs at least one seat with autologin enabled. Otherwise it is not
> possible to login in both seats, only in one of them.

Note that the must-use-autologin-to-use-all-seats bug (bug #976124) is a separate issue unrelated to this branch and merge request. (Unfortunately I am unable to reproduce bug #976124 on my system.)

Richard Hansen (rhansen) wrote :

I was hoping that requesting a review from the PS Jenkins bot would result in some automatic regression testing. Guess not. :)

Robert Ancell (robert-ancell) wrote :

Nice work!

The xserver-vt option seems a bit odd - you don't want the configuration to define a particular VT, but instead if LightDM should assign them.

I think it would work better with:

[SeatDefaults]
use-vt=false

Then seat-xlocal.c and seat-unity.c wouldn't call xserver_local_set_vt () if this was false.

The logic in xserver-local.c using vt == 0 as share is a bit overly complicated - just make a new x_server_local_set_share_vt () and set that from seat-xlocal.c and seat-unity.c.

This needs a test case - the test cases are a bit hard to add and multi-seat have never been tested so I'm flexible here. Take a look at tests/scripts/autologin.conf and modify that to have two seats. We should also test more cases but that's a start. Lean on me if you have any questions and if it's too hard I can write the first tests. Ongoing features will all need tests.

Minor details (not blockers):

Seems an excessive use of parenthesis!
+ if (((vt < 0) && (active_vt >= vt_get_min ())) || (vt == active_vt))
why not?
+ if ((vt < 0 && active_vt >= vt_get_min ()) || vt == active_vt)

The sample configuration comments are very wordy, i.e.

8 +# xdg-seat=<name>: If specified, XDG_SEAT will be set to <name> (for
9 +# pam_systemd) and, for X sessions, '-seat <name>' will be passed
10 +# to X. By default, XDG_SEAT is set to 'seat0' and '-seat' is not
11 +# passed to X.

I'd do something more like:

xdg-seat=<name>: Set the XDG name for this seat

and lower down

xdg-seat=seat0 (implying that seat0 is the default)

Remember that this can be used by other display servers than just X. (This is also why xserver-vt is a bad config name)

review: Needs Fixing
Robert Ancell (robert-ancell) wrote :

Oh, the Jenkins bot only runs jobs for Canonical employees since a MP could potentially contain malicious code. Yeah, it's a pain and we'd love a solution :( It will run once I approve the MP.

Richard Hansen (rhansen) wrote :
Download full text (4.1 KiB)

Thanks for the review! I'll work on addressing your comments.

Do you have any comments about the prerequisite branches (lp:~a7x/lightdm/seatunity-call-parent and lp:~a7x/lightdm/multiseat-logging)?

> The xserver-vt option seems a bit odd - you don't want the
> configuration to define a particular VT,

Revision 1764 [1] added xserver-vt specifically to enable the user to manually override the VT that LightDM would otherwise choose. This was how I got multiseat running initially -- I set both seats to VT 7 and manually added the -sharevts command-line argument via the xserver-command setting. My lightdm.conf looked something like this:

    [Seat:0]
    xdg-seat=seat0
    xserver-vt=7

    [Seat:1]
    xdg-seat=seat1
    xserver-vt=7
    xserver-command=/usr/bin/X -sharevts

Later I added revision 1765 [2] to extended the semantics of the xserver-vt option so that 0 means -sharevts. This enabled me to get rid of the xserver-command line from seat 1 and the xserver-vt line from seat 0:

    [Seat:0]
    xdg-seat=seat0

    [Seat:1]
    xdg-seat=seat1
    xserver-vt=0

I used VT 0 for this purpose because Linux does not have a VT 0 [3]. I didn't think about other *nix OSes at the time; supposedly SysV had a VT 0, so other systems might too. So, in hindsight, hijacking VT 0 to mean -sharevts might not be the best idea. (It's also a bit odd from a user perspective as you mention.)

While I agree that the functionality provided by xserver-vt=0 should be provided via some other configuration mechanism (e.g., use-vt=false), I think there is still value in allowing the user to manually override the VT that LightDM would normally choose. But that's not really related to multiseat, so I can take it out of this branch.

[1] https://bazaar.launchpad.net/~a7x/lightdm/multiseat/revision/1764
[2] https://bazaar.launchpad.net/~a7x/lightdm/multiseat/revision/1765
[3] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/vt/vt_ioctl.c#n45

> but instead if LightDM should assign them.
>
> I think it would work better with:
>
> [SeatDefaults]
> use-vt=false
>
> Then seat-xlocal.c and seat-unity.c wouldn't call
> xserver_local_set_vt () if this was false.

Presumably use-vt=false would also:
  * not pass vtXX to X
  * pass -sharevts to X
Right?

I'm tempted to also support use-vt=<integer> in addition to true and false (if easily supported). This would allow the user to force LightDM to use VT <integer> rather than automatically picking one. Thoughts?

The behavior of GDM with systemd, and the recommended configuration I've seen (without any official documentation to back it up), is to do something like this:

  * main seat: /usr/bin/X -seat seat0 vt7
  * other seats: /usr/bin/X -seat seatX -sharevts

I don't fully understand the interaction between the kernel, Plymouth, and X when it comes to virtual terminals, but setting use-vt=false for all seats would not match the above behavior. I'm not sure what would happen if I did do -sharevts without vtXX on all seats.

I expect the right multiseat config would look like this:

    [SeatDefaults]
    use-vt=false

    [Seat:0]
    xdg-seat=seat0
    use-vt=true...

Read more...

Robert Ancell (robert-ancell) wrote :

> Do you have any comments about the prerequisite branches (lp:~a7x/lightdm
> /seatunity-call-parent and lp:~a7x/lightdm/multiseat-logging)?

Sorry, have not reviewed them yet.

> I'm tempted to also support use-vt=<integer> in addition to true and false (if
> easily supported). This would allow the user to force LightDM to use VT
> <integer> rather than automatically picking one. Thoughts?

Yes, this sounds good. But I think we can avoid this (see below)

> I don't fully understand the interaction between the kernel, Plymouth, and X
> when it comes to virtual terminals, but setting use-vt=false for all seats
> would not match the above behavior. I'm not sure what would happen if I did
> do -sharevts without vtXX on all seats.

Firstly, it seems no-one really understands VTs and more than we need to get rid of them as fast as we can :)

OK, I think I understand what the X.org code does now.
- We should always provide a vtXX option to X - if we don't, then X will get a new VT or use the active VT if run with -sharevts. It's safest for us to explicitly tell X rather than it get it wrong (e.g. if you VT switched during creating the second X server).
- You can't have more than one X server on the same VT without using -sharevts. This is because each X server would listen for VT changes and conflict with each other. In the multi-seat case only one of the X servers does this.
- In multi-seat, only seat0 can switch to another console (e.g. a text console). This seat needs to drop the input and output devices when switched away from.
- In multi-seat, seat1-N don't change input or output when a VT switch occurs. So they don't need to monitor VT switching and have -sharevts passed to them.
- If -sharevts is set, X.Org basically does nothing with the VT. This kind of contradicts my first point that we should set the VT because it probably doesn't matter what VT is picked.

In conclusion, I think we might just be able to do this:

[Seat:0]
xdg-seat=seat0

[Seat:1]
xdg-seat=seat1

And for seat0 we run X with:
X vtXX

And for seat1 we run X with:
X -sharevts

We can determine this with:
if (strcmp (xdg_seat, "seat0") == 0)
    x_server_local_set_vt (x_server, vt);
else
    x_server_local_set_sharevts (x_server, TRUE);

Note we should also call seat_set_can_switch(seat, FALSE) for seats that are not "seat0" - since they can't VT switch.

> I should note that unset xdg-seat and xdg-seat=seat0 are not equivalent. xdg-
> seat=seat0 causes '-seat seat0' to be passed to X, but unset xdg-seat does
> not.
>
> From browsing the X source code, passing '-seat seat0' to X appears to be a
> no-op, but:
> * I'm not 100% certain
> * the X man page does not guarantee that '-seat seat0' is a no-op
> * I didn't want to introduce any behavior change from the current
> defaults (which is also why I don't derive the XDG_SEAT name from
> the title of the [Seat:foo] section in lightdm.conf)

I'd say we should be optimistic that X will support the -seat option if xdg-seat is provided. Since the X command line interface is not standard or introspectable lets just assume the best and add an option later if required (e.g. xserver-supports-seat=false).

Robert Ancell (robert-ancell) wrote :

I'm not sure but we may need seat0 to start before seatN since only seat0 will setup the VT. But since seatN doesn't seem to do anything with the VT this may not be the case. (X may even have a bug in this regard since seatN doesn't setup the VT but it does reset it on exit).

Alberts Muktupāvels (muktupavels) wrote :

*) I think it is not good idea to set vt based on seat name. What about if user choose name seats like this - User1Seat, User2Seat?

I have done it for testing. It simply requires extra rules in 99-multiseat.rules file to assign correct devices to first seat.

Otherwise I don't see any need for xdg_seat option as we can generate it automatically from seats name in lightdm.conf.

*) What about adding share_vt=true/false option if we keep option to set name. Or simply add it automatically for all seats other than seat0 as Robert already told.

Alberts Muktupāvels (muktupavels) wrote :

1) xserver-sharevts = True if lightdm should pass '-sharevts' to X server. Default - false.
2) Why xdg-seat no xserver-seat? It is mainly needed for X server. In documentation - "Optionally, use pam_misc_setenv() to set the environment variables XDG_SEAT and XDG_VTNR. The former should contain "seat0", the latter the VT number your session runs on. pam_systemd can determine these values automatically but it's nice to pass these variables anyway."

Richard Hansen (rhansen) wrote :
Download full text (4.5 KiB)

> > I don't fully understand the interaction between the kernel,
> > Plymouth, and X when it comes to virtual terminals, but setting
> > use-vt=false for all seats would not match the above behavior.
> > I'm not sure what would happen if I did do -sharevts without vtXX
> > on all seats.
>
> Firstly, it seems no-one really understands VTs and more than we
> need to get rid of them as fast as we can :)

I can't wait until kmscon [1] is done. :)

[1] http://www.freedesktop.org/wiki/Software/kmscon/

>
> OK, I think I understand what the X.org code does now.
> - We should always provide a vtXX option to X - if we don't, then X
> will get a new VT or use the active VT if run with -sharevts. It's
> safest for us to explicitly tell X rather than it get it wrong
> (e.g. if you VT switched during creating the second X server).

I think we should always provide vtXX unless -sharevts is used, in
which case we should not provide vtXX. (This is the conclusion you
reached below, but I just wanted to be clear.)

> - You can't have more than one X server on the same VT without using
> -sharevts. This is because each X server would listen for VT
> changes and conflict with each other. In the multi-seat case only
> one of the X servers does this.
> - In multi-seat, only seat0 can switch to another console (e.g. a
> text console). This seat needs to drop the input and output
> devices when switched away from.
> - In multi-seat, seat1-N don't change input or output when a VT
> switch occurs. So they don't need to monitor VT switching and
> have -sharevts passed to them.
> - If -sharevts is set, X.Org basically does nothing with the
> VT. This kind of contradicts my first point that we should set the
> VT because it probably doesn't matter what VT is picked.

X mostly does nothing with the VT, but it does get info about the
current VT. Thus, I think:

- VT switching must happen before instances of X -sharevts are
  started.

And another point:
- All instances of X (and Mir and...) must be on the same VT. If not,
  then you can only use one seat at a time (e.g., to use seat0 you hit
  Ctrl-Alt-F7 and to use seat1 you hit Ctrl-Alt-F8).

>
> In conclusion, I think we might just be able to do this:
>
> [Seat:0]
> xdg-seat=seat0
>
> [Seat:1]
> xdg-seat=seat1
>
> And for seat0 we run X with:
> X vtXX
>
> And for seat1 we run X with:
> X -sharevts
>
> We can determine this with:
> if (strcmp (xdg_seat, "seat0") == 0)
> x_server_local_set_vt (x_server, vt);
> else
> x_server_local_set_sharevts (x_server, TRUE);

Here's what I propose:

  * use-vt=auto (default): If seat0 (or XDG seat name is NULL),
    switch to the automatically chosen VT, pass vtXX to X, and do not
    pass -sharevts to X. Otherwise (not seat0), do not switch VTs, do
    not pass vtXX to X, but do pass -sharevts to X.
  * use-vt=true: Switch to the automatically chosen VT, pass vtXX to
    X, and do not pass -sharevts to X.
  * use-vt=false: Do not switch VTs, do not pass vtXX to X, but do
    pass -sharevts to X.
  * use-vt=<integer>: Switch to the specified VT, pass vt<integer> to
    X, and do not pass -sharevts to X.

This gives the default behavior...

Read more...

Richard Hansen (rhansen) wrote :

> I'm not sure but we may need seat0 to start before seatN since only
> seat0 will setup the VT.

I'm concerned about this as well.

If I code up the use-vt=auto|true|false|<integer> scheme that I
proposed, then this gets more complicated: We must start up the seat
that does VT switching (which might not be seat0) before the other
seats.

Maybe I should simplify and just do the behavior of use-vt=auto and
not add a use-vt option. We can add my proposed use-vt behavior later
if it turns out to be required.

> But since seatN doesn't seem to do anything with the VT this may not
> be the case. (X may even have a bug in this regard since seatN
> doesn't setup the VT but it does reset it on exit).

Ah, so that's why it gets the current VT number when -sharevts is
used. Yeah, that doesn't sound right to me.

I just thought of some issues:

What happens if the user specifies more than one seat with VT
switching? Because VT switching is done on seat0, and seat0 is the
default name unless otherwise specified, it is easy to accidentally do
this. For example, the following configs would cause LightDM to want
to do VT switching on multiple seats:

    [Seat:0]

    [Seat:1]

or:

    [Seat:0]
    xdg-seat=seat0

    [Seat:1]

or:

    [Seat:0]

    [Seat:1]
    xdg-seat=seat0

This seems bad, so perhaps it should be an error if multiple seat0
seats are specified. (e.g., ignore the second and subsequent seat0
sections in the config file and log an error message)

Also: What happens if the user does not provide a seat0 seat? For
example:

    [Seat:0]
    xdg-seat=MySeat0

    [Seat:1]
    xdg-seat=MySeat1

Then no VT switching will happen. Perhaps this should be an error
case too, but I'm not sure how to handle it in the most user-friendly
manner. Just exit LightDM?

Richard Hansen (rhansen) wrote :

> *) I think it is not good idea to set vt based on seat name. What
> about if user choose name seats like this - User1Seat, User2Seat?
>
> I have done it for testing. It simply requires extra rules in
> 99-multiseat.rules file to assign correct devices to first seat.

The use-vt=auto|true|false|<integer> proposal would allow a user to do
this, but I don't think it's a big deal to require the user to have a
seat0.

Hmm... What if seat0 is handled by another display manager or
process? E.g., use GDM to handle seat0 but LightDM to handle
seats1-N. I guess we shouldn't require a seat0, but only do VT
switching if there is a seat0 (and heavily warn if there is no seat0
in the config file since there might be a race between LightDM and
whatever is managing seat0).

>
> Otherwise I don't see any need for xdg_seat option as we can
> generate it automatically from seats name in lightdm.conf.

This makes me nervous for the first pass at adding multiseat support
because this would change the behavior of LightDM for existing setups.
I don't want to accidentally break things for users -- I only want the
behavior to change if the user edits the config file.

But it would be more convenient to not have to add an xdg-seat=<name>
line for each seat. Perhaps we can add this later after we've thought
about it more.

>
> *) What about adding share_vt=true/false option if we keep option to
> set name. Or simply add it automatically for all seats other than
> seat0 as Robert already told.

I think the use-vt=auto|true|false|<integer> scheme I proposed would
provide sufficient configurability.

Richard Hansen (rhansen) wrote :

> 1) xserver-sharevts = True if lightdm should pass '-sharevts' to X
> server. Default - false.

If the user is interested in fine-grained control of -sharevts, they
can modify the xserver-command setting to add -sharevts. Otherwise,
use-vt=auto|true|false|<integer> should be sufficient.

> 2) Why xdg-seat no xserver-seat? It is mainly needed for X server.

It's also used by Mir, Wayland/Weston, and potentially other programs.

Laércio de Sousa (lbssousa) wrote :

> I'm not sure but we may need seat0 to start before seatN since only seat0 will
> setup the VT. But since seatN doesn't seem to do anything with the VT this may
> not be the case. (X may even have a bug in this regard since seatN doesn't
> setup the VT but it does reset it on exit).

I think it will be clear when automatic multiseat support arrives. In that scenario, seat0 will be always available (static seat), while the other seats must be started on org.freedesktop.login1.Manager.SeatNew() triggers (on demand/dynamic seats). So it's natural for me that seat0 must start first.

Laércio de Sousa (lbssousa) wrote :

BTW, for automatic multiseat capable DMs, logind provides a X wrapper called "systemd-multi-seat-x". It "exec"s the real X server, passing -sharevts automatically for non-seat0 seats, among other things.

Richard Hansen (rhansen) wrote :

Laércio: I replied to your comments in the automatic multiseat bug report (bug #1190581).

Alberts Muktupāvels (muktupavels) wrote :

Created new branch for xdg-seat config setting based on your branch.

https://code.launchpad.net/~albertsmuktupavels/lightdm/add-xdg-seat-config-setting/+merge/182087

Alberts Muktupāvels (muktupavels) wrote :

Created one more branch based on your work. It is only about setting vt only for seat0. It does NOT add new config option.

https://code.launchpad.net/~albertsmuktupavels/lightdm/set-vt-only-on-seat0/+merge/184738

Robert Ancell (robert-ancell) wrote :

There's been a number of changes since this merge proposal - is any of it still applicable?

Alberts Muktupāvels (muktupavels) wrote :

1) Option to set VT number? I don't see any need for it.
2) Auto add -sharevts for all seats except seat0. But this is not big problem as it can be added in configuration file.

My lightdm.conf:
[SeatDefaults]
user-session=ubuntu
greeter-session=unity-greeter

[Seat:0]
xdg-seat=seat0
xserver-command=/usr/bin/X -core -config xorg-seat0.conf -layout seat0 -s 120

[Seat:1]
xdg-seat=seat1
xserver-command=/usr/bin/X -core -config xorg-seat1.conf -layout seat1 -s 120 -sharevts

Laércio de Sousa (lbssousa) wrote :

This merge proposal has been superseded by another one from Alberts Muktupāvels, which is already merged and released. It's safe to get rid of this one.

review: Disapprove

Unmerged revisions

1766. By Richard Hansen on 2013-08-04

add 'xdg-seat' config setting for naming a seat

If specified, this setting does two things:
  * causes the "-seat <seatname>" arguments to be passed to X
  * overrides the default value of the pam_systemd XDG_SEAT variable
    ("<seatname>" instead of "seat0")

This is required for multiseat setups, as documeted at:
http://www.freedesktop.org/wiki/Software/systemd/writing-display-managers/

1765. By Richard Hansen on 2013-08-04

let 'xserver-vt=0' indicate that the user wants X to share VTs

If the user specifies 'xserver-vt=0' for a seat, then:
  * VT switching will not be performed for the Seat
  * the "vtXX" argument will not be passed to X
  * the "-sharevts" argument will be passed to X
  * XDG_VTNR will be left unset

This is required for multiseat setups.

1764. By Richard Hansen on 2013-08-04

add 'xserver-vt' config setting for forcing a Seat's VT number

This makes it possible to run multiple X servers on the same VT (using
the Xorg -sharevts option), which is required for multiseat setups.

1763. By Richard Hansen on 2013-08-04

new seat_has_property() function

This function will be used to see if the user specified a VT number
for the X seat.

1762. By Richard Hansen on 2013-08-04

log the values of the XDG_SEAT and XDG_VTNR variables

This makes it easier to debug multiseat setups.

1761. By Richard Hansen on 2013-08-04

delay setting Session pid to 0 (for logging)

The Session pid is currently used in Session log messages. Delay
setting it to 0 so that more log messages have a meaningful prefix (to
make it possible to correlate them with other log messages).

1760. By Richard Hansen on 2013-08-04

add session PID to Session (including Greeter) log messages

This makes it easier to debug multiseat setups.

1759. By Richard Hansen on 2013-08-04

have Session implement the Logger interface

This is a step toward logging the session PID in each Session
log message, which will make it easier to debug multiseat setups.

The PID is set to 0 when the Session process terminates, so it is not
possible to follow a Session's complete lifetime in the logs. But
it's better than nothing.

A future commit could easily change this to log some other identifier,
such as the associated Display or Seat name, or the PID before the
process terminated.

1758. By Richard Hansen on 2013-08-04

add display server name to DisplayServer log messages

This makes it easier to debug multiseat setups.

1757. By Richard Hansen on 2013-08-04

have DisplayServer implement the Logger interface

This is a step toward logging the display server name in each
DisplayServer log message, which will make it easier to debug
multiseat setups.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/lightdm.conf'
2--- data/lightdm.conf 2013-07-11 02:20:58 +0000
3+++ data/lightdm.conf 2013-08-05 07:42:31 +0000
4@@ -36,11 +36,22 @@
5 # Seat defaults
6 #
7 # type = Seat type (xlocal, xremote)
8+# xdg-seat=<name>: If specified, XDG_SEAT will be set to <name> (for
9+# pam_systemd) and, for X sessions, '-seat <name>' will be passed
10+# to X. By default, XDG_SEAT is set to 'seat0' and '-seat' is not
11+# passed to X.
12 # xserver-command = X server command to run (can also contain arguments e.g. X -special-option)
13 # xserver-layout = Layout to pass to X server
14 # xserver-config = Config file to pass to X server
15 # xserver-allow-tcp = True if TCP/IP connections are allowed to this X server
16 # xserver-share = True if the X server is shared for both greeter and session
17+# xserver-vt=N: If N is a positive integer, this forces the X
18+# server to start on virtual terminal number N (LightDM will
19+# switch to VT N, 'vtN' will be passed to X, and XDG_VTNR will be
20+# set to N). If N is 0, VT sharing is assumed ('-sharevts' will
21+# be passed to X and XDG_VTNR will not be set). The default value
22+# is the next unused integer greater than or equal to the value of
23+# minimum-vt.
24 # xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true)
25 # xdmcp-port = XDMCP UDP/IP port to communicate on
26 # xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf)
27@@ -69,11 +80,13 @@
28 #
29 [SeatDefaults]
30 #type=xlocal
31+#xdg-seat=
32 #xserver-command=X
33 #xserver-layout=
34 #xserver-config=
35 #xserver-allow-tcp=false
36 #xserver-share=true
37+#xserver-vt=
38 #xdmcp-manager=
39 #xdmcp-port=177
40 #xdmcp-key=
41
42=== modified file 'src/seat-unity.c'
43--- src/seat-unity.c 2013-08-05 07:42:30 +0000
44+++ src/seat-unity.c 2013-08-05 07:42:31 +0000
45@@ -392,6 +392,7 @@
46 {
47 XServerLocal *x_server;
48 const gchar *command = NULL, *layout = NULL, *config_file = NULL, *xdmcp_manager = NULL, *key_name = NULL;
49+ const gchar *xseat;
50 gboolean allow_tcp;
51 gint port = 0;
52
53@@ -404,7 +405,12 @@
54 x_server_local_set_command (x_server, command);
55
56 if (SEAT_UNITY (seat)->priv->use_vt_switching)
57- x_server_local_set_vt (x_server, vt_get_unused ());
58+ {
59+ gint vt = vt_get_unused ();
60+ if (seat_has_property (seat, "xserver-vt"))
61+ vt = seat_get_integer_property (seat, "xserver-vt");
62+ x_server_local_set_vt (x_server, vt);
63+ }
64 else
65 {
66 gchar *id;
67@@ -420,6 +426,10 @@
68 if (layout)
69 x_server_local_set_layout (x_server, layout);
70
71+ xseat = seat_get_string_property (seat, "xdg-seat");
72+ if (xseat)
73+ x_server_local_set_seat (x_server, xseat);
74+
75 config_file = seat_get_string_property (seat, "xserver-config");
76 if (config_file)
77 x_server_local_set_config (x_server, config_file);
78@@ -521,7 +531,9 @@
79
80 greeter_session =
81 SEAT_CLASS (seat_unity_parent_class)->create_greeter_session (seat);
82- xdg_seat = "seat0";
83+ xdg_seat = seat_get_string_property (seat, "xdg-seat");
84+ if (!xdg_seat)
85+ xdg_seat = "seat0";
86 l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
87 session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
88 if (!SEAT_UNITY (seat)->priv->use_vt_switching)
89@@ -544,7 +556,9 @@
90 const gchar *xdg_seat;
91
92 session = SEAT_CLASS (seat_unity_parent_class)->create_session (seat);
93- xdg_seat = "seat0";
94+ xdg_seat = seat_get_string_property (seat, "xdg-seat");
95+ if (!xdg_seat)
96+ xdg_seat = "seat0";
97 l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
98 session_set_env (session, "XDG_SEAT", xdg_seat);
99 if (!SEAT_UNITY (seat)->priv->use_vt_switching)
100@@ -569,7 +583,7 @@
101 if (SEAT_UNITY (seat)->priv->use_vt_switching)
102 {
103 gint vt = display_server_get_vt (session_get_display_server (session));
104- if (vt >= 0)
105+ if (vt > 0)
106 vt_set_active (vt);
107
108 SEAT_CLASS (seat_unity_parent_class)->set_active_session (seat, session);
109
110=== modified file 'src/seat-xlocal.c'
111--- src/seat-xlocal.c 2013-08-05 07:42:30 +0000
112+++ src/seat-xlocal.c 2013-08-05 07:42:31 +0000
113@@ -65,9 +65,13 @@
114
115 XServerLocal *x_server;
116 const gchar *command = NULL, *layout = NULL, *config_file = NULL, *xdmcp_manager = NULL, *key_name = NULL;
117+ const gchar *xseat;
118 gboolean allow_tcp;
119 gint vt = -1, port = 0;
120
121+ if (seat_has_property (seat, "xserver-vt"))
122+ vt = seat_get_integer_property (seat, "xserver-vt");
123+
124 if (vt > 0)
125 l_debug (seat, "Starting local X display on VT %d", vt);
126 else
127@@ -87,7 +91,7 @@
128 if (plymouth_get_is_active () && plymouth_has_active_vt ())
129 {
130 gint active_vt = vt_get_active ();
131- if (active_vt >= vt_get_min ())
132+ if (((vt < 0) && (active_vt >= vt_get_min ())) || (vt == active_vt))
133 {
134 vt = active_vt;
135 g_signal_connect (x_server, "ready", G_CALLBACK (x_server_ready_cb), seat);
136@@ -111,6 +115,10 @@
137 if (layout)
138 x_server_local_set_layout (x_server, layout);
139
140+ xseat = seat_get_string_property (seat, "xdg-seat");
141+ if (xseat)
142+ x_server_local_set_seat (x_server, xseat);
143+
144 config_file = seat_get_string_property (seat, "xserver-config");
145 if (config_file)
146 x_server_local_set_config (x_server, config_file);
147@@ -172,7 +180,9 @@
148 const gchar *xdg_seat;
149
150 greeter_session = SEAT_CLASS (seat_xlocal_parent_class)->create_greeter_session (seat);
151- xdg_seat = "seat0";
152+ xdg_seat = seat_get_string_property (seat, "xdg-seat");
153+ if (!xdg_seat)
154+ xdg_seat = "seat0";
155 l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
156 session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
157
158@@ -186,7 +196,9 @@
159 const gchar *xdg_seat;
160
161 session = SEAT_CLASS (seat_xlocal_parent_class)->create_session (seat);
162- xdg_seat = "seat0";
163+ xdg_seat = seat_get_string_property (seat, "xdg-seat");
164+ if (!xdg_seat)
165+ xdg_seat = "seat0";
166 l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
167 session_set_env (SESSION (session), "XDG_SEAT", xdg_seat);
168
169@@ -197,7 +209,7 @@
170 seat_xlocal_set_active_session (Seat *seat, Session *session)
171 {
172 gint vt = display_server_get_vt (session_get_display_server (session));
173- if (vt >= 0)
174+ if (vt > 0)
175 vt_set_active (vt);
176
177 SEAT_CLASS (seat_xlocal_parent_class)->set_active_session (seat, session);
178
179=== modified file 'src/seat-xremote.c'
180--- src/seat-xremote.c 2013-08-05 07:42:30 +0000
181+++ src/seat-xremote.c 2013-08-05 07:42:31 +0000
182@@ -58,7 +58,9 @@
183 const gchar *xdg_seat;
184
185 greeter_session = SEAT_CLASS (seat_xremote_parent_class)->create_greeter_session (seat);
186- xdg_seat = "seat0";
187+ xdg_seat = seat_get_string_property (seat, "xdg-seat");
188+ if (!xdg_seat)
189+ xdg_seat = "seat0";
190 l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
191 session_set_env (SESSION (greeter_session), "XDG_SEAT", xdg_seat);
192
193@@ -72,7 +74,9 @@
194 const gchar *xdg_seat;
195
196 session = SEAT_CLASS (seat_xremote_parent_class)->create_session (seat);
197- xdg_seat = "seat0";
198+ xdg_seat = seat_get_string_property (seat, "xdg-seat");
199+ if (!xdg_seat)
200+ xdg_seat = "seat0";
201 l_debug (seat, "Setting XDG_SEAT=%s", xdg_seat);
202 session_set_env (SESSION (session), "XDG_SEAT", xdg_seat);
203
204
205=== modified file 'src/seat.c'
206--- src/seat.c 2013-08-05 07:42:30 +0000
207+++ src/seat.c 2013-08-05 07:42:31 +0000
208@@ -115,6 +115,13 @@
209 return seat;
210 }
211
212+gboolean
213+seat_has_property (Seat *seat, const gchar *name)
214+{
215+ g_return_val_if_fail (seat != NULL, FALSE);
216+ return g_hash_table_lookup (seat->priv->properties, name) != NULL;
217+}
218+
219 void
220 seat_set_property (Seat *seat, const gchar *name, const gchar *value)
221 {
222
223=== modified file 'src/seat.h'
224--- src/seat.h 2013-08-05 07:42:30 +0000
225+++ src/seat.h 2013-08-05 07:42:31 +0000
226@@ -62,6 +62,8 @@
227
228 Seat *seat_new (const gchar *module_name);
229
230+gboolean seat_has_property (Seat *seat, const gchar *name);
231+
232 void seat_set_property (Seat *seat, const gchar *name, const gchar *value);
233
234 const gchar *seat_get_string_property (Seat *seat, const gchar *name);
235
236=== modified file 'src/x-server-local.c'
237--- src/x-server-local.c 2013-08-05 07:42:30 +0000
238+++ src/x-server-local.c 2013-08-05 07:42:31 +0000
239@@ -40,6 +40,9 @@
240 /* Server layout to use */
241 gchar *layout;
242
243+ /* Value for -seat argument */
244+ gchar *xseat;
245+
246 /* TRUE if TCP/IP connections are allowed */
247 gboolean allow_tcp;
248
249@@ -205,6 +208,14 @@
250 }
251
252 void
253+x_server_local_set_seat (XServerLocal *server, const gchar *xseat)
254+{
255+ g_return_if_fail (server != NULL);
256+ g_free (server->priv->xseat);
257+ server->priv->xseat = g_strdup (xseat);
258+}
259+
260+void
261 x_server_local_set_allow_tcp (XServerLocal *server, gboolean allow_tcp)
262 {
263 g_return_if_fail (server != NULL);
264@@ -474,6 +485,9 @@
265 if (server->priv->layout)
266 g_string_append_printf (command, " -layout %s", server->priv->layout);
267
268+ if (server->priv->xseat)
269+ g_string_append_printf (command, " -seat %s", server->priv->xseat);
270+
271 write_authority_file (server);
272 if (server->priv->authority_file)
273 g_string_append_printf (command, " -auth %s", server->priv->authority_file);
274@@ -498,7 +512,13 @@
275 g_string_append (command, " -nolisten tcp");
276
277 if (server->priv->vt >= 0)
278- g_string_append_printf (command, " vt%d -novtswitch", server->priv->vt);
279+ {
280+ if (server->priv->vt > 0)
281+ g_string_append_printf (command, " vt%d", server->priv->vt);
282+ else
283+ g_string_append_printf (command, " -sharevts");
284+ g_string_append_printf (command, " -novtswitch");
285+ }
286
287 if (server->priv->background)
288 g_string_append_printf (command, " -background %s", server->priv->background);
289
290=== modified file 'src/x-server-local.h'
291--- src/x-server-local.h 2013-07-24 11:22:04 +0000
292+++ src/x-server-local.h 2013-08-05 07:42:31 +0000
293@@ -51,6 +51,8 @@
294
295 void x_server_local_set_layout (XServerLocal *server, const gchar *layout);
296
297+void x_server_local_set_seat (XServerLocal *server, const gchar *xseat);
298+
299 void x_server_local_set_allow_tcp (XServerLocal *server, gboolean allow_tcp);
300
301 void x_server_local_set_xdmcp_server (XServerLocal *server, const gchar *hostname);

Subscribers

People subscribed via source and target branches