From: Rémi Bernon rbernon@codeweavers.com
--- server/file.h | 11 +++--- server/mapping.c | 8 ++-- server/queue.c | 98 ++++++++++++++++++++++++------------------------ server/user.h | 2 +- 4 files changed, 59 insertions(+), 60 deletions(-)
diff --git a/server/file.h b/server/file.h index 59b73c0245c..8fc82a460ff 100644 --- a/server/file.h +++ b/server/file.h @@ -193,15 +193,14 @@ extern struct mapping *create_session_mapping( struct object *root, const struct unsigned int attr, const struct security_descriptor *sd ); extern void set_session_mapping( struct mapping *mapping );
-extern const volatile void *alloc_shared_object(void); -extern void free_shared_object( const volatile void *object_shm ); -extern void invalidate_shared_object( const volatile void *object_shm ); -extern struct obj_locator get_shared_object_locator( const volatile void *object_shm ); +extern volatile void *alloc_shared_object(void); +extern void free_shared_object( volatile void *object_shm ); +extern void invalidate_shared_object( volatile void *object_shm ); +extern struct obj_locator get_shared_object_locator( volatile void *object_shm );
#define SHARED_WRITE_BEGIN( object_shm, type ) \ do { \ - const type *__shared = (object_shm); \ - type *shared = (type *)__shared; \ + type *shared = (object_shm); \ shared_object_t *__obj = CONTAINING_RECORD( shared, shared_object_t, shm ); \ LONG64 __seq = __obj->seq + 1, __end = __seq + 1; \ assert( (__seq & 1) != 0 ); \ diff --git a/server/mapping.c b/server/mapping.c index 247b28cf6f5..a74573efe0e 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -1375,7 +1375,7 @@ static struct session_block *find_free_session_block( mem_size_t size ) return grow_session_mapping( size ); }
-const volatile void *alloc_shared_object(void) +volatile void *alloc_shared_object(void) { struct session_object *object; struct list *ptr; @@ -1407,7 +1407,7 @@ const volatile void *alloc_shared_object(void) return &object->obj.shm; }
-void free_shared_object( const volatile void *object_shm ) +void free_shared_object( volatile void *object_shm ) { struct session_object *object = CONTAINING_RECORD( object_shm, struct session_object, obj.shm );
@@ -1422,7 +1422,7 @@ void free_shared_object( const volatile void *object_shm ) }
/* invalidate client caches for a shared object by giving it a new id */ -void invalidate_shared_object( const volatile void *object_shm ) +void invalidate_shared_object( volatile void *object_shm ) { struct session_object *object = CONTAINING_RECORD( object_shm, struct session_object, obj.shm );
@@ -1433,7 +1433,7 @@ void invalidate_shared_object( const volatile void *object_shm ) SHARED_WRITE_END; }
-struct obj_locator get_shared_object_locator( const volatile void *object_shm ) +struct obj_locator get_shared_object_locator( volatile void *object_shm ) { struct session_object *object = CONTAINING_RECORD( object_shm, struct session_object, obj.shm ); struct obj_locator locator = {.offset = object->offset, .id = object->obj.id}; diff --git a/server/queue.c b/server/queue.c index b4b6069f927..cfbc9e6c89b 100644 --- a/server/queue.c +++ b/server/queue.c @@ -109,7 +109,7 @@ struct thread_input int caret_state; /* caret on/off state */ struct list msg_list; /* list of hardware messages */ unsigned char desktop_keystate[256]; /* desktop keystate when keystate was synced */ - const input_shm_t *shared; /* thread input in session shared memory */ + input_shm_t *shared; /* thread input in session shared memory */ };
struct msg_queue @@ -133,7 +133,7 @@ struct msg_queue struct hook_table *hooks; /* hook table */ timeout_t last_get_msg; /* time of last get message call */ int keystate_lock; /* owns an input keystate lock */ - const queue_shm_t *shared; /* queue in session shared memory */ + queue_shm_t *shared; /* queue in session shared memory */ };
struct hotkey @@ -359,8 +359,8 @@ void free_msg_queue( struct thread *thread ) /* synchronize thread input keystate with the desktop */ static void sync_input_keystate( struct thread_input *input ) { - const input_shm_t *input_shm = input->shared; - const desktop_shm_t *desktop_shm; + input_shm_t *input_shm = input->shared; + desktop_shm_t *desktop_shm; int i;
if (!input->desktop || input_shm->keystate_lock) return; @@ -380,7 +380,7 @@ static void sync_input_keystate( struct thread_input *input ) /* locks thread input keystate to prevent synchronization */ static void lock_input_keystate( struct thread_input *input ) { - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared;
SHARED_WRITE_BEGIN( input_shm, input_shm_t ) { @@ -392,7 +392,7 @@ static void lock_input_keystate( struct thread_input *input ) /* unlock the thread input keystate and synchronize it again */ static void unlock_input_keystate( struct thread_input *input ) { - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared;
SHARED_WRITE_BEGIN( input_shm, input_shm_t ) { @@ -407,7 +407,7 @@ static void unlock_input_keystate( struct thread_input *input ) static int assign_thread_input( struct thread *thread, struct thread_input *new_input ) { struct msg_queue *queue = thread->queue; - const input_shm_t *input_shm; + input_shm_t *input_shm;
if (!queue) { @@ -471,7 +471,7 @@ static struct message *alloc_hardware_message( lparam_t info, struct hw_msg_sour
static int is_cursor_clipped( struct desktop *desktop ) { - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; struct rectangle top_rect, clip_rect = desktop_shm->cursor.clip; get_virtual_screen_rect( desktop, &top_rect, 1 ); return !is_rect_equal( &clip_rect, &top_rect ); @@ -481,7 +481,7 @@ static void queue_cursor_message( struct desktop *desktop, user_handle_t win, un lparam_t wparam, lparam_t lparam ) { static const struct hw_msg_source source = { IMDT_UNAVAILABLE, IMO_SYSTEM }; - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; struct thread_input *input; struct message *msg;
@@ -518,7 +518,7 @@ static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t
if (updated && (input = get_desktop_cursor_thread_input( desktop ))) { - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared; user_handle_t handle = input_shm->cursor_count < 0 ? 0 : input_shm->cursor; /* when clipping send the message to the foreground window as well, as some driver have an artificial overlay window */ if (is_cursor_clipped( desktop )) queue_cursor_message( desktop, 0, WM_WINE_SETCURSOR, win, handle ); @@ -530,7 +530,7 @@ static int update_desktop_cursor_window( struct desktop *desktop, user_handle_t
static int update_desktop_cursor_pos( struct desktop *desktop, user_handle_t win, int x, int y ) { - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; int updated; unsigned int time = get_tick_count();
@@ -588,7 +588,7 @@ static void set_cursor_pos( struct desktop *desktop, int x, int y ) /* sync cursor position after window change */ void update_cursor_pos( struct desktop *desktop ) { - const desktop_shm_t *desktop_shm; + desktop_shm_t *desktop_shm;
desktop_shm = desktop->shared; set_cursor_pos( desktop, desktop_shm->cursor.x, desktop_shm->cursor.y ); @@ -598,7 +598,7 @@ void update_cursor_pos( struct desktop *desktop ) static void get_message_defaults( struct msg_queue *queue, int *x, int *y, unsigned int *time ) { struct desktop *desktop = queue->input->desktop; - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared;
*x = desktop_shm->cursor.x; *y = desktop_shm->cursor.y; @@ -608,7 +608,7 @@ static void get_message_defaults( struct msg_queue *queue, int *x, int *y, unsig /* set the cursor clip rectangle */ void set_clip_rectangle( struct desktop *desktop, const struct rectangle *rect, unsigned int flags, int reset ) { - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; struct rectangle top_rect, new_rect; unsigned int old_flags; int x, y; @@ -650,7 +650,7 @@ void set_clip_rectangle( struct desktop *desktop, const struct rectangle *rect, /* change the foreground input and reset the cursor clip rect */ static void set_foreground_input( struct desktop *desktop, struct thread_input *input ) { - const input_shm_t *input_shm, *old_input_shm; + input_shm_t *input_shm, *old_input_shm; shared_object_t dummy_obj = {0};
if (desktop->foreground_input == input) return; @@ -706,7 +706,7 @@ void add_queue_hook_count( struct thread *thread, unsigned int index, int count /* check the queue status */ static inline int is_signaled( struct msg_queue *queue ) { - const queue_shm_t *queue_shm = queue->shared; + queue_shm_t *queue_shm = queue->shared; return (queue_shm->wake_bits & queue_shm->wake_mask) || (queue_shm->changed_bits & queue_shm->changed_mask); } @@ -714,7 +714,7 @@ static inline int is_signaled( struct msg_queue *queue ) /* set some queue bits */ static inline void set_queue_bits( struct msg_queue *queue, unsigned int bits ) { - const queue_shm_t *queue_shm = queue->shared; + queue_shm_t *queue_shm = queue->shared;
if (bits & (QS_KEY | QS_MOUSEBUTTON)) { @@ -735,7 +735,7 @@ static inline void set_queue_bits( struct msg_queue *queue, unsigned int bits ) /* clear some queue bits */ static inline void clear_queue_bits( struct msg_queue *queue, unsigned int bits ) { - const queue_shm_t *queue_shm = queue->shared; + queue_shm_t *queue_shm = queue->shared;
SHARED_WRITE_BEGIN( queue_shm, queue_shm_t ) { @@ -1300,7 +1300,7 @@ static void msg_queue_remove_queue(struct object *obj, struct wait_queue_entry * static void msg_queue_dump( struct object *obj, int verbose ) { struct msg_queue *queue = (struct msg_queue *)obj; - const queue_shm_t *queue_shm = queue->shared; + queue_shm_t *queue_shm = queue->shared; fprintf( stderr, "Msg queue bits=%x mask=%x\n", queue_shm->wake_bits, queue_shm->wake_mask ); } @@ -1325,7 +1325,7 @@ static int msg_queue_signaled( struct object *obj, struct wait_queue_entry *entr static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; - const queue_shm_t *queue_shm = queue->shared; + queue_shm_t *queue_shm = queue->shared;
SHARED_WRITE_BEGIN( queue_shm, queue_shm_t ) { @@ -1340,7 +1340,7 @@ static void msg_queue_destroy( struct object *obj ) struct msg_queue *queue = (struct msg_queue *)obj; struct list *ptr; struct hotkey *hotkey, *hotkey2; - const input_shm_t *input_shm = queue->input->shared; + input_shm_t *input_shm = queue->input->shared; int i;
cleanup_results( queue ); @@ -1393,7 +1393,7 @@ static void msg_queue_poll_event( struct fd *fd, int event ) static void thread_input_dump( struct object *obj, int verbose ) { struct thread_input *input = (struct thread_input *)obj; - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared; fprintf( stderr, "Thread input focus=%08x capture=%08x active=%08x\n", input_shm->focus, input_shm->capture, input_shm->active ); } @@ -1416,7 +1416,7 @@ static void thread_input_destroy( struct object *obj ) static inline void thread_input_cleanup_window( struct msg_queue *queue, user_handle_t window ) { struct thread_input *input = queue->input; - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared;
SHARED_WRITE_BEGIN( input_shm, input_shm_t ) { @@ -1454,7 +1454,7 @@ static int check_queue_input_window( struct msg_queue *queue, user_handle_t wind void check_thread_queue_idle( struct thread *thread ) { struct msg_queue *queue = thread->queue; - const queue_shm_t *queue_shm = queue->shared; + queue_shm_t *queue_shm = queue->shared;
if ((queue_shm->wake_mask & QS_SMRESULT)) return; if (thread->process->idle_event) set_event( thread->process->idle_event ); @@ -1488,7 +1488,7 @@ int attach_thread_input( struct thread *thread_from, struct thread *thread_to )
if (thread_from->queue) { - const input_shm_t *old_input_shm, *input_shm; + input_shm_t *old_input_shm, *input_shm; old_input = thread_from->queue->input; old_input_shm = old_input->shared; input_shm = input->shared; @@ -1504,7 +1504,7 @@ int attach_thread_input( struct thread *thread_from, struct thread *thread_to ) ret = assign_thread_input( thread_from, input ); if (ret) { - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared; SHARED_WRITE_BEGIN( input_shm, input_shm_t ) { memset( (void *)shared->keystate, 0, sizeof(shared->keystate) ); @@ -1523,7 +1523,7 @@ void detach_thread_input( struct thread *thread_from )
if ((input = create_thread_input( thread_from ))) { - const input_shm_t *old_input_shm, *input_shm; + input_shm_t *old_input_shm, *input_shm; old_input_shm = old_input->shared; input_shm = input->shared;
@@ -1767,7 +1767,7 @@ static void update_key_state( volatile unsigned char *keystate, unsigned int msg
static void update_thread_input_key_state( struct thread_input *input, unsigned int msg, lparam_t wparam ) { - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared; SHARED_WRITE_BEGIN( input_shm, input_shm_t ) { update_key_state( shared->keystate, msg, wparam, 0 ); @@ -1816,7 +1816,7 @@ static void release_hardware_message( struct msg_queue *queue, unsigned int hw_i
static int queue_hotkey_message( struct desktop *desktop, struct message *msg ) { - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; struct hotkey *hotkey; unsigned int modifiers = 0;
@@ -1857,7 +1857,7 @@ static user_handle_t find_hardware_message_window( struct desktop *desktop, stru struct message *msg, unsigned int *msg_code, struct thread **thread ) { - const input_shm_t *input_shm = input ? input->shared : NULL; + input_shm_t *input_shm = input ? input->shared : NULL; user_handle_t win = 0;
*thread = NULL; @@ -1930,7 +1930,7 @@ static unsigned int get_rawinput_device_flags( struct process *process, struct m /* queue a hardware message into a given thread input */ static void queue_hardware_message( struct desktop *desktop, struct message *msg, int always_queue ) { - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; user_handle_t win; struct thread *thread; struct thread_input *input; @@ -2042,7 +2042,7 @@ static struct thread *get_foreground_thread( struct desktop *desktop, user_handl /* if desktop has no foreground process, assume the receiving window is */ if (desktop->foreground_input) { - const input_shm_t *input_shm = desktop->foreground_input->shared; + input_shm_t *input_shm = desktop->foreground_input->shared; return get_window_thread( input_shm->focus ); } if (window) return get_window_thread( window ); @@ -2247,7 +2247,7 @@ static void dispatch_rawinput_message( struct desktop *desktop, struct rawinput_ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, const union hw_input *input, unsigned int origin, struct msg_queue *sender ) { - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; struct hardware_msg_data *msg_data; struct rawinput_message raw_msg; struct message *msg; @@ -2372,7 +2372,7 @@ static void stop_key_repeat( struct desktop *desktop ) static int queue_keyboard_message( struct desktop *desktop, user_handle_t win, const union hw_input *input, unsigned int origin, struct msg_queue *sender, int repeat ) { - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; struct hw_msg_source source = { IMDT_KEYBOARD, origin }; struct hardware_msg_data *msg_data; struct message *msg; @@ -2563,7 +2563,7 @@ static void queue_pointer_message( struct pointer *pointer, int repeated ) }; struct hw_msg_source source = { IMDT_UNAVAILABLE, IMDT_TOUCH }; struct desktop *desktop = pointer->desktop; - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; const union hw_input *input = &pointer->input; unsigned int i, wparam = input->hw.wparam; timeout_t time = get_tick_count(); @@ -2642,7 +2642,7 @@ static struct pointer *find_pointer_from_id( struct desktop *desktop, unsigned i static void queue_custom_hardware_message( struct desktop *desktop, user_handle_t win, unsigned int origin, const union hw_input *input ) { - const desktop_shm_t *desktop_shm = desktop->shared; + desktop_shm_t *desktop_shm = desktop->shared; struct hw_msg_source source = { IMDT_UNAVAILABLE, origin }; struct thread *foreground; struct pointer *pointer; @@ -3140,7 +3140,7 @@ DECL_HANDLER(set_queue_mask)
if (queue) { - const queue_shm_t *queue_shm = queue->shared; + queue_shm_t *queue_shm = queue->shared;
SHARED_WRITE_BEGIN( queue_shm, queue_shm_t ) { @@ -3176,7 +3176,7 @@ DECL_HANDLER(get_queue_status) struct msg_queue *queue = current->queue; if (queue) { - const queue_shm_t *queue_shm = queue->shared; + queue_shm_t *queue_shm = queue->shared;
reply->wake_bits = queue_shm->wake_bits; reply->changed_bits = queue_shm->changed_bits; @@ -3277,7 +3277,7 @@ DECL_HANDLER(send_hardware_message) struct desktop *desktop; unsigned int origin = (req->flags & SEND_HWMSG_INJECTED ? IMO_INJECTED : IMO_HARDWARE); struct msg_queue *sender = req->flags & SEND_HWMSG_INJECTED ? get_current_queue() : NULL; - const desktop_shm_t *desktop_shm; + desktop_shm_t *desktop_shm; int wait = 0;
if (!(desktop = get_hardware_input_desktop( req->win ))) return; @@ -3334,7 +3334,7 @@ DECL_HANDLER(get_message) struct list *ptr; struct msg_queue *queue = get_current_queue(); user_handle_t get_win = get_user_full_handle( req->get_win ); - const queue_shm_t *queue_shm; + queue_shm_t *queue_shm; unsigned int filter;
if (get_win && get_win != 1 && get_win != -1 && !get_user_object( get_win, USER_WINDOW )) @@ -3804,7 +3804,7 @@ DECL_HANDLER(get_key_state) else { struct msg_queue *queue = get_current_queue(); - const input_shm_t *input_shm = queue->input->shared; + input_shm_t *input_shm = queue->input->shared; unsigned char *keystate = (void *)input_shm->keystate; sync_input_keystate( queue->input ); reply->state = keystate[req->key & 0xff]; @@ -3818,7 +3818,7 @@ DECL_HANDLER(set_key_state) struct msg_queue *queue = get_current_queue(); struct desktop *desktop = queue->input->desktop; data_size_t size = min( 256, get_req_data_size() ); - const input_shm_t *input_shm = queue->input->shared; + input_shm_t *input_shm = queue->input->shared;
SHARED_WRITE_BEGIN( input_shm, input_shm_t ) { @@ -3879,7 +3879,7 @@ DECL_HANDLER(set_focus_window) reply->previous = 0; if (queue && check_queue_input_window( queue, req->handle )) { - const input_shm_t *input_shm = queue->input->shared; + input_shm_t *input_shm = queue->input->shared; SHARED_WRITE_BEGIN( input_shm, input_shm_t ) { reply->previous = shared->focus; @@ -3900,7 +3900,7 @@ DECL_HANDLER(set_active_window) { if (!req->handle || make_window_active( req->handle )) { - const input_shm_t *input_shm = queue->input->shared; + input_shm_t *input_shm = queue->input->shared; SHARED_WRITE_BEGIN( input_shm, input_shm_t ) { reply->previous = shared->active; @@ -3922,7 +3922,7 @@ DECL_HANDLER(set_capture_window) if (queue && check_queue_input_window( queue, req->handle )) { struct thread_input *input = queue->input; - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared;
/* if in menu mode, reject all requests to change focus, except if the menu bit is set */ if (input_shm->menu_owner && !(req->flags & CAPTURE_MENU)) @@ -3954,7 +3954,7 @@ DECL_HANDLER(set_caret_window) if (queue && check_queue_input_window( queue, req->handle )) { struct thread_input *input = queue->input; - const input_shm_t *input_shm = input->shared; + input_shm_t *input_shm = input->shared; user_handle_t caret = get_user_full_handle(req->handle);
reply->previous = input_shm->caret; @@ -3977,7 +3977,7 @@ DECL_HANDLER(set_caret_window) DECL_HANDLER(set_caret_info) { struct msg_queue *queue = get_current_queue(); - const input_shm_t *input_shm; + input_shm_t *input_shm; struct thread_input *input;
if (!queue) return; @@ -4036,9 +4036,9 @@ DECL_HANDLER(set_cursor) struct msg_queue *queue = get_current_queue(); user_handle_t prev_cursor, new_cursor; struct thread_input *input; - const input_shm_t *input_shm; + input_shm_t *input_shm; struct desktop *desktop; - const desktop_shm_t *desktop_shm; + desktop_shm_t *desktop_shm;
if (!queue) return; input = queue->input; diff --git a/server/user.h b/server/user.h index ce463b9395d..3040dffee75 100644 --- a/server/user.h +++ b/server/user.h @@ -94,7 +94,7 @@ struct desktop struct key_repeat key_repeat; /* key auto-repeat */ unsigned int clip_flags; /* last cursor clip flags */ user_handle_t cursor_win; /* window that contains the cursor */ - const desktop_shm_t *shared; /* desktop session shared memory */ + desktop_shm_t *shared; /* desktop session shared memory */ };
/* user handles functions */
For !7610
To be clear, I don't think !7610 depends on it.