Changeset 35cffea in mainline for uspace/lib/display/src/display.c


Ignore:
Timestamp:
2022-05-19T08:02:31Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ad698f4
Parents:
fd05ea6
git-author:
Jiri Svoboda <jiri@…> (2022-05-18 17:02:12)
git-committer:
Jiri Svoboda <jiri@…> (2022-05-19 08:02:31)
Message:

Maximizing/unmaximizing a window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/display/src/display.c

    rfd05ea6 r35cffea  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    350350}
    351351
     352/** Get display window maximized rectangle.
     353 *
     354 * Get the rectangle to which a window would be maximized.
     355 *
     356 * @param window Window
     357 * @param rect Place to store maximized rectangle
     358 * @return EOK on success or an error code
     359 */
     360errno_t display_window_get_max_rect(display_window_t *window, gfx_rect_t *rect)
     361{
     362        async_exch_t *exch;
     363        aid_t req;
     364        ipc_call_t answer;
     365        errno_t rc;
     366
     367        exch = async_exchange_begin(window->display->sess);
     368        req = async_send_1(exch, DISPLAY_WINDOW_GET_MAX_RECT, window->id,
     369            &answer);
     370        rc = async_data_read_start(exch, rect, sizeof (gfx_rect_t));
     371        async_exchange_end(exch);
     372        if (rc != EOK) {
     373                async_forget(req);
     374                return rc;
     375        }
     376
     377        async_wait_for(req, &rc);
     378        if (rc != EOK)
     379                return rc;
     380
     381        return EOK;
     382}
     383
    352384/** Request a window resize.
    353385 *
     
    453485
    454486        return EOK;
     487}
     488
     489/** Maximize window.
     490 *
     491 * @param window Window
     492 * @return EOK on success or an error code
     493 */
     494errno_t display_window_maximize(display_window_t *window)
     495{
     496        async_exch_t *exch;
     497        errno_t rc;
     498
     499        exch = async_exchange_begin(window->display->sess);
     500        rc = async_req_1_0(exch, DISPLAY_WINDOW_MAXIMIZE, window->id);
     501        async_exchange_end(exch);
     502
     503        return rc;
     504}
     505
     506/** Unmaximize window.
     507 *
     508 * @param window Window
     509 * @return EOK on success or an error code
     510 */
     511errno_t display_window_unmaximize(display_window_t *window)
     512{
     513        async_exch_t *exch;
     514        errno_t rc;
     515
     516        exch = async_exchange_begin(window->display->sess);
     517        rc = async_req_1_0(exch, DISPLAY_WINDOW_UNMAXIMIZE, window->id);
     518        async_exchange_end(exch);
     519
     520        return rc;
    455521}
    456522
Note: See TracChangeset for help on using the changeset viewer.