Changeset 3fd38b2 in mainline for uspace/app


Ignore:
Timestamp:
2022-09-29T07:45:07Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c77cfd8
Parents:
50a16d9
git-author:
Jiri Svoboda <jiri@…> (2022-09-28 07:44:28)
git-committer:
Jiri Svoboda <jiri@…> (2022-09-29 07:45:07)
Message:

Size taskbar based on display size, fix text mode

Location:
uspace/app/taskbar
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar/clock.c

    r50a16d9 r3fd38b2  
    4444#include <ui/paint.h>
    4545#include <ui/resource.h>
     46#include <ui/ui.h>
    4647#include "clock.h"
    4748
     
    135136        gfx_context_t *gc = ui_window_get_gc(clock->window);
    136137        ui_resource_t *res = ui_window_get_res(clock->window);
     138        ui_t *ui = ui_window_get_ui(clock->window);
    137139        char buf[10];
    138140        gfx_text_fmt_t fmt;
     
    141143        errno_t rc;
    142144
     145        if (!ui_is_textmode(ui)) {
     146                /* Paint frame */
     147                rc = ui_paint_inset_frame(res, &clock->rect, &irect);
     148                if (rc != EOK)
     149                        goto error;
     150        } else {
     151                irect = clock->rect;
     152        }
     153
     154        rc = gfx_set_color(gc, ui_resource_get_wnd_face_color(res));
     155        if (rc != EOK)
     156                goto error;
     157
    143158        /* Fill background */
    144 
    145         rc = ui_paint_inset_frame(res, &clock->rect, &irect);
    146         if (rc != EOK)
    147                 goto error;
    148 
    149         rc = gfx_set_color(gc, ui_resource_get_wnd_face_color(res));
    150         if (rc != EOK)
    151                 goto error;
    152 
    153159        rc = gfx_fill_rect(gc, &irect);
    154160        if (rc != EOK)
  • uspace/app/taskbar/taskbar.c

    r50a16d9 r3fd38b2  
    7373        ui_wnd_params_t params;
    7474        taskbar_t *taskbar = NULL;
     75        gfx_rect_t scr_rect;
    7576        gfx_rect_t rect;
    7677        ui_resource_t *ui_res;
     
    8687        if (rc != EOK) {
    8788                printf("Error creating UI on display %s.\n", display_spec);
     89                goto error;
     90        }
     91
     92        rc = ui_get_rect(taskbar->ui, &scr_rect);
     93        if (rc != EOK) {
     94                printf("Error getting screen dimensions.\n");
    8895                goto error;
    8996        }
     
    94101        params.style &= ~ui_wds_titlebar;
    95102
     103        params.rect.p0.x = 0;
     104        params.rect.p0.y = 0;
     105        params.rect.p1.x = scr_rect.p1.x - scr_rect.p0.x;
     106
    96107        if (ui_is_textmode(taskbar->ui)) {
    97                 params.rect.p0.x = 0;
    98                 params.rect.p0.y = 0;
    99                 params.rect.p1.x = 80;
    100108                params.rect.p1.y = 1;
    101109                params.style &= ~ui_wds_frame;
    102110        } else {
    103                 params.rect.p0.x = 0;
    104                 params.rect.p0.y = 0;
    105                 params.rect.p1.x = 1024;
    106111                params.rect.p1.y = 32;
    107112        }
     
    144149                goto error;
    145150
    146         rect.p0.x = 1024 - 80;
    147         rect.p0.y = 4;
    148         rect.p1.x = 1024 - 4;
    149         rect.p1.y = 32 - 4;
     151        if (ui_is_textmode(taskbar->ui)) {
     152                rect.p0.x = params.rect.p1.x - 10;
     153                rect.p0.y = 0;
     154                rect.p1.x = params.rect.p1.x;
     155                rect.p1.y = 1;
     156        } else {
     157                rect.p0.x = params.rect.p1.x - 80;
     158                rect.p0.y = 4;
     159                rect.p1.x = params.rect.p1.x - 4;
     160                rect.p1.y = 32 - 4;
     161        }
     162
    150163        taskbar_clock_set_rect(taskbar->clock, &rect);
    151164
Note: See TracChangeset for help on using the changeset viewer.