session management tweaking

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Mon Oct 11 19:47:05 CEST 2004


edscott wilson garcia wrote:
> Hey Benny,
> 
> El lun, 11-10-2004 a las 09:21, Benedikt Meurer escribió:
> 
>>Have a look at libxfcegui4/session.c, it includes a simple 
>>implementation of X11R6 client-side session management.
>>
> 
> 
> I looked into it and am now setting the sm property but it is not
> working. This is what I did:
> 
>    session_client = client_session_new (argc,argv,
> NULL,SESSION_RESTART_IMMEDIATELY,10);
>     session_init(session_client);
> 
> followed by a call to the routine:
> 
> void set_restart_command (int argc, char **argv){
> #ifdef HAVE_LIBSM
>       int i=0;
>        SmProp prop1,*props[1];
>        SmPropValue *vals = g_new (SmPropValue, argc);
>        
>        props[0] = &prop1;
> 
> 	prop1.name = SmRestartCommand;
> 	prop1.type = SmLISTofARRAY8;
> 	prop1.vals = vals;
> 	for (i=0;i<argc;i++){
> 	    if (!argv[i]) {
> 		argc=i;
> 		break;
> 	    }
> 	    vals[i].value = argv[i];
> 	    vals[i].length = strlen(argv[i]);
> 	}
> 	prop1.num_vals = argc;
> 	SmcSetProperties ((SmcConn) session_client->session_connection, 1,
> props);
> 	g_free(vals);
> #endif
> 
> }
> 
> Can you see anything wrong with the above?

Your code is correct (but useless). The problem is the session-client in 
libxfcegui4. Once the session manager sends a SaveYourself request to 
the client, the session_client code sends the old restart command to the 
session manager (see session-client.c:445). You could get around this by 
setting session_client->restart_command manually after the call to 
client_session_new(). The session-client code will then send the correct 
RestartCommand when the SM asks the client to save its state. This 
should do the trick.

> regards,
> Edscott

regards,
Benedikt



More information about the Xfce4-dev mailing list