blob: 1ac5ac05e03fe957861432680611bf4d7378b7a8 [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{
55 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 */
Alexandre Julliard5ad90c02005-07-11 13:30:23 +000059 struct window *top_window; /* desktop window for this desktop */
Alexandre Julliard4a40b2e2005-07-11 18:05:50 +000060 struct hook_table *global_hooks; /* table of global hooks on this desktop */
Alexandre Julliard499e3432005-07-11 10:55:53 +000061};
62
Alexandre Julliard1a66d222001-08-28 18:44:52 +000063/* user handles functions */
64
65extern user_handle_t alloc_user_handle( void *ptr, enum user_object type );
66extern void *get_user_object( user_handle_t handle, enum user_object type );
67extern void *get_user_object_handle( user_handle_t *handle, enum user_object type );
Alexandre Julliardbc878ef2001-09-12 17:09:24 +000068extern user_handle_t get_user_full_handle( user_handle_t handle );
Alexandre Julliard1a66d222001-08-28 18:44:52 +000069extern void *free_user_handle( user_handle_t handle );
70extern void *next_user_handle( user_handle_t *handle, enum user_object type );
71
Ulrich Czekallab2df5f92003-06-23 23:02:02 +000072/* clipboard functions */
73
74extern void cleanup_clipboard_thread( struct thread *thread );
75
Alexandre Julliard14e68ba2002-11-20 19:54:32 +000076/* hook functions */
77
Alexandre Julliardca3ac8f2003-07-11 21:55:58 +000078extern void remove_thread_hooks( struct thread *thread );
Alexandre Julliard63342352005-05-11 13:03:15 +000079extern unsigned int get_active_hooks(void);
Alexandre Julliard14e68ba2002-11-20 19:54:32 +000080
Alexandre Julliard1a66d222001-08-28 18:44:52 +000081/* queue functions */
82
Alexandre Julliard31022d62002-08-16 23:30:41 +000083extern void free_msg_queue( struct thread *thread );
Alexandre Julliardd55e7f12003-07-03 18:16:48 +000084extern struct hook_table *get_queue_hooks( struct thread *thread );
85extern void set_queue_hooks( struct thread *thread, struct hook_table *hooks );
Alexandre Julliard805bdc52001-11-13 22:23:48 +000086extern void inc_queue_paint_count( struct thread *thread, int incr );
Alexandre Julliard1a66d222001-08-28 18:44:52 +000087extern void queue_cleanup_window( struct thread *thread, user_handle_t win );
Alexandre Julliardd70a2532005-04-26 14:31:33 +000088extern int init_thread_queue( struct thread *thread );
Alexandre Julliardab5063b2002-10-11 18:50:15 +000089extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to );
Alexandre Julliard5ad90c02005-07-11 13:30:23 +000090extern void detach_thread_input( struct thread *thread_from );
Alexandre Julliard81f2a732002-03-23 20:43:52 +000091extern void post_message( user_handle_t win, unsigned int message,
92 unsigned int wparam, unsigned int lparam );
Dmitry Timoshkov6dba0a72005-02-03 16:40:20 +000093extern void post_win_event( struct thread *thread, unsigned int event,
94 user_handle_t win, unsigned int object_id,
95 unsigned int child_id, void *proc,
96 const WCHAR *module, size_t module_size,
97 user_handle_t handle );
Alexandre Julliard1a66d222001-08-28 18:44:52 +000098
Alexandre Julliarde8d86b72004-06-23 20:44:58 +000099/* region functions */
100
Alexandre Julliard43b28262005-02-22 19:42:35 +0000101extern struct region *create_empty_region(void);
Alexandre Julliard618a7e52004-06-29 03:53:25 +0000102extern struct region *create_region_from_req_data( const void *data, size_t size );
Alexandre Julliarde8d86b72004-06-23 20:44:58 +0000103extern void free_region( struct region *region );
104extern void set_region_rect( struct region *region, const rectangle_t *rect );
Alexandre Julliard807fe072004-09-17 18:20:11 +0000105extern rectangle_t *get_region_data( const struct region *region, size_t max_size,
106 size_t *total_size );
107extern rectangle_t *get_region_data_and_free( struct region *region, size_t max_size,
108 size_t *total_size );
Alexandre Julliarde8d86b72004-06-23 20:44:58 +0000109extern int is_region_empty( const struct region *region );
110extern void get_region_extents( const struct region *region, rectangle_t *rect );
111extern void offset_region( struct region *region, int x, int y );
112extern struct region *copy_region( struct region *dst, const struct region *src );
113extern struct region *intersect_region( struct region *dst, const struct region *src1,
114 const struct region *src2 );
115extern struct region *subtract_region( struct region *dst, const struct region *src1,
116 const struct region *src2 );
117extern struct region *union_region( struct region *dst, const struct region *src1,
118 const struct region *src2 );
Alexandre Julliard5e128dd2004-09-08 01:34:22 +0000119extern struct region *xor_region( struct region *dst, const struct region *src1,
120 const struct region *src2 );
Alexandre Julliard4616dcb2004-07-20 22:17:38 +0000121extern int point_in_region( struct region *region, int x, int y );
Alexandre Julliardedc90a92004-09-01 22:49:14 +0000122extern int rect_in_region( struct region *region, const rectangle_t *rect );
Alexandre Julliarde8d86b72004-06-23 20:44:58 +0000123
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000124/* window functions */
125
Alexandre Julliard5ad90c02005-07-11 13:30:23 +0000126extern void destroy_window( struct window *win );
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000127extern void destroy_thread_windows( struct thread *thread );
Alexandre Julliarda09da0c2001-09-21 21:08:40 +0000128extern int is_child_window( user_handle_t parent, user_handle_t child );
Alexandre Julliard5030bda2002-10-11 23:41:06 +0000129extern int is_top_level_window( user_handle_t window );
Alexandre Julliard085ef062004-10-27 21:54:41 +0000130extern int is_window_visible( user_handle_t window );
Alexandre Julliard5030bda2002-10-11 23:41:06 +0000131extern int make_window_active( user_handle_t window );
Alexandre Julliard81f2a732002-03-23 20:43:52 +0000132extern struct thread *get_window_thread( user_handle_t handle );
Alexandre Julliard5ad90c02005-07-11 13:30:23 +0000133extern user_handle_t window_from_point( struct desktop *desktop, int x, int y );
Alexandre Julliard47f98212001-11-14 21:28:36 +0000134extern user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *thread );
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000135extern struct window_class *get_window_class( user_handle_t window );
136
137/* window class functions */
138
139extern void destroy_process_classes( struct process *process );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000140extern struct window_class *grab_class( struct process *process, atom_t atom,
141 void *instance, int *extra_bytes );
Alexandre Julliardbfce1512003-12-10 04:08:06 +0000142extern void release_class( struct window_class *class );
143extern atom_t get_class_atom( struct window_class *class );
Alexandre Julliardbd13ab82003-12-11 05:34:53 +0000144extern void *get_class_client_ptr( struct window_class *class );
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000145
Alexandre Julliard1bf96e02005-06-08 18:44:50 +0000146/* windows station functions */
147
Alexandre Julliard45128bd2005-06-29 20:13:36 +0000148extern struct winstation *get_process_winstation( struct process *process, unsigned int access );
Alexandre Julliard499e3432005-07-11 10:55:53 +0000149extern struct desktop *get_thread_desktop( struct thread *thread, unsigned int access );
Alexandre Julliardead9b062005-11-18 16:31:18 +0000150extern void connect_process_winstation( struct process *process, const struct unicode_str *name );
151extern void connect_process_desktop( struct process *process, const struct unicode_str *name );
Alexandre Julliard1bf96e02005-06-08 18:44:50 +0000152extern void close_thread_desktop( struct thread *thread );
153
Alexandre Julliard1a66d222001-08-28 18:44:52 +0000154#endif /* __WINE_SERVER_USER_H */