Changeset 2f106b0 in mainline
- Timestamp:
- 2022-11-12T20:48:05Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a5c7b865
- Parents:
- c48192e
- Location:
- uspace/app/taskbar
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar/taskbar.c
rc48192e r2f106b0 192 192 } 193 193 194 if (ui_is_textmode(taskbar->ui)) { 195 rect.p0.x = params.rect.p0.x + 9; 196 rect.p0.y = 0; 197 rect.p1.x = params.rect.p1.x - 10; 198 rect.p1.y = 1; 199 } else { 200 rect.p0.x = params.rect.p0.x + 90; 201 rect.p0.y = 4; 202 rect.p1.x = params.rect.p1.x - 84; 203 rect.p1.y = 32 - 4; 204 } 205 wndlist_set_rect(taskbar->wndlist, &rect); 206 194 207 rc = wndlist_open_wm(taskbar->wndlist, wndmgt_svc); 195 208 if (rc != EOK) { … … 249 262 void taskbar_destroy(taskbar_t *taskbar) 250 263 { 251 ui_fixed_remove(taskbar->fixed, 264 ui_fixed_remove(taskbar->fixed, taskbar_clock_ctl(taskbar->clock)); 252 265 taskbar_clock_destroy(taskbar->clock); 253 266 ui_window_destroy(taskbar->window); -
uspace/app/taskbar/test/wndlist.c
rc48192e r2f106b0 86 86 } 87 87 88 /* Test setting window list rectangle */ 89 PCUT_TEST(set_rect) 90 { 91 errno_t rc; 92 ui_t *ui = NULL; 93 ui_wnd_params_t params; 94 ui_window_t *window = NULL; 95 ui_fixed_t *fixed = NULL; 96 gfx_rect_t rect; 97 wndlist_t *wndlist; 98 99 rc = ui_create_disp(NULL, &ui); 100 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 101 102 ui_wnd_params_init(¶ms); 103 params.caption = "Hello"; 104 105 rc = ui_window_create(ui, ¶ms, &window); 106 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 107 PCUT_ASSERT_NOT_NULL(window); 108 109 rc = ui_fixed_create(&fixed); 110 ui_window_add(window, ui_fixed_ctl(fixed)); 111 112 rc = wndlist_create(window, fixed, &wndlist); 113 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 114 115 rect.p0.x = 1; 116 rect.p0.y = 2; 117 rect.p1.x = 3; 118 rect.p1.y = 4; 119 wndlist_set_rect(wndlist, &rect); 120 PCUT_ASSERT_INT_EQUALS(1, wndlist->rect.p0.x); 121 PCUT_ASSERT_INT_EQUALS(2, wndlist->rect.p0.y); 122 PCUT_ASSERT_INT_EQUALS(3, wndlist->rect.p1.x); 123 PCUT_ASSERT_INT_EQUALS(4, wndlist->rect.p1.y); 124 125 wndlist_destroy(wndlist); 126 127 ui_window_destroy(window); 128 ui_destroy(ui); 129 } 130 88 131 /** Test opening WM service */ 89 132 PCUT_TEST(open_wm) -
uspace/app/taskbar/wndlist.c
rc48192e r2f106b0 64 64 }; 65 65 66 enum { 67 /** X distance between left edges of two consecutive buttons */ 68 wndlist_button_pitch = 145, 69 /** X distance between left edges of two consecutive buttons (text) */ 70 wndlist_button_pitch_text = 17, 71 /** Padding between buttons */ 72 wndlist_button_pad = 5, 73 /** Padding between buttons (text) */ 74 wndlist_button_pad_text = 1 75 }; 76 66 77 /** Create task bar window list. 67 78 * … … 91 102 error: 92 103 return rc; 104 } 105 106 /** Set window list rectangle. 107 * 108 * @param wndlist Window list 109 * @param rect Rectangle 110 */ 111 void wndlist_set_rect(wndlist_t *wndlist, gfx_rect_t *rect) 112 { 113 wndlist->rect = *rect; 93 114 } 94 115 … … 287 308 gfx_rect_t rect; 288 309 ui_resource_t *res; 310 gfx_coord_t pitch; 311 gfx_coord_t pad; 289 312 size_t idx; 290 313 … … 301 324 302 325 if (ui_resource_is_textmode(res)) { 303 rect.p0.x = 17 * idx + 9; 326 pitch = wndlist_button_pitch_text; 327 pad = wndlist_button_pad_text; 328 } else { 329 pitch = wndlist_button_pitch; 330 pad = wndlist_button_pad; 331 } 332 333 rect.p0.x = wndlist->rect.p0.x + pitch * idx; 334 rect.p0.y = wndlist->rect.p0.y; 335 rect.p1.x = wndlist->rect.p0.x + pitch * (idx + 1) - pad; 336 rect.p1.y = wndlist->rect.p1.y; 337 338 /* Entry does not fit? */ 339 if (rect.p1.x > wndlist->rect.p1.x) { 340 /* Make entry invisible */ 341 rect.p0.x = 0; 304 342 rect.p0.y = 0; 305 rect.p1.x = 17 * idx + 25; 306 rect.p1.y = 1; 307 } else { 308 rect.p0.x = 145 * idx + 90; 309 rect.p0.y = 4; 310 rect.p1.x = 145 * idx + 230; 311 rect.p1.y = 28; 343 rect.p1.x = 0; 344 rect.p1.y = 0; 312 345 } 313 346 -
uspace/app/taskbar/wndlist.h
rc48192e r2f106b0 38 38 39 39 #include <errno.h> 40 #include <gfx/coord.h> 40 41 #include <stdbool.h> 41 42 #include <ui/fixed.h> … … 45 46 46 47 extern errno_t wndlist_create(ui_window_t *, ui_fixed_t *, wndlist_t **); 48 extern void wndlist_set_rect(wndlist_t *, gfx_rect_t *); 47 49 extern errno_t wndlist_open_wm(wndlist_t *, const char *); 48 50 extern void wndlist_destroy(wndlist_t *);
Note:
See TracChangeset
for help on using the changeset viewer.