Changeset 4034954c in mainline
- Timestamp:
- 2023-09-27T20:01:51Z (15 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e54de59
- Parents:
- 5afc1aa
- Location:
- uspace/lib/ui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/private/menubar.h
r5afc1aa r4034954c 67 67 68 68 extern void ui_menu_bar_select(ui_menu_bar_t *, ui_menu_dd_t *, bool, sysarg_t); 69 extern void ui_menu_bar_select_sysmenu(ui_menu_bar_t *, sysarg_t);69 extern void ui_menu_bar_select_sysmenu(ui_menu_bar_t *, bool, sysarg_t); 70 70 extern void ui_menu_bar_left(ui_menu_bar_t *, sysarg_t); 71 71 extern void ui_menu_bar_right(ui_menu_bar_t *, sysarg_t); -
uspace/lib/ui/src/menubar.c
r5afc1aa r4034954c 294 294 } 295 295 296 /** Select first drop-down. 297 * 298 * @param mbar Menu bar 299 * @param openup @c true to open drop-down if it was not open 300 * @param idev_id Input device ID 301 */ 296 302 void ui_menu_bar_select_first(ui_menu_bar_t *mbar, bool openup, 297 303 sysarg_t idev_id) … … 303 309 } 304 310 311 /** Select last drop-down. 312 * 313 * @param mbar Menu bar 314 * @param openup @c true to open drop-down if it was not open 315 * @param idev_id Input device ID 316 */ 305 317 void ui_menu_bar_select_last(ui_menu_bar_t *mbar, bool openup, 306 318 sysarg_t idev_id) … … 312 324 } 313 325 314 void ui_menu_bar_select_sysmenu(ui_menu_bar_t *mbar, sysarg_t idev_id) 315 { 316 bool was_open; 317 326 /** Select system menu. 327 * 328 * @param mbar Menu bar 329 * @param openup @c true to open drop-down if it was not open 330 * @param idev_id Input device ID 331 */ 332 void ui_menu_bar_select_sysmenu(ui_menu_bar_t *mbar, bool openup, 333 sysarg_t idev_id) 334 { 318 335 ui_wdecor_sysmenu_hdl_set_active(mbar->window->wdecor, true); 319 was_open = mbar->selected != NULL && 320 ui_menu_dd_is_open(mbar->selected); 321 322 if (was_open) 336 337 if (openup) 323 338 ui_window_send_sysmenu(mbar->window, idev_id); 324 339 } … … 335 350 { 336 351 ui_menu_dd_t *nmdd; 352 bool sel_sysmenu = false; 353 bool was_open; 337 354 338 355 if (mbar->selected == NULL) … … 342 359 if (nmdd == NULL) { 343 360 if ((mbar->window->wdecor->style & ui_wds_sysmenu_hdl) != 0) { 344 ui_menu_bar_select_sysmenu(mbar, idev_id);361 sel_sysmenu = true; 345 362 } else { 346 363 nmdd = ui_menu_dd_last(mbar); … … 348 365 } 349 366 367 was_open = mbar->selected != NULL && 368 ui_menu_dd_is_open(mbar->selected); 369 350 370 if (nmdd != mbar->selected) 351 371 ui_menu_bar_select(mbar, nmdd, false, idev_id); 372 373 /* 374 * Only open sysmenu *after* closing the previous menu, avoid 375 * having multiple popup windows at the same time. 376 */ 377 if (sel_sysmenu) 378 ui_menu_bar_select_sysmenu(mbar, was_open, idev_id); 352 379 } 353 380 … … 363 390 { 364 391 ui_menu_dd_t *nmdd; 392 bool sel_sysmenu = false; 393 bool was_open; 365 394 366 395 if (mbar->selected == NULL) … … 370 399 if (nmdd == NULL) { 371 400 if ((mbar->window->wdecor->style & ui_wds_sysmenu_hdl) != 0) { 372 ui_menu_bar_select_sysmenu(mbar, idev_id);401 sel_sysmenu = true; 373 402 } else { 374 403 nmdd = ui_menu_dd_first(mbar); … … 376 405 } 377 406 407 was_open = mbar->selected != NULL && 408 ui_menu_dd_is_open(mbar->selected); 409 378 410 if (nmdd != mbar->selected) 379 411 ui_menu_bar_select(mbar, nmdd, false, idev_id); 412 413 /* 414 * Only open sysmenu *after* closing the previous menu, avoid 415 * having multiple popup windows at the same time. 416 */ 417 if (sel_sysmenu) 418 ui_menu_bar_select_sysmenu(mbar, was_open, idev_id); 380 419 } 381 420 -
uspace/lib/ui/src/window.c
r5afc1aa r4034954c 1061 1061 1062 1062 if (window->mbar != NULL) { 1063 ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false); 1064 ui_menu_close(window->sysmenu); 1063 1065 ui_menu_bar_select_last(window->mbar, false, idev_id); 1064 ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);1065 1066 } 1066 1067 } … … 1077 1078 1078 1079 if (window->mbar != NULL) { 1080 ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false); 1081 ui_menu_close(window->sysmenu); 1079 1082 ui_menu_bar_select_first(window->mbar, false, idev_id); 1080 ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);1081 1083 } 1082 1084 } … … 1095 1097 1096 1098 if (window->mbar != NULL) { 1099 ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false); 1100 ui_menu_close(window->sysmenu); 1097 1101 ui_menu_bar_press_accel(window->mbar, c, idev_id); 1098 ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false);1099 1102 } 1100 1103 } … … 1550 1553 ui_window_t *window = (ui_window_t *)arg; 1551 1554 1552 (void)sysmenu;1553 1554 if (window->mbar != NULL)1555 if (window->mbar != NULL) { 1556 ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false); 1557 ui_menu_close(sysmenu); 1555 1558 ui_menu_bar_select_last(window->mbar, true, idev_id); 1559 } 1556 1560 } 1557 1561 … … 1566 1570 ui_window_t *window = (ui_window_t *)arg; 1567 1571 1568 (void)sysmenu;1569 1570 if (window->mbar != NULL)1572 if (window->mbar != NULL) { 1573 ui_wdecor_sysmenu_hdl_set_active(window->wdecor, false); 1574 ui_menu_close(sysmenu); 1571 1575 ui_menu_bar_select_first(window->mbar, true, idev_id); 1576 } 1572 1577 } 1573 1578 -
uspace/lib/ui/test/menubar.c
r5afc1aa r4034954c 453 453 PCUT_ASSERT_NOT_NULL(mdd2); 454 454 455 ui_menu_bar_select_sysmenu(mbar, 0);455 ui_menu_bar_select_sysmenu(mbar, false, 0); 456 456 PCUT_ASSERT_TRUE(window->wdecor->sysmenu_hdl_active); 457 457
Note:
See TracChangeset
for help on using the changeset viewer.