Added requests to store window rectangles in the server.

This commit is contained in:
Alexandre Julliard 2001-10-16 21:55:37 +00:00
parent b662e11a00
commit 0d50965a13
6 changed files with 196 additions and 1 deletions

View File

@ -140,6 +140,15 @@ typedef struct
} property_data_t;
typedef struct
{
int left;
int top;
int right;
int bottom;
} rectangle_t;
@ -1652,6 +1661,36 @@ struct get_window_tree_request
};
struct set_window_rectangles_request
{
struct request_header __header;
user_handle_t handle;
rectangle_t window;
rectangle_t client;
};
struct get_window_rectangles_request
{
struct request_header __header;
user_handle_t handle;
rectangle_t window;
rectangle_t client;
};
struct get_windows_offset_request
{
struct request_header __header;
user_handle_t from;
user_handle_t to;
int x;
int y;
};
struct set_window_property_request
{
@ -1823,6 +1862,9 @@ enum request
REQ_get_window_parents,
REQ_get_window_children,
REQ_get_window_tree,
REQ_set_window_rectangles,
REQ_get_window_rectangles,
REQ_get_windows_offset,
REQ_set_window_property,
REQ_remove_window_property,
REQ_get_window_property,
@ -1963,12 +2005,15 @@ union generic_request
struct get_window_parents_request get_window_parents;
struct get_window_children_request get_window_children;
struct get_window_tree_request get_window_tree;
struct set_window_rectangles_request set_window_rectangles;
struct get_window_rectangles_request get_window_rectangles;
struct get_windows_offset_request get_windows_offset;
struct set_window_property_request set_window_property;
struct remove_window_property_request remove_window_property;
struct get_window_property_request get_window_property;
struct get_window_properties_request get_window_properties;
};
#define SERVER_PROTOCOL_VERSION 59
#define SERVER_PROTOCOL_VERSION 60
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */

View File

@ -141,6 +141,15 @@ typedef struct
handle_t handle; /* handle stored in property */
} property_data_t;
/* structure to specify window rectangles */
typedef struct
{
int left;
int top;
int right;
int bottom;
} rectangle_t;
/****************************************************************/
/* Request declarations */
@ -1478,6 +1487,32 @@ enum message_type
user_handle_t last_child; /* last child */
@END
/* Set the window and client rectangles of a window */
@REQ(set_window_rectangles)
user_handle_t handle; /* handle to the window */
rectangle_t window; /* window rectangle */
rectangle_t client; /* client rectangle */
@END
/* Get the window and client rectangles of a window */
@REQ(get_window_rectangles)
user_handle_t handle; /* handle to the window */
@REPLY
rectangle_t window; /* window rectangle */
rectangle_t client; /* client rectangle */
@END
/* Get the coordinates offset between two windows */
@REQ(get_windows_offset)
user_handle_t from; /* handle to the first window */
user_handle_t to; /* handle to the second window */
@REPLY
int x; /* x coordinate offset */
int y; /* y coordinate offset */
@END
/* Set a window property */
@REQ(set_window_property)

View File

@ -194,6 +194,9 @@ DECL_HANDLER(get_window_info);
DECL_HANDLER(get_window_parents);
DECL_HANDLER(get_window_children);
DECL_HANDLER(get_window_tree);
DECL_HANDLER(set_window_rectangles);
DECL_HANDLER(get_window_rectangles);
DECL_HANDLER(get_windows_offset);
DECL_HANDLER(set_window_property);
DECL_HANDLER(remove_window_property);
DECL_HANDLER(get_window_property);
@ -333,6 +336,9 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_get_window_parents,
(req_handler)req_get_window_children,
(req_handler)req_get_window_tree,
(req_handler)req_set_window_rectangles,
(req_handler)req_get_window_rectangles,
(req_handler)req_get_windows_offset,
(req_handler)req_set_window_property,
(req_handler)req_remove_window_property,
(req_handler)req_get_window_property,

View File

@ -43,6 +43,12 @@ static void dump_uints( const int *ptr, int len )
fputc( '}', stderr );
}
static void dump_rectangle( const void *req, const rectangle_t *rect )
{
fprintf( stderr, "{%d,%d;%d,%d}",
rect->left, rect->top, rect->right, rect->bottom );
}
static void dump_context( const CONTEXT *context )
{
#ifdef __i386__
@ -1761,6 +1767,42 @@ static void dump_get_window_tree_reply( const struct get_window_tree_request *re
fprintf( stderr, " last_child=%08x", req->last_child );
}
static void dump_set_window_rectangles_request( const struct set_window_rectangles_request *req )
{
fprintf( stderr, " handle=%08x,", req->handle );
fprintf( stderr, " window=" );
dump_rectangle( req, &req->window );
fprintf( stderr, "," );
fprintf( stderr, " client=" );
dump_rectangle( req, &req->client );
}
static void dump_get_window_rectangles_request( const struct get_window_rectangles_request *req )
{
fprintf( stderr, " handle=%08x", req->handle );
}
static void dump_get_window_rectangles_reply( const struct get_window_rectangles_request *req )
{
fprintf( stderr, " window=" );
dump_rectangle( req, &req->window );
fprintf( stderr, "," );
fprintf( stderr, " client=" );
dump_rectangle( req, &req->client );
}
static void dump_get_windows_offset_request( const struct get_windows_offset_request *req )
{
fprintf( stderr, " from=%08x,", req->from );
fprintf( stderr, " to=%08x", req->to );
}
static void dump_get_windows_offset_reply( const struct get_windows_offset_request *req )
{
fprintf( stderr, " x=%d,", req->x );
fprintf( stderr, " y=%d", req->y );
}
static void dump_set_window_property_request( const struct set_window_property_request *req )
{
fprintf( stderr, " window=%08x,", req->window );
@ -1932,6 +1974,9 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_window_parents_request,
(dump_func)dump_get_window_children_request,
(dump_func)dump_get_window_tree_request,
(dump_func)dump_set_window_rectangles_request,
(dump_func)dump_get_window_rectangles_request,
(dump_func)dump_get_windows_offset_request,
(dump_func)dump_set_window_property_request,
(dump_func)dump_remove_window_property_request,
(dump_func)dump_get_window_property_request,
@ -2069,6 +2114,9 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_get_window_children_reply,
(dump_func)dump_get_window_tree_reply,
(dump_func)0,
(dump_func)dump_get_window_rectangles_reply,
(dump_func)dump_get_windows_offset_reply,
(dump_func)0,
(dump_func)dump_remove_window_property_reply,
(dump_func)dump_get_window_property_reply,
(dump_func)dump_get_window_properties_reply,
@ -2204,6 +2252,9 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"get_window_parents",
"get_window_children",
"get_window_tree",
"set_window_rectangles",
"get_window_rectangles",
"get_windows_offset",
"set_window_property",
"remove_window_property",
"get_window_property",

View File

@ -40,6 +40,8 @@ struct window
user_handle_t handle; /* full handle for this window */
struct thread *thread; /* thread owning the window */
atom_t atom; /* class atom */
rectangle_t window_rect; /* window rectangle */
rectangle_t client_rect; /* client rectangle */
int prop_inuse; /* number of in-use window properties */
int prop_alloc; /* number of allocated window properties */
struct property *properties; /* window properties array */
@ -476,6 +478,61 @@ DECL_HANDLER(get_window_tree)
}
/* set the window and client rectangles of a window */
DECL_HANDLER(set_window_rectangles)
{
struct window *win = get_window( req->handle );
if (win)
{
win->window_rect = req->window;
win->client_rect = req->client;
}
}
/* get the window and client rectangles of a window */
DECL_HANDLER(get_window_rectangles)
{
struct window *win = get_window( req->handle );
if (win)
{
req->window = win->window_rect;
req->client = win->client_rect;
}
}
/* get the coordinates offset between two windows */
DECL_HANDLER(get_windows_offset)
{
struct window *win;
req->x = req->y = 0;
if (req->from)
{
if (!(win = get_window( req->from ))) return;
while (win)
{
req->x += win->client_rect.left;
req->y += win->client_rect.top;
win = win->parent;
}
}
if (req->to)
{
if (!(win = get_window( req->to ))) return;
while (win)
{
req->x -= win->client_rect.left;
req->y -= win->client_rect.top;
win = win->parent;
}
}
}
/* set a window property */
DECL_HANDLER(set_window_property)
{

View File

@ -18,6 +18,7 @@
"handle_t" => "%d",
"atom_t" => "%04x",
"user_handle_t" => "%08x",
"rectangle_t" => "&dump_rectangle",
);
my @requests = ();