blob: 6aba98f8b235646f5e009c18276d331ea32da993 [file] [log] [blame]
Alexandre Julliard1a66d222001-08-28 18:44:52 +00001/*
2 * Wine server USER definitions
3 *
4 * Copyright (C) 2001 Alexandre Julliard
Alexandre Julliard0799c1a2002-03-09 23:29:33 +00005 *
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.
10 *
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.
15 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Alexandre Julliard1a66d222001-08-28 18:44:52 +000019 */
20
21#ifndef __WINE_SERVER_USER_H
22#define __WINE_SERVER_USER_H
23
24#include "wine/server_protocol.h"
25
26struct thread;
Alexandre Julliarde8d86b72004-06-23 20:44:58 +000027struct region;
Alexandre Julliard1a66d222001-08-28 18:44:52 +000028struct window;
Alexandre Julliard805bdc52001-11-13 22:23:48 +000029struct msg_queue;
Alexandre Julliardd55e7f12003-07-03 18:16:48 +000030struct hook_table;
Alexandre Julliardbfce1512003-12-10 04:08:06 +000031struct window_class;
Alexandre Julliard248f4b22005-07-07 11:29:23 +000032struct atom_table;
Alexandre Julliard45128bd2005-06-29 20:13:36 +000033struct clipboard;
Alexandre Julliard1a66d222001-08-28 18:44:52 +000034
35enum user_object
36{
Alexandre Julliard02861352002-10-29 00:41:42 +000037 USER_WINDOW = 1,
38 USER_HOOK
Alexandre Julliard1a66d222001-08-28 18:44:52 +000039};
40
Alexandre Julliard8c518802005-07-08 11:37:40 +000041#define DESKTOP_ATOM ((atom_t)32769)
42
Alexandre Julliard499e3432005-07-11 10:55:53 +000043struct winstation
44{
45 struct object obj; /* object header */
46 unsigned int flags; /* winstation flags */
47 struct list entry; /* entry in global winstation list */
48 struct list desktops; /* list of desktops of this winstation */
49 struct clipboard *clipboard; /* clipboard information */
50 struct atom_table *atom_table; /* global atom table */
51};
52
53struct desktop
54{
Alexandre Julliardf978f612006-03-06 21:02:24 +010055 struct object obj; /* object header */
56 unsigned int flags; /* desktop flags */
57 struct winstation *winstation; /* winstation this desktop belongs to */
58 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 struct timeout_user *close_timeout; /* timeout before closing the desktop */
62 unsigned int users; /* processes and threads using this desktop */
Alexandre Julliard499e3432005-07-11 10:55:53 +000063};
64
Alexandre Julliard1a66d222001-08-28 18:44:52 +000065/* user handles functions */
66
67extern user_handle_t alloc_user_handle( void *ptr, enum user_object type );
68extern void *get_user_object( user_handle_t handle, enum user_object type );
69extern void *get_user_object_handle( user_handle_t *handle, enum user_object type );
Alexandre Julliardbc878ef2001-09-12 17:09:24 +000070extern user_handle_t get_user_full_handle( user_handle_t handle );
Alexandre Julliard1a66d222001-08-28 18:44:52 +000071extern void *free_user_handle( user_handle_t handle );
72extern void *next_user_handle( user_handle_t *handle, enum user_object type );
73
Ulrich Czekallab2df5f92003-06-23 23:02:02 +000074/* clipboard functions */
75
76extern void cleanup_clipboard_thread( struct thread *thread );
77
Alexandre Julliard14e68ba2002-11-20 19:54:32 +000078/* hook functions */
79
Alexandre Julliardca3ac8f2003-07-11 21:55:58 +000080extern void remove_thread_hooks( struct thread *thread );
Alexandre Julliard63342352005-05-11 13:03:15 +000081extern unsigned int get_active_hooks(void);
Alexandre Julliard14e68ba2002-11-20 19:54:32 +000082
Alexandre Julliard1a66d222001-08-28 18:44:52 +000083/* queue functions */
84
Alexandre Julliard31022d62002-08-16 23:30:41 +000085extern void free_msg_queue( struct thread *thread );
Alexandre Julliardd55e7f12003-07-03 18:16:48 +000086extern struct hook_table *get_queue_hooks( struct thread *thread );
87extern void set_queue_hooks( struct thread *thread, struct hook_table *hooks );
Alexandre Julliard805bdc52001-11-13 22:23:48 +000088extern void inc_queue_paint_count( struct thread *thread, int incr );
Alexandre Julliard1a66d222001-08-28 18:44:52 +000089extern void queue_cleanup_window( struct thread *thread, user_handle_t win );
Alexandre Julliardd70a2532005-04-26 14:31:33 +000090extern int init_thread_queue( struct thread *thread );
Alexandre Julliardab5063b2002-10-11 18:50:15 +000091extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to );
Alexandre Julliard5ad90c02005-07-11 13:30:23 +000092extern void detach_thread_input( struct thread *thread_from );
Alexandre Julliard81f2a732002-03-23 20:43:52 +000093extern void post_message( user_handle_t win, unsigned int message,
94 unsigned int wparam, unsigned int lparam );
Dmitry Timoshkov6dba0a72005-02-03 16:40:20 +000095extern void post_win_event( struct thread *thread, unsigned int event,
96 user_handle_t win, unsigned int object_id,
97 unsigned int child_id, void *proc,
98 const WCHAR *module, size_t module_size,
99 user_handle_t handle );
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000100
Alexandre Julliarde8d86b72004-06-23 20:44:58 +0000101/* region functions */
102
Alexandre Julliard43b28262005-02-22 19:42:35 +0000103extern struct region *create_empty_region(void);
Alexandre Julliard618a7e52004-06-29 03:53:25 +0000104extern struct region *create_region_from_req_data( const void *data, size_t size );
Alexandre Julliarde8d86b72004-06-23 20:44:58 +0000105extern void free_region( struct region *region );
106extern void set_region_rect( struct region *region, const rectangle_t *rect );
Alexandre Julliard807fe072004-09-17 18:20:11 +0000107extern rectangle_t *get_region_data( const struct region *region, size_t max_size,
108 size_t *total_size );
109extern rectangle_t *get_region_data_and_free( struct region *region, size_t max_size,
110 size_t *total_size );
Alexandre Julliarde8d86b72004-06-23 20:44:58 +0000111extern int is_region_empty( const struct region *region );
112extern void get_region_extents( const struct region *region, rectangle_t *rect );
113extern void offset_region( struct region *region, int x, int y );
114extern struct region *copy_region( struct region *dst, const struct region *src );
115extern struct region *intersect_region( struct region *dst, const struct region *src1,
116 const struct region *src2 );
117extern struct region *subtract_region( struct region *dst, const struct region *src1,
118 const struct region *src2 );
119extern struct region *union_region( struct region *dst, const struct region *src1,
120 const struct region *src2 );
Alexandre Julliard5e128dd2004-09-08 01:34:22 +0000121extern struct region *xor_region( struct region *dst, const struct region *src1,
122 const struct region *src2 );
Alexandre Julliard4616dcb2004-07-20 22:17:38 +0000123extern int point_in_region( struct region *region, int x, int y );
Alexandre Julliardedc90a92004-09-01 22:49:14 +0000124extern int rect_in_region( struct region *region, const rectangle_t *rect );
Alexandre Julliarde8d86b72004-06-23 20:44:58 +0000125
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000126/* window functions */
127
Alexandre Julliardf978f612006-03-06 21:02:24 +0100128extern struct process *get_top_window_owner( struct desktop *desktop );
129extern void close_desktop_window( struct desktop *desktop );
Alexandre Julliard5ad90c02005-07-11 13:30:23 +0000130extern void destroy_window( struct window *win );
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000131extern void destroy_thread_windows( struct thread *thread );
Alexandre Julliarda09da0c2001-09-21 21:08:40 +0000132extern int is_child_window( user_handle_t parent, user_handle_t child );
Alexandre Julliard5030bda2002-10-11 23:41:06 +0000133extern int is_top_level_window( user_handle_t window );
Alexandre Julliard085ef062004-10-27 21:54:41 +0000134extern int is_window_visible( user_handle_t window );
Alexandre Julliard5030bda2002-10-11 23:41:06 +0000135extern int make_window_active( user_handle_t window );
Alexandre Julliard81f2a732002-03-23 20:43:52 +0000136extern struct thread *get_window_thread( user_handle_t handle );
Alexandre Julliard5ad90c02005-07-11 13:30:23 +0000137extern user_handle_t window_from_point( struct desktop *desktop, int x, int y );
Alexandre Julliard47f98212001-11-14 21:28:36 +0000138extern user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *thread );
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000139extern struct window_class *get_window_class( user_handle_t window );
140
141/* window class functions */
142
143extern void destroy_process_classes( struct process *process );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000144extern struct window_class *grab_class( struct process *process, atom_t atom,
145 void *instance, int *extra_bytes );
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000146extern void release_class( struct window_class *class );
Alexandre Julliard251be542006-03-06 20:37:52 +0100147extern int is_desktop_class( struct window_class *class );
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000148extern atom_t get_class_atom( struct window_class *class );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000149extern void *get_class_client_ptr( struct window_class *class );
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000150
Alexandre Julliard1bf96e02005-06-08 18:44:50 +0000151/* windows station functions */
152
Alexandre Julliard45128bd2005-06-29 20:13:36 +0000153extern struct winstation *get_process_winstation( struct process *process, unsigned int access );
Alexandre Julliard499e3432005-07-11 10:55:53 +0000154extern struct desktop *get_thread_desktop( struct thread *thread, unsigned int access );
Alexandre Julliard90af5a02006-03-27 12:57:17 +0200155extern void connect_process_winstation( struct process *process, struct thread *parent );
156extern void set_process_default_desktop( struct process *process, struct desktop *desktop,
157 obj_handle_t handle );
Alexandre Julliardf978f612006-03-06 21:02:24 +0100158extern void close_process_desktop( struct process *process );
Alexandre Julliard1bf96e02005-06-08 18:44:50 +0000159extern void close_thread_desktop( struct thread *thread );
160
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000161#endif /* __WINE_SERVER_USER_H */