Create the desktop class when needed without requiring a client

request.
This commit is contained in:
Alexandre Julliard 2005-07-19 19:45:48 +00:00
parent f29a1315ec
commit 8197e0b07b
1 changed files with 17 additions and 23 deletions

View File

@ -50,8 +50,6 @@ struct window_class
char extra_bytes[1]; /* extra bytes storage */ char extra_bytes[1]; /* extra bytes storage */
}; };
#define DESKTOP_ATOM ((atom_t)32769)
static struct window_class *desktop_class; static struct window_class *desktop_class;
static struct window_class *create_class( struct process *process, int extra_bytes, int local ) static struct window_class *create_class( struct process *process, int extra_bytes, int local )
@ -73,23 +71,22 @@ static struct window_class *create_class( struct process *process, int extra_byt
return class; return class;
} }
static struct window_class *create_desktop_class( unsigned int style, int win_extra ) static struct window_class *get_desktop_class(void)
{ {
struct window_class *class; if (!desktop_class)
{
if (!(class = mem_alloc( sizeof(*class) - 1 ))) return NULL; if (!(desktop_class = mem_alloc( sizeof(*desktop_class) - 1 ))) return NULL;
desktop_class->process = NULL;
class->process = NULL; desktop_class->count = 0;
class->count = 0; desktop_class->local = 0;
class->local = 0; desktop_class->nb_extra_bytes = 0;
class->nb_extra_bytes = 0; desktop_class->atom = DESKTOP_ATOM;
class->atom = DESKTOP_ATOM; desktop_class->instance = NULL;
class->instance = NULL; desktop_class->style = CS_DBLCLKS;
class->style = style; desktop_class->win_extra = 0;
class->win_extra = win_extra; desktop_class->client_ptr = NULL;
class->client_ptr = NULL; }
desktop_class = class; return desktop_class;
return class;
} }
static void destroy_class( struct window_class *class ) static void destroy_class( struct window_class *class )
@ -120,7 +117,7 @@ static struct window_class *find_class( struct process *process, atom_t atom, vo
if (class->atom != atom) continue; if (class->atom != atom) continue;
if (!instance || !class->local || class->instance == instance) return class; if (!instance || !class->local || class->instance == instance) return class;
} }
if (atom == DESKTOP_ATOM) return desktop_class; if (atom == DESKTOP_ATOM) return get_desktop_class();
return NULL; return NULL;
} }
@ -160,10 +157,7 @@ DECL_HANDLER(create_class)
struct winstation *winstation; struct winstation *winstation;
if (!req->local && req->atom == DESKTOP_ATOM) if (!req->local && req->atom == DESKTOP_ATOM)
{ return; /* silently ignore attempts to create the desktop class */
if (!desktop_class) create_desktop_class( req->style, req->win_extra );
return; /* silently ignore further attempts to create the desktop class */
}
class = find_class( current->process, req->atom, req->instance ); class = find_class( current->process, req->atom, req->instance );
if (class && !class->local == !req->local) if (class && !class->local == !req->local)