Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Wine server USER definitions |
| 3 | * |
| 4 | * Copyright (C) 2001 Alexandre Julliard |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 5 | * |
| 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 Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | #ifndef __WINE_SERVER_USER_H |
| 22 | #define __WINE_SERVER_USER_H |
| 23 | |
| 24 | #include "wine/server_protocol.h" |
| 25 | |
| 26 | struct thread; |
Alexandre Julliard | e8d86b7 | 2004-06-23 20:44:58 +0000 | [diff] [blame] | 27 | struct region; |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 28 | struct window; |
Alexandre Julliard | 805bdc5 | 2001-11-13 22:23:48 +0000 | [diff] [blame] | 29 | struct msg_queue; |
Alexandre Julliard | d55e7f1 | 2003-07-03 18:16:48 +0000 | [diff] [blame] | 30 | struct hook_table; |
Alexandre Julliard | bfce151 | 2003-12-10 04:08:06 +0000 | [diff] [blame] | 31 | struct window_class; |
Alexandre Julliard | 248f4b2 | 2005-07-07 11:29:23 +0000 | [diff] [blame] | 32 | struct atom_table; |
Alexandre Julliard | 45128bd | 2005-06-29 20:13:36 +0000 | [diff] [blame] | 33 | struct clipboard; |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 34 | |
| 35 | enum user_object |
| 36 | { |
Alexandre Julliard | 0286135 | 2002-10-29 00:41:42 +0000 | [diff] [blame] | 37 | USER_WINDOW = 1, |
| 38 | USER_HOOK |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 39 | }; |
| 40 | |
Alexandre Julliard | 8c51880 | 2005-07-08 11:37:40 +0000 | [diff] [blame] | 41 | #define DESKTOP_ATOM ((atom_t)32769) |
| 42 | |
Alexandre Julliard | 499e343 | 2005-07-11 10:55:53 +0000 | [diff] [blame] | 43 | struct 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 | |
| 53 | struct desktop |
| 54 | { |
Alexandre Julliard | f978f61 | 2006-03-06 21:02:24 +0100 | [diff] [blame] | 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 */ |
| 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 Julliard | 499e343 | 2005-07-11 10:55:53 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 65 | /* user handles functions */ |
| 66 | |
| 67 | extern user_handle_t alloc_user_handle( void *ptr, enum user_object type ); |
| 68 | extern void *get_user_object( user_handle_t handle, enum user_object type ); |
| 69 | extern void *get_user_object_handle( user_handle_t *handle, enum user_object type ); |
Alexandre Julliard | bc878ef | 2001-09-12 17:09:24 +0000 | [diff] [blame] | 70 | extern user_handle_t get_user_full_handle( user_handle_t handle ); |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 71 | extern void *free_user_handle( user_handle_t handle ); |
| 72 | extern void *next_user_handle( user_handle_t *handle, enum user_object type ); |
| 73 | |
Ulrich Czekalla | b2df5f9 | 2003-06-23 23:02:02 +0000 | [diff] [blame] | 74 | /* clipboard functions */ |
| 75 | |
| 76 | extern void cleanup_clipboard_thread( struct thread *thread ); |
| 77 | |
Alexandre Julliard | 14e68ba | 2002-11-20 19:54:32 +0000 | [diff] [blame] | 78 | /* hook functions */ |
| 79 | |
Alexandre Julliard | ca3ac8f | 2003-07-11 21:55:58 +0000 | [diff] [blame] | 80 | extern void remove_thread_hooks( struct thread *thread ); |
Alexandre Julliard | 6334235 | 2005-05-11 13:03:15 +0000 | [diff] [blame] | 81 | extern unsigned int get_active_hooks(void); |
Alexandre Julliard | 14e68ba | 2002-11-20 19:54:32 +0000 | [diff] [blame] | 82 | |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 83 | /* queue functions */ |
| 84 | |
Alexandre Julliard | 31022d6 | 2002-08-16 23:30:41 +0000 | [diff] [blame] | 85 | extern void free_msg_queue( struct thread *thread ); |
Alexandre Julliard | d55e7f1 | 2003-07-03 18:16:48 +0000 | [diff] [blame] | 86 | extern struct hook_table *get_queue_hooks( struct thread *thread ); |
| 87 | extern void set_queue_hooks( struct thread *thread, struct hook_table *hooks ); |
Alexandre Julliard | 805bdc5 | 2001-11-13 22:23:48 +0000 | [diff] [blame] | 88 | extern void inc_queue_paint_count( struct thread *thread, int incr ); |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 89 | extern void queue_cleanup_window( struct thread *thread, user_handle_t win ); |
Alexandre Julliard | d70a253 | 2005-04-26 14:31:33 +0000 | [diff] [blame] | 90 | extern int init_thread_queue( struct thread *thread ); |
Alexandre Julliard | ab5063b | 2002-10-11 18:50:15 +0000 | [diff] [blame] | 91 | extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to ); |
Alexandre Julliard | 5ad90c0 | 2005-07-11 13:30:23 +0000 | [diff] [blame] | 92 | extern void detach_thread_input( struct thread *thread_from ); |
Alexandre Julliard | 81f2a73 | 2002-03-23 20:43:52 +0000 | [diff] [blame] | 93 | extern void post_message( user_handle_t win, unsigned int message, |
| 94 | unsigned int wparam, unsigned int lparam ); |
Dmitry Timoshkov | 6dba0a7 | 2005-02-03 16:40:20 +0000 | [diff] [blame] | 95 | extern 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 Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 100 | |
Alexandre Julliard | e8d86b7 | 2004-06-23 20:44:58 +0000 | [diff] [blame] | 101 | /* region functions */ |
| 102 | |
Alexandre Julliard | 43b2826 | 2005-02-22 19:42:35 +0000 | [diff] [blame] | 103 | extern struct region *create_empty_region(void); |
Alexandre Julliard | 618a7e5 | 2004-06-29 03:53:25 +0000 | [diff] [blame] | 104 | extern struct region *create_region_from_req_data( const void *data, size_t size ); |
Alexandre Julliard | e8d86b7 | 2004-06-23 20:44:58 +0000 | [diff] [blame] | 105 | extern void free_region( struct region *region ); |
| 106 | extern void set_region_rect( struct region *region, const rectangle_t *rect ); |
Alexandre Julliard | 807fe07 | 2004-09-17 18:20:11 +0000 | [diff] [blame] | 107 | extern rectangle_t *get_region_data( const struct region *region, size_t max_size, |
| 108 | size_t *total_size ); |
| 109 | extern rectangle_t *get_region_data_and_free( struct region *region, size_t max_size, |
| 110 | size_t *total_size ); |
Alexandre Julliard | e8d86b7 | 2004-06-23 20:44:58 +0000 | [diff] [blame] | 111 | extern int is_region_empty( const struct region *region ); |
| 112 | extern void get_region_extents( const struct region *region, rectangle_t *rect ); |
| 113 | extern void offset_region( struct region *region, int x, int y ); |
| 114 | extern struct region *copy_region( struct region *dst, const struct region *src ); |
| 115 | extern struct region *intersect_region( struct region *dst, const struct region *src1, |
| 116 | const struct region *src2 ); |
| 117 | extern struct region *subtract_region( struct region *dst, const struct region *src1, |
| 118 | const struct region *src2 ); |
| 119 | extern struct region *union_region( struct region *dst, const struct region *src1, |
| 120 | const struct region *src2 ); |
Alexandre Julliard | 5e128dd | 2004-09-08 01:34:22 +0000 | [diff] [blame] | 121 | extern struct region *xor_region( struct region *dst, const struct region *src1, |
| 122 | const struct region *src2 ); |
Alexandre Julliard | 4616dcb | 2004-07-20 22:17:38 +0000 | [diff] [blame] | 123 | extern int point_in_region( struct region *region, int x, int y ); |
Alexandre Julliard | edc90a9 | 2004-09-01 22:49:14 +0000 | [diff] [blame] | 124 | extern int rect_in_region( struct region *region, const rectangle_t *rect ); |
Alexandre Julliard | e8d86b7 | 2004-06-23 20:44:58 +0000 | [diff] [blame] | 125 | |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 126 | /* window functions */ |
| 127 | |
Alexandre Julliard | f978f61 | 2006-03-06 21:02:24 +0100 | [diff] [blame] | 128 | extern struct process *get_top_window_owner( struct desktop *desktop ); |
| 129 | extern void close_desktop_window( struct desktop *desktop ); |
Alexandre Julliard | 5ad90c0 | 2005-07-11 13:30:23 +0000 | [diff] [blame] | 130 | extern void destroy_window( struct window *win ); |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 131 | extern void destroy_thread_windows( struct thread *thread ); |
Alexandre Julliard | a09da0c | 2001-09-21 21:08:40 +0000 | [diff] [blame] | 132 | extern int is_child_window( user_handle_t parent, user_handle_t child ); |
Alexandre Julliard | 5030bda | 2002-10-11 23:41:06 +0000 | [diff] [blame] | 133 | extern int is_top_level_window( user_handle_t window ); |
Alexandre Julliard | 085ef06 | 2004-10-27 21:54:41 +0000 | [diff] [blame] | 134 | extern int is_window_visible( user_handle_t window ); |
Alexandre Julliard | 5030bda | 2002-10-11 23:41:06 +0000 | [diff] [blame] | 135 | extern int make_window_active( user_handle_t window ); |
Alexandre Julliard | 81f2a73 | 2002-03-23 20:43:52 +0000 | [diff] [blame] | 136 | extern struct thread *get_window_thread( user_handle_t handle ); |
Alexandre Julliard | 5ad90c0 | 2005-07-11 13:30:23 +0000 | [diff] [blame] | 137 | extern user_handle_t window_from_point( struct desktop *desktop, int x, int y ); |
Alexandre Julliard | 47f9821 | 2001-11-14 21:28:36 +0000 | [diff] [blame] | 138 | extern user_handle_t find_window_to_repaint( user_handle_t parent, struct thread *thread ); |
Alexandre Julliard | bfce151 | 2003-12-10 04:08:06 +0000 | [diff] [blame] | 139 | extern struct window_class *get_window_class( user_handle_t window ); |
| 140 | |
| 141 | /* window class functions */ |
| 142 | |
| 143 | extern void destroy_process_classes( struct process *process ); |
Alexandre Julliard | bd13ab8 | 2003-12-11 05:34:53 +0000 | [diff] [blame] | 144 | extern struct window_class *grab_class( struct process *process, atom_t atom, |
| 145 | void *instance, int *extra_bytes ); |
Alexandre Julliard | bfce151 | 2003-12-10 04:08:06 +0000 | [diff] [blame] | 146 | extern void release_class( struct window_class *class ); |
Alexandre Julliard | 251be54 | 2006-03-06 20:37:52 +0100 | [diff] [blame] | 147 | extern int is_desktop_class( struct window_class *class ); |
Alexandre Julliard | bfce151 | 2003-12-10 04:08:06 +0000 | [diff] [blame] | 148 | extern atom_t get_class_atom( struct window_class *class ); |
Alexandre Julliard | bd13ab8 | 2003-12-11 05:34:53 +0000 | [diff] [blame] | 149 | extern void *get_class_client_ptr( struct window_class *class ); |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 150 | |
Alexandre Julliard | 1bf96e0 | 2005-06-08 18:44:50 +0000 | [diff] [blame] | 151 | /* windows station functions */ |
| 152 | |
Alexandre Julliard | 45128bd | 2005-06-29 20:13:36 +0000 | [diff] [blame] | 153 | extern struct winstation *get_process_winstation( struct process *process, unsigned int access ); |
Alexandre Julliard | 499e343 | 2005-07-11 10:55:53 +0000 | [diff] [blame] | 154 | extern struct desktop *get_thread_desktop( struct thread *thread, unsigned int access ); |
Alexandre Julliard | 90af5a0 | 2006-03-27 12:57:17 +0200 | [diff] [blame] | 155 | extern void connect_process_winstation( struct process *process, struct thread *parent ); |
| 156 | extern void set_process_default_desktop( struct process *process, struct desktop *desktop, |
| 157 | obj_handle_t handle ); |
Alexandre Julliard | f978f61 | 2006-03-06 21:02:24 +0100 | [diff] [blame] | 158 | extern void close_process_desktop( struct process *process ); |
Alexandre Julliard | 1bf96e0 | 2005-06-08 18:44:50 +0000 | [diff] [blame] | 159 | extern void close_thread_desktop( struct thread *thread ); |
| 160 | |
Alexandre Julliard | 1a66d22 | 2001-08-28 18:44:52 +0000 | [diff] [blame] | 161 | #endif /* __WINE_SERVER_USER_H */ |