Changeset 46a47c0 in mainline for uspace/lib/ui/src
- Timestamp:
- 2023-01-16T20:34:01Z (3 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b0ae23f
- Parents:
- b3eeae5
- Location:
- uspace/lib/ui/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/src/control.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 130 130 * 131 131 * @param control Control 132 * @param nfocus Number of remaining foci 132 133 */ 133 void ui_control_unfocus(ui_control_t *control )134 void ui_control_unfocus(ui_control_t *control, unsigned nfocus) 134 135 { 135 136 if (control->ops->unfocus != NULL) 136 control->ops->unfocus(control->ext );137 control->ops->unfocus(control->ext, nfocus); 137 138 } 138 139 -
uspace/lib/ui/src/fixed.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 1Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 48 48 static ui_evclaim_t ui_fixed_ctl_kbd_event(void *, kbd_event_t *); 49 49 static ui_evclaim_t ui_fixed_ctl_pos_event(void *, pos_event_t *); 50 static void ui_fixed_ctl_unfocus(void * );50 static void ui_fixed_ctl_unfocus(void *, unsigned); 51 51 52 52 /** Push button control ops */ … … 262 262 * 263 263 * @param fixed Fixed layout 264 */ 265 void ui_fixed_unfocus(ui_fixed_t *fixed) 266 { 267 ui_fixed_elem_t *elem; 268 269 elem = ui_fixed_first(fixed); 270 while (elem != NULL) { 271 ui_control_unfocus(elem->control); 264 * @param nfocus Number of remaining foci 265 */ 266 void ui_fixed_unfocus(ui_fixed_t *fixed, unsigned nfocus) 267 { 268 ui_fixed_elem_t *elem; 269 270 elem = ui_fixed_first(fixed); 271 while (elem != NULL) { 272 ui_control_unfocus(elem->control, nfocus); 272 273 273 274 elem = ui_fixed_next(elem); … … 327 328 * 328 329 * @param arg Argument (ui_fixed_t *) 329 */ 330 void ui_fixed_ctl_unfocus(void *arg) 331 { 332 ui_fixed_t *fixed = (ui_fixed_t *) arg; 333 334 ui_fixed_unfocus(fixed); 330 * @param nfocus Number of remaining foci 331 */ 332 void ui_fixed_ctl_unfocus(void *arg, unsigned nfocus) 333 { 334 ui_fixed_t *fixed = (ui_fixed_t *) arg; 335 336 ui_fixed_unfocus(fixed, nfocus); 335 337 } 336 338 -
uspace/lib/ui/src/window.c
rb3eeae5 r46a47c0 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 59 59 60 60 static void dwnd_close_event(void *); 61 static void dwnd_focus_event(void * );61 static void dwnd_focus_event(void *, unsigned); 62 62 static void dwnd_kbd_event(void *, kbd_event_t *); 63 63 static void dwnd_pos_event(void *, pos_event_t *); 64 64 static void dwnd_resize_event(void *, gfx_rect_t *); 65 static void dwnd_unfocus_event(void * );65 static void dwnd_unfocus_event(void *, unsigned); 66 66 67 67 static display_wnd_cb_t dwnd_cb = { … … 833 833 834 834 /** Handle window focus event. */ 835 static void dwnd_focus_event(void *arg )835 static void dwnd_focus_event(void *arg, unsigned nfocus) 836 836 { 837 837 ui_window_t *window = (ui_window_t *) arg; … … 839 839 840 840 ui_lock(ui); 841 (void)nfocus; 841 842 842 843 if (window->wdecor != NULL) { … … 845 846 } 846 847 847 ui_window_send_focus(window );848 ui_window_send_focus(window, nfocus); 848 849 ui_unlock(ui); 849 850 } … … 903 904 904 905 /** Handle window unfocus event. */ 905 static void dwnd_unfocus_event(void *arg )906 static void dwnd_unfocus_event(void *arg, unsigned nfocus) 906 907 { 907 908 ui_window_t *window = (ui_window_t *) arg; … … 910 911 ui_lock(ui); 911 912 912 if (window->wdecor != NULL ) {913 if (window->wdecor != NULL && nfocus == 0) { 913 914 ui_wdecor_set_active(window->wdecor, false); 914 915 ui_wdecor_paint(window->wdecor); 915 916 } 916 917 917 ui_window_send_unfocus(window );918 ui_window_send_unfocus(window, nfocus); 918 919 ui_unlock(ui); 919 920 } … … 1104 1105 * 1105 1106 * @param window Window 1106 */ 1107 void ui_window_send_focus(ui_window_t *window) 1107 * @param nfocus New number of foci 1108 */ 1109 void ui_window_send_focus(ui_window_t *window, unsigned nfocus) 1108 1110 { 1109 1111 if (window->cb != NULL && window->cb->focus != NULL) 1110 window->cb->focus(window, window->arg );1112 window->cb->focus(window, window->arg, nfocus); 1111 1113 } 1112 1114 … … 1150 1152 * 1151 1153 * @param window Window 1152 */ 1153 void ui_window_send_unfocus(ui_window_t *window) 1154 * @param nfocus Number of remaining foci 1155 */ 1156 void ui_window_send_unfocus(ui_window_t *window, unsigned nfocus) 1154 1157 { 1155 1158 if (window->cb != NULL && window->cb->unfocus != NULL) 1156 window->cb->unfocus(window, window->arg );1159 window->cb->unfocus(window, window->arg, nfocus); 1157 1160 else 1158 return ui_window_def_unfocus(window );1161 return ui_window_def_unfocus(window, nfocus); 1159 1162 } 1160 1163 … … 1292 1295 * 1293 1296 * @param window Window 1297 * @param nfocus Number of remaining foci 1294 1298 * @return EOK on success or an error code 1295 1299 */ 1296 void ui_window_def_unfocus(ui_window_t *window )1300 void ui_window_def_unfocus(ui_window_t *window, unsigned nfocus) 1297 1301 { 1298 1302 if (window->control != NULL) 1299 ui_control_unfocus(window->control );1303 ui_control_unfocus(window->control, nfocus); 1300 1304 } 1301 1305
Note:
See TracChangeset
for help on using the changeset viewer.