Changes in uspace/lib/display/src/disp_srv.c [5480d5e:5d380b6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/display/src/disp_srv.c
r5480d5e r5d380b6 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 63 63 sysarg_t wnd_id; 64 64 ipc_call_t call; 65 display_wnd_params_enc_t eparams; 65 66 display_wnd_params_t params; 67 char *caption; 66 68 size_t size; 67 69 errno_t rc; … … 73 75 } 74 76 75 if (size != sizeof(display_wnd_params_t)) { 76 async_answer_0(&call, EINVAL); 77 async_answer_0(icall, EINVAL); 78 return; 79 } 80 81 rc = async_data_write_finalize(&call, ¶ms, size); 82 if (rc != EOK) { 77 if (size != sizeof(display_wnd_params_enc_t)) { 78 async_answer_0(&call, EINVAL); 79 async_answer_0(icall, EINVAL); 80 return; 81 } 82 83 rc = async_data_write_finalize(&call, &eparams, size); 84 if (rc != EOK) { 85 async_answer_0(&call, rc); 86 async_answer_0(icall, rc); 87 return; 88 } 89 90 caption = calloc(eparams.caption_size + 1, 1); 91 if (caption == NULL) { 92 async_answer_0(icall, ENOMEM); 93 return; 94 } 95 96 if (!async_data_write_receive(&call, &size)) { 97 free(caption); 98 async_answer_0(&call, EREFUSED); 99 async_answer_0(icall, EREFUSED); 100 return; 101 } 102 103 if (size != eparams.caption_size) { 104 free(caption); 105 async_answer_0(&call, EINVAL); 106 async_answer_0(icall, EINVAL); 107 return; 108 } 109 110 rc = async_data_write_finalize(&call, caption, eparams.caption_size); 111 if (rc != EOK) { 112 free(caption); 83 113 async_answer_0(&call, rc); 84 114 async_answer_0(icall, rc); … … 87 117 88 118 if (srv->ops->window_create == NULL) { 89 async_answer_0(icall, ENOTSUP); 90 return; 91 } 119 free(caption); 120 async_answer_0(icall, ENOTSUP); 121 return; 122 } 123 124 /* Decode the parameters from transport */ 125 params.rect = eparams.rect; 126 params.caption = caption; 127 params.min_size = eparams.min_size; 128 params.pos = eparams.pos; 129 params.flags = eparams.flags; 130 params.idev_id = eparams.idev_id; 92 131 93 132 rc = srv->ops->window_create(srv->arg, ¶ms, &wnd_id); … … 114 153 { 115 154 sysarg_t wnd_id; 155 sysarg_t pos_id; 116 156 ipc_call_t call; 117 157 gfx_coord2_t pos; … … 120 160 121 161 wnd_id = ipc_get_arg1(icall); 162 pos_id = ipc_get_arg2(icall); 122 163 123 164 if (!async_data_write_receive(&call, &size)) { … … 145 186 } 146 187 147 rc = srv->ops->window_move_req(srv->arg, wnd_id, &pos );188 rc = srv->ops->window_move_req(srv->arg, wnd_id, &pos, pos_id); 148 189 async_answer_0(icall, rc); 149 190 } … … 185 226 rc = srv->ops->window_move(srv->arg, wnd_id, &dpos); 186 227 async_answer_0(icall, rc); 228 } 229 230 static void display_window_get_pos_srv(display_srv_t *srv, ipc_call_t *icall) 231 { 232 sysarg_t wnd_id; 233 ipc_call_t call; 234 gfx_coord2_t dpos; 235 size_t size; 236 errno_t rc; 237 238 wnd_id = ipc_get_arg1(icall); 239 240 if (srv->ops->window_get_pos == NULL) { 241 async_answer_0(icall, ENOTSUP); 242 return; 243 } 244 245 if (!async_data_read_receive(&call, &size)) { 246 async_answer_0(&call, EREFUSED); 247 async_answer_0(icall, EREFUSED); 248 return; 249 } 250 251 rc = srv->ops->window_get_pos(srv->arg, wnd_id, &dpos); 252 if (rc != EOK) { 253 async_answer_0(&call, rc); 254 async_answer_0(icall, rc); 255 return; 256 } 257 258 if (size != sizeof(gfx_coord2_t)) { 259 async_answer_0(&call, EINVAL); 260 async_answer_0(icall, EINVAL); 261 return; 262 } 263 264 rc = async_data_read_finalize(&call, &dpos, size); 265 if (rc != EOK) { 266 async_answer_0(&call, rc); 267 async_answer_0(icall, rc); 268 return; 269 } 270 271 async_answer_0(icall, EOK); 272 } 273 274 static void display_window_get_max_rect_srv(display_srv_t *srv, 275 ipc_call_t *icall) 276 { 277 sysarg_t wnd_id; 278 ipc_call_t call; 279 gfx_rect_t rect; 280 size_t size; 281 errno_t rc; 282 283 wnd_id = ipc_get_arg1(icall); 284 285 if (srv->ops->window_get_max_rect == NULL) { 286 async_answer_0(icall, ENOTSUP); 287 return; 288 } 289 290 if (!async_data_read_receive(&call, &size)) { 291 async_answer_0(&call, EREFUSED); 292 async_answer_0(icall, EREFUSED); 293 return; 294 } 295 296 rc = srv->ops->window_get_max_rect(srv->arg, wnd_id, &rect); 297 if (rc != EOK) { 298 async_answer_0(&call, rc); 299 async_answer_0(icall, rc); 300 return; 301 } 302 303 if (size != sizeof(gfx_rect_t)) { 304 async_answer_0(&call, EINVAL); 305 async_answer_0(icall, EINVAL); 306 return; 307 } 308 309 rc = async_data_read_finalize(&call, &rect, size); 310 if (rc != EOK) { 311 async_answer_0(&call, rc); 312 async_answer_0(icall, rc); 313 return; 314 } 315 316 async_answer_0(icall, EOK); 187 317 } 188 318 … … 193 323 display_wnd_rsztype_t rsztype; 194 324 gfx_coord2_t pos; 325 sysarg_t pos_id; 195 326 size_t size; 196 327 errno_t rc; … … 198 329 wnd_id = ipc_get_arg1(icall); 199 330 rsztype = (display_wnd_rsztype_t) ipc_get_arg2(icall); 331 pos_id = ipc_get_arg3(icall); 200 332 201 333 if (!async_data_write_receive(&call, &size)) { … … 223 355 } 224 356 225 rc = srv->ops->window_resize_req(srv->arg, wnd_id, rsztype, &pos); 357 rc = srv->ops->window_resize_req(srv->arg, wnd_id, rsztype, &pos, 358 pos_id); 226 359 async_answer_0(icall, rc); 227 360 } … … 266 399 } 267 400 401 static void display_window_minimize_srv(display_srv_t *srv, ipc_call_t *icall) 402 { 403 sysarg_t wnd_id; 404 errno_t rc; 405 406 wnd_id = ipc_get_arg1(icall); 407 408 if (srv->ops->window_minimize == NULL) { 409 async_answer_0(icall, ENOTSUP); 410 return; 411 } 412 413 rc = srv->ops->window_minimize(srv->arg, wnd_id); 414 async_answer_0(icall, rc); 415 } 416 417 static void display_window_maximize_srv(display_srv_t *srv, ipc_call_t *icall) 418 { 419 sysarg_t wnd_id; 420 errno_t rc; 421 422 wnd_id = ipc_get_arg1(icall); 423 424 if (srv->ops->window_maximize == NULL) { 425 async_answer_0(icall, ENOTSUP); 426 return; 427 } 428 429 rc = srv->ops->window_maximize(srv->arg, wnd_id); 430 async_answer_0(icall, rc); 431 } 432 433 static void display_window_unmaximize_srv(display_srv_t *srv, ipc_call_t *icall) 434 { 435 sysarg_t wnd_id; 436 errno_t rc; 437 438 wnd_id = ipc_get_arg1(icall); 439 440 if (srv->ops->window_unmaximize == NULL) { 441 async_answer_0(icall, ENOTSUP); 442 return; 443 } 444 445 rc = srv->ops->window_unmaximize(srv->arg, wnd_id); 446 async_answer_0(icall, rc); 447 } 448 268 449 static void display_window_set_cursor_srv(display_srv_t *srv, ipc_call_t *icall) 269 450 { … … 282 463 rc = srv->ops->window_set_cursor(srv->arg, wnd_id, cursor); 283 464 async_answer_0(icall, rc); 465 } 466 467 static void display_window_set_caption_srv(display_srv_t *srv, 468 ipc_call_t *icall) 469 { 470 sysarg_t wnd_id; 471 ipc_call_t call; 472 char *caption; 473 size_t size; 474 errno_t rc; 475 476 wnd_id = ipc_get_arg1(icall); 477 478 if (!async_data_write_receive(&call, &size)) { 479 async_answer_0(&call, EREFUSED); 480 async_answer_0(icall, EREFUSED); 481 return; 482 } 483 484 caption = calloc(size + 1, 1); 485 if (caption == NULL) { 486 async_answer_0(&call, ENOMEM); 487 async_answer_0(icall, ENOMEM); 488 return; 489 } 490 491 rc = async_data_write_finalize(&call, caption, size); 492 if (rc != EOK) { 493 free(caption); 494 async_answer_0(&call, rc); 495 async_answer_0(icall, rc); 496 return; 497 } 498 499 if (srv->ops->window_set_caption == NULL) { 500 free(caption); 501 async_answer_0(icall, ENOTSUP); 502 return; 503 } 504 505 rc = srv->ops->window_set_caption(srv->arg, wnd_id, caption); 506 async_answer_0(icall, rc); 507 free(caption); 284 508 } 285 509 … … 305 529 /* Transfer event data */ 306 530 if (!async_data_read_receive(&call, &size)) { 531 async_answer_0(&call, EREFUSED); 307 532 async_answer_0(icall, EREFUSED); 308 533 return; … … 339 564 /* Transfer information */ 340 565 if (!async_data_read_receive(&call, &size)) { 566 async_answer_0(&call, EREFUSED); 341 567 async_answer_0(icall, EREFUSED); 342 568 return; … … 399 625 display_window_move_srv(srv, &call); 400 626 break; 627 case DISPLAY_WINDOW_GET_POS: 628 display_window_get_pos_srv(srv, &call); 629 break; 630 case DISPLAY_WINDOW_GET_MAX_RECT: 631 display_window_get_max_rect_srv(srv, &call); 632 break; 401 633 case DISPLAY_WINDOW_RESIZE_REQ: 402 634 display_window_resize_req_srv(srv, &call); … … 405 637 display_window_resize_srv(srv, &call); 406 638 break; 639 case DISPLAY_WINDOW_MINIMIZE: 640 display_window_minimize_srv(srv, &call); 641 break; 642 case DISPLAY_WINDOW_MAXIMIZE: 643 display_window_maximize_srv(srv, &call); 644 break; 645 case DISPLAY_WINDOW_UNMAXIMIZE: 646 display_window_unmaximize_srv(srv, &call); 647 break; 407 648 case DISPLAY_WINDOW_SET_CURSOR: 408 649 display_window_set_cursor_srv(srv, &call); 650 break; 651 case DISPLAY_WINDOW_SET_CAPTION: 652 display_window_set_caption_srv(srv, &call); 409 653 break; 410 654 case DISPLAY_GET_EVENT:
Note:
See TracChangeset
for help on using the changeset viewer.