I've been adding a new handler to Wine's server. Unfortunately, I've run into a problem with C_ASSERT that I can't seem to resolve.
In server/request.h, I've added the following code:
C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_request, spi_workarea) == 16 ); C_ASSERT( sizeof(struct get_desktop_workarea_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_x) == 4 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_y) == 4 ); C_ASSERT( sizeof(struct get_desktop_workarea_reply) == 8 );
But the compiler ends with output errors, as in the following:
In file included from request.c:69:0: request.h:1527:1: error: size of unnamed array is negative request.h:1528:1: error: size of unnamed array is negative request.h:1529:1: error: size of unnamed array is negative request.h:1530:1: error: size of unnamed array is negative request.h:1531:1: error: size of unnamed array is negative
Each error represents the C_ASSERT code listed above.
I'm probably missing something obvious here. Can someone please offer any advice on resolving these errors?
Thank you.
Am 13.04.2013 15:39, schrieb Hugh McMaster:
I've been adding a new handler to Wine's server. Unfortunately, I've run into a problem with C_ASSERT that I can't seem to resolve.
In server/request.h, I've added the following code:
C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_request, spi_workarea) == 16 ); C_ASSERT( sizeof(struct get_desktop_workarea_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_x) == 4 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_y) == 4 ); C_ASSERT( sizeof(struct get_desktop_workarea_reply) == 8 );
But the compiler ends with output errors, as in the following:
In file included from request.c:69:0: request.h:1527:1: error: size of unnamed array is negative request.h:1528:1: error: size of unnamed array is negative request.h:1529:1: error: size of unnamed array is negative request.h:1530:1: error: size of unnamed array is negative request.h:1531:1: error: size of unnamed array is negative
Each error represents the C_ASSERT code listed above.
I'm probably missing something obvious here. Can someone please offer any advice on resolving these errors?
we'd need more info like the actual struct get_desktop_workarea_request
On Apr 13, 2013, at 7:39 AM, Hugh McMaster wrote:
I've been adding a new handler to Wine's server. Unfortunately, I've run into a problem with C_ASSERT that I can't seem to resolve.
In server/request.h, I've added the following code:
STOP! You should modify server/protocol.def instead. The file you changed is automatically generated from protocol.def, along with a bunch of other files needed to make the server interface magic work.
Chip
Am 13.04.2013 15:39, schrieb Hugh McMaster:
I've been adding a new handler to Wine's server. Unfortunately, I've run into a problem with C_ASSERT that I can't seem to resolve.
In server/request.h, I've added the following code:
C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_request, spi_workarea) == 16 ); C_ASSERT( sizeof(struct get_desktop_workarea_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_x) == 4 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_y) == 4 ); C_ASSERT( sizeof(struct get_desktop_workarea_reply) == 8 );
But the compiler ends with output errors, as in the following:
In file included from request.c:69:0: request.h:1527:1: error: size of unnamed array is negative request.h:1528:1: error: size of unnamed array is negative request.h:1529:1: error: size of unnamed array is negative request.h:1530:1: error: size of unnamed array is negative request.h:1531:1: error: size of unnamed array is negative
Each error represents the C_ASSERT code listed above.
I'm probably missing something obvious here. Can someone please offer any advice on resolving these errors?
we'd need more info like the actual struct get_desktop_workarea_request
Hallo André, I missed your response to the list.
This is what I have done. Wine compiles perfectly if I uncomment the C_ASSERT lines. I note that Charles Davis said in another response that request.h should not be modified.
*** server/protocol.def *** /* Retrieve the desktop workarea */ @REQ(get_desktop_workarea) RECT spi_workarea; /* values from SystemParametersInfo */ @REPLY int screen_x; /* screen dimensions without taskbar */ int screen_y; @END
*** server/window.c *** /* retrieve the desktop workarea */ DECL_HANDLER(get_desktop_workarea) { RECT wa; wa = req->spi_workarea; int screen_w = wa.right; int screen_h = wa.bottom; reply->screen_x = screen_w; reply->screen_y = screen_h; }
*** include/wine/server_protocol.h ***
struct get_desktop_workarea_request { struct request_header __header; RECT spi_workarea; }; struct get_desktop_workarea_reply { struct reply_header __header; int screen_x; int screen_y; };
enum_request { [snip] REQ_get_desktop_workarea, [snip] }
generic_request { [snip] struct get_desktop_workarea_request get_desktop_workarea_request; [snip] }
generic_request { [snip] struct get_desktop_workarea_reply get_desktop_workarea_reply; [snip] }
*** server/request.h *** DECL_HANDLER(get_desktop_workarea);
static const req_handler req_handlers[REQ_NB_REQUESTS] = { [snip] (req_handler)req_get_desktop_workarea, [snip] } [snip] C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_request, spi_workarea) == 16 ); C_ASSERT( sizeof(struct get_desktop_workarea_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_x) == 4 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_y) == 4 ); C_ASSERT( sizeof(struct get_desktop_workarea_reply) == 8 );
On Apr 13, 2013, at 9:40 PM, Hugh McMaster wrote:
Am 13.04.2013 15:39, schrieb Hugh McMaster:
I've been adding a new handler to Wine's server. Unfortunately, I've run into a problem with C_ASSERT that I can't seem to resolve.
In server/request.h, I've added the following code:
C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_request, spi_workarea) == 16 ); C_ASSERT( sizeof(struct get_desktop_workarea_request) == 16 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_x) == 4 ); C_ASSERT( FIELD_OFFSET(struct get_desktop_workarea_reply, screen_y) == 4 ); C_ASSERT( sizeof(struct get_desktop_workarea_reply) == 8 );
But the compiler ends with output errors, as in the following:
In file included from request.c:69:0: request.h:1527:1: error: size of unnamed array is negative request.h:1528:1: error: size of unnamed array is negative request.h:1529:1: error: size of unnamed array is negative request.h:1530:1: error: size of unnamed array is negative request.h:1531:1: error: size of unnamed array is negative
Each error represents the C_ASSERT code listed above.
I'm probably missing something obvious here. Can someone please offer any advice on resolving these errors?
we'd need more info like the actual struct get_desktop_workarea_request
Hallo André, I missed your response to the list.
This is what I have done. Wine compiles perfectly if I uncomment the C_ASSERT lines. I note that Charles Davis said in another response that request.h should not be modified.
*** server/protocol.def *** /* Retrieve the desktop workarea */ @REQ(get_desktop_workarea) RECT spi_workarea; /* values from SystemParametersInfo */
That should be a rectangle_t. The server doesn't actually use native Windows types.
Chip
On Apr 13, 2013, at 7:39 AM, Hugh McMaster wrote:
I've been adding a new handler to Wine's server. Unfortunately, I've run into a problem with C_ASSERT that I can't seem to resolve.
In server/request.h, I've added the following code:
STOP! You should modify server/protocol.def instead. The file you changed is automatically generated from protocol.def, along with a bunch of other files needed to make the server interface magic work.
Hi Charles,
I had already modified protocol.def. The interesting thing about server/request.h is that the handler declarations appear in the area of the file commented as automatically generated.
I've posted the code I was working on in a response to André Hentschel.
Thank you for your help so far.
On Apr 13, 2013, at 9:43 PM, Hugh McMaster wrote:
On Apr 13, 2013, at 7:39 AM, Hugh McMaster wrote:
I've been adding a new handler to Wine's server. Unfortunately, I've run into a problem with C_ASSERT that I can't seem to resolve.
In server/request.h, I've added the following code:
STOP! You should modify server/protocol.def instead. The file you changed is automatically generated from protocol.def, along with a bunch of other files needed to make the server interface magic work.
Hi Charles,
I had already modified protocol.def.
Oh. It's just that you hadn't mentioned that. Sorry for the curt "STOP" above.
The interesting thing about server/request.h is that the handler declarations appear in the area of the file commented as automatically generated.
Of course they do. The Perl script tools/make_requests is responsible for generating those declarations from server/protocol.def. It is also responsible for generating include/wine/server_protocol.h, and pieces of server/trace.c. You should not have to manually change any of them (other than protocol.def, of course). You might, however, have to run make_requests manually, though (the makefiles, for some reason, won't invoke it for you).
Also, bear in mind that, when you're done with your patch and you submit it to wine-patches, you should not include the changes to any generated files (despite that they're version-controlled). Don't worry; AJ will run make_requests when he commits your patch to update the files in version control.
Oh, and a warning: AJ is very touchy about the server (and why not? It's probably the most critical component in Wine, being responsible for coordinating all Wine processes in a given prefix). He holds patches against the server to much higher standards than usual--and they're already pretty high. So don't worry if your patch doesn't get in at first.
Chip
On Apr 13, 2013, Charles Davis wrote:
STOP! You should modify server/protocol.def instead. The file you changed is automatically generated from protocol.def, along with a bunch of other files needed to make the server interface magic work.
On Apr 13, 2013, at 7:39 AM, Hugh McMaster wrote: The interesting thing about server/request.h is that the handler declarations appear in the area of the file commented as automatically generated.
Of course they do. The Perl script tools/make_requests is responsible for generating those declarations from server/protocol.def. It is also responsible for generating include/wine/server_protocol.h, and pieces of server/trace.c. You should not have to manually change any of them (other than protocol.def, of course). You might, however, have to run make_requests manually, though (the makefiles, for some reason, won't invoke it for you).
This was the key piece of information I needed. I never knew I had to run tools/make_requests, so I was making all of the changes to the various server files manually. After running tools/make_requests, Wine compiled perfectly.
I am having a bit of trouble with the server though.
In server/window.c, I've got the following code for testing purposes.
/* retrieve the desktop workarea */ DECL_HANDLER(get_desktop_workarea) { int screen_h = req->spi_workarea.bottom; reply->screen_x = 1680; reply->screen_y = screen_h; }
I'm also using the following server request in programs/wineconsole.c (again, for testing):
typedef struct { int left; int top; int right; int bottom; } rectangle_t;
rectangle_t workarea; SystemParametersInfoA(SPI_GETWORKAREA, 0, &workarea, 0);
SERVER_START_REQ( get_desktop_workarea ) { if(!wine_server_call_err( req )) { req->spi_workarea.bottom = workarea.bottom; printf("wineconsole.c: width: %d, height: %d\n", reply->screen_x, reply->screen_y); } } SERVER_END_REQ;
The terminal output is unexpected. screen_width is 1680, as you would expect from a hard-coded constant. screen_height is 0, though. It should be 1025.
Is there something special/different that needs to be done for the server to accept input?
Once again, thank you for your help.
On Apr 14, 7:20 PM, Hugh McMaster wrote:
Is there something special/different that needs to be done for the server to accept input?
I can answer this myself now.
SERVER_START_REQ { req->spi_workarea.right = workarea.right; req->spi_workarea.bottom = workarea.bottom; wine_server_call( req ); } SERVER_END_REQ;
The key is to include the last line of the server request.