Changeset dc5c303 in mainline for uspace/lib/ui/src/ui.c


Ignore:
Timestamp:
2023-12-28T13:59:23Z (14 months ago)
Author:
GitHub <noreply@…>
Children:
6b66de6b
Parents:
42c2e65 (diff), f87ff8e (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@…> (2023-12-28 13:59:23)
git-committer:
GitHub <noreply@…> (2023-12-28 13:59:23)
Message:

Merge branch 'master' into topic/packet-capture

File:
1 edited

Legend:

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

    r42c2e65 rdc5c303  
    338338        switch (event->type) {
    339339        case CEV_KEY:
     340                ui_lock(ui);
    340341                ui_window_send_kbd(awnd, &event->ev.key);
     342                ui_unlock(ui);
    341343                break;
    342344        case CEV_POS:
     
    348350                claim = ui_wdecor_pos_event(awnd->wdecor, &pos);
    349351                /* Note: If event is claimed, awnd might not be valid anymore */
    350                 if (claim == ui_unclaimed)
     352                if (claim == ui_unclaimed) {
     353                        ui_lock(ui);
    351354                        ui_window_send_pos(awnd, &pos);
     355                        ui_unlock(ui);
     356                }
    352357
    353358                break;
     
    454459errno_t ui_suspend(ui_t *ui)
    455460{
    456         if (ui->cgc == NULL)
     461        errno_t rc;
     462
     463        assert(!ui->suspended);
     464
     465        if (ui->cgc == NULL) {
     466                ui->suspended = true;
    457467                return EOK;
     468        }
    458469
    459470        (void) console_set_caption(ui->console, "");
    460         return console_gc_suspend(ui->cgc);
     471        rc = console_gc_suspend(ui->cgc);
     472        if (rc != EOK)
     473                return rc;
     474
     475        ui->suspended = true;
     476        return EOK;
    461477}
    462478
     
    477493        cons_event_t ev;
    478494
    479         if (ui->cgc == NULL)
     495        assert(ui->suspended);
     496
     497        if (ui->cgc == NULL) {
     498                ui->suspended = false;
    480499                return EOK;
     500        }
    481501
    482502        rc = console_get_pos(ui->console, &col, &row);
     
    510530                return rc;
    511531
     532        ui->suspended = false;
     533
    512534        awnd = ui_window_get_active(ui);
    513535        if (awnd != NULL)
    514536                (void) console_set_caption(ui->console, awnd->wdecor->caption);
    515537
    516         return gfx_cursor_set_visible(console_gc_get_ctx(ui->cgc), false);
     538        rc = gfx_cursor_set_visible(console_gc_get_ctx(ui->cgc), false);
     539        if (rc != EOK)
     540                return rc;
     541
     542        return EOK;
     543}
     544
     545/** Determine if UI is suspended.
     546 *
     547 * @param ui UI
     548 * @return @c true iff UI is suspended
     549 */
     550bool ui_is_suspended(ui_t *ui)
     551{
     552        return ui->suspended;
    517553}
    518554
Note: See TracChangeset for help on using the changeset viewer.