Back to index

lightdm  1.3.2
Classes | Functions
xserver.c File Reference
#include <config.h>
#include <string.h>
#include <xcb/xcb.h>
#include "xserver.h"
#include "xsession.h"

Go to the source code of this file.

Classes

struct  XServerPrivate

Functions

 G_DEFINE_TYPE (XServer, xserver, DISPLAY_SERVER_TYPE)
void xserver_set_hostname (XServer *server, const gchar *hostname)
gchar * xserver_get_hostname (XServer *server)
void xserver_set_display_number (XServer *server, guint number)
guint xserver_get_display_number (XServer *server)
const gchar * xserver_get_address (XServer *server)
void xserver_set_authority (XServer *server, XAuthority *authority)
XAuthorityxserver_get_authority (XServer *server)
static gboolean xserver_start (DisplayServer *display_server)
static void xserver_init (XServer *server)
static void xserver_finalize (GObject *object)
static void xserver_class_init (XServerClass *klass)

Class Documentation

struct XServerPrivate

Definition at line 19 of file xserver.c.

Collaboration diagram for XServerPrivate:
Class Members
gchar * address
GHashTable * atoms
XAuthority * authority
guint8 bitmap_format_bit_order
GHashTable * clients
xcb_connection_t * connection
gint display_number
gchar * hostname
guint8 image_byte_order
gboolean listen_tcp
gboolean listen_unix
guint8 max_keycode
guint8 min_keycode
guint32 motion_buffer_size
gint next_atom_index
guint number
GList * pixmap_formats
GList * screens
gchar * socket_path
GIOChannel * tcp_channel
gint tcp_port
GSocket * tcp_socket
GIOChannel * unix_channel
GSocket * unix_socket
gchar * vendor

Function Documentation

static void xserver_class_init ( XServerClass klass) [static]

Definition at line 159 of file xserver.c.

{
    GObjectClass *object_class = G_OBJECT_CLASS (klass);
    DisplayServerClass *display_server_class = DISPLAY_SERVER_CLASS (klass);

    display_server_class->start = xserver_start;
    object_class->finalize = xserver_finalize;

    g_type_class_add_private (klass, sizeof (XServerPrivate));
}

Here is the call graph for this function:

static void xserver_finalize ( GObject *  object) [static]

Definition at line 142 of file xserver.c.

{
    XServer *self;

    self = XSERVER (object);

    g_free (self->priv->hostname);
    g_free (self->priv->address);
    if (self->priv->authority)
        g_object_unref (self->priv->authority);
    if (self->priv->connection)
        xcb_disconnect (self->priv->connection);

    G_OBJECT_CLASS (xserver_parent_class)->finalize (object);
}

Here is the caller graph for this function:

const gchar* xserver_get_address ( XServer server)

Definition at line 73 of file xserver.c.

{
    g_return_val_if_fail (server != NULL, NULL);

    if (!server->priv->address)
    {
        if (server->priv->hostname)
            server->priv->address = g_strdup_printf("%s:%d", server->priv->hostname, server->priv->number);
        else
            server->priv->address = g_strdup_printf(":%d", server->priv->number);
    }  

    return server->priv->address;
}

Here is the caller graph for this function:

Definition at line 102 of file xserver.c.

{
    g_return_val_if_fail (server != NULL, NULL);
    return server->priv->authority;
}

Here is the caller graph for this function:

guint xserver_get_display_number ( XServer server)

Definition at line 66 of file xserver.c.

{
    g_return_val_if_fail (server != NULL, 0);
    return server->priv->number;
}

Here is the caller graph for this function:

gchar* xserver_get_hostname ( XServer server)

Definition at line 50 of file xserver.c.

{
    g_return_val_if_fail (server != NULL, NULL);
    return server->priv->hostname;
}

Here is the caller graph for this function:

static void xserver_init ( XServer server) [static]

Definition at line 136 of file xserver.c.

{
    server->priv = G_TYPE_INSTANCE_GET_PRIVATE (server, XSERVER_TYPE, XServerPrivate);
}
void xserver_set_authority ( XServer server,
XAuthority authority 
)

Definition at line 89 of file xserver.c.

{
    g_return_if_fail (server != NULL);

    if (server->priv->authority)
        g_object_unref (server->priv->authority);
    if (authority)
        server->priv->authority = g_object_ref (authority);
    else
        server->priv->authority = NULL;
}

Here is the caller graph for this function:

void xserver_set_display_number ( XServer server,
guint  number 
)

Definition at line 57 of file xserver.c.

{
    g_return_if_fail (server != NULL);
    server->priv->number = number;
    g_free (server->priv->address);
    server->priv->address = NULL;
}

Here is the caller graph for this function:

void xserver_set_hostname ( XServer server,
const gchar *  hostname 
)

Definition at line 40 of file xserver.c.

{
    g_return_if_fail (server != NULL);
    g_free (server->priv->hostname);
    server->priv->hostname = g_strdup (hostname);
    g_free (server->priv->address);
    server->priv->address = NULL;
}

Here is the caller graph for this function:

static gboolean xserver_start ( DisplayServer display_server) [static]

Definition at line 109 of file xserver.c.

{
    XServer *server = XSERVER (display_server);
    xcb_auth_info_t *auth = NULL, a;

    if (server->priv->authority)
    {
        a.namelen = strlen (xauth_get_authorization_name (server->priv->authority));
        a.name = (char *) xauth_get_authorization_name (server->priv->authority);
        a.datalen = xauth_get_authorization_data_length (server->priv->authority);
        a.data = (char *) xauth_get_authorization_data (server->priv->authority);
        auth = &a;
    }

    /* Open connection */  
    g_debug ("Connecting to XServer %s", xserver_get_address (server));
    server->priv->connection = xcb_connect_to_display_with_auth_info (xserver_get_address (server), auth, NULL);
    if (xcb_connection_has_error (server->priv->connection))
    {
        g_debug ("Error connecting to XServer %s", xserver_get_address (server));
        return FALSE;
    }

    return DISPLAY_SERVER_CLASS (xserver_parent_class)->start (display_server);
}

Here is the call graph for this function:

Here is the caller graph for this function: