user.h 6.87 KB
Newer Older
1 2 3 4
/*
 * Wine server USER definitions
 *
 * Copyright (C) 2001 Alexandre Julliard
5 6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 20 21 22 23 24 25 26
 */

#ifndef __WINE_SERVER_USER_H
#define __WINE_SERVER_USER_H

#include "wine/server_protocol.h"

struct thread;
27
struct region;
28
struct window;
29
struct msg_queue;
30
struct hook_table;
31
struct window_class;
32
struct atom_table;
33
struct clipboard;
34 35 36

enum user_object
{
37 38
    USER_WINDOW = 1,
    USER_HOOK
39 40
};

41 42
#define DESKTOP_ATOM  ((atom_t)32769)

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
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 */
59
    struct window     *top_window;    /* desktop window for this desktop */
60
    struct hook_table *global_hooks;  /* table of global hooks on this desktop */
61 62
};

63 64 65 66 67
/* user handles functions */

extern user_handle_t alloc_user_handle( void *ptr, enum user_object type );
extern void *get_user_object( user_handle_t handle, enum user_object type );
extern void *get_user_object_handle( user_handle_t *handle, enum user_object type );
68
extern user_handle_t get_user_full_handle( user_handle_t handle );
69 70 71
extern void *free_user_handle( user_handle_t handle );
extern void *next_user_handle( user_handle_t *handle, enum user_object type );

72 73 74 75
/* clipboard functions */

extern void cleanup_clipboard_thread( struct thread *thread );

76 77
/* hook functions */

78
extern void remove_thread_hooks( struct thread *thread );
79
extern unsigned int get_active_hooks(void);
80

81 82
/* queue functions */

83
extern void free_msg_queue( struct thread *thread );
84 85
extern struct hook_table *get_queue_hooks( struct thread *thread );
extern void set_queue_hooks( struct thread *thread, struct hook_table *hooks );
86
extern void inc_queue_paint_count( struct thread *thread, int incr );
87
extern void queue_cleanup_window( struct thread *thread, user_handle_t win );
88
extern int init_thread_queue( struct thread *thread );
89
extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to );
90
extern void detach_thread_input( struct thread *thread_from );
91 92
extern void post_message( user_handle_t win, unsigned int message,
                          unsigned int wparam, unsigned int lparam );
93 94 95 96 97
extern void post_win_event( struct thread *thread, unsigned int event,
                            user_handle_t win, unsigned int object_id,
                            unsigned int child_id, void *proc,
                            const WCHAR *module, size_t module_size,
                            user_handle_t handle );
98

99 100
/* region functions */

101
extern struct region *create_empty_region(void);
102
extern struct region *create_region_from_req_data( const void *data, size_t size );
103 104
extern void free_region( struct region *region );
extern void set_region_rect( struct region *region, const rectangle_t *rect );
105 106 107 108
extern rectangle_t *get_region_data( const struct region *region, size_t max_size,
                                     size_t *total_size );
extern rectangle_t *get_region_data_and_free( struct region *region, size_t max_size,
                                              size_t *total_size );
109 110 111 112 113 114 115 116 117 118
extern int is_region_empty( const struct region *region );
extern void get_region_extents( const struct region *region, rectangle_t *rect );
extern void offset_region( struct region *region, int x, int y );
extern struct region *copy_region( struct region *dst, const struct region *src );
extern struct region *intersect_region( struct region *dst, const struct region *src1,
                                        const struct region *src2 );
extern struct region *subtract_region( struct region *dst, const struct region *src1,
                                       const struct region *src2 );
extern struct region *union_region( struct region *dst, const struct region *src1,
                                    const struct region *src2 );
119 120
extern struct region *xor_region( struct region *dst, const struct region *src1,
                                  const struct region *src2 );
121
extern int point_in_region( struct region *region, int x, int y );
122
extern int rect_in_region( struct region *region, const rectangle_t *rect );
123

124 125
/* window functions */

126
extern void destroy_window( struct window *win );
127
extern void destroy_thread_windows( struct thread *thread );
128
extern int is_child_window( user_handle_t parent, user_handle_t child );
129
extern int is_top_level_window( user_handle_t window );
130
extern int is_window_visible( user_handle_t window );
131
extern int make_window_active( user_handle_t window );
132
extern struct thread *get_window_thread( user_handle_t handle );
133
extern user_handle_t window_from_point( struct desktop *desktop, int x, int y );
134
extern user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *thread );
135 136 137 138 139
extern struct window_class *get_window_class( user_handle_t window );

/* window class functions */

extern void destroy_process_classes( struct process *process );
140 141
extern struct window_class *grab_class( struct process *process, atom_t atom,
                                        void *instance, int *extra_bytes );
142 143
extern void release_class( struct window_class *class );
extern atom_t get_class_atom( struct window_class *class );
144
extern void *get_class_client_ptr( struct window_class *class );
145

146 147
/* windows station functions */

148
extern struct winstation *get_process_winstation( struct process *process, unsigned int access );
149
extern struct desktop *get_thread_desktop( struct thread *thread, unsigned int access );
150 151
extern void connect_process_winstation( struct process *process, const struct unicode_str *name );
extern void connect_process_desktop( struct process *process, const struct unicode_str *name );
152 153
extern void close_thread_desktop( struct thread *thread );

154
#endif  /* __WINE_SERVER_USER_H */