session management tweaking

Benedikt Meurer benedikt.meurer at unix-ag.uni-siegen.de
Tue Oct 12 17:54:34 CEST 2004


edscott wilson garcia wrote:
> El lun, 11-10-2004 a las 12:47, Benedikt Meurer escribió:
> 
>>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.
> 
> 
> It should, but something is not right. I still get the original startup
> command using:
> 
> void set_restart_command (int argc, char **argv){
>       int i=0;
>       static gchar **rstart=NULL;
>       static int rargc=-1;
> 
>       if (rargc != argc) {
> 	  g_strfreev (rstart);
> 	  rstart = (gchar **)malloc((argc+1)*sizeof(gchar *));
>       }
>       for(i=0;i<argc;i++){
> 	rstart[i]=g_strdup(argv[i]);
>       }
>       rstart[argc]=NULL;
>       session_client->restart_command=rstart;
>       session_client->clone_command=rstart;
> }
> 
> This is strange :-\

Have you looked into the session file (.cache/sessions/xfce4-session*) 
to verify that its the original argv? Else I've no idea whats wrong 
here, sorry.

> regards,
> Edscott

Benedikt



More information about the Xfce4-dev mailing list