webservices: Implement WsCreateXmlBuffer.
[wine.git] / server / user.h
blob08d0959f3c25cf2ca25c090748c9db6b5b4d6915
1 /*
2 * Wine server USER definitions
4 * Copyright (C) 2001 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_SERVER_USER_H
22 #define __WINE_SERVER_USER_H
24 #include "wine/server_protocol.h"
26 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;
35 enum user_object
37 USER_WINDOW = 1,
38 USER_HOOK,
39 USER_CLIENT /* arbitrary client handle */
42 #define DESKTOP_ATOM ((atom_t)32769)
44 struct winstation
46 struct object obj; /* object header */
47 unsigned int flags; /* winstation flags */
48 struct list entry; /* entry in global winstation list */
49 struct list desktops; /* list of desktops of this winstation */
50 struct clipboard *clipboard; /* clipboard information */
51 struct atom_table *atom_table; /* global atom table */
54 struct global_cursor
56 int x; /* cursor position */
57 int y;
58 rectangle_t clip; /* cursor clip rectangle */
59 unsigned int clip_msg; /* message to post for cursor clip changes */
60 unsigned int last_change; /* time of last position change */
61 user_handle_t win; /* window that contains the cursor */
64 struct desktop
66 struct object obj; /* object header */
67 unsigned int flags; /* desktop flags */
68 struct winstation *winstation; /* winstation this desktop belongs to */
69 struct list entry; /* entry in winstation list of desktops */
70 struct window *top_window; /* desktop window for this desktop */
71 struct window *msg_window; /* HWND_MESSAGE top window */
72 struct hook_table *global_hooks; /* table of global hooks on this desktop */
73 struct list hotkeys; /* list of registered hotkeys */
74 struct timeout_user *close_timeout; /* timeout before closing the desktop */
75 struct thread_input *foreground_input; /* thread input of foreground thread */
76 unsigned int users; /* processes and threads using this desktop */
77 struct global_cursor cursor; /* global cursor information */
78 unsigned char keystate[256]; /* asynchronous key state */
81 /* user handles functions */
83 extern user_handle_t alloc_user_handle( void *ptr, enum user_object type );
84 extern void *get_user_object( user_handle_t handle, enum user_object type );
85 extern void *get_user_object_handle( user_handle_t *handle, enum user_object type );
86 extern user_handle_t get_user_full_handle( user_handle_t handle );
87 extern void *free_user_handle( user_handle_t handle );
88 extern void *next_user_handle( user_handle_t *handle, enum user_object type );
89 extern void free_process_user_handles( struct process *process );
91 /* clipboard functions */
93 extern void cleanup_clipboard_thread( struct thread *thread );
95 /* hook functions */
97 extern void remove_thread_hooks( struct thread *thread );
98 extern unsigned int get_active_hooks(void);
99 extern struct thread *get_first_global_hook( int id );
101 /* queue functions */
103 extern void free_msg_queue( struct thread *thread );
104 extern struct hook_table *get_queue_hooks( struct thread *thread );
105 extern void set_queue_hooks( struct thread *thread, struct hook_table *hooks );
106 extern void inc_queue_paint_count( struct thread *thread, int incr );
107 extern void queue_cleanup_window( struct thread *thread, user_handle_t win );
108 extern int init_thread_queue( struct thread *thread );
109 extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to );
110 extern void detach_thread_input( struct thread *thread_from );
111 extern void post_message( user_handle_t win, unsigned int message,
112 lparam_t wparam, lparam_t lparam );
113 extern void post_win_event( struct thread *thread, unsigned int event,
114 user_handle_t win, unsigned int object_id,
115 unsigned int child_id, client_ptr_t proc,
116 const WCHAR *module, data_size_t module_size,
117 user_handle_t handle );
118 extern void free_hotkeys( struct desktop *desktop, user_handle_t window );
120 /* region functions */
122 extern struct region *create_empty_region(void);
123 extern struct region *create_region_from_req_data( const void *data, data_size_t size );
124 extern void free_region( struct region *region );
125 extern void set_region_rect( struct region *region, const rectangle_t *rect );
126 extern rectangle_t *get_region_data( const struct region *region, data_size_t max_size,
127 data_size_t *total_size );
128 extern rectangle_t *get_region_data_and_free( struct region *region, data_size_t max_size,
129 data_size_t *total_size );
130 extern int is_region_empty( const struct region *region );
131 extern void get_region_extents( const struct region *region, rectangle_t *rect );
132 extern void offset_region( struct region *region, int x, int y );
133 extern void mirror_region( const rectangle_t *client_rect, struct region *region );
134 extern struct region *copy_region( struct region *dst, const struct region *src );
135 extern struct region *intersect_region( struct region *dst, const struct region *src1,
136 const struct region *src2 );
137 extern struct region *subtract_region( struct region *dst, const struct region *src1,
138 const struct region *src2 );
139 extern struct region *union_region( struct region *dst, const struct region *src1,
140 const struct region *src2 );
141 extern struct region *xor_region( struct region *dst, const struct region *src1,
142 const struct region *src2 );
143 extern int point_in_region( struct region *region, int x, int y );
144 extern int rect_in_region( struct region *region, const rectangle_t *rect );
146 /* window functions */
148 extern struct process *get_top_window_owner( struct desktop *desktop );
149 extern void get_top_window_rectangle( struct desktop *desktop, rectangle_t *rect );
150 extern void post_desktop_message( struct desktop *desktop, unsigned int message,
151 lparam_t wparam, lparam_t lparam );
152 extern void destroy_window( struct window *win );
153 extern void destroy_thread_windows( struct thread *thread );
154 extern int is_child_window( user_handle_t parent, user_handle_t child );
155 extern int is_valid_foreground_window( user_handle_t window );
156 extern int is_window_visible( user_handle_t window );
157 extern int is_window_transparent( user_handle_t window );
158 extern int make_window_active( user_handle_t window );
159 extern struct thread *get_window_thread( user_handle_t handle );
160 extern user_handle_t shallow_window_from_point( struct desktop *desktop, int x, int y );
161 extern struct thread *window_thread_from_point( user_handle_t scope, int x, int y );
162 extern user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *thread );
163 extern struct window_class *get_window_class( user_handle_t window );
165 /* window class functions */
167 extern void destroy_process_classes( struct process *process );
168 extern struct window_class *grab_class( struct process *process, atom_t atom,
169 mod_handle_t instance, int *extra_bytes );
170 extern void release_class( struct window_class *class );
171 extern int is_desktop_class( struct window_class *class );
172 extern int is_hwnd_message_class( struct window_class *class );
173 extern atom_t get_class_atom( struct window_class *class );
174 extern client_ptr_t get_class_client_ptr( struct window_class *class );
176 /* windows station functions */
178 extern struct desktop *get_desktop_obj( struct process *process, obj_handle_t handle, unsigned int access );
179 extern struct winstation *get_process_winstation( struct process *process, unsigned int access );
180 extern struct desktop *get_thread_desktop( struct thread *thread, unsigned int access );
181 extern void connect_process_winstation( struct process *process, struct thread *parent );
182 extern void set_process_default_desktop( struct process *process, struct desktop *desktop,
183 obj_handle_t handle );
184 extern void close_process_desktop( struct process *process );
185 extern void close_thread_desktop( struct thread *thread );
187 /* mirror a rectangle respective to the window client area */
188 static inline void mirror_rect( const rectangle_t *client_rect, rectangle_t *rect )
190 int width = client_rect->right - client_rect->left;
191 int tmp = rect->left;
192 rect->left = width - rect->right;
193 rect->right = width - tmp;
196 /* compute the intersection of two rectangles; return 0 if the result is empty */
197 static inline int intersect_rect( rectangle_t *dst, const rectangle_t *src1, const rectangle_t *src2 )
199 dst->left = max( src1->left, src2->left );
200 dst->top = max( src1->top, src2->top );
201 dst->right = min( src1->right, src2->right );
202 dst->bottom = min( src1->bottom, src2->bottom );
203 return (dst->left < dst->right && dst->top < dst->bottom);
206 #endif /* __WINE_SERVER_USER_H */