Changeset 15d0046 in mainline for uspace/lib/gui/button.c


Ignore:
Timestamp:
2014-09-12T13:22:33Z (10 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9b20126
Parents:
8db09e4 (diff), 105d8d6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gui/button.c

    r8db09e4 r15d0046  
    3838#include <drawctx.h>
    3939#include <surface.h>
     40#include <font/embedded.h>
     41#include <errno.h>
    4042#include "common.h"
    4143#include "window.h"
     
    7678        sysarg_t cpt_width;
    7779        sysarg_t cpt_height;
    78         font_get_box(&btn->font, btn->caption, &cpt_width, &cpt_height);
     80        font_get_box(btn->font, btn->caption, &cpt_width, &cpt_height);
    7981       
    8082        if ((widget->width >= cpt_width) && (widget->height >= cpt_height)) {
     
    8385               
    8486                drawctx_set_source(&drawctx, &btn->text);
    85                 drawctx_set_font(&drawctx, &btn->font);
     87                drawctx_set_font(&drawctx, btn->font);
    8688               
    8789                if (btn->caption)
     
    9698        widget_deinit(&btn->widget);
    9799        free(btn->caption);
    98         font_release(&btn->font);
     100        font_release(btn->font);
    99101}
    100102
     
    171173                btn->caption = str_dup(caption);
    172174       
    173         font_init(&btn->font, FONT_DECODER_EMBEDDED, NULL, points);
     175        int rc = embedded_font_create(&btn->font, points);
     176        if (rc != EOK) {
     177                free(btn->caption);
     178                btn->caption = NULL;
     179                return false;
     180        }
    174181       
    175182        sysarg_t cpt_width;
    176183        sysarg_t cpt_height;
    177         font_get_box(&btn->font, btn->caption, &cpt_width, &cpt_height);
     184        font_get_box(btn->font, btn->caption, &cpt_width, &cpt_height);
    178185        btn->widget.width_min = cpt_width + 10;
    179186        btn->widget.height_min = cpt_height + 10;
Note: See TracChangeset for help on using the changeset viewer.