Changeset 0576df9 in mainline for uspace/lib/ui/src/window.c


Ignore:
Timestamp:
2020-11-14T21:28:35Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63b35c7
Parents:
38f5598
Message:

Decoding images without libdraw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/window.c

    r38f5598 r0576df9  
    215215}
    216216
     217/** Resize/move window.
     218 *
     219 * Resize window to the dimensions of @a rect. If @a rect.p0 is not 0,0,
     220 * the top-left corner of the window will move on the screen accordingly.
     221 *
     222 * @param window Window
     223 * @param rect Rectangle
     224 *
     225 * @return EOK on success or an error code
     226 */
     227errno_t ui_window_resize(ui_window_t *window, gfx_rect_t *rect)
     228{
     229        gfx_coord2_t offs;
     230        gfx_rect_t nrect;
     231        errno_t rc;
     232
     233        /*
     234         * Move rect so that p0=0,0 - keep window's coordinate system origin
     235         * locked to top-left corner of the window.
     236         */
     237        offs = rect->p0;
     238        gfx_rect_rtranslate(&offs, rect, &nrect);
     239
     240        /* dwindow can be NULL in case of unit tests */
     241        if (window->dwindow != NULL) {
     242                rc = display_window_resize(window->dwindow, &offs, &nrect);
     243                if (rc != EOK)
     244                        return rc;
     245        }
     246
     247        ui_wdecor_set_rect(window->wdecor, &nrect);
     248        ui_wdecor_paint(window->wdecor);
     249        return EOK;
     250}
     251
    217252/** Set window callbacks.
    218253 *
Note: See TracChangeset for help on using the changeset viewer.