Revision 10989,
4.2 KB
checked in by iwaim, 7 years ago
(diff) |
xorg-x11-xinit: add flies
|
-
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 -*- |
1 | 2 | /* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */ |
2 | 3 | /* $XdotOrg: $ */ |
3 | 4 | |
… |
… |
in this Software without prior written a |
39 | 40 | #include <ctype.h> |
40 | 41 | #include <stdint.h> |
41 | 42 | |
| 43 | #define USE_CONKIT |
| 44 | #ifdef USE_CONKIT |
| 45 | #include <ck-connector.h> |
| 46 | #include <X11/Xatom.h> |
| 47 | static CkConnector *ckc = NULL; |
| 48 | #endif /* USE_CONKIT */ |
| 49 | |
42 | 50 | #ifdef X_POSIX_C_SOURCE |
43 | 51 | #define _POSIX_C_SOURCE X_POSIX_C_SOURCE |
44 | 52 | #include <signal.h> |
… |
… |
processTimeout(int timeout, char *string |
521 | 529 | return( serverpid != pidfound ); |
522 | 530 | } |
523 | 531 | |
| 532 | |
| 533 | #ifdef USE_CONKIT |
| 534 | static void |
| 535 | register_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; |
| 560 | out: |
| 561 | ; |
| 562 | } |
| 563 | #endif /* USE_CONKIT */ |
| 564 | |
524 | 565 | static int |
525 | 566 | startServer(char *server[]) |
526 | 567 | { |
… |
… |
startServer(char *server[]) |
631 | 672 | break; |
632 | 673 | } |
633 | 674 | |
| 675 | #ifdef USE_CONKIT |
| 676 | if (serverpid != -1 ) { |
| 677 | register_new_session_with_console_kit (); |
| 678 | } |
| 679 | #endif /* USE_CONKIT */ |
| 680 | |
634 | 681 | return(serverpid); |
635 | 682 | } |
636 | 683 | |
… |
… |
shutdown(void) |
785 | 832 | clientpid); |
786 | 833 | } |
787 | 834 | |
| 835 | #ifdef USE_CONKIT |
| 836 | if (ckc != NULL) { |
| 837 | ck_connector_unref (ckc); |
| 838 | ckc = NULL; |
| 839 | } |
| 840 | #endif |
| 841 | |
788 | 842 | if (serverpid < 0) |
789 | 843 | return; |
790 | 844 | errno = 0; |
… |
… |
shutdown(void) |
821 | 875 | * make a new copy of environment that has room for DISPLAY |
822 | 876 | */ |
823 | 877 | |
| 878 | |
| 879 | #ifdef USE_CONKIT |
| 880 | #define NUM_EXTRA_ENV_VARS 3 |
| 881 | #else |
| 882 | #define NUM_EXTRA_ENV_VARS 2 |
| 883 | #endif |
| 884 | |
824 | 885 | static void |
825 | 886 | set_environment(void) |
826 | 887 | { |
… |
… |
set_environment(void) |
832 | 893 | for (oldPtr = environ; *oldPtr; oldPtr++) ; |
833 | 894 | |
834 | 895 | nenvvars = (oldPtr - environ); |
835 | | newenviron = (char **) malloc ((nenvvars + 3) * sizeof(char **)); |
| 896 | newenviron = (char **) malloc ((nenvvars + NUM_EXTRA_ENV_VARS) * sizeof(char **)); |
836 | 897 | if (!newenviron) { |
837 | 898 | fprintf (stderr, |
838 | 899 | "%s: unable to allocate %d pointers for environment\n", |
839 | | program, nenvvars + 3); |
| 900 | program, nenvvars + NUM_EXTRA_ENV_VARS); |
840 | 901 | exit (1); |
841 | 902 | } |
842 | 903 | |
… |
… |
set_environment(void) |
846 | 907 | newPtr = newenviron; |
847 | 908 | *newPtr++ = displaybuf; |
848 | 909 | |
| 910 | #ifdef USE_CONKIT |
| 911 | *newPtr++ = "XDG_SESSION_COOKIE="; |
| 912 | #endif |
| 913 | |
849 | 914 | /* copy pointers to other variables */ |
850 | 915 | for (oldPtr = environ; *oldPtr; oldPtr++) { |
851 | 916 | 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 | { |
853 | 923 | *newPtr++ = *oldPtr; |
854 | 924 | } |
855 | 925 | } |
-
diff -up xinit-1.0.7/configure.ac.poke-ck xinit-1.0.7/configure.ac
old
|
new
|
AC_ARG_WITH(xinit, |
92 | 92 | [XINIT="$DEFAULT_XINIT"]) |
93 | 93 | |
94 | 94 | # Checks for pkg-config packages |
95 | | PKG_CHECK_MODULES(XINIT, x11) |
| 95 | PKG_CHECK_MODULES(XINIT, x11 ck-connector) |
96 | 96 | |
97 | 97 | case $host_os in |
98 | 98 | *bsd*) |
-
diff -up xinit-1.0.7/startx.cpp.poke-ck xinit-1.0.7/startx.cpp
old
|
new
|
EOF |
223 | 223 | fi |
224 | 224 | done |
225 | 225 | |
| 226 | if [ x"$display" != x ]; then |
| 227 | export DISPLAY=$display |
| 228 | else |
| 229 | export DISPLAY=:0 |
| 230 | fi |
| 231 | |
226 | 232 | #if defined(__SCO__) || defined(__UNIXWARE__) |
227 | 233 | if [ "$REMOTE_SERVER" = "TRUE" ]; then |
228 | 234 | exec SHELL_CMD ${client} |
Note: See
TracBrowser
for help on using the repository browser.