Changeset 06a61fc in mainline
- Timestamp:
- 2023-10-02T09:19:56Z (15 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b2261af0
- Parents:
- be0ec50
- git-author:
- Jiri Svoboda <jiri@…> (2023-10-01 09:19:27)
- git-committer:
- Jiri Svoboda <jiri@…> (2023-10-02 09:19:56)
- Location:
- uspace/app/taskbar
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskbar/meson.build
rbe0ec50 r06a61fc 1 1 # 2 # Copyright (c) 202 2Jiri Svoboda2 # Copyright (c) 2023 Jiri Svoboda 3 3 # All rights reserved. 4 4 # … … 32 32 'main.c', 33 33 'taskbar.c', 34 'tbsmenu.c', 34 35 'wndlist.c', 35 36 ) … … 38 39 'clock.c', 39 40 'taskbar.c', 41 'tbsmenu.c', 40 42 'wndlist.c', 41 43 'test/clock.c', 42 44 'test/main.c', 43 45 'test/taskbar.c', 46 'test/tbsmenu.c', 44 47 'test/wndlist.c', 45 48 ) -
uspace/app/taskbar/taskbar.c
rbe0ec50 r06a61fc 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 39 39 #include <str.h> 40 40 #include <ui/fixed.h> 41 #include <ui/label.h>42 41 #include <ui/resource.h> 43 42 #include <ui/ui.h> … … 46 45 #include "clock.h" 47 46 #include "taskbar.h" 47 #include "tbsmenu.h" 48 48 #include "wndlist.h" 49 49 … … 98 98 gfx_rect_t scr_rect; 99 99 gfx_rect_t rect; 100 ui_resource_t *ui_res;101 100 errno_t rc; 102 101 … … 161 160 162 161 ui_window_set_cb(taskbar->window, &window_cb, (void *)taskbar); 163 ui_res = ui_window_get_res(taskbar->window);164 162 165 163 rc = ui_fixed_create(&taskbar->fixed); … … 169 167 } 170 168 171 rc = ui_label_create(ui_res, "HelenOS", &taskbar->label); 172 if (rc != EOK) { 173 printf("Error creating label.\n"); 174 goto error; 175 } 176 177 ui_window_get_app_rect(taskbar->window, &rect); 178 if (ui_is_textmode(taskbar->ui)) { 179 rect.p0.x += 1; 180 } else { 181 rect.p0.x += 10; 182 } 183 ui_label_set_rect(taskbar->label, &rect); 184 ui_label_set_halign(taskbar->label, gfx_halign_left); 185 ui_label_set_valign(taskbar->label, gfx_valign_center); 186 187 rc = ui_fixed_add(taskbar->fixed, ui_label_ctl(taskbar->label)); 188 if (rc != EOK) { 189 printf("Error adding control to layout.\n"); 190 ui_label_destroy(taskbar->label); 191 goto error; 192 } 169 rc = tbsmenu_create(taskbar->window, taskbar->fixed, &taskbar->tbsmenu); 170 if (rc != EOK) { 171 printf("Error creating start menu.\n"); 172 goto error; 173 } 174 175 if (ui_is_textmode(taskbar->ui)) { 176 rect.p0.x = params.rect.p0.x + 1; 177 rect.p0.y = 0; 178 rect.p1.x = params.rect.p0.x + 9; 179 rect.p1.y = 1; 180 } else { 181 rect.p0.x = params.rect.p0.x + 5; 182 rect.p0.y = 4; 183 rect.p1.x = params.rect.p0.x + 84; 184 rect.p1.y = 32 - 4; 185 } 186 187 tbsmenu_set_rect(taskbar->tbsmenu, &rect); 193 188 194 189 rc = wndlist_create(taskbar->window, taskbar->fixed, &taskbar->wndlist); … … 199 194 200 195 if (ui_is_textmode(taskbar->ui)) { 201 rect.p0.x = params.rect.p0.x + 9;196 rect.p0.x = params.rect.p0.x + 10; 202 197 rect.p0.y = 0; 203 198 rect.p1.x = params.rect.p1.x - 10; … … 257 252 if (taskbar->wndlist != NULL) 258 253 wndlist_destroy(taskbar->wndlist); 254 if (taskbar->tbsmenu != NULL) 255 tbsmenu_destroy(taskbar->tbsmenu); 259 256 if (taskbar->window != NULL) 260 257 ui_window_destroy(taskbar->window); … … 270 267 ui_fixed_remove(taskbar->fixed, taskbar_clock_ctl(taskbar->clock)); 271 268 taskbar_clock_destroy(taskbar->clock); 269 wndlist_destroy(taskbar->wndlist); 270 tbsmenu_destroy(taskbar->tbsmenu); 272 271 ui_window_destroy(taskbar->window); 273 272 ui_destroy(taskbar->ui); -
uspace/app/taskbar/test/main.c
rbe0ec50 r06a61fc 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 33 33 PCUT_IMPORT(clock); 34 34 PCUT_IMPORT(taskbar); 35 PCUT_IMPORT(tbsmenu); 35 36 PCUT_IMPORT(wndlist); 36 37 -
uspace/app/taskbar/types/taskbar.h
rbe0ec50 r06a61fc 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 43 43 #include <ui/window.h> 44 44 #include "clock.h" 45 #include "tbsmenu.h" 45 46 #include "wndlist.h" 46 47 … … 53 54 /** Fixed layout */ 54 55 ui_fixed_t *fixed; 55 ui_label_t *label; 56 /** Start menu */ 57 tbsmenu_t *tbsmenu; 56 58 /** Window list */ 57 59 wndlist_t *wndlist; -
uspace/app/taskbar/types/wndlist.h
rbe0ec50 r06a61fc 1 1 /* 2 * Copyright (c) 202 2Jiri Svoboda2 * Copyright (c) 2023 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 69 69 ui_window_t *window; 70 70 71 /** Layout to which we add window butto ons */71 /** Layout to which we add window buttons */ 72 72 ui_fixed_t *fixed; 73 73 -
uspace/app/taskbar/wndlist.c
rbe0ec50 r06a61fc 45 45 #include <ui/ui.h> 46 46 #include <ui/window.h> 47 #include "clock.h"48 47 #include "wndlist.h" 49 48 … … 85 84 * @param window Containing window 86 85 * @param fixed Fixed layout to which buttons will be added 87 * @param wndmgt Window management service88 86 * @param rwndlist Place to store pointer to new window list 89 87 * @return @c EOK on success or an error code … … 178 176 } 179 177 180 /** Destroy task bar window list. */ 178 /** Destroy task bar window list. 179 * 180 * @param wndlist Window list 181 */ 181 182 void wndlist_destroy(wndlist_t *wndlist) 182 183 { … … 469 470 } 470 471 471 /** Compute and set window list entry rectangle. 472 * 473 * Compute rectangle for window list entry and set it. 472 /** Unpaint window list entry. 474 473 * 475 474 * @param entry Window list entry
Note:
See TracChangeset
for help on using the changeset viewer.