Changeset dc5c303 in mainline for uspace/app/taskbar/wndlist.c


Ignore:
Timestamp:
2023-12-28T13:59:23Z (2 years 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/app/taskbar/wndlist.c

    r42c2e65 rdc5c303  
    3030 * @{
    3131 */
    32 /** @file Task bar window list
     32/** @file Taskbar window list
    3333 */
    3434
     
    4545#include <ui/ui.h>
    4646#include <ui/window.h>
    47 #include "clock.h"
    4847#include "wndlist.h"
    4948
     
    8180};
    8281
    83 /** Create task bar window list.
     82/** Create taskbar window list.
    8483 *
    8584 * @param window Containing window
    8685 * @param fixed Fixed layout to which buttons will be added
    87  * @param wndmgt Window management service
    8886 * @param rwndlist Place to store pointer to new window list
    8987 * @return @c EOK on success or an error code
     
    178176}
    179177
    180 /** Destroy task bar window list. */
     178/** Destroy taskbar window list.
     179 *
     180 * @param wndlist Window list
     181 */
    181182void wndlist_destroy(wndlist_t *wndlist)
    182183{
     
    253254                wndlist_set_entry_rect(wndlist, entry);
    254255                if (paint)
    255                         return ui_pbutton_paint(entry->button);
     256                        return wndlist_paint_entry(entry);
    256257        }
    257258
     
    319320                        wndlist_set_entry_rect(wndlist, e);
    320321                        if (paint) {
    321                                 rc = ui_pbutton_paint(e->button);
     322                                rc = wndlist_paint_entry(e);
    322323                                if (rc != EOK)
    323324                                        return rc;
     
    401402        ui_pbutton_set_light(entry->button, active);
    402403
    403         rc = ui_pbutton_paint(entry->button);
     404        rc = wndlist_paint_entry(entry);
    404405        if (rc != EOK)
    405406                return rc;
    406407
    407         return wndlist_repaint(wndlist);
     408        return EOK;
    408409}
    409410
     
    469470}
    470471
    471 /** Compute and set window list entry rectangle.
    472  *
    473  * Compute rectangle for window list entry and set it.
     472/** Paint window list entry.
    474473 *
    475474 * @param entry Window list entry
    476475 * @return EOK on success or an error code
    477476 */
     477errno_t wndlist_paint_entry(wndlist_entry_t *entry)
     478{
     479        ui_t *ui;
     480
     481        ui = ui_window_get_ui(entry->wndlist->window);
     482        if (ui_is_suspended(ui))
     483                return EOK;
     484
     485        return ui_pbutton_paint(entry->button);
     486}
     487
     488/** Unpaint window list entry.
     489 *
     490 * @param entry Window list entry
     491 * @return EOK on success or an error code
     492 */
    478493errno_t wndlist_unpaint_entry(wndlist_entry_t *entry)
    479494{
    480495        errno_t rc;
     496        ui_t *ui;
    481497        gfx_context_t *gc;
    482498        ui_resource_t *res;
    483499        gfx_color_t *color;
    484500
     501        ui = ui_window_get_ui(entry->wndlist->window);
    485502        gc = ui_window_get_gc(entry->wndlist->window);
    486503        res = ui_window_get_res(entry->wndlist->window);
    487504        color = ui_resource_get_wnd_face_color(res);
    488505
     506        if (ui_is_suspended(ui))
     507                return EOK;
     508
    489509        rc = gfx_set_color(gc, color);
    490510        if (rc != EOK)
     
    511531        wndlist_t *wndlist = (wndlist_t *)arg;
    512532        wndmgt_window_info_t *winfo = NULL;
     533        ui_t *ui;
    513534        errno_t rc;
     535
     536        ui = ui_window_get_ui(wndlist->window);
     537        ui_lock(ui);
    514538
    515539        rc = wndmgt_get_window_info(wndlist->wndmgt, wnd_id, &winfo);
     
    527551
    528552        wndmgt_free_window_info(winfo);
     553        ui_unlock(ui);
    529554        return;
    530555error:
    531556        if (winfo != NULL)
    532557                wndmgt_free_window_info(winfo);
     558        ui_unlock(ui);
    533559}
    534560
     
    542568        wndlist_t *wndlist = (wndlist_t *)arg;
    543569        wndlist_entry_t *entry;
     570        ui_t *ui;
     571
     572        ui = ui_window_get_ui(wndlist->window);
     573        ui_lock(ui);
    544574
    545575        entry = wndlist_entry_by_id(wndlist, wnd_id);
    546         if (entry == NULL)
     576        if (entry == NULL) {
     577                ui_unlock(ui);
    547578                return;
     579        }
    548580
    549581        (void) wndlist_remove(wndlist, entry, true);
     582        ui_unlock(ui);
    550583}
    551584
     
    560593        wndmgt_window_info_t *winfo = NULL;
    561594        wndlist_entry_t *entry;
     595        ui_t *ui;
    562596        errno_t rc;
    563597
     598        ui = ui_window_get_ui(wndlist->window);
     599        ui_lock(ui);
     600
    564601        entry = wndlist_entry_by_id(wndlist, wnd_id);
    565         if (entry == NULL)
     602        if (entry == NULL) {
     603                ui_unlock(ui);
    566604                return;
     605        }
    567606
    568607        rc = wndmgt_get_window_info(wndlist->wndmgt, wnd_id, &winfo);
    569         if (rc != EOK)
     608        if (rc != EOK) {
     609                ui_unlock(ui);
    570610                return;
     611        }
    571612
    572613        (void) wndlist_update(wndlist, entry, winfo->caption,
    573614            winfo->nfocus != 0);
    574615        wndmgt_free_window_info(winfo);
     616        ui_unlock(ui);
    575617}
    576618
     
    661703errno_t wndlist_repaint(wndlist_t *wndlist)
    662704{
     705        if (ui_is_suspended(ui_window_get_ui(wndlist->window)))
     706                return EOK;
     707
    663708        return ui_window_paint(wndlist->window);
    664709}
     
    675720
    676721        /* ID of device that clicked the button */
    677         dev_id = entry->wndlist->ev_pos_id;
     722        dev_id = entry->wndlist->ev_idev_id;
    678723
    679724        (void) wndmgt_activate_window(entry->wndlist->wndmgt,
Note: See TracChangeset for help on using the changeset viewer.