Back to index

lightdm  1.3.2
Functions
seat-xlocal.c File Reference
#include <string.h>
#include "seat-xlocal.h"
#include "configuration.h"
#include "xserver-local.h"
#include "xsession.h"
#include "vt.h"

Go to the source code of this file.

Functions

 G_DEFINE_TYPE (SeatXLocal, seat_xlocal, SEAT_TYPE)
static void seat_xlocal_setup (Seat *seat)
static DisplayServerseat_xlocal_create_display_server (Seat *seat)
static Sessionseat_xlocal_create_session (Seat *seat, Display *display)
static void seat_xlocal_set_active_display (Seat *seat, Display *display)
static void seat_xlocal_run_script (Seat *seat, Display *display, Process *script)
static void seat_xlocal_display_removed (Seat *seat, Display *display)
static void seat_xlocal_init (SeatXLocal *seat)
static void seat_xlocal_class_init (SeatXLocalClass *klass)

Function Documentation

G_DEFINE_TYPE ( SeatXLocal  ,
seat_xlocal  ,
SEAT_TYPE   
)
static void seat_xlocal_class_init ( SeatXLocalClass klass) [static]

Definition at line 177 of file seat-xlocal.c.

Here is the call graph for this function:

Definition at line 30 of file seat-xlocal.c.

{
    XServerLocal *xserver;
    const gchar *command = NULL, *layout = NULL, *config_file = NULL, *xdmcp_manager = NULL, *key_name = NULL;
    gboolean allow_tcp;
    gint port = 0;

    g_debug ("Starting local X display");
  
    xserver = xserver_local_new ();

    /* If running inside an X server use Xephyr instead */
    if (g_getenv ("DISPLAY"))
        command = "Xephyr";
    if (!command)
        command = seat_get_string_property (seat, "xserver-command");
    if (command)
        xserver_local_set_command (xserver, command);

    layout = seat_get_string_property (seat, "xserver-layout");
    if (layout)
        xserver_local_set_layout (xserver, layout);

    config_file = seat_get_string_property (seat, "xserver-config");
    if (config_file)
        xserver_local_set_config (xserver, config_file);
  
    allow_tcp = seat_get_boolean_property (seat, "xserver-allow-tcp");
    xserver_local_set_allow_tcp (xserver, allow_tcp);    

    xdmcp_manager = seat_get_string_property (seat, "xdmcp-manager");
    if (xdmcp_manager)
        xserver_local_set_xdmcp_server (xserver, xdmcp_manager);

    port = seat_get_integer_property (seat, "xdmcp-port");
    if (port > 0)
        xserver_local_set_xdmcp_port (xserver, port);

    key_name = seat_get_string_property (seat, "xdmcp-key");
    if (key_name)
    {
        gchar *dir, *path;
        GKeyFile *keys;
        gboolean result;
        GError *error = NULL;

        dir = config_get_string (config_get_instance (), "LightDM", "config-directory");
        path = g_build_filename (dir, "keys.conf", NULL);
        g_free (dir);

        keys = g_key_file_new ();
        result = g_key_file_load_from_file (keys, path, G_KEY_FILE_NONE, &error);
        if (error)
            g_debug ("Error getting key %s", error->message);
        g_clear_error (&error);      

        if (result)
        {
            gchar *key = NULL;

            if (g_key_file_has_key (keys, "keyring", key_name, NULL))
                key = g_key_file_get_string (keys, "keyring", key_name, NULL);
            else
                g_debug ("Key %s not defined", key_name);

            if (key)
                xserver_local_set_xdmcp_key (xserver, key);
            g_free (key);
        }

        g_free (path);
        g_key_file_free (keys);
    }

    return DISPLAY_SERVER (xserver);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static Session* seat_xlocal_create_session ( Seat seat,
Display display 
) [static]

Definition at line 108 of file seat-xlocal.c.

{
    XServerLocal *xserver;
    XSession *session;
    gchar *tty;

    xserver = XSERVER_LOCAL (display_get_display_server (display));

    session = xsession_new (XSERVER (xserver));
    tty = g_strdup_printf ("/dev/tty%d", xserver_local_get_vt (xserver));
    session_set_tty (SESSION (session), tty);
    g_free (tty);

    return SESSION (session);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void seat_xlocal_display_removed ( Seat seat,
Display display 
) [static]

Definition at line 150 of file seat-xlocal.c.

{
    if (seat_get_is_stopping (seat))
        return;

    /* If this is the only display and it failed to start then stop this seat */
    if (g_list_length (seat_get_displays (seat)) == 0 && !display_get_is_ready (display))
    {
        g_debug ("Stopping X local seat, failed to start a display");
        seat_stop (seat);
        return;
    }

    /* Show a new greeter */  
    if (display == seat_get_active_display (seat))
    {
        g_debug ("Active display stopped, switching to greeter");
        seat_switch_to_greeter (seat);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void seat_xlocal_init ( SeatXLocal seat) [static]

Definition at line 172 of file seat-xlocal.c.

{
}
static void seat_xlocal_run_script ( Seat seat,
Display display,
Process script 
) [static]

Definition at line 135 of file seat-xlocal.c.

{
    gchar *path;
    XServerLocal *xserver;

    xserver = XSERVER_LOCAL (display_get_display_server (display));
    path = xserver_local_get_authority_file_path (xserver);
    process_set_env (script, "DISPLAY", xserver_get_address (XSERVER (xserver)));
    process_set_env (script, "XAUTHORITY", path);
    g_free (path);

    SEAT_CLASS (seat_xlocal_parent_class)->run_script (seat, display, script);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void seat_xlocal_set_active_display ( Seat seat,
Display display 
) [static]

Definition at line 125 of file seat-xlocal.c.

{
    gint number = xserver_local_get_vt (XSERVER_LOCAL (XSERVER (display_get_display_server (display))));
    if (number >= 0)
        vt_set_active (number);

    SEAT_CLASS (seat_xlocal_parent_class)->set_active_display (seat, display);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void seat_xlocal_setup ( Seat seat) [static]

Definition at line 23 of file seat-xlocal.c.

{
    seat_set_can_switch (seat, TRUE);
    SEAT_CLASS (seat_xlocal_parent_class)->setup (seat);
}

Here is the call graph for this function:

Here is the caller graph for this function: