Changeset 4d9c807 in mainline
- Timestamp:
- 2019-12-13T19:02:10Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fdc8e40
- Parents:
- 4fbdc3d
- Location:
- uspace
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r4fbdc3d r4d9c807 456 456 display_t *display = NULL; 457 457 gfx_context_t *gc; 458 display_wnd_params_t params; 458 459 display_window_t *window = NULL; 459 460 errno_t rc; … … 467 468 } 468 469 469 rc = display_window_create(display, &wnd_cb, NULL, &window); 470 display_wnd_params_init(¶ms); 471 params.rect.p0.x = 0; 472 params.rect.p0.y = 0; 473 params.rect.p1.x = 400; 474 params.rect.p1.y = 300; 475 476 rc = display_window_create(display, ¶ms, &wnd_cb, NULL, &window); 470 477 if (rc != EOK) { 471 478 printf("Error creating window.\n"); -
uspace/app/terminal/terminal.c
r4fbdc3d r4d9c807 715 715 terminal_t *term; 716 716 gfx_bitmap_params_t params; 717 display_wnd_params_t wparams; 717 718 errno_t rc; 718 719 … … 755 756 } 756 757 757 rc = display_window_create(display, &terminal_wnd_cb, (void *) term, 758 &term->window); 758 display_wnd_params_init(&wparams); 759 wparams.rect.p0.x = 0; 760 wparams.rect.p0.y = 0; 761 wparams.rect.p1.x = width; 762 wparams.rect.p1.y = height; 763 764 rc = display_window_create(display, &wparams, &terminal_wnd_cb, 765 (void *) term, &term->window); 759 766 if (rc != EOK) { 760 767 printf("Error creating window.\n"); -
uspace/lib/display/include/disp_srv.h
r4fbdc3d r4d9c807 39 39 #include <errno.h> 40 40 #include <types/display/event.h> 41 #include <types/display/wndparams.h> 41 42 42 43 typedef struct display_ops display_ops_t; … … 50 51 51 52 struct display_ops { 52 errno_t (*window_create)(void *, sysarg_t *);53 errno_t (*window_create)(void *, display_wnd_params_t *, sysarg_t *); 53 54 errno_t (*window_destroy)(void *, sysarg_t); 54 55 errno_t (*get_event)(void *, sysarg_t *, display_wnd_ev_t *); -
uspace/lib/display/include/display.h
r4fbdc3d r4d9c807 39 39 #include <gfx/context.h> 40 40 #include <stdbool.h> 41 #include "types/display/wndparams.h" 41 42 #include "types/display.h" 42 43 43 44 extern errno_t display_open(const char *, display_t **); 44 45 extern void display_close(display_t *); 45 extern errno_t display_window_create(display_t *, display_wnd_cb_t *, 46 void *, display_window_t **); 46 extern void display_wnd_params_init(display_wnd_params_t *); 47 extern errno_t display_window_create(display_t *, display_wnd_params_t *, 48 display_wnd_cb_t *, void *, display_window_t **); 47 49 extern errno_t display_window_destroy(display_window_t *); 48 50 extern errno_t display_window_get_gc(display_window_t *, gfx_context_t **); -
uspace/lib/display/src/disp_srv.c
r4fbdc3d r4d9c807 62 62 { 63 63 sysarg_t wnd_id; 64 ipc_call_t call; 65 display_wnd_params_t params; 66 size_t size; 64 67 errno_t rc; 65 68 66 69 printf("display_window_create_srv\n"); 70 71 if (!async_data_write_receive(&call, &size)) { 72 async_answer_0(&call, EREFUSED); 73 async_answer_0(icall, EREFUSED); 74 return; 75 } 76 77 if (size != sizeof(display_wnd_params_t)) { 78 async_answer_0(&call, EINVAL); 79 async_answer_0(icall, EINVAL); 80 return; 81 } 82 83 rc = async_data_write_finalize(&call, ¶ms, size); 84 if (rc != EOK) { 85 async_answer_0(&call, rc); 86 async_answer_0(icall, rc); 87 return; 88 } 67 89 68 90 if (srv->ops->window_create == NULL) { … … 71 93 } 72 94 73 rc = srv->ops->window_create(srv->arg, & wnd_id);95 rc = srv->ops->window_create(srv->arg, ¶ms, &wnd_id); 74 96 async_answer_1(icall, rc, wnd_id); 75 97 } -
uspace/lib/display/src/display.c
r4fbdc3d r4d9c807 36 36 #include <ipcgfx/client.h> 37 37 #include <loc.h> 38 #include <mem.h> 38 39 #include <stdlib.h> 39 40 … … 133 134 } 134 135 136 /** Initialize window parameters structure. 137 * 138 * @param params Window parameters structure 139 */ 140 void display_wnd_params_init(display_wnd_params_t *params) 141 { 142 memset(params, 0, sizeof(*params)); 143 } 144 135 145 /** Create a display window. 136 146 * 137 147 * @param display Display 148 * @param params Window parameters 138 149 * @param cb Callback functions 139 150 * @param cb_arg Argument to callback functions … … 141 152 * @return EOK on success or an error code 142 153 */ 143 errno_t display_window_create(display_t *display, display_wnd_ cb_t *cb,144 void *cb_arg, display_window_t **rwindow)154 errno_t display_window_create(display_t *display, display_wnd_params_t *params, 155 display_wnd_cb_t *cb, void *cb_arg, display_window_t **rwindow) 145 156 { 146 157 display_window_t *window; 147 158 async_exch_t *exch; 148 sysarg_t wnd_id; 159 aid_t req; 160 ipc_call_t answer; 149 161 errno_t rc; 150 162 … … 154 166 155 167 exch = async_exchange_begin(display->sess); 156 rc = async_req_0_1(exch, DISPLAY_WINDOW_CREATE, &wnd_id); 157 158 async_exchange_end(exch); 159 160 if (rc != EOK) { 161 free(window); 162 return rc; 163 } 168 req = async_send_0(exch, DISPLAY_WINDOW_CREATE, &answer); 169 rc = async_data_write_start(exch, params, sizeof (display_wnd_params_t)); 170 async_exchange_end(exch); 171 if (rc != EOK) { 172 async_forget(req); 173 return rc; 174 } 175 176 async_wait_for(req, &rc); 177 if (rc != EOK) 178 return rc; 164 179 165 180 window->display = display; 166 window->id = wnd_id;181 window->id = ipc_get_arg1(&answer); 167 182 window->cb = cb; 168 183 window->cb_arg = cb_arg; -
uspace/lib/display/test/display.c
r4fbdc3d r4d9c807 49 49 static void test_kbd_event(void *, kbd_event_t *); 50 50 51 static errno_t test_window_create(void *, sysarg_t *);51 static errno_t test_window_create(void *, display_wnd_params_t *, sysarg_t *); 52 52 static errno_t test_window_destroy(void *, sysarg_t); 53 53 static errno_t test_get_event(void *, sysarg_t *, display_wnd_ev_t *); … … 79 79 int event_cnt; 80 80 bool window_create_called; 81 gfx_rect_t create_rect; 81 82 bool window_destroy_called; 82 83 bool get_event_called; … … 120 121 service_id_t sid; 121 122 display_t *disp = NULL; 123 display_wnd_params_t params; 122 124 display_window_t *wnd; 123 125 test_response_t resp; … … 139 141 resp.rc = ENOMEM; 140 142 resp.window_create_called = false; 141 rc = display_window_create(disp, &test_display_wnd_cb, NULL, &wnd); 143 display_wnd_params_init(¶ms); 144 params.rect.p0.x = 0; 145 params.rect.p0.y = 0; 146 params.rect.p0.x = 100; 147 params.rect.p0.y = 100; 148 149 rc = display_window_create(disp, ¶ms, &test_display_wnd_cb, 150 (void *) &resp, &wnd); 142 151 PCUT_ASSERT_TRUE(resp.window_create_called); 152 PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.create_rect.p0.x); 153 PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.create_rect.p0.y); 154 PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.create_rect.p1.x); 155 PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.create_rect.p1.y); 143 156 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 144 157 PCUT_ASSERT_NULL(wnd); … … 158 171 service_id_t sid; 159 172 display_t *disp = NULL; 173 display_wnd_params_t params; 160 174 display_window_t *wnd; 161 175 test_response_t resp; … … 177 191 resp.rc = EOK; 178 192 resp.window_create_called = false; 179 rc = display_window_create(disp, &test_display_wnd_cb, NULL, &wnd); 193 display_wnd_params_init(¶ms); 194 params.rect.p0.x = 0; 195 params.rect.p0.y = 0; 196 params.rect.p0.x = 100; 197 params.rect.p0.y = 100; 198 199 rc = display_window_create(disp, ¶ms, &test_display_wnd_cb, 200 (void *) &resp, &wnd); 180 201 PCUT_ASSERT_TRUE(resp.window_create_called); 202 PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.create_rect.p0.x); 203 PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.create_rect.p0.y); 204 PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.create_rect.p1.x); 205 PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.create_rect.p1.y); 181 206 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 182 207 PCUT_ASSERT_NOT_NULL(wnd); … … 198 223 service_id_t sid; 199 224 display_t *disp = NULL; 225 display_wnd_params_t params; 200 226 display_window_t *wnd; 201 227 test_response_t resp; … … 216 242 resp.rc = EOK; 217 243 resp.window_create_called = false; 218 rc = display_window_create(disp, &test_display_wnd_cb, NULL, &wnd); 244 display_wnd_params_init(¶ms); 245 params.rect.p0.x = 0; 246 params.rect.p0.y = 0; 247 params.rect.p0.x = 100; 248 params.rect.p0.y = 100; 249 250 rc = display_window_create(disp, ¶ms, &test_display_wnd_cb, 251 (void *) &resp, &wnd); 219 252 PCUT_ASSERT_TRUE(resp.window_create_called); 253 PCUT_ASSERT_EQUALS(params.rect.p0.x, resp.create_rect.p0.x); 254 PCUT_ASSERT_EQUALS(params.rect.p0.y, resp.create_rect.p0.y); 255 PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.create_rect.p1.x); 256 PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.create_rect.p1.y); 220 257 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 221 258 PCUT_ASSERT_NOT_NULL(wnd); … … 238 275 service_id_t sid; 239 276 display_t *disp = NULL; 277 display_wnd_params_t params; 240 278 display_window_t *wnd; 241 279 test_response_t resp; … … 257 295 wnd = NULL; 258 296 resp.rc = EOK; 259 rc = display_window_create(disp, &test_display_wnd_cb, NULL, &wnd); 297 display_wnd_params_init(¶ms); 298 params.rect.p0.x = 0; 299 params.rect.p0.y = 0; 300 params.rect.p0.x = 100; 301 params.rect.p0.y = 100; 302 303 rc = display_window_create(disp, ¶ms, &test_display_wnd_cb, 304 (void *) &resp, &wnd); 260 305 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 261 306 PCUT_ASSERT_NOT_NULL(wnd); … … 283 328 service_id_t sid; 284 329 display_t *disp = NULL; 330 display_wnd_params_t params; 285 331 display_window_t *wnd; 286 332 test_response_t resp; … … 303 349 wnd = NULL; 304 350 resp.rc = EOK; 305 rc = display_window_create(disp, &test_display_wnd_cb, NULL, &wnd); 351 display_wnd_params_init(¶ms); 352 params.rect.p0.x = 0; 353 params.rect.p0.y = 0; 354 params.rect.p0.x = 100; 355 params.rect.p0.y = 100; 356 357 rc = display_window_create(disp, ¶ms, &test_display_wnd_cb, 358 (void *) &resp, &wnd); 306 359 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 307 360 PCUT_ASSERT_NOT_NULL(wnd); … … 336 389 service_id_t sid; 337 390 display_t *disp = NULL; 391 display_wnd_params_t params; 338 392 display_window_t *wnd; 339 393 test_response_t resp; … … 356 410 wnd = NULL; 357 411 resp.rc = EOK; 358 rc = display_window_create(disp, &test_display_wnd_cb, (void *) &resp, 359 &wnd); 412 display_wnd_params_init(¶ms); 413 params.rect.p0.x = 0; 414 params.rect.p0.y = 0; 415 params.rect.p0.x = 100; 416 params.rect.p0.y = 100; 417 418 rc = display_window_create(disp, ¶ms, &test_display_wnd_cb, 419 (void *) &resp, &wnd); 360 420 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 361 421 PCUT_ASSERT_NOT_NULL(wnd); … … 462 522 } 463 523 464 static errno_t test_window_create(void *arg, sysarg_t *rwnd_id) 524 static errno_t test_window_create(void *arg, display_wnd_params_t *params, 525 sysarg_t *rwnd_id) 465 526 { 466 527 test_response_t *resp = (test_response_t *) arg; 467 528 468 529 resp->window_create_called = true; 530 resp->create_rect = params->rect; 469 531 if (resp->rc == EOK) 470 532 *rwnd_id = resp->wnd_id; -
uspace/srv/hid/display/dsops.c
r4fbdc3d r4d9c807 43 43 #include "window.h" 44 44 45 static errno_t disp_window_create(void *, sysarg_t *);45 static errno_t disp_window_create(void *, display_wnd_params_t *, sysarg_t *); 46 46 static errno_t disp_window_destroy(void *, sysarg_t); 47 47 static errno_t disp_get_event(void *, sysarg_t *, display_wnd_ev_t *); … … 53 53 }; 54 54 55 static errno_t disp_window_create(void *arg, sysarg_t *rwnd_id) 55 static errno_t disp_window_create(void *arg, display_wnd_params_t *params, 56 sysarg_t *rwnd_id) 56 57 { 57 58 errno_t rc;
Note:
See TracChangeset
for help on using the changeset viewer.