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


Ignore:
Timestamp:
2024-10-13T08:23:40Z (2 months ago)
Author:
GitHub <noreply@…>
Children:
0472cf17
Parents:
2a0c827c (diff), b3b79981 (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.
git-author:
boba-buba <120932204+boba-buba@…> (2024-10-13 08:23:40)
git-committer:
GitHub <noreply@…> (2024-10-13 08:23:40)
Message:

Merge branch 'HelenOS:master' into topic/packet-capture

File:
1 edited

Legend:

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

    r2a0c827c rebb1489  
    11/*
    2  * Copyright (c) 2023 Jiri Svoboda
     2 * Copyright (c) 2024 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    318318{
    319319        ui_window_t *window;
     320        ui_window_t *pwindow = NULL;
    320321        display_info_t info;
    321322        gfx_coord2_t scr_dims;
     
    342343        dparams.rect = params->rect;
    343344        dparams.caption = params->caption;
    344         /* Only allow making the window larger */
    345         gfx_rect_dims(&params->rect, &dparams.min_size);
     345        dparams.min_size = params->min_size;
    346346
    347347        /*
     
    505505        *rwindow = window;
    506506
     507        if (ui_is_fullscreen(ui))
     508                pwindow = ui_window_get_active(ui);
     509
    507510        list_append(&window->lwindows, &ui->windows);
     511
     512        if (ui_is_fullscreen(ui)) {
     513                /* Send unfocus event to previously active window */
     514                if (pwindow != NULL)
     515                        ui_window_send_unfocus(pwindow, 0);
     516        }
     517
    508518        return EOK;
    509519error:
     
    531541{
    532542        ui_t *ui;
     543        ui_window_t *nwindow;
    533544
    534545        if (window == NULL)
     
    558569        if (ui_is_fullscreen(ui)) {
    559570                ui_paint(ui);
     571                /* Send focus event to newly active window */
     572                nwindow = ui_window_get_active(ui);
     573                if (nwindow != NULL)
     574                        ui_window_send_focus(nwindow, 0);
    560575        }
    561576
     
    10311046        ui_lock(ui);
    10321047        (void) ui_window_resize(window, rect);
    1033         (void) ui_window_paint(window);
     1048        ui_window_send_resize(window);
    10341049        ui_unlock(ui);
    10351050}
     
    12791294void ui_window_send_minimize(ui_window_t *window)
    12801295{
    1281         if (window->cb != NULL && window->cb->maximize != NULL)
     1296        if (window->cb != NULL && window->cb->minimize != NULL)
    12821297                window->cb->minimize(window, window->arg);
    12831298        else
     
    13771392        else
    13781393                return ui_window_def_unfocus(window, nfocus);
     1394}
     1395
     1396/** Send window resize event.
     1397 *
     1398 * @param window Window
     1399 */
     1400void ui_window_send_resize(ui_window_t *window)
     1401{
     1402        if (window->cb != NULL && window->cb->resize != NULL)
     1403                window->cb->resize(window, window->arg);
     1404        else
     1405                return ui_window_def_resize(window);
    13791406}
    13801407
     
    15571584        if (window->control != NULL)
    15581585                ui_control_unfocus(window->control, nfocus);
     1586}
     1587
     1588/** Default window resize routine.
     1589 *
     1590 * @param window Window
     1591 * @return EOK on success or an error code
     1592 */
     1593void ui_window_def_resize(ui_window_t *window)
     1594{
     1595        ui_window_paint(window);
    15591596}
    15601597
Note: See TracChangeset for help on using the changeset viewer.