source: projects/specs/trunk/x/xorg-x11-xinit/xinit-1.0.7-poke-ck.patch @ 10989

Revision 10989, 4.2 KB checked in by iwaim, 7 years ago (diff)

xorg-x11-xinit: add flies

  • xinit-1.0.7/xinit.c

    diff -up xinit-1.0.7/xinit.c.poke-ck xinit-1.0.7/xinit.c
    old new  
     1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- 
    12/* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */ 
    23/* $XdotOrg: $ */ 
    34 
    in this Software without prior written a 
    3940#include <ctype.h> 
    4041#include <stdint.h> 
    4142 
     43#define USE_CONKIT 
     44#ifdef USE_CONKIT 
     45#include <ck-connector.h> 
     46#include <X11/Xatom.h> 
     47static CkConnector *ckc = NULL; 
     48#endif /* USE_CONKIT */ 
     49 
    4250#ifdef X_POSIX_C_SOURCE 
    4351#define _POSIX_C_SOURCE X_POSIX_C_SOURCE 
    4452#include <signal.h> 
    processTimeout(int timeout, char *string 
    521529        return( serverpid != pidfound ); 
    522530} 
    523531 
     532 
     533#ifdef USE_CONKIT 
     534static void 
     535register_new_session_with_console_kit (void) 
     536{ 
     537        static char conkitbuf[256]; 
     538        DBusError   error; 
     539 
     540        ckc = ck_connector_new (); 
     541        if (ckc == NULL) { 
     542                Error ("Cannot register with ConsoleKit: OOM creating CkConnector\n"); 
     543                goto out; 
     544        } 
     545 
     546        dbus_error_init (&error); 
     547        if (!ck_connector_open_session (ckc, &error)) { 
     548                Error ("Cannot register with ConsoleKit: %s: %s\n", error.name, error.message); 
     549                goto out; 
     550        } 
     551 
     552        /* If we managed to register with ConsoleKit, put the 
     553         * environment variable XDG_SESSION_COOKIE=cookie as second 
     554         * element in newenviron. See set_environment() where we 
     555         * earlier have made sure there is room... 
     556         */ 
     557        conkitbuf[sizeof (conkitbuf) - 1] = '\0'; 
     558        snprintf (conkitbuf, sizeof (conkitbuf) - 1, "XDG_SESSION_COOKIE=%s", ck_connector_get_cookie (ckc)); 
     559        newenviron[1] = conkitbuf; 
     560out: 
     561        ; 
     562} 
     563#endif /* USE_CONKIT */ 
     564 
    524565static int 
    525566startServer(char *server[]) 
    526567{ 
    startServer(char *server[]) 
    631672                break; 
    632673        } 
    633674 
     675#ifdef USE_CONKIT 
     676        if (serverpid != -1 ) { 
     677                register_new_session_with_console_kit (); 
     678        } 
     679#endif /* USE_CONKIT */ 
     680 
    634681        return(serverpid); 
    635682} 
    636683 
    shutdown(void) 
    785832                                clientpid); 
    786833        } 
    787834 
     835#ifdef USE_CONKIT 
     836        if (ckc != NULL) { 
     837                ck_connector_unref (ckc); 
     838                ckc = NULL; 
     839        } 
     840#endif 
     841 
    788842        if (serverpid < 0) 
    789843                return; 
    790844        errno = 0; 
    shutdown(void) 
    821875 * make a new copy of environment that has room for DISPLAY 
    822876 */ 
    823877 
     878 
     879#ifdef USE_CONKIT 
     880#define NUM_EXTRA_ENV_VARS 3 
     881#else 
     882#define NUM_EXTRA_ENV_VARS 2 
     883#endif 
     884 
    824885static void  
    825886set_environment(void) 
    826887{ 
    set_environment(void) 
    832893    for (oldPtr = environ; *oldPtr; oldPtr++) ; 
    833894 
    834895    nenvvars = (oldPtr - environ); 
    835     newenviron = (char **) malloc ((nenvvars + 3) * sizeof(char **)); 
     896    newenviron = (char **) malloc ((nenvvars + NUM_EXTRA_ENV_VARS) * sizeof(char **)); 
    836897    if (!newenviron) { 
    837898        fprintf (stderr, 
    838899                 "%s:  unable to allocate %d pointers for environment\n", 
    839                  program, nenvvars + 3); 
     900                 program, nenvvars + NUM_EXTRA_ENV_VARS); 
    840901        exit (1); 
    841902    } 
    842903 
    set_environment(void) 
    846907    newPtr = newenviron; 
    847908    *newPtr++ = displaybuf; 
    848909 
     910#ifdef USE_CONKIT 
     911    *newPtr++ = "XDG_SESSION_COOKIE="; 
     912#endif 
     913 
    849914    /* copy pointers to other variables */ 
    850915    for (oldPtr = environ; *oldPtr; oldPtr++) { 
    851916        if (strncmp (*oldPtr, "DISPLAY=", 8) != 0 
    852          && strncmp (*oldPtr, "WINDOWPATH=", 11) != 0) { 
     917         && strncmp (*oldPtr, "WINDOWPATH=", 11) != 0 
     918#ifdef USE_CONKIT 
     919         && strncmp (*oldPtr, "XDG_SESSION_COOKIE=", 19) != 0 
     920#endif 
     921         ) 
     922        { 
    853923            *newPtr++ = *oldPtr; 
    854924        } 
    855925    } 
  • xinit-1.0.7/configure.ac

    diff -up xinit-1.0.7/configure.ac.poke-ck xinit-1.0.7/configure.ac
    old new AC_ARG_WITH(xinit, 
    9292        [XINIT="$DEFAULT_XINIT"]) 
    9393 
    9494# Checks for pkg-config packages 
    95 PKG_CHECK_MODULES(XINIT, x11) 
     95PKG_CHECK_MODULES(XINIT, x11 ck-connector) 
    9696 
    9797case $host_os in 
    9898    *bsd*) 
  • xinit-1.0.7/startx.cpp

    diff -up xinit-1.0.7/startx.cpp.poke-ck xinit-1.0.7/startx.cpp
    old new EOF 
    223223    fi 
    224224done 
    225225 
     226if [ x"$display" != x ]; then 
     227    export DISPLAY=$display 
     228else 
     229    export DISPLAY=:0 
     230fi 
     231 
    226232#if defined(__SCO__) || defined(__UNIXWARE__) 
    227233if [ "$REMOTE_SERVER" = "TRUE" ]; then 
    228234        exec SHELL_CMD ${client} 
Note: See TracBrowser for help on using the repository browser.