Export the winstation and desktop structures to avoid having to write

too many accessor functions.
This commit is contained in:
Alexandre Julliard 2005-07-11 10:55:53 +00:00
parent fc200d0ca7
commit 499e343d9f
4 changed files with 31 additions and 57 deletions

View File

@ -286,18 +286,12 @@ static atom_t find_atom( struct atom_table *table, const WCHAR *str, size_t len
static struct atom_table *get_global_table( struct winstation *winstation, int create ) static struct atom_table *get_global_table( struct winstation *winstation, int create )
{ {
struct atom_table *global_table; if (!winstation->atom_table)
if (!(global_table = get_winstation_atom_table( winstation )))
{ {
if (create) if (create) winstation->atom_table = create_table( HASH_SIZE );
{
global_table = create_table( HASH_SIZE );
if (global_table) set_winstation_atom_table( winstation, global_table );
}
else set_error( STATUS_OBJECT_NAME_NOT_FOUND ); else set_error( STATUS_OBJECT_NAME_NOT_FOUND );
} }
return global_table; return winstation->atom_table;
} }
static struct atom_table *get_table( obj_handle_t h, int create ) static struct atom_table *get_table( obj_handle_t h, int create )

View File

@ -80,7 +80,7 @@ static struct clipboard *get_process_clipboard(void)
if (!winstation) return NULL; if (!winstation) return NULL;
if (!(clipboard = get_winstation_clipboard( winstation ))) if (!(clipboard = winstation->clipboard))
{ {
if ((clipboard = alloc_object( &clipboard_ops ))) if ((clipboard = alloc_object( &clipboard_ops )))
{ {
@ -91,7 +91,7 @@ static struct clipboard *get_process_clipboard(void)
clipboard->viewer = 0; clipboard->viewer = 0;
clipboard->seqno = 0; clipboard->seqno = 0;
clipboard->seqno_timestamp = 0; clipboard->seqno_timestamp = 0;
set_winstation_clipboard( winstation, clipboard ); winstation->clipboard = clipboard;
} }
} }
release_object( winstation ); release_object( winstation );
@ -107,7 +107,7 @@ void cleanup_clipboard_thread(struct thread *thread)
if (!winstation) return; if (!winstation) return;
if ((clipboard = get_winstation_clipboard( winstation ))) if ((clipboard = winstation->clipboard))
{ {
if (thread == clipboard->open_thread) if (thread == clipboard->open_thread)
{ {

View File

@ -40,6 +40,24 @@ enum user_object
#define DESKTOP_ATOM ((atom_t)32769) #define DESKTOP_ATOM ((atom_t)32769)
struct winstation
{
struct object obj; /* object header */
unsigned int flags; /* winstation flags */
struct list entry; /* entry in global winstation list */
struct list desktops; /* list of desktops of this winstation */
struct clipboard *clipboard; /* clipboard information */
struct atom_table *atom_table; /* global atom table */
};
struct desktop
{
struct object obj; /* object header */
unsigned int flags; /* desktop flags */
struct winstation *winstation; /* winstation this desktop belongs to */
struct list entry; /* entry in winstation list of desktops */
};
/* user handles functions */ /* user handles functions */
extern user_handle_t alloc_user_handle( void *ptr, enum user_object type ); extern user_handle_t alloc_user_handle( void *ptr, enum user_object type );
@ -125,10 +143,7 @@ extern void *get_class_client_ptr( struct window_class *class );
/* windows station functions */ /* windows station functions */
extern struct winstation *get_process_winstation( struct process *process, unsigned int access ); extern struct winstation *get_process_winstation( struct process *process, unsigned int access );
extern void set_winstation_clipboard( struct winstation *winstation, struct clipboard *clipboard ); extern struct desktop *get_thread_desktop( struct thread *thread, unsigned int access );
extern void set_winstation_atom_table( struct winstation *winstation, struct atom_table *table );
extern struct clipboard *get_winstation_clipboard( struct winstation *winstation );
extern struct atom_table *get_winstation_atom_table( struct winstation *winstation );
extern void connect_process_winstation( struct process *process, const WCHAR *name, size_t len ); extern void connect_process_winstation( struct process *process, const WCHAR *name, size_t len );
extern void connect_process_desktop( struct process *process, const WCHAR *name, size_t len ); extern void connect_process_desktop( struct process *process, const WCHAR *name, size_t len );
extern void close_thread_desktop( struct thread *thread ); extern void close_thread_desktop( struct thread *thread );

View File

@ -35,23 +35,6 @@
#include "user.h" #include "user.h"
#include "wine/unicode.h" #include "wine/unicode.h"
struct winstation
{
struct object obj; /* object header */
unsigned int flags; /* winstation flags */
struct list entry; /* entry in global winstation list */
struct list desktops; /* list of desktops of this winstation */
struct clipboard *clipboard; /* clipboard information */
struct atom_table *atom_table; /* global atom table */
};
struct desktop
{
struct object obj; /* object header */
unsigned int flags; /* desktop flags */
struct winstation *winstation; /* winstation this desktop belongs to */
struct list entry; /* entry in winstation list of desktops */
};
static struct list winstation_list = LIST_INIT(winstation_list); static struct list winstation_list = LIST_INIT(winstation_list);
static struct winstation *interactive_winstation; static struct winstation *interactive_winstation;
@ -155,30 +138,6 @@ struct winstation *get_process_winstation( struct process *process, unsigned int
access, &winstation_ops ); access, &winstation_ops );
} }
/* set the pointer to the (opaque) clipboard info */
void set_winstation_clipboard( struct winstation *winstation, struct clipboard *clipboard )
{
winstation->clipboard = clipboard;
}
/* retrieve the pointer to the (opaque) clipboard info */
struct clipboard *get_winstation_clipboard( struct winstation *winstation )
{
return winstation->clipboard;
}
/* set the pointer to the (opaque) atom table */
void set_winstation_atom_table( struct winstation *winstation, struct atom_table *table )
{
winstation->atom_table = table;
}
/* retrieve the pointer to the (opaque) clipboard info */
struct atom_table *get_winstation_atom_table( struct winstation *winstation )
{
return winstation->atom_table;
}
/* build the full name of a desktop object */ /* build the full name of a desktop object */
static WCHAR *build_desktop_name( const WCHAR *name, size_t len, static WCHAR *build_desktop_name( const WCHAR *name, size_t len,
struct winstation *winstation, size_t *res_len ) struct winstation *winstation, size_t *res_len )
@ -263,6 +222,12 @@ static void desktop_destroy( struct object *obj )
release_object( desktop->winstation ); release_object( desktop->winstation );
} }
/* retrieve the thread desktop, checking the handle access rights */
struct desktop *get_thread_desktop( struct thread *thread, unsigned int access )
{
return get_desktop_obj( thread->process, thread->desktop, access );
}
/* connect a process to its window station */ /* connect a process to its window station */
void connect_process_winstation( struct process *process, const WCHAR *name, size_t len ) void connect_process_winstation( struct process *process, const WCHAR *name, size_t len )
{ {