Changeset b4b4dafe in mainline
- Timestamp:
- 2021-06-03T14:02:59Z (3 years ago)
- Children:
- 2e6394e
- Parents:
- 6baab83
- git-author:
- Jiri Svoboda <jiri@…> (2021-06-02 17:00:03)
- git-committer:
- Jiri Svoboda <jiri@…> (2021-06-03 14:02:59)
- Location:
- uspace
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/display/include/types/display/wndparams.h
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 38 38 #include <gfx/coord.h> 39 39 40 /** Window flags */ 41 typedef enum { 42 /** Popup window (capture events, no focus) */ 43 wndf_popup = 0x1 44 } display_wnd_flags_t; 45 40 46 /** Parameters for a new window. 41 47 * … … 50 56 /** Minimum size (when being resized) */ 51 57 gfx_coord2_t min_size; 58 /** Flags */ 59 display_wnd_flags_t flags; 52 60 } display_wnd_params_t; 53 61 -
uspace/lib/ui/include/types/ui/window.h
r6baab83 rb4b4dafe 63 63 } ui_wnd_placement_t; 64 64 65 /** Window flags */ 66 typedef enum { 67 /** Popup window */ 68 ui_wndf_popup = 0x1 69 } ui_wnd_flags_t; 70 65 71 /** Window parameters */ 66 72 typedef struct { … … 73 79 /** Window placement */ 74 80 ui_wnd_placement_t placement; 81 /** Window flags */ 82 ui_wnd_flags_t flags; 75 83 /** Parent rectangle for popup windows */ 76 84 gfx_rect_t prect; -
uspace/lib/ui/include/ui/window.h
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 202 0Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * -
uspace/lib/ui/src/popup.c
r6baab83 rb4b4dafe 94 94 wparams.style &= ~ui_wds_decorated; 95 95 wparams.placement = ui_wnd_place_popup; 96 wparams.flags |= ui_wndf_popup; 96 97 97 98 /* Compute position of parent rectangle relative to the screen */ -
uspace/lib/ui/src/window.c
r6baab83 rb4b4dafe 188 188 gfx_rect_dims(¶ms->rect, &dparams.min_size); 189 189 190 if ((params->flags & ui_wndf_popup) != 0) 191 dparams.flags |= wndf_popup; 192 190 193 if (ui->display != NULL) { 191 194 if (params->placement != ui_wnd_place_default) { -
uspace/srv/hid/display/client.c
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 115 115 seat = ds_display_first_seat(wnd->display); 116 116 while (seat != NULL) { 117 ds_seat_evac_ focus(seat, wnd);117 ds_seat_evac_wnd_refs(seat, wnd); 118 118 seat = ds_display_next_seat(seat); 119 119 } -
uspace/srv/hid/display/dsops.c
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 75 75 errno_t rc; 76 76 ds_client_t *client = (ds_client_t *) arg; 77 ds_seat_t *seat;78 77 ds_window_t *wnd; 79 78 … … 92 91 wnd->id); 93 92 94 /* XXX All the below should probably be part of ds_window_create() */95 wnd->dpos.x = ((wnd->id - 1) & 1) * 400;96 wnd->dpos.y = ((wnd->id - 1) & 2) / 2 * 300;97 98 seat = ds_display_first_seat(client->display);99 ds_seat_set_focus(seat, wnd);100 (void) ds_display_paint(wnd->display, NULL);101 102 93 ds_display_unlock(client->display); 103 94 -
uspace/srv/hid/display/seat.c
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 106 106 } 107 107 108 /** Evacuate focus from window. 108 /** Set seat popup window. 109 * 110 * @param seat Seat 111 * @param wnd Popup window 112 */ 113 void ds_seat_set_popup(ds_seat_t *seat, ds_window_t *wnd) 114 { 115 seat->popup = wnd; 116 } 117 118 /** Evacuate seat references to window. 109 119 * 110 120 * If seat's focus is @a wnd, it will be set to a different window. 121 * If seat's popup window is @a wnd, it will be set to NULL. 111 122 * 112 123 * @param seat Seat 113 124 * @param wnd Window to evacuate focus from 114 125 */ 115 void ds_seat_evac_ focus(ds_seat_t *seat, ds_window_t *wnd)126 void ds_seat_evac_wnd_refs(ds_seat_t *seat, ds_window_t *wnd) 116 127 { 117 128 ds_window_t *nwnd; … … 126 137 ds_seat_set_focus(seat, nwnd); 127 138 } 139 140 if (seat->popup == wnd) 141 seat->popup = NULL; 128 142 } 129 143 … … 168 182 } 169 183 170 dwindow = seat->focus; 184 dwindow = seat->popup; 185 if (dwindow == NULL) 186 dwindow = seat->focus; 187 171 188 if (dwindow == NULL) 172 189 return EOK; … … 328 345 /* Focus window on button press */ 329 346 if (event->type == PTD_PRESS && event->btn_num == 1) { 330 if (wnd != NULL ) {347 if (wnd != NULL && (wnd->flags & wndf_popup) == 0) { 331 348 ds_seat_set_focus(seat, wnd); 332 349 } … … 410 427 411 428 wnd = ds_display_window_by_pos(seat->display, &seat->pntpos); 429 /* 430 * Deliver event to popup window, unless the pointer is over 431 * it (in which case it will be delivered to that window 432 * below, anyway. 433 */ 434 if (seat->popup != wnd && seat->popup != NULL) { 435 rc = ds_window_post_pos_event(seat->popup, event); 436 if (rc != EOK) 437 return rc; 438 } 439 412 440 if (seat->focus != wnd && seat->focus != NULL) { 413 441 rc = ds_window_post_pos_event(seat->focus, event); -
uspace/srv/hid/display/seat.h
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 49 49 extern void ds_seat_destroy(ds_seat_t *); 50 50 extern void ds_seat_set_focus(ds_seat_t *, ds_window_t *); 51 extern void ds_seat_evac_focus(ds_seat_t *, ds_window_t *); 51 extern void ds_seat_set_popup(ds_seat_t *, ds_window_t *); 52 extern void ds_seat_evac_wnd_refs(ds_seat_t *, ds_window_t *); 52 53 extern void ds_seat_switch_focus(ds_seat_t *); 53 54 extern errno_t ds_seat_post_kbd_event(ds_seat_t *, kbd_event_t *); -
uspace/srv/hid/display/test/client.c
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 34 34 #include "../client.h" 35 35 #include "../display.h" 36 #include "../seat.h" 36 37 #include "../window.h" 37 38 … … 78 79 ds_display_t *disp; 79 80 ds_client_t *client; 81 ds_seat_t *seat; 80 82 ds_window_t *w0; 81 83 ds_window_t *w1; 82 84 ds_window_t *wnd; 83 85 display_wnd_params_t params; 84 errno_t rc; 85 86 rc = ds_display_create(NULL, df_none, &disp); 87 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 88 89 rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client); 86 bool called_cb = NULL; 87 errno_t rc; 88 89 rc = ds_display_create(NULL, df_none, &disp); 90 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 91 92 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 93 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 94 95 rc = ds_seat_create(disp, &seat); 90 96 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 91 97 … … 114 120 ds_window_destroy(w0); 115 121 ds_window_destroy(w1); 122 ds_seat_destroy(seat); 116 123 ds_client_destroy(client); 117 124 ds_display_destroy(disp); … … 123 130 ds_display_t *disp; 124 131 ds_client_t *client; 132 ds_seat_t *seat; 125 133 ds_window_t *w0; 126 134 ds_window_t *w1; 127 135 ds_window_t *wnd; 128 136 display_wnd_params_t params; 129 errno_t rc; 130 131 rc = ds_display_create(NULL, df_none, &disp); 132 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 133 134 rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client); 137 bool called_cb = NULL; 138 errno_t rc; 139 140 rc = ds_display_create(NULL, df_none, &disp); 141 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 142 143 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 144 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 145 146 rc = ds_seat_create(disp, &seat); 135 147 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 136 148 … … 156 168 ds_window_destroy(w0); 157 169 ds_window_destroy(w1); 170 ds_seat_destroy(seat); 158 171 ds_client_destroy(client); 159 172 ds_display_destroy(disp); … … 165 178 ds_display_t *disp; 166 179 ds_client_t *client; 180 ds_seat_t *seat; 167 181 ds_window_t *wnd; 168 182 display_wnd_params_t params; … … 178 192 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 179 193 180 display_wnd_params_init(¶ms); 181 params.rect.p0.x = params.rect.p0.y = 0; 182 params.rect.p1.x = params.rect.p1.y = 1; 183 184 rc = ds_window_create(client, ¶ms, &wnd); 185 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 186 187 PCUT_ASSERT_FALSE(called_cb); 194 rc = ds_seat_create(disp, &seat); 195 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 196 197 display_wnd_params_init(¶ms); 198 params.rect.p0.x = params.rect.p0.y = 0; 199 params.rect.p1.x = params.rect.p1.y = 1; 200 201 rc = ds_window_create(client, ¶ms, &wnd); 202 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 203 204 /* New window gets focused event */ 205 PCUT_ASSERT_TRUE(called_cb); 206 207 rc = ds_client_get_event(client, &rwindow, &revent); 208 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 209 210 called_cb = false; 188 211 189 212 rc = ds_client_get_event(client, &rwindow, &revent); … … 203 226 204 227 ds_window_destroy(wnd); 228 ds_seat_destroy(seat); 205 229 ds_client_destroy(client); 206 230 ds_display_destroy(disp); … … 212 236 ds_display_t *disp; 213 237 ds_client_t *client; 238 ds_seat_t *seat; 214 239 ds_window_t *wnd; 215 240 display_wnd_params_t params; … … 225 250 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 226 251 227 display_wnd_params_init(¶ms); 228 params.rect.p0.x = params.rect.p0.y = 0; 229 params.rect.p1.x = params.rect.p1.y = 1; 230 231 rc = ds_window_create(client, ¶ms, &wnd); 232 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 233 234 PCUT_ASSERT_FALSE(called_cb); 252 rc = ds_seat_create(disp, &seat); 253 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 254 255 display_wnd_params_init(¶ms); 256 params.rect.p0.x = params.rect.p0.y = 0; 257 params.rect.p1.x = params.rect.p1.y = 1; 258 259 rc = ds_window_create(client, ¶ms, &wnd); 260 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 261 262 /* New window gets focused event */ 263 PCUT_ASSERT_TRUE(called_cb); 264 265 rc = ds_client_get_event(client, &rwindow, &revent); 266 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 267 268 called_cb = false; 235 269 236 270 rc = ds_client_get_event(client, &rwindow, &revent); … … 250 284 251 285 ds_window_destroy(wnd); 286 ds_seat_destroy(seat); 252 287 ds_client_destroy(client); 253 288 ds_display_destroy(disp); … … 259 294 ds_display_t *disp; 260 295 ds_client_t *client; 296 ds_seat_t *seat; 261 297 ds_window_t *wnd; 262 298 display_wnd_params_t params; … … 273 309 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 274 310 275 display_wnd_params_init(¶ms); 276 params.rect.p0.x = params.rect.p0.y = 0; 277 params.rect.p1.x = params.rect.p1.y = 1; 278 279 rc = ds_window_create(client, ¶ms, &wnd); 280 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 311 rc = ds_seat_create(disp, &seat); 312 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 313 314 display_wnd_params_init(¶ms); 315 params.rect.p0.x = params.rect.p0.y = 0; 316 params.rect.p1.x = params.rect.p1.y = 1; 317 318 rc = ds_window_create(client, ¶ms, &wnd); 319 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 320 321 /* New window gets focused event */ 322 PCUT_ASSERT_TRUE(called_cb); 323 324 rc = ds_client_get_event(client, &rwindow, &revent); 325 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 326 327 called_cb = false; 328 329 rc = ds_client_get_event(client, &rwindow, &revent); 330 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 281 331 282 332 event.type = KEY_PRESS; … … 284 334 event.mods = 0; 285 335 event.c = L'\0'; 286 287 PCUT_ASSERT_FALSE(called_cb);288 289 rc = ds_client_get_event(client, &rwindow, &revent);290 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);291 336 292 337 rc = ds_client_post_kbd_event(client, wnd, &event); … … 307 352 308 353 ds_window_destroy(wnd); 354 ds_seat_destroy(seat); 309 355 ds_client_destroy(client); 310 356 ds_display_destroy(disp); … … 316 362 ds_display_t *disp; 317 363 ds_client_t *client; 364 ds_seat_t *seat; 318 365 ds_window_t *wnd; 319 366 display_wnd_params_t params; … … 330 377 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 331 378 332 display_wnd_params_init(¶ms); 333 params.rect.p0.x = params.rect.p0.y = 0; 334 params.rect.p1.x = params.rect.p1.y = 1; 335 336 rc = ds_window_create(client, ¶ms, &wnd); 337 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 379 rc = ds_seat_create(disp, &seat); 380 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 381 382 display_wnd_params_init(¶ms); 383 params.rect.p0.x = params.rect.p0.y = 0; 384 params.rect.p1.x = params.rect.p1.y = 1; 385 386 rc = ds_window_create(client, ¶ms, &wnd); 387 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 388 389 /* New window gets focused event */ 390 PCUT_ASSERT_TRUE(called_cb); 391 392 rc = ds_client_get_event(client, &rwindow, &revent); 393 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 394 395 called_cb = false; 396 397 PCUT_ASSERT_FALSE(called_cb); 398 399 rc = ds_client_get_event(client, &rwindow, &revent); 400 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 338 401 339 402 event.type = POS_PRESS; 340 403 event.hpos = 1; 341 404 event.vpos = 2; 342 343 PCUT_ASSERT_FALSE(called_cb);344 345 rc = ds_client_get_event(client, &rwindow, &revent);346 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);347 405 348 406 rc = ds_client_post_pos_event(client, wnd, &event); … … 362 420 363 421 ds_window_destroy(wnd); 422 ds_seat_destroy(seat); 364 423 ds_client_destroy(client); 365 424 ds_display_destroy(disp); … … 371 430 ds_display_t *disp; 372 431 ds_client_t *client; 432 ds_seat_t *seat; 373 433 ds_window_t *wnd; 374 434 display_wnd_params_t params; … … 385 445 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 386 446 387 display_wnd_params_init(¶ms); 388 params.rect.p0.x = params.rect.p0.y = 0; 389 params.rect.p1.x = params.rect.p1.y = 1; 390 391 rc = ds_window_create(client, ¶ms, &wnd); 392 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 447 rc = ds_seat_create(disp, &seat); 448 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 449 450 display_wnd_params_init(¶ms); 451 params.rect.p0.x = params.rect.p0.y = 0; 452 params.rect.p1.x = params.rect.p1.y = 1; 453 454 rc = ds_window_create(client, ¶ms, &wnd); 455 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 456 457 /* New window gets focused event */ 458 PCUT_ASSERT_TRUE(called_cb); 459 460 rc = ds_client_get_event(client, &rwindow, &revent); 461 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 462 463 called_cb = false; 464 465 PCUT_ASSERT_FALSE(called_cb); 466 467 rc = ds_client_get_event(client, &rwindow, &revent); 468 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc); 393 469 394 470 rect.p0.x = 1; … … 396 472 rect.p1.x = 3; 397 473 rect.p1.y = 4; 398 399 PCUT_ASSERT_FALSE(called_cb);400 401 rc = ds_client_get_event(client, &rwindow, &revent);402 PCUT_ASSERT_ERRNO_VAL(ENOENT, rc);403 474 404 475 rc = ds_client_post_resize_event(client, wnd, &rect); … … 419 490 420 491 ds_window_destroy(wnd); 492 ds_seat_destroy(seat); 421 493 ds_client_destroy(client); 422 494 ds_display_destroy(disp); … … 428 500 ds_display_t *disp; 429 501 ds_client_t *client; 502 ds_seat_t *seat; 430 503 ds_window_t *wnd; 431 504 display_wnd_params_t params; … … 441 514 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 442 515 443 display_wnd_params_init(¶ms); 444 params.rect.p0.x = params.rect.p0.y = 0; 445 params.rect.p1.x = params.rect.p1.y = 1; 446 447 rc = ds_window_create(client, ¶ms, &wnd); 448 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 449 450 PCUT_ASSERT_FALSE(called_cb); 516 rc = ds_seat_create(disp, &seat); 517 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 518 519 display_wnd_params_init(¶ms); 520 params.rect.p0.x = params.rect.p0.y = 0; 521 params.rect.p1.x = params.rect.p1.y = 1; 522 523 rc = ds_window_create(client, ¶ms, &wnd); 524 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 525 526 /* New window gets focused event */ 527 PCUT_ASSERT_TRUE(called_cb); 528 529 rc = ds_client_get_event(client, &rwindow, &revent); 530 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 531 532 called_cb = false; 451 533 452 534 rc = ds_client_get_event(client, &rwindow, &revent); … … 466 548 467 549 ds_window_destroy(wnd); 550 ds_seat_destroy(seat); 468 551 ds_client_destroy(client); 469 552 ds_display_destroy(disp); … … 479 562 ds_display_t *disp; 480 563 ds_client_t *client; 564 ds_seat_t *seat; 481 565 ds_window_t *wnd; 482 566 display_wnd_params_t params; … … 489 573 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 490 574 491 display_wnd_params_init(¶ms); 492 params.rect.p0.x = params.rect.p0.y = 0; 493 params.rect.p1.x = params.rect.p1.y = 1; 494 495 rc = ds_window_create(client, ¶ms, &wnd); 496 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 497 575 rc = ds_seat_create(disp, &seat); 576 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 577 578 display_wnd_params_init(¶ms); 579 params.rect.p0.x = params.rect.p0.y = 0; 580 params.rect.p1.x = params.rect.p1.y = 1; 581 582 rc = ds_window_create(client, ¶ms, &wnd); 583 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 584 585 ds_seat_destroy(seat); 498 586 ds_client_destroy(client); 499 587 ds_display_destroy(disp); -
uspace/srv/hid/display/test/display.c
r6baab83 rb4b4dafe 94 94 ds_display_t *disp; 95 95 ds_client_t *client; 96 ds_seat_t *seat; 96 97 ds_window_t *w0; 97 98 ds_window_t *w1; 98 99 ds_window_t *wnd; 99 100 display_wnd_params_t params; 100 errno_t rc; 101 102 rc = ds_display_create(NULL, df_none, &disp); 103 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 104 105 rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client); 101 bool called_cb = false; 102 errno_t rc; 103 104 rc = ds_display_create(NULL, df_none, &disp); 105 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 106 107 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 108 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 109 110 rc = ds_seat_create(disp, &seat); 106 111 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 107 112 … … 148 153 ds_window_destroy(w0); 149 154 ds_window_destroy(w1); 155 ds_seat_destroy(seat); 150 156 ds_client_destroy(client); 151 157 ds_display_destroy(disp); … … 157 163 ds_display_t *disp; 158 164 ds_client_t *client; 165 ds_seat_t *seat; 159 166 ds_window_t *w0; 160 167 ds_window_t *w1; … … 162 169 display_wnd_params_t params; 163 170 gfx_coord2_t pos; 164 errno_t rc; 165 166 rc = ds_display_create(NULL, df_none, &disp); 167 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 168 169 rc = ds_client_create(disp, &test_ds_client_cb, NULL, &client); 171 bool called_cb = false; 172 errno_t rc; 173 174 rc = ds_display_create(NULL, df_none, &disp); 175 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 176 177 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 178 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 179 180 rc = ds_seat_create(disp, &seat); 170 181 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 171 182 … … 198 209 ds_window_destroy(w0); 199 210 ds_window_destroy(w1); 211 ds_seat_destroy(seat); 200 212 ds_client_destroy(client); 201 213 ds_display_destroy(disp); -
uspace/srv/hid/display/test/seat.c
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 126 126 called_cb = false; 127 127 128 ds_seat_evac_ focus(seat, w1);128 ds_seat_evac_wnd_refs(seat, w1); 129 129 PCUT_ASSERT_EQUALS(w0, seat->focus); 130 130 PCUT_ASSERT_TRUE(called_cb); … … 172 172 called_cb = false; 173 173 174 ds_seat_evac_ focus(seat, wnd);174 ds_seat_evac_wnd_refs(seat, wnd); 175 175 PCUT_ASSERT_NULL(seat->focus); 176 176 PCUT_ASSERT_TRUE(called_cb); 177 178 ds_window_destroy(wnd); 179 ds_seat_destroy(seat); 180 ds_client_destroy(client); 181 ds_display_destroy(disp); 182 } 183 184 /** Evacuate popup reference from window. 185 * 186 * After evacuating no window should be set as the popup 187 */ 188 PCUT_TEST(evac_popup) 189 { 190 ds_display_t *disp; 191 ds_client_t *client; 192 ds_seat_t *seat; 193 ds_window_t *wnd; 194 display_wnd_params_t params; 195 bool called_cb = false; 196 errno_t rc; 197 198 rc = ds_display_create(NULL, df_none, &disp); 199 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 200 201 rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client); 202 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 203 204 rc = ds_seat_create(disp, &seat); 205 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 206 207 display_wnd_params_init(¶ms); 208 params.rect.p0.x = params.rect.p0.y = 0; 209 params.rect.p1.x = params.rect.p1.y = 1; 210 params.flags |= wndf_popup; 211 212 rc = ds_window_create(client, ¶ms, &wnd); 213 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 214 215 PCUT_ASSERT_EQUALS(wnd, seat->popup); 216 217 ds_seat_evac_wnd_refs(seat, wnd); 218 PCUT_ASSERT_NULL(seat->popup); 177 219 178 220 ds_window_destroy(wnd); … … 436 478 w1->dpos.y = 400; 437 479 438 PCUT_ASSERT_FALSE(called_cb); 480 /* New window gets focused event */ 481 PCUT_ASSERT_TRUE(called_cb); 482 483 called_cb = false; 439 484 440 485 ds_seat_set_focus(seat, w0); -
uspace/srv/hid/display/test/window.c
r6baab83 rb4b4dafe 104 104 ds_display_t *disp; 105 105 ds_client_t *client; 106 ds_seat_t *seat; 106 107 ds_window_t *wnd; 107 108 display_wnd_params_t params; … … 113 114 114 115 rc = ds_client_create(disp, NULL, NULL, &client); 116 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 117 118 rc = ds_seat_create(disp, &seat); 115 119 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 116 120 … … 126 130 127 131 ds_window_destroy(wnd); 132 ds_seat_destroy(seat); 128 133 ds_client_destroy(client); 129 134 ds_display_destroy(disp); … … 136 141 ds_display_t *disp; 137 142 ds_client_t *client; 143 ds_seat_t *seat; 138 144 ds_window_t *wnd; 139 145 ds_window_t *rwindow; … … 152 158 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 153 159 160 rc = ds_seat_create(disp, &seat); 161 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 162 154 163 display_wnd_params_init(¶ms); 155 164 params.rect.p0.x = params.rect.p0.y = 0; … … 157 166 158 167 rc = ds_window_create(client, ¶ms, &wnd); 168 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 169 170 /* New window gets focused event */ 171 rc = ds_client_get_event(client, &rwindow, &revent); 159 172 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 160 173 … … 174 187 175 188 ds_window_destroy(wnd); 189 ds_seat_destroy(seat); 176 190 ds_client_destroy(client); 177 191 ds_display_destroy(disp); … … 184 198 ds_display_t *disp; 185 199 ds_client_t *client; 200 ds_seat_t *seat; 186 201 ds_window_t *wnd; 187 202 display_wnd_params_t params; … … 196 211 197 212 rc = ds_client_create(disp, NULL, NULL, &client); 213 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 214 215 rc = ds_seat_create(disp, &seat); 198 216 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 199 217 … … 242 260 243 261 ds_window_destroy(wnd); 262 ds_seat_destroy(seat); 244 263 ds_client_destroy(client); 245 264 ds_display_destroy(disp); … … 252 271 ds_display_t *disp; 253 272 ds_client_t *client; 273 ds_seat_t *seat; 254 274 ds_window_t *wnd; 255 275 display_wnd_params_t params; … … 264 284 265 285 rc = ds_client_create(disp, NULL, NULL, &client); 286 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 287 288 rc = ds_seat_create(disp, &seat); 266 289 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 267 290 … … 284 307 285 308 ds_window_destroy(wnd); 309 ds_seat_destroy(seat); 286 310 ds_client_destroy(client); 287 311 ds_display_destroy(disp); … … 340 364 ds_display_t *disp; 341 365 ds_client_t *client; 366 ds_seat_t *seat; 342 367 ds_window_t *wnd; 343 368 display_wnd_params_t params; … … 353 378 354 379 rc = ds_client_create(disp, NULL, NULL, &client); 380 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 381 382 rc = ds_seat_create(disp, &seat); 355 383 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 356 384 … … 597 625 598 626 ds_window_destroy(wnd); 627 ds_seat_destroy(seat); 599 628 ds_client_destroy(client); 600 629 ds_display_destroy(disp); … … 607 636 ds_display_t *disp; 608 637 ds_client_t *client; 638 ds_seat_t *seat; 609 639 ds_window_t *wnd; 610 640 display_wnd_params_t params; … … 618 648 619 649 rc = ds_client_create(disp, NULL, NULL, &client); 650 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 651 652 rc = ds_seat_create(disp, &seat); 620 653 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 621 654 … … 646 679 647 680 ds_window_destroy(wnd); 681 ds_seat_destroy(seat); 648 682 ds_client_destroy(client); 649 683 ds_display_destroy(disp); -
uspace/srv/hid/display/types/display/seat.h
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 48 48 /** Window this seat is focused on */ 49 49 struct ds_window *focus; 50 /** This seat's popup window */ 51 struct ds_window *popup; 50 52 /** Cursor selected by client */ 51 53 struct ds_cursor *client_cursor; -
uspace/srv/hid/display/types/display/window.h
r6baab83 rb4b4dafe 1 1 /* 2 * Copyright (c) 20 19Jiri Svoboda2 * Copyright (c) 2021 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 #include <adt/list.h> 40 40 #include <display/event.h> 41 #include <display/wndparams.h> 41 42 #include <display/wndresize.h> 42 43 #include <gfx/context.h> … … 92 93 /** Cursor set by client */ 93 94 struct ds_cursor *cursor; 94 95 /** Window flags */ 96 display_wnd_flags_t flags; 95 97 /** State */ 96 98 ds_window_state_t state; -
uspace/srv/hid/display/window.c
r6baab83 rb4b4dafe 67 67 { 68 68 ds_window_t *wnd = NULL; 69 ds_seat_t *seat; 69 70 gfx_context_t *dgc; 70 71 gfx_coord2_t dims; … … 116 117 wnd->gc = mem_gc_get_ctx(wnd->mgc); 117 118 wnd->cursor = wnd->display->cursor[dcurs_arrow]; 119 wnd->flags = params->flags; 120 121 wnd->dpos.x = ((wnd->id - 1) & 1) * 400; 122 wnd->dpos.y = ((wnd->id - 1) & 2) / 2 * 300; 123 124 seat = ds_display_first_seat(client->display); 125 126 if ((params->flags & wndf_popup) != 0) 127 ds_seat_set_popup(seat, wnd); 128 else 129 ds_seat_set_focus(seat, wnd); 130 131 (void) ds_display_paint(wnd->display, NULL); 132 118 133 *rgc = wnd; 119 134 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.