24 |
#ifdef HAVE_X_SM |
#ifdef HAVE_X_SM |
25 |
|
|
26 |
#include <X11/SM/SMlib.h> |
#include <X11/SM/SMlib.h> |
27 |
|
#include <X11/Xlib.h> |
28 |
|
#include <X11/Xutil.h> |
29 |
|
|
30 |
#ifdef HAVE_STRING_H |
#ifdef HAVE_STRING_H |
31 |
#include <string.h> |
#include <string.h> |
32 |
#else |
#else |
50 |
#include "lisp.h" |
#include "lisp.h" |
51 |
#include "termhooks.h" |
#include "termhooks.h" |
52 |
#include "termopts.h" |
#include "termopts.h" |
53 |
|
#include "xterm.h" |
54 |
|
|
55 |
#ifndef MAXPATHLEN |
#ifndef MAXPATHLEN |
56 |
#define MAXPATHLEN 1024 |
#define MAXPATHLEN 1024 |
407 |
#endif /* ! defined (SIGIO) */ |
#endif /* ! defined (SIGIO) */ |
408 |
} |
} |
409 |
|
|
410 |
|
/* Create the client leader window. */ |
411 |
|
static void |
412 |
|
create_client_leader_window (dpyinfo, client_id) |
413 |
|
struct x_display_info *dpyinfo; |
414 |
|
char *client_id; |
415 |
|
{ |
416 |
|
Window w; |
417 |
|
XClassHint class_hints; |
418 |
|
Atom sm_id; |
419 |
|
|
420 |
|
w = XCreateSimpleWindow (dpyinfo->display, |
421 |
|
dpyinfo->root_window, |
422 |
|
-1, -1, 1, 1, |
423 |
|
CopyFromParent, CopyFromParent, CopyFromParent); |
424 |
|
|
425 |
|
class_hints.res_name = (char *) SDATA (Vx_resource_name); |
426 |
|
class_hints.res_class = (char *) SDATA (Vx_resource_class); |
427 |
|
XSetClassHint (dpyinfo->display, w, &class_hints); |
428 |
|
XStoreName (dpyinfo->display, w, class_hints.res_name); |
429 |
|
|
430 |
|
sm_id = XInternAtom (dpyinfo->display, "SM_CLIENT_ID", False); |
431 |
|
XChangeProperty (dpyinfo->display, w, sm_id, XA_STRING, 8, PropModeReplace, |
432 |
|
client_id, strlen (client_id)); |
433 |
|
|
434 |
|
dpyinfo->client_leader_window = w; |
435 |
|
} |
436 |
|
|
437 |
/* Try to open a connection to the session manager. */ |
/* Try to open a connection to the session manager. */ |
438 |
void |
void |
439 |
x_session_initialize () |
x_session_initialize (dpyinfo) |
440 |
|
struct x_display_info *dpyinfo; |
441 |
{ |
{ |
442 |
#define SM_ERRORSTRING_LEN 512 |
#define SM_ERRORSTRING_LEN 512 |
443 |
char errorstring[SM_ERRORSTRING_LEN]; |
char errorstring[SM_ERRORSTRING_LEN]; |
498 |
errorstring); |
errorstring); |
499 |
|
|
500 |
if (smc_conn != 0) |
if (smc_conn != 0) |
501 |
Vx_session_id = make_string (client_id, strlen (client_id)); |
{ |
502 |
|
Vx_session_id = make_string (client_id, strlen (client_id)); |
503 |
|
|
504 |
|
#ifdef USE_GTK |
505 |
|
/* GTK creats a leader window by itself, but we need to tell |
506 |
|
it about our client_id. */ |
507 |
|
gdk_set_sm_client_id (client_id); |
508 |
|
#else |
509 |
|
create_client_leader_window (dpyinfo, client_id); |
510 |
|
#endif |
511 |
|
} |
512 |
} |
} |
513 |
|
|
514 |
|
|