push 150847dede558b39567907bd3738046f0ea247b2
[wine/hacks.git] / server / user.h
blob938adf82365266edafc37ecc2994f493de9c974e
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_CURSOR
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 desktop
56 struct object obj; /* object header */
57 unsigned int flags; /* desktop flags */
58 struct winstation *winstation; /* winstation this desktop belongs to */
59 struct list entry; /* entry in winstation list of desktops */
60 struct window *top_window; /* desktop window for this desktop */
61 struct hook_table *global_hooks; /* table of global hooks on this desktop */
62 struct timeout_user *close_timeout; /* timeout before closing the desktop */
63 unsigned int users; /* processes and threads using this desktop */
66 /* user handles functions */
68 extern user_handle_t alloc_user_handle( void *ptr, enum user_object type );
69 extern void *get_user_object( user_handle_t handle, enum user_object type );
70 extern void *get_user_object_handle( user_handle_t *handle, enum user_object type );
71 extern user_handle_t get_user_full_handle( user_handle_t handle );
72 extern void *free_user_handle( user_handle_t handle );
73 extern void *next_user_handle( user_handle_t *handle, enum user_object type );
75 /* clipboard functions */
77 extern void cleanup_clipboard_thread( struct thread *thread );
79 /* cursor functions */
81 extern void destroy_process_cursors( struct process *process );
83 /* hook functions */
85 extern void remove_thread_hooks( struct thread *thread );
86 extern unsigned int get_active_hooks(void);
88 /* queue functions */
90 extern void free_msg_queue( struct thread *thread );
91 extern struct hook_table *get_queue_hooks( struct thread *thread );
92 extern void set_queue_hooks( struct thread *thread, struct hook_table *hooks );
93 extern void inc_queue_paint_count( struct thread *thread, int incr );
94 extern void queue_cleanup_window( struct thread *thread, user_handle_t win );
95 extern int init_thread_queue( struct thread *thread );
96 extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to );
97 extern void detach_thread_input( struct thread *thread_from );
98 extern void post_message( user_handle_t win, unsigned int message,
99 unsigned long wparam, unsigned long lparam );
100 extern void post_win_event( struct thread *thread, unsigned int event,
101 user_handle_t win, unsigned int object_id,
102 unsigned int child_id, void *proc,
103 const WCHAR *module, data_size_t module_size,
104 user_handle_t handle );
106 /* region functions */
108 extern struct region *create_empty_region(void);
109 extern struct region *create_region_from_req_data( const void *data, data_size_t size );
110 extern void free_region( struct region *region );
111 extern void set_region_rect( struct region *region, const rectangle_t *rect );
112 extern rectangle_t *get_region_data( const struct region *region, data_size_t max_size,
113 data_size_t *total_size );
114 extern rectangle_t *get_region_data_and_free( struct region *region, data_size_t max_size,
115 data_size_t *total_size );
116 extern int is_region_empty( const struct region *region );
117 extern void get_region_extents( const struct region *region, rectangle_t *rect );
118 extern void offset_region( struct region *region, int x, int y );
119 extern struct region *copy_region( struct region *dst, const struct region *src );
120 extern struct region *intersect_region( struct region *dst, const struct region *src1,
121 const struct region *src2 );
122 extern struct region *subtract_region( struct region *dst, const struct region *src1,
123 const struct region *src2 );
124 extern struct region *union_region( struct region *dst, const struct region *src1,
125 const struct region *src2 );
126 extern struct region *xor_region( struct region *dst, const struct region *src1,
127 const struct region *src2 );
128 extern int point_in_region( struct region *region, int x, int y );
129 extern int rect_in_region( struct region *region, const rectangle_t *rect );
131 /* window functions */
133 extern struct process *get_top_window_owner( struct desktop *desktop );
134 extern void close_desktop_window( struct desktop *desktop );
135 extern void destroy_window( struct window *win );
136 extern void destroy_thread_windows( struct thread *thread );
137 extern int is_child_window( user_handle_t parent, user_handle_t child );
138 extern int is_top_level_window( user_handle_t window );
139 extern int is_window_visible( user_handle_t window );
140 extern int make_window_active( user_handle_t window );
141 extern struct thread *get_window_thread( user_handle_t handle );
142 extern user_handle_t window_from_point( struct desktop *desktop, int x, int y );
143 extern user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *thread );
144 extern struct window_class *get_window_class( user_handle_t window );
146 /* window class functions */
148 extern void destroy_process_classes( struct process *process );
149 extern struct window_class *grab_class( struct process *process, atom_t atom,
150 void *instance, int *extra_bytes );
151 extern void release_class( struct window_class *class );
152 extern int is_desktop_class( struct window_class *class );
153 extern atom_t get_class_atom( struct window_class *class );
154 extern void *get_class_client_ptr( struct window_class *class );
156 /* windows station functions */
158 extern struct winstation *get_process_winstation( struct process *process, unsigned int access );
159 extern struct desktop *get_thread_desktop( struct thread *thread, unsigned int access );
160 extern void connect_process_winstation( struct process *process, struct thread *parent );
161 extern void set_process_default_desktop( struct process *process, struct desktop *desktop,
162 obj_handle_t handle );
163 extern void close_process_desktop( struct process *process );
164 extern void close_thread_desktop( struct thread *thread );
166 #endif /* __WINE_SERVER_USER_H */