From ab28cf3bbac095b1ec05d62d8e8e6045ead849e8 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard <julliard@winehq.org> Date: Fri, 22 Nov 2024 15:22:15 +0100 Subject: [PATCH] server: Use an explicit struct instead of a typedef for rectangles. --- include/wine/server.h | 10 +-- include/wine/server_protocol.h | 40 ++++++------ server/protocol.def | 40 ++++++------ server/queue.c | 8 +-- server/region.c | 112 ++++++++++++++++----------------- server/request_handlers.h | 2 +- server/request_trace.h | 2 +- server/trace.c | 4 +- server/user.h | 38 +++++------ server/window.c | 78 +++++++++++------------ tools/make_requests | 2 +- 11 files changed, 168 insertions(+), 168 deletions(-) diff --git a/include/wine/server.h b/include/wine/server.h index 081c71492fa..458c33c27b5 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -118,8 +118,8 @@ static inline void *wine_server_get_ptr( client_ptr_t ptr ) return (void *)(ULONG_PTR)ptr; } -/* convert a server rectangle_t to a RECT */ -static inline RECT wine_server_get_rect( rectangle_t rectangle ) +/* convert a server struct rectangle to a RECT */ +static inline RECT wine_server_get_rect( struct rectangle rectangle ) { RECT rect = { @@ -131,10 +131,10 @@ static inline RECT wine_server_get_rect( rectangle_t rectangle ) return rect; } -/* convert a RECT to a server rectangle_t */ -static inline rectangle_t wine_server_rectangle( RECT rect ) +/* convert a RECT to a server struct rectangle */ +static inline struct rectangle wine_server_rectangle( RECT rect ) { - rectangle_t rectangle = + struct rectangle rectangle = { .left = rect.left, .top = rect.top, diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 08857521ac8..cff351d5f20 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -251,13 +251,13 @@ struct property_data }; -typedef struct +struct rectangle { int left; int top; int right; int bottom; -} rectangle_t; +}; struct async_data @@ -882,10 +882,10 @@ struct directory_entry struct monitor_info { - rectangle_t raw; - rectangle_t virt; - unsigned int flags; - unsigned int dpi; + struct rectangle raw; + struct rectangle virt; + unsigned int flags; + unsigned int dpi; }; #define MONITOR_FLAG_PRIMARY 0x01 #define MONITOR_FLAG_CLONE 0x02 @@ -955,7 +955,7 @@ struct shared_cursor int x; int y; unsigned int last_change; - rectangle_t clip; + struct rectangle clip; }; typedef volatile struct @@ -983,7 +983,7 @@ typedef volatile struct user_handle_t menu_owner; user_handle_t move_size; user_handle_t caret; - rectangle_t caret_rect; + struct rectangle caret_rect; user_handle_t cursor; int cursor_count; unsigned char keystate[256]; @@ -3618,8 +3618,8 @@ struct set_window_pos_request unsigned int monitor_dpi; user_handle_t handle; user_handle_t previous; - rectangle_t window; - rectangle_t client; + struct rectangle window; + struct rectangle client; /* VARARG(valid,rectangles); */ char __pad_60[4]; }; @@ -3646,8 +3646,8 @@ struct get_window_rectangles_request struct get_window_rectangles_reply { struct reply_header __header; - rectangle_t window; - rectangle_t client; + struct rectangle window; + struct rectangle client; }; enum coords_relative { @@ -3716,8 +3716,8 @@ struct get_visible_region_reply { struct reply_header __header; user_handle_t top_win; - rectangle_t top_rect; - rectangle_t win_rect; + struct rectangle top_rect; + struct rectangle win_rect; unsigned int paint_flags; data_size_t total_size; /* VARARG(region,rectangles); */ @@ -3736,7 +3736,7 @@ struct get_window_region_request struct get_window_region_reply { struct reply_header __header; - rectangle_t visible_rect; + struct rectangle visible_rect; data_size_t total_size; /* VARARG(region,rectangles); */ char __pad_28[4]; @@ -3791,7 +3791,7 @@ struct update_window_zorder_request { struct request_header __header; user_handle_t window; - rectangle_t rect; + struct rectangle rect; }; struct update_window_zorder_reply { @@ -4277,7 +4277,7 @@ struct set_caret_window_reply { struct reply_header __header; user_handle_t previous; - rectangle_t old_rect; + struct rectangle old_rect; int old_hide; int old_state; char __pad_36[4]; @@ -4300,7 +4300,7 @@ struct set_caret_info_reply { struct reply_header __header; user_handle_t full_handle; - rectangle_t old_rect; + struct rectangle old_rect; int old_hide; int old_state; char __pad_36[4]; @@ -5628,7 +5628,7 @@ struct set_cursor_request int show_count; int x; int y; - rectangle_t clip; + struct rectangle clip; }; struct set_cursor_reply { @@ -5639,7 +5639,7 @@ struct set_cursor_reply int prev_y; int new_x; int new_y; - rectangle_t new_clip; + struct rectangle new_clip; unsigned int last_change; char __pad_52[4]; }; diff --git a/server/protocol.def b/server/protocol.def index 6e518843086..bd0307c5d79 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -267,13 +267,13 @@ struct property_data }; /* structure to specify window rectangles */ -typedef struct +struct rectangle { int left; int top; int right; int bottom; -} rectangle_t; +}; /* structure for parameters of async I/O calls */ struct async_data @@ -898,10 +898,10 @@ struct directory_entry struct monitor_info { - rectangle_t raw; /* host / physical position of the monitor rect */ - rectangle_t virt; /* client / virtual position of the monitor rect */ - unsigned int flags; /* MONITOR_FLAG_* flags for the monitor */ - unsigned int dpi; /* physical DPI for the monitor */ + struct rectangle raw; /* host / physical position of the monitor rect */ + struct rectangle virt; /* client / virtual position of the monitor rect */ + unsigned int flags; /* MONITOR_FLAG_* flags for the monitor */ + unsigned int dpi; /* physical DPI for the monitor */ }; #define MONITOR_FLAG_PRIMARY 0x01 #define MONITOR_FLAG_CLONE 0x02 @@ -971,7 +971,7 @@ struct shared_cursor int x; /* cursor position */ int y; unsigned int last_change; /* time of last position change */ - rectangle_t clip; /* cursor clip rectangle */ + struct rectangle clip; /* cursor clip rectangle */ }; typedef volatile struct @@ -999,7 +999,7 @@ typedef volatile struct user_handle_t menu_owner; /* handle to the menu owner */ user_handle_t move_size; /* handle to the moving/resizing window */ user_handle_t caret; /* handle to the caret window */ - rectangle_t caret_rect; /* caret rectangle */ + struct rectangle caret_rect; /* caret rectangle */ user_handle_t cursor; /* handle to the cursor */ int cursor_count; /* cursor show count */ unsigned char keystate[256]; /* key state */ @@ -2684,8 +2684,8 @@ enum message_type unsigned int monitor_dpi; /* DPI of the window's monitor */ user_handle_t handle; /* handle to the window */ user_handle_t previous; /* previous window in Z order */ - rectangle_t window; /* window rectangle (in parent coords) */ - rectangle_t client; /* client rectangle (in parent coords) */ + struct rectangle window; /* window rectangle (in parent coords) */ + struct rectangle client; /* client rectangle (in parent coords) */ VARARG(valid,rectangles); /* valid rectangles from WM_NCCALCSIZE (in parent coords) */ @REPLY unsigned int new_style; /* new window style */ @@ -2703,8 +2703,8 @@ enum message_type int relative; /* coords relative to (see below) */ int dpi; /* DPI to map to, or zero for per-monitor DPI */ @REPLY - rectangle_t window; /* window rectangle */ - rectangle_t client; /* client rectangle */ + struct rectangle window; /* window rectangle */ + struct rectangle client; /* client rectangle */ @END enum coords_relative { @@ -2749,8 +2749,8 @@ enum coords_relative unsigned int flags; /* DCX flags */ @REPLY user_handle_t top_win; /* top window to clip against */ - rectangle_t top_rect; /* top window visible rect with screen coords */ - rectangle_t win_rect; /* window rect in screen coords */ + struct rectangle top_rect; /* top window visible rect with screen coords */ + struct rectangle win_rect; /* window rect in screen coords */ unsigned int paint_flags; /* paint flags (from SET_WINPOS_* flags) */ data_size_t total_size; /* total size of the resulting region */ VARARG(region,rectangles); /* list of rectangles for the region (in screen coords) */ @@ -2762,7 +2762,7 @@ enum coords_relative user_handle_t window; /* handle to the window */ int surface; /* get the visible surface region */ @REPLY - rectangle_t visible_rect; /* window visible rect in screen coords */ + struct rectangle visible_rect;/* window visible rect in screen coords */ data_size_t total_size; /* total size of the resulting region */ VARARG(region,rectangles); /* list of rectangles for the region (in window coords) */ @END @@ -2801,7 +2801,7 @@ enum coords_relative /* Update the z order of a window so that a given rectangle is fully visible */ @REQ(update_window_zorder) user_handle_t window; /* handle to the window */ - rectangle_t rect; /* rectangle that must be visible (in client coords) */ + struct rectangle rect; /* rectangle that must be visible (in client coords) */ @END @@ -3087,7 +3087,7 @@ enum coords_relative int height; /* caret height */ @REPLY user_handle_t previous; /* handle to the previous caret window */ - rectangle_t old_rect; /* previous caret rectangle */ + struct rectangle old_rect; /* previous caret rectangle */ int old_hide; /* previous hide count */ int old_state; /* previous caret state (1=on, 0=off) */ @END @@ -3103,7 +3103,7 @@ enum coords_relative int state; /* caret state (see below) */ @REPLY user_handle_t full_handle; /* handle to the current caret window */ - rectangle_t old_rect; /* previous caret rectangle */ + struct rectangle old_rect; /* previous caret rectangle */ int old_hide; /* previous hide count */ int old_state; /* previous caret state (1=on, 0=off) */ @END @@ -3931,7 +3931,7 @@ struct handle_info int show_count; /* show count increment/decrement */ int x; /* cursor position */ int y; - rectangle_t clip; /* cursor clip rectangle */ + struct rectangle clip; /* cursor clip rectangle */ @REPLY user_handle_t prev_handle; /* previous handle */ int prev_count; /* previous show count */ @@ -3939,7 +3939,7 @@ struct handle_info int prev_y; int new_x; /* new position */ int new_y; - rectangle_t new_clip; /* new clip rectangle */ + struct rectangle new_clip; /* new clip rectangle */ unsigned int last_change; /* time of last position change */ @END #define SET_CURSOR_HANDLE 0x01 diff --git a/server/queue.c b/server/queue.c index c7beebe037d..47870884644 100644 --- a/server/queue.c +++ b/server/queue.c @@ -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; - rectangle_t top_rect, clip_rect = desktop_shm->cursor.clip; + 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 ); } @@ -605,10 +605,10 @@ 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 rectangle_t *rect, unsigned int flags, int reset ) +void set_clip_rectangle( struct desktop *desktop, const struct rectangle *rect, unsigned int flags, int reset ) { const desktop_shm_t *desktop_shm = desktop->shared; - rectangle_t top_rect, new_rect; + struct rectangle top_rect, new_rect; unsigned int old_flags; int x, y; @@ -2528,7 +2528,7 @@ static void queue_pointer_message( struct pointer *pointer, int repeated ) unsigned int i, wparam = input->hw.wparam; timeout_t time = get_tick_count(); user_handle_t win = pointer->win; - rectangle_t top_rect; + struct rectangle top_rect; struct message *msg; int x, y; diff --git a/server/region.c b/server/region.c index d169f1ac2b4..a9054df5db7 100644 --- a/server/region.c +++ b/server/region.c @@ -85,8 +85,8 @@ struct region { int size; int num_rects; - rectangle_t *rects; - rectangle_t extents; + struct rectangle *rects; + struct rectangle extents; }; @@ -98,19 +98,19 @@ struct region (r1)->bottom > (r2)->top && \ (r1)->top < (r2)->bottom) -typedef int (*overlap_func_t)( struct region *reg, const rectangle_t *r1, const rectangle_t *r1End, - const rectangle_t *r2, const rectangle_t *r2End, int top, int bottom ); -typedef int (*non_overlap_func_t)( struct region *reg, const rectangle_t *r, - const rectangle_t *rEnd, int top, int bottom ); +typedef int (*overlap_func_t)( struct region *reg, const struct rectangle *r1, const struct rectangle *r1End, + const struct rectangle *r2, const struct rectangle *r2End, int top, int bottom ); +typedef int (*non_overlap_func_t)( struct region *reg, const struct rectangle *r, + const struct rectangle *rEnd, int top, int bottom ); -static const rectangle_t empty_rect; /* all-zero rectangle for empty regions */ +static const struct rectangle empty_rect; /* all-zero rectangle for empty regions */ /* add a rectangle to a region */ -static inline rectangle_t *add_rect( struct region *reg ) +static inline struct rectangle *add_rect( struct region *reg ) { if (reg->num_rects >= reg->size) { - rectangle_t *new_rect = realloc( reg->rects, 2 * sizeof(rectangle_t) * reg->size ); + struct rectangle *new_rect = realloc( reg->rects, 2 * sizeof(struct rectangle) * reg->size ); if (!new_rect) { set_error( STATUS_NO_MEMORY ); @@ -123,9 +123,9 @@ static inline rectangle_t *add_rect( struct region *reg ) } /* make sure all the rectangles are valid and that the region is properly y-x-banded */ -static inline int validate_rectangles( const rectangle_t *rects, unsigned int nb_rects ) +static inline int validate_rectangles( const struct rectangle *rects, unsigned int nb_rects ) { - const rectangle_t *ptr, *end; + const struct rectangle *ptr, *end; for (ptr = rects, end = rects + nb_rects; ptr < end; ptr++) { @@ -149,9 +149,9 @@ static inline int validate_rectangles( const rectangle_t *rects, unsigned int nb static int coalesce_region( struct region *pReg, int prevStart, int curStart ) { int curNumRects; - rectangle_t *pRegEnd = &pReg->rects[pReg->num_rects]; - rectangle_t *pPrevRect = &pReg->rects[prevStart]; - rectangle_t *pCurRect = &pReg->rects[curStart]; + struct rectangle *pRegEnd = &pReg->rects[pReg->num_rects]; + struct rectangle *pPrevRect = &pReg->rects[prevStart]; + struct rectangle *pCurRect = &pReg->rects[curStart]; int prevNumRects = curStart - prevStart; int bandtop = pCurRect->top; @@ -212,14 +212,14 @@ static int region_op( struct region *newReg, const struct region *reg1, const st non_overlap_func_t non_overlap2_func ) { int ybot, ytop, top, bot, prevBand, curBand; - const rectangle_t *r1BandEnd, *r2BandEnd; + const struct rectangle *r1BandEnd, *r2BandEnd; - const rectangle_t *r1 = reg1->rects; - const rectangle_t *r2 = reg2->rects; - const rectangle_t *r1End = r1 + reg1->num_rects; - const rectangle_t *r2End = r2 + reg2->num_rects; + const struct rectangle *r1 = reg1->rects; + const struct rectangle *r2 = reg2->rects; + const struct rectangle *r1End = r1 + reg1->num_rects; + const struct rectangle *r2End = r2 + reg2->num_rects; - rectangle_t *new_rects, *old_rects = newReg->rects; + struct rectangle *new_rects, *old_rects = newReg->rects; int new_size, ret = 0; new_size = max( reg1->num_rects, reg2->num_rects ) * 2; @@ -339,7 +339,7 @@ done: /* recalculate the extents of a region */ static void set_region_extents( struct region *region ) { - rectangle_t *pRect, *pRectEnd; + struct rectangle *pRect, *pRectEnd; if (region->num_rects == 0) { @@ -368,8 +368,8 @@ static void set_region_extents( struct region *region ) /* handle an overlapping band for intersect_region */ static int intersect_overlapping( struct region *pReg, - const rectangle_t *r1, const rectangle_t *r1End, - const rectangle_t *r2, const rectangle_t *r2End, + const struct rectangle *r1, const struct rectangle *r1End, + const struct rectangle *r2, const struct rectangle *r2End, int top, int bottom ) { @@ -382,7 +382,7 @@ static int intersect_overlapping( struct region *pReg, if (left < right) { - rectangle_t *rect = add_rect( pReg ); + struct rectangle *rect = add_rect( pReg ); if (!rect) return 0; rect->left = left; rect->top = top; @@ -402,12 +402,12 @@ static int intersect_overlapping( struct region *pReg, } /* handle a non-overlapping band for subtract_region */ -static int subtract_non_overlapping( struct region *pReg, const rectangle_t *r, - const rectangle_t *rEnd, int top, int bottom ) +static int subtract_non_overlapping( struct region *pReg, const struct rectangle *r, + const struct rectangle *rEnd, int top, int bottom ) { while (r != rEnd) { - rectangle_t *rect = add_rect( pReg ); + struct rectangle *rect = add_rect( pReg ); if (!rect) return 0; rect->left = r->left; rect->top = top; @@ -420,8 +420,8 @@ static int subtract_non_overlapping( struct region *pReg, const rectangle_t *r, /* handle an overlapping band for subtract_region */ static int subtract_overlapping( struct region *pReg, - const rectangle_t *r1, const rectangle_t *r1End, - const rectangle_t *r2, const rectangle_t *r2End, + const struct rectangle *r1, const struct rectangle *r1End, + const struct rectangle *r2, const struct rectangle *r2End, int top, int bottom ) { int left = r1->left; @@ -442,7 +442,7 @@ static int subtract_overlapping( struct region *pReg, } else if (r2->left < r1->right) { - rectangle_t *rect = add_rect( pReg ); + struct rectangle *rect = add_rect( pReg ); if (!rect) return 0; rect->left = left; rect->top = top; @@ -461,7 +461,7 @@ static int subtract_overlapping( struct region *pReg, { if (r1->right > left) { - rectangle_t *rect = add_rect( pReg ); + struct rectangle *rect = add_rect( pReg ); if (!rect) return 0; rect->left = left; rect->top = top; @@ -476,7 +476,7 @@ static int subtract_overlapping( struct region *pReg, while (r1 != r1End) { - rectangle_t *rect = add_rect( pReg ); + struct rectangle *rect = add_rect( pReg ); if (!rect) return 0; rect->left = left; rect->top = top; @@ -489,12 +489,12 @@ static int subtract_overlapping( struct region *pReg, } /* handle a non-overlapping band for union_region */ -static int union_non_overlapping( struct region *pReg, const rectangle_t *r, - const rectangle_t *rEnd, int top, int bottom ) +static int union_non_overlapping( struct region *pReg, const struct rectangle *r, + const struct rectangle *rEnd, int top, int bottom ) { while (r != rEnd) { - rectangle_t *rect = add_rect( pReg ); + struct rectangle *rect = add_rect( pReg ); if (!rect) return 0; rect->left = r->left; rect->top = top; @@ -507,8 +507,8 @@ static int union_non_overlapping( struct region *pReg, const rectangle_t *r, /* handle an overlapping band for union_region */ static int union_overlapping( struct region *pReg, - const rectangle_t *r1, const rectangle_t *r1End, - const rectangle_t *r2, const rectangle_t *r2End, + const struct rectangle *r1, const struct rectangle *r1End, + const struct rectangle *r2, const struct rectangle *r2End, int top, int bottom ) { #define MERGERECT(r) \ @@ -524,7 +524,7 @@ static int union_overlapping( struct region *pReg, } \ else \ { \ - rectangle_t *rect = add_rect( pReg ); \ + struct rectangle *rect = add_rect( pReg ); \ if (!rect) return 0; \ rect->top = top; \ rect->bottom = bottom; \ @@ -586,8 +586,8 @@ struct region *create_region_from_req_data( const void *data, data_size_t size ) { unsigned int alloc_rects; struct region *region; - const rectangle_t *rects = data; - int nb_rects = size / sizeof(rectangle_t); + const struct rectangle *rects = data; + int nb_rects = size / sizeof(struct rectangle); /* special case: empty region can be specified by a single all-zero rectangle */ if (nb_rects == 1 && !memcmp( rects, &empty_rect, sizeof(empty_rect) )) nb_rects = 0; @@ -621,7 +621,7 @@ void free_region( struct region *region ) } /* set region to a simple rectangle */ -void set_region_rect( struct region *region, const rectangle_t *rect ) +void set_region_rect( struct region *region, const struct rectangle *rect ) { if (!is_rect_empty( rect )) { @@ -636,11 +636,11 @@ void set_region_rect( struct region *region, const rectangle_t *rect ) } /* retrieve the region data for sending to the client */ -rectangle_t *get_region_data( const struct region *region, data_size_t max_size, data_size_t *total_size ) +struct rectangle *get_region_data( const struct region *region, data_size_t max_size, data_size_t *total_size ) { - const rectangle_t *data = region->rects; + const struct rectangle *data = region->rects; - if (!(*total_size = region->num_rects * sizeof(rectangle_t))) + if (!(*total_size = region->num_rects * sizeof(struct rectangle))) { /* return a single empty rect for empty regions */ *total_size = sizeof(empty_rect); @@ -652,11 +652,11 @@ rectangle_t *get_region_data( const struct region *region, data_size_t max_size, } /* retrieve the region data for sending to the client and free the region at the same time */ -rectangle_t *get_region_data_and_free( struct region *region, data_size_t max_size, data_size_t *total_size ) +struct rectangle *get_region_data_and_free( struct region *region, data_size_t max_size, data_size_t *total_size ) { - rectangle_t *ret = region->rects; + struct rectangle *ret = region->rects; - if (!(*total_size = region->num_rects * sizeof(rectangle_t))) + if (!(*total_size = region->num_rects * sizeof(struct rectangle))) { /* return a single empty rect for empty regions */ *total_size = sizeof(empty_rect); @@ -702,7 +702,7 @@ int is_region_equal( const struct region *region1, const struct region *region2 /* get the extents rect of a region */ -void get_region_extents( const struct region *region, rectangle_t *rect ) +void get_region_extents( const struct region *region, struct rectangle *rect ) { *rect = region->extents; } @@ -710,7 +710,7 @@ void get_region_extents( const struct region *region, rectangle_t *rect ) /* add an offset to a region */ void offset_region( struct region *region, int x, int y ) { - rectangle_t *rect, *end; + struct rectangle *rect, *end; if (!region->num_rects) return; for (rect = region->rects, end = rect + region->num_rects; rect < end; rect++) @@ -719,7 +719,7 @@ void offset_region( struct region *region, int x, int y ) } /* mirror a region relative to a window client rect */ -void mirror_region( const rectangle_t *client_rect, struct region *region ) +void mirror_region( const struct rectangle *client_rect, struct region *region ) { int start, end, i, j; @@ -729,7 +729,7 @@ void mirror_region( const rectangle_t *client_rect, struct region *region ) if (region->rects[end + 1].top != region->rects[end].top) break; for (i = start, j = end; i < j; i++, j--) { - rectangle_t rect = region->rects[j]; + struct rectangle rect = region->rects[j]; region->rects[i] = region->rects[j]; region->rects[j] = rect; mirror_rect( client_rect, ®ion->rects[j] ); @@ -744,7 +744,7 @@ void mirror_region( const rectangle_t *client_rect, struct region *region ) /* scale a region for a given dpi factor */ void scale_region( struct region *region, unsigned int dpi_from, unsigned int dpi_to ) { - rectangle_t *rect, *end; + struct rectangle *rect, *end; if (!region->num_rects) return; for (rect = region->rects, end = rect + region->num_rects; rect < end; rect++) @@ -760,7 +760,7 @@ struct region *copy_region( struct region *dst, const struct region *src ) if (dst->size < src->num_rects) { - rectangle_t *rect = realloc( dst->rects, src->num_rects * sizeof(*rect) ); + struct rectangle *rect = realloc( dst->rects, src->num_rects * sizeof(*rect) ); if (!rect) { set_error( STATUS_NO_MEMORY ); @@ -858,7 +858,7 @@ struct region *xor_region( struct region *dst, const struct region *src1, /* check if the given point is inside the region */ int point_in_region( struct region *region, int x, int y ) { - const rectangle_t *ptr, *end; + const struct rectangle *ptr, *end; for (ptr = region->rects, end = region->rects + region->num_rects; ptr < end; ptr++) { @@ -873,9 +873,9 @@ int point_in_region( struct region *region, int x, int y ) } /* check if the given rectangle is (at least partially) inside the region */ -int rect_in_region( struct region *region, const rectangle_t *rect ) +int rect_in_region( struct region *region, const struct rectangle *rect ) { - const rectangle_t *ptr, *end; + const struct rectangle *ptr, *end; for (ptr = region->rects, end = region->rects + region->num_rects; ptr < end; ptr++) { diff --git a/server/request_handlers.h b/server/request_handlers.h index 11638c0ca08..23d4e2d3ee3 100644 --- a/server/request_handlers.h +++ b/server/request_handlers.h @@ -611,7 +611,6 @@ C_ASSERT( sizeof(mod_handle_t) == 8 ); C_ASSERT( sizeof(obj_handle_t) == 4 ); C_ASSERT( sizeof(object_id_t) == 8 ); C_ASSERT( sizeof(process_id_t) == 4 ); -C_ASSERT( sizeof(rectangle_t) == 16 ); C_ASSERT( sizeof(short int) == 2 ); C_ASSERT( sizeof(struct async_data) == 40 ); C_ASSERT( sizeof(struct context_data) == 1728 ); @@ -628,6 +627,7 @@ C_ASSERT( sizeof(struct pe_image_info) == 88 ); C_ASSERT( sizeof(struct process_info) == 40 ); C_ASSERT( sizeof(struct property_data) == 16 ); C_ASSERT( sizeof(struct rawinput_device) == 12 ); +C_ASSERT( sizeof(struct rectangle) == 16 ); C_ASSERT( sizeof(struct startup_info_data) == 96 ); C_ASSERT( sizeof(struct thread_info) == 40 ); C_ASSERT( sizeof(struct user_apc) == 40 ); diff --git a/server/request_trace.h b/server/request_trace.h index 4d475290346..c659d44cab2 100644 --- a/server/request_trace.h +++ b/server/request_trace.h @@ -14,7 +14,7 @@ static void dump_ioctl_code( const char *prefix, const ioctl_code_t *val ); static void dump_irp_params( const char *prefix, const union irp_params *val ); static void dump_luid( const char *prefix, const struct luid *val ); static void dump_obj_locator( const char *prefix, const struct obj_locator *val ); -static void dump_rectangle( const char *prefix, const rectangle_t *val ); +static void dump_rectangle( const char *prefix, const struct rectangle *val ); static void dump_timeout( const char *prefix, const timeout_t *val ); static void dump_uint64( const char *prefix, const unsigned __int64 *val ); static void dump_varargs_acl( const char *prefix, data_size_t size ); diff --git a/server/trace.c b/server/trace.c index a2649cce13c..77a91435b55 100644 --- a/server/trace.c +++ b/server/trace.c @@ -150,7 +150,7 @@ static void dump_uints64( const char *prefix, const unsigned __int64 *ptr, int l fputc( '}', stderr ); } -static void dump_rectangle( const char *prefix, const rectangle_t *rect ) +static void dump_rectangle( const char *prefix, const struct rectangle *rect ) { fprintf( stderr, "%s{%d,%d;%d,%d}", prefix, rect->left, rect->top, rect->right, rect->bottom ); @@ -1018,7 +1018,7 @@ static void dump_varargs_startup_info( const char *prefix, data_size_t size ) static void dump_varargs_rectangles( const char *prefix, data_size_t size ) { - const rectangle_t *rect = cur_data; + const struct rectangle *rect = cur_data; data_size_t len = size / sizeof(*rect); fprintf( stderr,"%s{", prefix ); diff --git a/server/user.h b/server/user.h index a57e11b5a97..892f746739a 100644 --- a/server/user.h +++ b/server/user.h @@ -130,7 +130,7 @@ extern int init_thread_queue( struct thread *thread ); extern void check_thread_queue_idle( struct thread *thread ); extern int attach_thread_input( struct thread *thread_from, struct thread *thread_to ); extern void detach_thread_input( struct thread *thread_from ); -extern void set_clip_rectangle( struct desktop *desktop, const rectangle_t *rect, +extern void set_clip_rectangle( struct desktop *desktop, const struct rectangle *rect, unsigned int flags, int reset ); extern void update_cursor_pos( struct desktop *desktop ); extern void post_message( user_handle_t win, unsigned int message, @@ -151,16 +151,16 @@ extern void set_rawinput_process( struct process *process, int enable ); extern struct region *create_empty_region(void); extern struct region *create_region_from_req_data( const void *data, data_size_t size ); extern void free_region( struct region *region ); -extern void set_region_rect( struct region *region, const rectangle_t *rect ); -extern rectangle_t *get_region_data( const struct region *region, data_size_t max_size, - data_size_t *total_size ); -extern rectangle_t *get_region_data_and_free( struct region *region, data_size_t max_size, - data_size_t *total_size ); +extern void set_region_rect( struct region *region, const struct rectangle *rect ); +extern struct rectangle *get_region_data( const struct region *region, data_size_t max_size, + data_size_t *total_size ); +extern struct rectangle *get_region_data_and_free( struct region *region, data_size_t max_size, + data_size_t *total_size ); extern int is_region_empty( const struct region *region ); extern int is_region_equal( const struct region *region1, const struct region *region2 ); -extern void get_region_extents( const struct region *region, rectangle_t *rect ); +extern void get_region_extents( const struct region *region, struct rectangle *rect ); extern void offset_region( struct region *region, int x, int y ); -extern void mirror_region( const rectangle_t *client_rect, struct region *region ); +extern void mirror_region( const struct rectangle *client_rect, struct region *region ); extern void scale_region( struct region *region, unsigned int dpi_from, unsigned int dpi_to ); extern struct region *copy_region( struct region *dst, const struct region *src ); extern struct region *intersect_region( struct region *dst, const struct region *src1, @@ -172,12 +172,12 @@ extern struct region *union_region( struct region *dst, const struct region *src extern struct region *xor_region( struct region *dst, const struct region *src1, const struct region *src2 ); extern int point_in_region( struct region *region, int x, int y ); -extern int rect_in_region( struct region *region, const rectangle_t *rect ); +extern int rect_in_region( struct region *region, const struct rectangle *rect ); /* window functions */ extern struct process *get_top_window_owner( struct desktop *desktop ); -extern void get_virtual_screen_rect( struct desktop *desktop, rectangle_t *rect, int is_raw ); +extern void get_virtual_screen_rect( struct desktop *desktop, struct rectangle *rect, int is_raw ); extern void post_desktop_message( struct desktop *desktop, unsigned int message, lparam_t wparam, lparam_t lparam ); extern void free_window_handle( struct window *win ); @@ -222,18 +222,18 @@ extern void set_thread_default_desktop( struct thread *thread, struct desktop *d extern void release_thread_desktop( struct thread *thread, int close ); /* checks if two rectangles are identical */ -static inline int is_rect_equal( const rectangle_t *rect1, const rectangle_t *rect2 ) +static inline int is_rect_equal( const struct rectangle *rect1, const struct rectangle *rect2 ) { return (rect1->left == rect2->left && rect1->right == rect2->right && rect1->top == rect2->top && rect1->bottom == rect2->bottom); } -static inline int is_rect_empty( const rectangle_t *rect ) +static inline int is_rect_empty( const struct rectangle *rect ) { return (rect->left >= rect->right || rect->top >= rect->bottom); } -static inline int point_in_rect( const rectangle_t *rect, int x, int y ) +static inline int point_in_rect( const struct rectangle *rect, int x, int y ) { return (x >= rect->left && x < rect->right && y >= rect->top && y < rect->bottom); } @@ -244,7 +244,7 @@ static inline int scale_dpi( int val, unsigned int dpi_from, unsigned int dpi_to return (val * dpi_to - (dpi_from / 2)) / dpi_from; } -static inline void scale_dpi_rect( rectangle_t *rect, unsigned int dpi_from, unsigned int dpi_to ) +static inline void scale_dpi_rect( struct rectangle *rect, unsigned int dpi_from, unsigned int dpi_to ) { rect->left = scale_dpi( rect->left, dpi_from, dpi_to ); rect->top = scale_dpi( rect->top, dpi_from, dpi_to ); @@ -253,7 +253,7 @@ static inline void scale_dpi_rect( rectangle_t *rect, unsigned int dpi_from, uns } /* offset the coordinates of a rectangle */ -static inline void offset_rect( rectangle_t *rect, int offset_x, int offset_y ) +static inline void offset_rect( struct rectangle *rect, int offset_x, int offset_y ) { rect->left += offset_x; rect->top += offset_y; @@ -262,7 +262,7 @@ static inline void offset_rect( rectangle_t *rect, int offset_x, int offset_y ) } /* mirror a rectangle respective to the window client area */ -static inline void mirror_rect( const rectangle_t *client_rect, rectangle_t *rect ) +static inline void mirror_rect( const struct rectangle *client_rect, struct rectangle *rect ) { int width = client_rect->right - client_rect->left; int tmp = rect->left; @@ -271,7 +271,7 @@ static inline void mirror_rect( const rectangle_t *client_rect, rectangle_t *rec } /* compute the intersection of two rectangles; return 0 if the result is empty */ -static inline int intersect_rect( rectangle_t *dst, const rectangle_t *src1, const rectangle_t *src2 ) +static inline int intersect_rect( struct rectangle *dst, const struct rectangle *src1, const struct rectangle *src2 ) { dst->left = max( src1->left, src2->left ); dst->top = max( src1->top, src2->top ); @@ -280,13 +280,13 @@ static inline int intersect_rect( rectangle_t *dst, const rectangle_t *src1, con return !is_rect_empty( dst ); } -static inline void reset_bounds( rectangle_t *bounds ) +static inline void reset_bounds( struct rectangle *bounds ) { bounds->left = bounds->top = INT_MAX; bounds->right = bounds->bottom = INT_MIN; } -static inline void union_rect( rectangle_t *dest, const rectangle_t *src1, const rectangle_t *src2 ) +static inline void union_rect( struct rectangle *dest, const struct rectangle *src1, const struct rectangle *src2 ) { if (is_rect_empty( src1 )) { diff --git a/server/window.c b/server/window.c index 8131d197951..2af70b09102 100644 --- a/server/window.c +++ b/server/window.c @@ -66,10 +66,10 @@ struct window struct window_class *class; /* window class */ atom_t atom; /* class atom */ user_handle_t last_active; /* last active popup */ - rectangle_t window_rect; /* window rectangle (relative to parent client area) */ - rectangle_t visible_rect; /* visible part of window rect (relative to parent client area) */ - rectangle_t surface_rect; /* window surface rectangle (relative to parent client area) */ - rectangle_t client_rect; /* client rectangle (relative to parent client area) */ + struct rectangle window_rect; /* window rectangle (relative to parent client area) */ + struct rectangle visible_rect; /* visible part of window rect (relative to parent client area) */ + struct rectangle surface_rect; /* window surface rectangle (relative to parent client area) */ + struct rectangle client_rect; /* client rectangle (relative to parent client area) */ struct region *win_region; /* region for shaped windows (relative to window rect) */ struct region *update_region; /* update region (relative to window rect) */ unsigned int style; /* window style */ @@ -143,7 +143,7 @@ struct user_handle_array int total; }; -static const rectangle_t empty_rect; +static const struct rectangle empty_rect; /* magic HWND_TOP etc. pointers */ #define WINPTR_TOP ((struct window *)1L) @@ -240,14 +240,14 @@ static inline void update_pixel_format_flags( struct window *win ) win->paint_flags |= PAINT_PIXEL_FORMAT_CHILD; } -static rectangle_t monitors_get_union_rect( struct winstation *winstation, int is_raw ) +static struct rectangle monitors_get_union_rect( struct winstation *winstation, int is_raw ) { struct monitor_info *monitor, *end; - rectangle_t rect = {0}; + struct rectangle rect = {0}; for (monitor = winstation->monitors, end = monitor + winstation->monitor_count; monitor < end; monitor++) { - rectangle_t monitor_rect = is_raw ? monitor->raw : monitor->virt; + struct rectangle monitor_rect = is_raw ? monitor->raw : monitor->virt; if (monitor->flags & (MONITOR_FLAG_CLONE | MONITOR_FLAG_INACTIVE)) continue; union_rect( &rect, &rect, &monitor_rect ); } @@ -256,14 +256,14 @@ static rectangle_t monitors_get_union_rect( struct winstation *winstation, int i } /* returns the largest intersecting or nearest monitor, keep in sync with win32u/sysparams.c */ -static struct monitor_info *get_monitor_from_rect( struct winstation *winstation, const rectangle_t *rect, int is_raw ) +static struct monitor_info *get_monitor_from_rect( struct winstation *winstation, const struct rectangle *rect, int is_raw ) { struct monitor_info *monitor, *nearest = NULL, *found = NULL, *end; unsigned int max_area = 0, min_distance = -1; for (monitor = winstation->monitors, end = monitor + winstation->monitor_count; monitor < end; monitor++) { - rectangle_t intersect, target = is_raw ? monitor->raw : monitor->virt; + struct rectangle intersect, target = is_raw ? monitor->raw : monitor->virt; if (monitor->flags & (MONITOR_FLAG_CLONE | MONITOR_FLAG_INACTIVE)) continue; @@ -306,7 +306,7 @@ static struct monitor_info *get_monitor_from_rect( struct winstation *winstation static void map_point_raw_to_virt( struct desktop *desktop, int *x, int *y ) { int width_from, height_from, width_to, height_to; - rectangle_t rect = {*x, *y, *x + 1, *y + 1}; + struct rectangle rect = {*x, *y, *x + 1, *y + 1}; struct monitor_info *monitor; if (!(monitor = get_monitor_from_rect( desktop->winstation, &rect, 1 ))) return; @@ -583,7 +583,7 @@ struct process *get_top_window_owner( struct desktop *desktop ) } /* get the top window size of a given desktop */ -void get_virtual_screen_rect( struct desktop *desktop, rectangle_t *rect, int is_raw ) +void get_virtual_screen_rect( struct desktop *desktop, struct rectangle *rect, int is_raw ) { *rect = monitors_get_union_rect( desktop->winstation, is_raw ); } @@ -804,7 +804,7 @@ static void map_dpi_point( struct window *win, int *x, int *y, unsigned int from } /* map a window rectangle between different DPI scaling levels */ -static void map_dpi_rect( struct window *win, rectangle_t *rect, unsigned int from, unsigned int to ) +static void map_dpi_rect( struct window *win, struct rectangle *rect, unsigned int from, unsigned int to ) { if (!from) from = get_monitor_dpi( win ); if (!to) to = get_monitor_dpi( win ); @@ -1148,7 +1148,7 @@ static struct region *intersect_window_region( struct region *region, struct win /* convert coordinates from client to screen coords */ -static inline void client_to_screen_rect( struct window *win, rectangle_t *rect ) +static inline void client_to_screen_rect( struct window *win, struct rectangle *rect ) { for ( ; win && !is_desktop_window(win); win = win->parent) offset_rect( rect, win->client_rect.left, win->client_rect.top ); @@ -1198,7 +1198,7 @@ static struct region *clip_children( struct window *parent, struct window *last, /* set the region to the client rect clipped by the window rect, in parent-relative coordinates */ static void set_region_client_rect( struct region *region, struct window *win ) { - rectangle_t rect; + struct rectangle rect; intersect_rect( &rect, &win->window_rect, &win->client_rect ); intersect_rect( &rect, &rect, &win->surface_rect ); @@ -1209,7 +1209,7 @@ static void set_region_client_rect( struct region *region, struct window *win ) /* set the region to the visible rect clipped by the window surface, in parent-relative coordinates */ static void set_region_visible_rect( struct region *region, struct window *win ) { - rectangle_t rect; + struct rectangle rect; intersect_rect( &rect, &win->visible_rect, &win->surface_rect ); set_region_rect( region, &rect ); @@ -1394,7 +1394,7 @@ struct window_class* get_window_class( user_handle_t window ) /* determine the window visible rectangle, i.e. window or client rect cropped by parent rects */ /* the returned rectangle is in window coordinates; return 0 if rectangle is empty */ -static int get_window_visible_rect( struct window *win, rectangle_t *rect, int frame ) +static int get_window_visible_rect( struct window *win, struct rectangle *rect, int frame ) { int offset_x = win->window_rect.left, offset_y = win->window_rect.top; @@ -1421,7 +1421,7 @@ static int get_window_visible_rect( struct window *win, rectangle_t *rect, int f /* and converted from client to window coordinates. Helper for (in)validate_window. */ static struct region *crop_region_to_win_rect( struct window *win, struct region *region, int frame ) { - rectangle_t rect; + struct rectangle rect; struct region *tmp; if (!get_window_visible_rect( win, &rect, frame )) return NULL; @@ -1487,11 +1487,11 @@ static int add_update_region( struct window *win, struct region *region ) /* crop the update region of children to the specified rectangle, in client coords */ -static void crop_children_update_region( struct window *win, rectangle_t *rect ) +static void crop_children_update_region( struct window *win, struct rectangle *rect ) { struct window *child; struct region *tmp; - rectangle_t child_rect; + struct rectangle child_rect; LIST_FOR_EACH_ENTRY( child, &win->children, struct window, entry ) { @@ -1529,7 +1529,7 @@ static void crop_children_update_region( struct window *win, rectangle_t *rect ) static void validate_non_client( struct window *win ) { struct region *tmp; - rectangle_t rect; + struct rectangle rect; if (!win->update_region) return; /* nothing to do */ @@ -1838,7 +1838,7 @@ static unsigned int get_window_update_flags( struct window *win, struct window * /* expose the areas revealed by a vis region change on the window parent */ /* returns the region exposed on the window itself (in client coordinates) */ -static struct region *expose_window( struct window *win, const rectangle_t *old_window_rect, +static struct region *expose_window( struct window *win, const struct rectangle *old_window_rect, struct region *old_vis_rgn, int zorder_changed ) { struct region *new_vis_rgn, *exposed_rgn; @@ -1896,15 +1896,15 @@ static struct region *expose_window( struct window *win, const rectangle_t *old_ /* set the window and client rectangles, updating the update region if necessary */ static void set_window_pos( struct window *win, struct window *previous, - unsigned int swp_flags, const rectangle_t *window_rect, - const rectangle_t *client_rect, const rectangle_t *visible_rect, - const rectangle_t *surface_rect, const rectangle_t *valid_rect ) + unsigned int swp_flags, const struct rectangle *window_rect, + const struct rectangle *client_rect, const struct rectangle *visible_rect, + const struct rectangle *surface_rect, const struct rectangle *valid_rect ) { struct region *old_vis_rgn = NULL, *exposed_rgn = NULL; - const rectangle_t old_window_rect = win->window_rect; - const rectangle_t old_visible_rect = win->visible_rect; - const rectangle_t old_client_rect = win->client_rect; - rectangle_t rect; + const struct rectangle old_window_rect = win->window_rect; + const struct rectangle old_visible_rect = win->visible_rect; + const struct rectangle old_client_rect = win->client_rect; + struct rectangle rect; int client_changed, frame_changed; int visible = (win->style & WS_VISIBLE) || (swp_flags & SWP_SHOWWINDOW); int zorder_changed = 0; @@ -2563,8 +2563,8 @@ DECL_HANDLER(get_window_tree) /* set the position and Z order of a window */ DECL_HANDLER(set_window_pos) { - rectangle_t window_rect, client_rect, visible_rect, surface_rect, valid_rect, old_window, old_client; - const rectangle_t *extra_rects = get_req_data(); + struct rectangle window_rect, client_rect, visible_rect, surface_rect, valid_rect, old_window, old_client; + const struct rectangle *extra_rects = get_req_data(); struct window *previous = NULL; struct window *top, *win = get_window( req->handle ); unsigned int flags = req->swp_flags, old_style; @@ -2613,11 +2613,11 @@ DECL_HANDLER(set_window_pos) window_rect = req->window; client_rect = req->client; - if (get_req_data_size() >= sizeof(rectangle_t)) visible_rect = extra_rects[0]; + if (get_req_data_size() >= sizeof(struct rectangle)) visible_rect = extra_rects[0]; else visible_rect = window_rect; - if (get_req_data_size() >= 2 * sizeof(rectangle_t)) surface_rect = extra_rects[1]; + if (get_req_data_size() >= 2 * sizeof(struct rectangle)) surface_rect = extra_rects[1]; else surface_rect = visible_rect; - if (get_req_data_size() >= 3 * sizeof(rectangle_t)) valid_rect = extra_rects[2]; + if (get_req_data_size() >= 3 * sizeof(struct rectangle)) valid_rect = extra_rects[2]; else valid_rect = empty_rect; if (win->parent && win->parent->ex_style & WS_EX_LAYOUTRTL) { @@ -2772,7 +2772,7 @@ DECL_HANDLER(get_visible_region) top = get_top_clipping_window( win ); if ((region = get_visible_region( win, req->flags ))) { - rectangle_t *data; + struct rectangle *data; map_win_region_to_screen( win, region ); data = get_region_data_and_free( region, get_reply_max_size(), &reply->total_size ); if (data) set_reply_data_ptr( data, reply->total_size ); @@ -2800,7 +2800,7 @@ DECL_HANDLER(get_visible_region) /* get the window regions */ DECL_HANDLER(get_window_region) { - rectangle_t *data; + struct rectangle *data; struct region *region; struct window *win = get_window( req->window ); @@ -2813,7 +2813,7 @@ DECL_HANDLER(get_window_region) if ((region = get_surface_region( win ))) { - rectangle_t *data = get_region_data_and_free( region, get_reply_max_size(), &reply->total_size ); + struct rectangle *data = get_region_data_and_free( region, get_reply_max_size(), &reply->total_size ); if (data) set_reply_data_ptr( data, reply->total_size ); } return; @@ -2861,7 +2861,7 @@ DECL_HANDLER(set_window_region) /* get a window update region */ DECL_HANDLER(get_update_region) { - rectangle_t *data; + struct rectangle *data; unsigned int flags = req->flags; struct window *from_child = NULL; struct window *win = get_window( req->window ); @@ -2937,7 +2937,7 @@ DECL_HANDLER(get_update_region) /* update the z order of a window so that a given rectangle is fully visible */ DECL_HANDLER(update_window_zorder) { - rectangle_t tmp, rect = req->rect; + struct rectangle tmp, rect = req->rect; struct window *ptr, *win = get_window( req->window ); if (!win || !win->parent || !is_visible( win )) return; /* nothing to do */ diff --git a/tools/make_requests b/tools/make_requests index 0de3bfcabb6..495a0ac75db 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -37,7 +37,6 @@ my %formats = "unsigned __int64" => [ 8, 8, "&uint64" ], "timeout_t" => [ 8, 8 ], "abstime_t" => [ 8, 8 ], - "rectangle_t" => [ 16, 4 ], "ioctl_code_t" => [ 4, 4 ], # structures and unions "union apc_call" => [ 64, 8 ], @@ -61,6 +60,7 @@ my %formats = "struct process_info" => [ 40, 8 ], "struct property_data" => [ 16, 8 ], "struct rawinput_device" => [ 12, 4 ], + "struct rectangle" => [ 16, 4 ], "union select_op" => [ 264, 8 ], "struct startup_info_data" => [ 96, 4 ], "union tcp_connection" => [ 60, 4 ], -- GitLab