Changeset 5d380b6 in mainline
- Timestamp:
- 2023-01-20T11:50:41Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b1f0a14
- Parents:
- 6828a56
- git-author:
- Jiri Svoboda <jiri@…> (2023-01-20 19:50:21)
- git-committer:
- Jiri Svoboda <jiri@…> (2023-01-20 11:50:41)
- Location:
- uspace
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/display/include/types/display/wndparams.h
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 74 74 /** Flags */ 75 75 display_wnd_flags_t flags; 76 /** Input device ID associated with window's seat (or zero) */ 77 sysarg_t idev_id; 76 78 } display_wnd_params_t; 77 79 -
uspace/lib/display/private/params.h
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 37 37 38 38 #include <gfx/coord.h> 39 #include <types/common.h> 39 40 40 41 /** Window resize arguments. */ … … 61 62 /** Flags */ 62 63 display_wnd_flags_t flags; 64 /** Input device ID associated with window's seat (or zero) */ 65 sysarg_t idev_id; 63 66 } display_wnd_params_enc_t; 64 67 -
uspace/lib/display/src/disp_srv.c
r6828a56 r5d380b6 128 128 params.pos = eparams.pos; 129 129 params.flags = eparams.flags; 130 params.idev_id = eparams.idev_id; 130 131 131 132 rc = srv->ops->window_create(srv->arg, ¶ms, &wnd_id); -
uspace/lib/display/src/display.c
r6828a56 r5d380b6 176 176 eparams.pos = params->pos; 177 177 eparams.flags = params->flags; 178 eparams.idev_id = params->idev_id; 178 179 179 180 window = calloc(1, sizeof(display_window_t)); -
uspace/lib/display/test/display.c
r6828a56 r5d380b6 118 118 gfx_rect_t create_rect; 119 119 gfx_coord2_t create_min_size; 120 sysarg_t create_idev_id; 120 121 bool window_destroy_called; 121 122 sysarg_t destroy_wnd_id; … … 237 238 params.min_size.x = 11; 238 239 params.min_size.y = 12; 240 params.idev_id = 42; 239 241 240 242 rc = display_window_create(disp, ¶ms, &test_display_wnd_cb, … … 247 249 PCUT_ASSERT_EQUALS(params.min_size.x, resp.create_min_size.x); 248 250 PCUT_ASSERT_EQUALS(params.min_size.y, resp.create_min_size.y); 251 PCUT_ASSERT_EQUALS(params.idev_id, resp.create_idev_id); 249 252 PCUT_ASSERT_ERRNO_VAL(resp.rc, rc); 250 253 PCUT_ASSERT_NULL(wnd); … … 289 292 params.rect.p0.x = 100; 290 293 params.rect.p0.y = 100; 294 params.idev_id = 42; 291 295 292 296 rc = display_window_create(disp, ¶ms, &test_display_wnd_cb, … … 297 301 PCUT_ASSERT_EQUALS(params.rect.p1.x, resp.create_rect.p1.x); 298 302 PCUT_ASSERT_EQUALS(params.rect.p1.y, resp.create_rect.p1.y); 303 PCUT_ASSERT_EQUALS(params.idev_id, resp.create_idev_id); 299 304 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 300 305 PCUT_ASSERT_NOT_NULL(wnd); … … 2138 2143 resp->create_rect = params->rect; 2139 2144 resp->create_min_size = params->min_size; 2145 resp->create_idev_id = params->idev_id; 2140 2146 if (resp->rc == EOK) 2141 2147 *rwnd_id = resp->wnd_id; -
uspace/lib/ui/include/types/ui/popup.h
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 40 40 #include <io/kbd_event.h> 41 41 #include <io/pos_event.h> 42 #include <types/common.h> 42 43 43 44 struct ui_popup; … … 50 51 /** Placement rectangle close to which popup should be placed */ 51 52 gfx_rect_t place; 53 /** Input device ID associated with the popup's seat */ 54 sysarg_t idev_id; 52 55 } ui_popup_params_t; 53 56 -
uspace/lib/ui/include/types/ui/window.h
r6828a56 r5d380b6 89 89 /** Parent rectangle for popup windows */ 90 90 gfx_rect_t prect; 91 /** Input device associated with the window's seat */ 92 sysarg_t idev_id; 91 93 } ui_wnd_params_t; 92 94 -
uspace/lib/ui/include/ui/menu.h
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 42 42 #include <io/pos_event.h> 43 43 #include <stdbool.h> 44 #include <types/common.h> 44 45 #include <types/ui/menu.h> 45 46 #include <types/ui/menubar.h> … … 56 57 extern void ui_menu_get_rect(ui_menu_t *, gfx_coord2_t *, gfx_rect_t *); 57 58 extern char32_t ui_menu_get_accel(ui_menu_t *); 58 extern errno_t ui_menu_open(ui_menu_t *, gfx_rect_t * );59 extern errno_t ui_menu_open(ui_menu_t *, gfx_rect_t *, sysarg_t); 59 60 extern void ui_menu_close(ui_menu_t *); 60 61 extern bool ui_menu_is_open(ui_menu_t *); -
uspace/lib/ui/include/ui/menubar.h
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 40 40 #include <gfx/coord.h> 41 41 #include <io/pos_event.h> 42 #include <types/common.h> 42 43 #include <types/ui/menubar.h> 43 44 #include <types/ui/control.h> … … 56 57 extern ui_evclaim_t ui_menu_bar_kbd_event(ui_menu_bar_t *, kbd_event_t *); 57 58 extern ui_evclaim_t ui_menu_bar_pos_event(ui_menu_bar_t *, pos_event_t *); 58 extern void ui_menu_bar_press_accel(ui_menu_bar_t *, char32_t );59 extern void ui_menu_bar_press_accel(ui_menu_bar_t *, char32_t, sysarg_t); 59 60 extern void ui_menu_bar_unfocus(ui_menu_bar_t *); 60 61 extern void ui_menu_bar_activate(ui_menu_bar_t *); -
uspace/lib/ui/private/menubar.h
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 41 41 #include <gfx/coord.h> 42 42 #include <stdbool.h> 43 #include <types/common.h> 43 44 #include <types/ui/menu.h> 44 45 #include <types/ui/menubar.h> … … 65 66 }; 66 67 67 extern void ui_menu_bar_select(ui_menu_bar_t *, ui_menu_t *, bool );68 extern void ui_menu_bar_left(ui_menu_bar_t * );69 extern void ui_menu_bar_right(ui_menu_bar_t * );68 extern void ui_menu_bar_select(ui_menu_bar_t *, ui_menu_t *, bool, sysarg_t); 69 extern void ui_menu_bar_left(ui_menu_bar_t *, sysarg_t); 70 extern void ui_menu_bar_right(ui_menu_bar_t *, sysarg_t); 70 71 extern ui_evclaim_t ui_menu_bar_key_press_unmod(ui_menu_bar_t *, kbd_event_t *); 71 72 extern void ui_menu_bar_entry_rect(ui_menu_bar_t *, ui_menu_t *, gfx_rect_t *); -
uspace/lib/ui/src/menu.c
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 280 280 * @param menu Menu 281 281 * @param prect Parent rectangle around which the menu should be placed 282 */ 283 errno_t ui_menu_open(ui_menu_t *menu, gfx_rect_t *prect) 282 * @param idev_id Input device associated with the menu's seat 283 */ 284 errno_t ui_menu_open(ui_menu_t *menu, gfx_rect_t *prect, sysarg_t idev_id) 284 285 { 285 286 ui_popup_t *popup = NULL; … … 301 302 params.rect = geom.outer_rect; 302 303 params.place = *prect; 304 params.idev_id = idev_id; 303 305 304 306 rc = ui_popup_create(menu->mbar->ui, menu->mbar->window, ¶ms, … … 522 524 if (event->type == KEY_PRESS && (event->mods & KM_ALT) != 0 && 523 525 (event->mods & (KM_CTRL | KM_SHIFT)) == 0 && event->c != '\0') 524 ui_menu_bar_press_accel(menu->mbar, event->c );526 ui_menu_bar_press_accel(menu->mbar, event->c, event->kbd_id); 525 527 526 528 return ui_claimed; … … 616 618 break; 617 619 case KC_LEFT: 618 ui_menu_bar_left(menu->mbar );620 ui_menu_bar_left(menu->mbar, event->kbd_id); 619 621 break; 620 622 case KC_RIGHT: 621 ui_menu_bar_right(menu->mbar );623 ui_menu_bar_right(menu->mbar, event->kbd_id); 622 624 break; 623 625 case KC_UP: -
uspace/lib/ui/src/menubar.c
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 243 243 * @param menu Menu to select (or deselect if selected) or @c NULL 244 244 * @param openup Open menu even if not currently open 245 */ 246 void ui_menu_bar_select(ui_menu_bar_t *mbar, ui_menu_t *menu, bool openup) 245 * @param idev_id Input device ID associated with the selecting seat 246 */ 247 void ui_menu_bar_select(ui_menu_bar_t *mbar, ui_menu_t *menu, bool openup, 248 sysarg_t idev_id) 247 249 { 248 250 ui_menu_t *old_menu; … … 272 274 * specified. 273 275 */ 274 (void) ui_menu_open(mbar->selected, &rect );276 (void) ui_menu_open(mbar->selected, &rect, idev_id); 275 277 } 276 278 } … … 283 285 * 284 286 * @param mbar Menu bar 285 */ 286 void ui_menu_bar_left(ui_menu_bar_t *mbar) 287 * @param idev_id Input device ID 288 */ 289 void ui_menu_bar_left(ui_menu_bar_t *mbar, sysarg_t idev_id) 287 290 { 288 291 ui_menu_t *nmenu; … … 296 299 297 300 if (nmenu != mbar->selected) 298 ui_menu_bar_select(mbar, nmenu, false );301 ui_menu_bar_select(mbar, nmenu, false, idev_id); 299 302 } 300 303 … … 305 308 * 306 309 * @param mbar Menu bar 307 */ 308 void ui_menu_bar_right(ui_menu_bar_t *mbar) 310 * @param idev_id Input device ID 311 */ 312 void ui_menu_bar_right(ui_menu_bar_t *mbar, sysarg_t idev_id) 309 313 { 310 314 ui_menu_t *nmenu; … … 318 322 319 323 if (nmenu != mbar->selected) 320 ui_menu_bar_select(mbar, nmenu, false );324 ui_menu_bar_select(mbar, nmenu, false, idev_id); 321 325 } 322 326 … … 345 349 346 350 if (event->key == KC_LEFT) 347 ui_menu_bar_left(mbar );351 ui_menu_bar_left(mbar, event->kbd_id); 348 352 349 353 if (event->key == KC_RIGHT) 350 ui_menu_bar_right(mbar );354 ui_menu_bar_right(mbar, event->kbd_id); 351 355 352 356 if (event->key == KC_ENTER || event->key == KC_DOWN) { … … 354 358 ui_menu_bar_entry_rect(mbar, mbar->selected, 355 359 &rect); 356 ui_menu_open(mbar->selected, &rect );360 ui_menu_open(mbar->selected, &rect, event->kbd_id); 357 361 } 358 362 … … 362 366 if (event->c != '\0' && !ui_menu_is_open(mbar->selected)) { 363 367 /* Check if it is an accelerator. */ 364 ui_menu_bar_press_accel(mbar, event->c );368 ui_menu_bar_press_accel(mbar, event->c, event->kbd_id); 365 369 } 366 370 … … 379 383 (event->mods & (KM_CTRL | KM_SHIFT)) == 0 && event->c != '\0') { 380 384 /* Check if it is an accelerator. */ 381 ui_menu_bar_press_accel(mbar, event->c );385 ui_menu_bar_press_accel(mbar, event->c, event->kbd_id); 382 386 } 383 387 … … 399 403 * @param mbar Menu bar 400 404 * @param c Character 401 */ 402 void ui_menu_bar_press_accel(ui_menu_bar_t *mbar, char32_t c) 405 * @param kbd_id Keyboard ID 406 */ 407 void ui_menu_bar_press_accel(ui_menu_bar_t *mbar, char32_t c, sysarg_t kbd_id) 403 408 { 404 409 ui_menu_t *menu; … … 409 414 maccel = ui_menu_get_accel(menu); 410 415 if (c == maccel) { 411 ui_menu_bar_select(mbar, menu, true );416 ui_menu_bar_select(mbar, menu, true, kbd_id); 412 417 return; 413 418 } … … 433 438 gfx_coord_t hpad; 434 439 gfx_coord2_t ppos; 440 sysarg_t pos_id; 435 441 436 442 res = ui_window_get_res(mbar->window); … … 446 452 447 453 pos = mbar->rect.p0; 454 pos_id = event->pos_id; 448 455 449 456 menu = ui_menu_first(mbar); … … 463 470 /* Open the menu, close if already open. */ 464 471 if (menu == mbar->selected) 465 ui_menu_bar_select(mbar, NULL, false );472 ui_menu_bar_select(mbar, NULL, false, pos_id); 466 473 else 467 ui_menu_bar_select(mbar, menu, true );474 ui_menu_bar_select(mbar, menu, true, pos_id); 468 475 469 476 return ui_claimed; … … 544 551 void ui_menu_bar_deactivate(ui_menu_bar_t *mbar) 545 552 { 546 ui_menu_bar_select(mbar, NULL, false );553 ui_menu_bar_select(mbar, NULL, false, 0); 547 554 mbar->active = false; 548 555 } -
uspace/lib/ui/src/popup.c
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 99 99 wparams.placement = ui_wnd_place_popup; 100 100 wparams.flags |= ui_wndf_popup; 101 wparams.idev_id = params->idev_id; 101 102 102 103 /* Compute position of parent rectangle relative to the screen */ -
uspace/lib/ui/src/window.c
r6828a56 r5d380b6 227 227 /* Only allow making the window larger */ 228 228 gfx_rect_dims(¶ms->rect, &dparams.min_size); 229 dparams.idev_id = params->idev_id; 229 230 230 231 if ((params->flags & ui_wndf_popup) != 0) -
uspace/lib/ui/test/menu.c
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 293 293 294 294 /* Open and close */ 295 rc = ui_menu_open(menu, &prect );295 rc = ui_menu_open(menu, &prect, 0); 296 296 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 297 297 … … 341 341 PCUT_ASSERT_FALSE(open); 342 342 343 rc = ui_menu_open(menu, &prect );343 rc = ui_menu_open(menu, &prect, 0); 344 344 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 345 345 … … 393 393 394 394 /* Menu needs to be open to be able to paint it */ 395 rc = ui_menu_open(menu, &prect );395 rc = ui_menu_open(menu, &prect, 0); 396 396 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 397 397 … … 442 442 443 443 /* Menu needs to be open to be able to paint it */ 444 rc = ui_menu_open(menu, &prect );444 rc = ui_menu_open(menu, &prect, 0); 445 445 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 446 446 … … 491 491 492 492 /* Menu needs to be open to be able to paint it */ 493 rc = ui_menu_open(menu, &prect );493 rc = ui_menu_open(menu, &prect, 0); 494 494 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 495 495 … … 539 539 540 540 /* Menu needs to be open to be able to move around it */ 541 rc = ui_menu_open(menu, &prect );541 rc = ui_menu_open(menu, &prect, 0); 542 542 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 543 543 … … 599 599 600 600 /* Menu needs to be open to be able to move around it */ 601 rc = ui_menu_open(menu, &prect );601 rc = ui_menu_open(menu, &prect, 0); 602 602 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 603 603 … … 655 655 656 656 /* Menu needs to be open to be able to move around it */ 657 rc = ui_menu_open(menu, &prect );657 rc = ui_menu_open(menu, &prect, 0); 658 658 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 659 659 … … 715 715 716 716 /* Menu needs to be open to be able to move around it */ 717 rc = ui_menu_open(menu, &prect );717 rc = ui_menu_open(menu, &prect, 0); 718 718 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 719 719 -
uspace/lib/ui/test/menubar.c
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 235 235 PCUT_ASSERT_FALSE(ui_menu_is_open(menu)); 236 236 237 ui_menu_bar_press_accel(mbar, 't' );237 ui_menu_bar_press_accel(mbar, 't', 0); 238 238 239 239 PCUT_ASSERT_TRUE(ui_menu_is_open(menu)); … … 329 329 PCUT_ASSERT_NOT_NULL(menu2); 330 330 331 ui_menu_bar_select(mbar, menu1, true );331 ui_menu_bar_select(mbar, menu1, true, 0); 332 332 PCUT_ASSERT_EQUALS(menu1, mbar->selected); 333 333 334 334 /* Selecting different menu should select it */ 335 ui_menu_bar_select(mbar, menu2, true );335 ui_menu_bar_select(mbar, menu2, true, 0); 336 336 PCUT_ASSERT_EQUALS(menu2, mbar->selected); 337 337 -
uspace/lib/ui/test/menuentry.c
r6828a56 r5d380b6 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 381 381 prect.p1.y = 0; 382 382 383 rc = ui_menu_open(menu, &prect );383 rc = ui_menu_open(menu, &prect, 0); 384 384 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 385 385 … … 492 492 prect.p1.y = 0; 493 493 494 rc = ui_menu_open(menu, &prect );494 rc = ui_menu_open(menu, &prect, 0); 495 495 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 496 496 … … 555 555 prect.p1.y = 0; 556 556 557 rc = ui_menu_open(menu, &prect );557 rc = ui_menu_open(menu, &prect, 0); 558 558 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 559 559 … … 623 623 prect.p1.y = 0; 624 624 625 rc = ui_menu_open(menu, &prect );625 rc = ui_menu_open(menu, &prect, 0); 626 626 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 627 627 … … 695 695 prect.p1.y = 0; 696 696 697 rc = ui_menu_open(menu, &prect );697 rc = ui_menu_open(menu, &prect, 0); 698 698 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 699 699 … … 750 750 prect.p1.y = 0; 751 751 752 rc = ui_menu_open(menu, &prect );752 rc = ui_menu_open(menu, &prect, 0); 753 753 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 754 754 … … 810 810 prect.p1.y = 0; 811 811 812 rc = ui_menu_open(menu, &prect );812 rc = ui_menu_open(menu, &prect, 0); 813 813 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 814 814 … … 870 870 prect.p1.y = 0; 871 871 872 rc = ui_menu_open(menu, &prect );872 rc = ui_menu_open(menu, &prect, 0); 873 873 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 874 874 … … 933 933 prect.p1.y = 0; 934 934 935 rc = ui_menu_open(menu, &prect );935 rc = ui_menu_open(menu, &prect, 0); 936 936 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 937 937 -
uspace/srv/hid/display/display.c
r6828a56 r5d380b6 597 597 } 598 598 599 /** Get default seat in display. 600 * 601 * @param disp Display 602 * @return First seat or @c NULL if there is none 603 */ 604 ds_seat_t *ds_display_default_seat(ds_display_t *disp) 605 { 606 /* XXX Probably not the best solution */ 607 return ds_display_first_seat(disp); 608 } 609 599 610 /** Find seat by ID. 600 611 * … … 640 651 641 652 /* If none was found, return the default seat */ 642 return ds_display_ first_seat(disp);653 return ds_display_default_seat(disp); 643 654 } 644 655 -
uspace/srv/hid/display/display.h
r6828a56 r5d380b6 85 85 extern ds_seat_t *ds_display_first_seat(ds_display_t *); 86 86 extern ds_seat_t *ds_display_next_seat(ds_seat_t *); 87 extern ds_seat_t *ds_display_default_seat(ds_display_t *); 87 88 extern ds_seat_t *ds_display_find_seat(ds_display_t *, ds_seat_id_t); 88 89 extern ds_seat_t *ds_display_seat_by_idev(ds_display_t *, ds_idev_id_t); -
uspace/srv/hid/display/window.c
r6828a56 r5d380b6 88 88 } 89 89 90 /* Caption */ 90 91 wnd->caption = str_dup(params->caption); 91 92 if (wnd->caption == NULL) { … … 99 100 gfx_bitmap_params_init(&bparams); 100 101 bparams.rect = params->rect; 102 103 /* Allocate window bitmap */ 101 104 102 105 dgc = ds_display_get_gc(wnd->display); … … 142 145 } 143 146 144 // TODO Multi-seat: which seat should own the new window? 145 seat = ds_display_first_seat(client->display); 146 147 /* Determine which seat should own the window */ 148 if (params->idev_id != 0) 149 seat = ds_display_seat_by_idev(wnd->display, params->idev_id); 150 else 151 seat = ds_display_default_seat(wnd->display); 152 153 /* Is this a popup window? */ 147 154 if ((params->flags & wndf_popup) != 0) 148 155 ds_seat_set_popup(seat, wnd); … … 150 157 ds_seat_set_focus(seat, wnd); 151 158 159 /* Is this window a panel? */ 152 160 if ((params->flags & wndf_avoid) != 0) 153 161 ds_display_update_max_rect(wnd->display);
Note:
See TracChangeset
for help on using the changeset viewer.