Changeset 3c54869 in mainline


Ignore:
Timestamp:
2023-01-04T20:24:44Z (16 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d86797
Parents:
cdd6fc9
Message:

Highlight active window in task bar

Location:
uspace
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar/test/wndlist.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    208208        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    209209
    210         rc = wndlist_append(wndlist, 123, "Foo", true);
     210        rc = wndlist_append(wndlist, 123, "Foo", true, true);
    211211        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    212212
     
    214214        PCUT_ASSERT_INT_EQUALS(123, entry->wnd_id);
    215215        PCUT_ASSERT_NOT_NULL(entry->button);
     216        PCUT_ASSERT_TRUE(ui_pbutton_get_light(entry->button));
    216217
    217218        wndlist_destroy(wndlist);
     
    248249        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    249250
    250         rc = wndlist_append(wndlist, 1, "Foo", true);
    251         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    252 
    253         rc = wndlist_append(wndlist, 2, "Bar", true);
     251        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     252        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     253
     254        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    254255        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    255256
     
    269270}
    270271
     272/** Test updating entry */
     273PCUT_TEST(update)
     274{
     275        errno_t rc;
     276        ui_t *ui = NULL;
     277        ui_wnd_params_t params;
     278        ui_window_t *window = NULL;
     279        ui_fixed_t *fixed = NULL;
     280        wndlist_t *wndlist;
     281        wndlist_entry_t *entry;
     282
     283        rc = ui_create_disp(NULL, &ui);
     284        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     285
     286        ui_wnd_params_init(&params);
     287        params.caption = "Hello";
     288
     289        rc = ui_window_create(ui, &params, &window);
     290        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     291        PCUT_ASSERT_NOT_NULL(window);
     292
     293        rc = ui_fixed_create(&fixed);
     294        ui_window_add(window, ui_fixed_ctl(fixed));
     295
     296        rc = wndlist_create(window, fixed, &wndlist);
     297        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     298
     299        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     300        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     301
     302        entry = wndlist_first(wndlist);
     303        PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
     304        PCUT_ASSERT_NOT_NULL(entry->button);
     305        PCUT_ASSERT_TRUE(ui_pbutton_get_light(entry->button));
     306
     307        rc = wndlist_update(wndlist, entry, "Bar", false);
     308        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     309
     310        PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
     311        PCUT_ASSERT_NOT_NULL(entry->button);
     312        PCUT_ASSERT_FALSE(ui_pbutton_get_light(entry->button));
     313
     314        wndlist_destroy(wndlist);
     315
     316        ui_window_destroy(window);
     317        ui_destroy(ui);
     318}
     319
    271320/** Test setting entry rectangle */
    272321PCUT_TEST(set_entry_rect)
     
    296345        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    297346
    298         rc = wndlist_append(wndlist, 123, "Foo", true);
     347        rc = wndlist_append(wndlist, 123, "Foo", true, true);
    299348        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    300349
     
    337386        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    338387
    339         rc = wndlist_append(wndlist, 1, "Foo", true);
    340         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    341 
    342         rc = wndlist_append(wndlist, 2, "Bar", true);
     388        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     389        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     390
     391        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    343392        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    344393
     
    384433        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    385434
    386         rc = wndlist_append(wndlist, 1, "Foo", true);
    387         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    388 
    389         rc = wndlist_append(wndlist, 2, "Bar", true);
     435        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     436        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     437
     438        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    390439        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    391440
     
    434483        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    435484
    436         rc = wndlist_append(wndlist, 1, "Foo", true);
    437         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    438 
    439         rc = wndlist_append(wndlist, 2, "Bar", true);
     485        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     486        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     487
     488        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    440489        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    441490
     
    480529        PCUT_ASSERT_INT_EQUALS(0, count);
    481530
    482         rc = wndlist_append(wndlist, 1, "Foo", true);
     531        rc = wndlist_append(wndlist, 1, "Foo", true, true);
    483532        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    484533
     
    486535        PCUT_ASSERT_INT_EQUALS(1, count);
    487536
    488         rc = wndlist_append(wndlist, 2, "Bar", true);
     537        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    489538        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    490539
     
    524573        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    525574
    526         rc = wndlist_append(wndlist, 1, "Foo", true);
    527         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    528 
    529         rc = wndlist_append(wndlist, 2, "Bar", true);
     575        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     576        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     577
     578        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    530579        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    531580
  • uspace/app/taskbar/wndlist.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    157157                if ((winfo->flags & (wndf_popup | wndf_system)) == 0) {
    158158                        rc = wndlist_append(wndlist, wlist->windows[i],
    159                             winfo->caption, false);
     159                            winfo->caption, winfo->nfocus != 0, false);
    160160                        if (rc != EOK) {
    161161                                wndmgt_free_window_info(winfo);
     
    202202 * @param wnd_id Window ID
    203203 * @param caption Entry caption
     204 * @param active @c true iff window is active
    204205 * @param paint @c true to paint immediately
    205206 * @return @c EOK on success or an error code
    206207 */
    207208errno_t wndlist_append(wndlist_t *wndlist, sysarg_t wnd_id,
    208     const char *caption, bool paint)
     209    const char *caption, bool active, bool paint)
    209210{
    210211        wndlist_entry_t *entry = NULL;
     
    230231
    231232        entry->visible = false;
     233
     234        ui_pbutton_set_light(entry->button, active);
    232235
    233236        /* Set button callbacks */
     
    382385 * @param wndlist Window list
    383386 * @param entry Window list entry
     387 * @param active @c true iff the window is active
    384388 * @return @c EOK on success or an error code
    385389 */
    386390errno_t wndlist_update(wndlist_t *wndlist, wndlist_entry_t *entry,
    387     const char *caption)
     391    const char *caption, bool active)
    388392{
    389393        errno_t rc;
     
    393397        if (rc != EOK)
    394398                return rc;
     399
     400        ui_pbutton_set_light(entry->button, active);
    395401
    396402        rc = ui_pbutton_paint(entry->button);
     
    507513
    508514        if ((winfo->flags & (wndf_popup | wndf_system)) == 0) {
    509                 rc = wndlist_append(wndlist, wnd_id, winfo->caption, true);
     515                rc = wndlist_append(wndlist, wnd_id, winfo->caption,
     516                    winfo->nfocus != 0, true);
    510517                if (rc != EOK) {
    511518                        wndmgt_free_window_info(winfo);
     
    558565                return;
    559566
    560         (void) wndlist_update(wndlist, entry, winfo->caption);
     567        (void) wndlist_update(wndlist, entry, winfo->caption,
     568            winfo->nfocus != 0);
    561569        wndmgt_free_window_info(winfo);
    562570}
  • uspace/app/taskbar/wndlist.h

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5050extern errno_t wndlist_open_wm(wndlist_t *, const char *);
    5151extern void wndlist_destroy(wndlist_t *);
    52 extern errno_t wndlist_append(wndlist_t *, sysarg_t, const char *, bool);
     52extern errno_t wndlist_append(wndlist_t *, sysarg_t, const char *, bool,
     53    bool);
    5354extern errno_t wndlist_remove(wndlist_t *, wndlist_entry_t *, bool);
    5455extern bool wndlist_update_pitch(wndlist_t *);
    55 extern errno_t wndlist_update(wndlist_t *, wndlist_entry_t *, const char *);
     56extern errno_t wndlist_update(wndlist_t *, wndlist_entry_t *, const char *,
     57    bool);
    5658extern void wndlist_set_entry_rect(wndlist_t *, wndlist_entry_t *);
    5759extern wndlist_entry_t *wndlist_entry_by_id(wndlist_t *, sysarg_t);
  • uspace/lib/ui/include/ui/pbutton.h

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    5656extern void ui_pbutton_set_rect(ui_pbutton_t *, gfx_rect_t *);
    5757extern void ui_pbutton_set_default(ui_pbutton_t *, bool);
     58extern bool ui_pbutton_get_light(ui_pbutton_t *);
     59extern void ui_pbutton_set_light(ui_pbutton_t *, bool);
    5860extern errno_t ui_pbutton_set_caption(ui_pbutton_t *, const char *);
    5961extern errno_t ui_pbutton_paint(ui_pbutton_t *);
  • uspace/lib/ui/private/pbutton.h

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    6565        /** Button is selected as default */
    6666        bool isdefault;
     67        /** Button light is on */
     68        bool light;
    6769        /** Button is currently held down */
    6870        bool held;
  • uspace/lib/ui/private/resource.h

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    6666        /** Button face color */
    6767        gfx_color_t *btn_face_color;
     68        /** Lit button face color */
     69        gfx_color_t *btn_face_lit_color;
    6870        /** Button text color */
    6971        gfx_color_t *btn_text_color;
  • uspace/lib/ui/src/pbutton.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    188188}
    189189
     190/** Get button light status.
     191 *
     192 * @param pbutton Button
     193 * @return @c true iff light is on
     194 */
     195bool ui_pbutton_get_light(ui_pbutton_t *pbutton)
     196{
     197        return pbutton->light;
     198}
     199
     200/** Turn button light on or off.
     201 *
     202 * @param pbutton Button
     203 * @param light @c true iff button should be lit
     204 */
     205void ui_pbutton_set_light(ui_pbutton_t *pbutton, bool light)
     206{
     207        pbutton->light = light;
     208}
     209
    190210/** Set push button caption.
    191211 *
     
    327347        gfx_rect_t irect;
    328348        gfx_coord_t thickness;
     349        gfx_color_t *color;
    329350        bool depressed;
    330351        errno_t rc;
     
    338359        rect.p1.y = pbutton->rect.p1.y - thickness;
    339360
    340         rc = gfx_set_color(pbutton->res->gc, pbutton->res->btn_face_color);
     361        color = pbutton->light ? pbutton->res->btn_face_lit_color :
     362            pbutton->res->btn_face_color;
     363
     364        rc = gfx_set_color(pbutton->res->gc, color);
    341365        if (rc != EOK)
    342366                goto error;
  • uspace/lib/ui/src/resource.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    6262        gfx_color_t *btn_frame_color = NULL;
    6363        gfx_color_t *btn_face_color = NULL;
     64        gfx_color_t *btn_face_lit_color = NULL;
    6465        gfx_color_t *btn_text_color = NULL;
    6566        gfx_color_t *btn_highlight_color = NULL;
     
    114115                goto error;
    115116
     117        rc = gfx_color_new_rgb_i16(0xe8e8, 0xe8e8, 0xe8e8, &btn_face_lit_color);
     118        if (rc != EOK)
     119                goto error;
     120
    116121        rc = gfx_color_new_rgb_i16(0, 0, 0, &btn_text_color);
    117122        if (rc != EOK)
     
    227232        resource->btn_frame_color = btn_frame_color;
    228233        resource->btn_face_color = btn_face_color;
     234        resource->btn_face_lit_color = btn_face_lit_color;
    229235        resource->btn_text_color = btn_text_color;
    230236        resource->btn_highlight_color = btn_highlight_color;
     
    263269        if (btn_face_color != NULL)
    264270                gfx_color_delete(btn_face_color);
     271        if (btn_face_lit_color != NULL)
     272                gfx_color_delete(btn_face_lit_color);
    265273        if (btn_text_color != NULL)
    266274                gfx_color_delete(btn_text_color);
     
    336344        gfx_color_t *btn_frame_color = NULL;
    337345        gfx_color_t *btn_face_color = NULL;
     346        gfx_color_t *btn_face_lit_color = NULL;
    338347        gfx_color_t *btn_text_color = NULL;
    339348        gfx_color_t *btn_highlight_color = NULL;
     
    383392                goto error;
    384393
     394        rc = gfx_color_new_ega(0x30, &btn_face_lit_color);
     395        if (rc != EOK)
     396                goto error;
     397
    385398        rc = gfx_color_new_ega(0x20, &btn_text_color);
    386399        if (rc != EOK)
     
    486499        resource->btn_frame_color = btn_frame_color;
    487500        resource->btn_face_color = btn_face_color;
     501        resource->btn_face_lit_color = btn_face_lit_color;
    488502        resource->btn_text_color = btn_text_color;
    489503        resource->btn_highlight_color = btn_highlight_color;
     
    522536        if (btn_face_color != NULL)
    523537                gfx_color_delete(btn_face_color);
     538        if (btn_face_lit_color != NULL)
     539                gfx_color_delete(btn_face_lit_color);
    524540        if (btn_text_color != NULL)
    525541                gfx_color_delete(btn_text_color);
     
    607623        gfx_color_delete(resource->btn_frame_color);
    608624        gfx_color_delete(resource->btn_face_color);
     625        gfx_color_delete(resource->btn_face_lit_color);
    609626        gfx_color_delete(resource->btn_text_color);
    610627        gfx_color_delete(resource->btn_highlight_color);
  • uspace/lib/ui/test/pbutton.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    190190}
    191191
     192/** Get light gets internal field */
     193PCUT_TEST(get_light)
     194{
     195        ui_pbutton_t *pbutton;
     196        errno_t rc;
     197
     198        rc = ui_pbutton_create(NULL, "Hello", &pbutton);
     199        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     200
     201        pbutton->light = true;
     202        PCUT_ASSERT_TRUE(ui_pbutton_get_light(pbutton));
     203
     204        pbutton->light = false;
     205        PCUT_ASSERT_FALSE(ui_pbutton_get_light(pbutton));
     206
     207        ui_pbutton_destroy(pbutton);
     208}
     209
     210/** Set light sets internal field */
     211PCUT_TEST(set_light)
     212{
     213        ui_pbutton_t *pbutton;
     214        errno_t rc;
     215
     216        rc = ui_pbutton_create(NULL, "Hello", &pbutton);
     217        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     218
     219        ui_pbutton_set_light(pbutton, true);
     220        PCUT_ASSERT_TRUE(pbutton->light);
     221
     222        ui_pbutton_set_light(pbutton, false);
     223        PCUT_ASSERT_FALSE(pbutton->light);
     224
     225        ui_pbutton_destroy(pbutton);
     226}
     227
    192228/** Set caption sets internal field */
    193229PCUT_TEST(set_caption)
  • uspace/lib/wndmgt/include/types/wndmgt.h

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    8989        /** Window flags */
    9090        unsigned flags;
     91        /** Number of foci on this window */
     92        unsigned nfocus;
    9193} wndmgt_window_info_t;
    9294
  • uspace/lib/wndmgt/src/wndmgt.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    271271        info->caption = caption;
    272272        info->flags = ipc_get_arg1(&answer);
     273        info->nfocus = ipc_get_arg2(&answer);
    273274        *rinfo = info;
    274275        return EOK;
  • uspace/lib/wndmgt/src/wndmgt_srv.c

    rcdd6fc9 r3c54869  
    200200        }
    201201
    202         async_answer_1(icall, EOK, info->flags);
     202        async_answer_2(icall, EOK, info->flags, info->nfocus);
    203203        wndmgt_free_window_info(info);
    204204}
  • uspace/lib/wndmgt/test/wndmgt.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    282282        resp.get_window_info_rinfo->caption = str_dup("Hello");
    283283        resp.get_window_info_rinfo->flags = 42;
     284        resp.get_window_info_rinfo->nfocus = 123;
    284285        PCUT_ASSERT_NOT_NULL(resp.get_window_info_rinfo->caption);
    285286        wnd_id = 1;
     
    292293        PCUT_ASSERT_STR_EQUALS("Hello", info->caption);
    293294        PCUT_ASSERT_INT_EQUALS(42, info->flags);
     295        PCUT_ASSERT_INT_EQUALS(123, info->nfocus);
    294296
    295297        wndmgt_free_window_info(info);
  • uspace/srv/hid/display/test/window.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    623623}
    624624
     625/** Test ds_window_post_focus_event() */
     626PCUT_TEST(window_post_focus_event)
     627{
     628        gfx_context_t *gc;
     629        ds_display_t *disp;
     630        ds_client_t *client;
     631        ds_seat_t *seat;
     632        ds_window_t *wnd;
     633        display_wnd_params_t params;
     634        errno_t rc;
     635
     636        rc = gfx_context_new(&dummy_ops, NULL, &gc);
     637        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     638
     639        rc = ds_display_create(gc, df_none, &disp);
     640        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     641
     642        rc = ds_client_create(disp, NULL, NULL, &client);
     643        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     644
     645        rc = ds_seat_create(disp, &seat);
     646        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     647
     648        display_wnd_params_init(&params);
     649        params.rect.p0.x = params.rect.p0.y = 0;
     650        params.rect.p1.x = params.rect.p1.y = 1;
     651
     652        rc = ds_window_create(client, &params, &wnd);
     653        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     654
     655        rc = ds_window_post_focus_event(wnd);
     656        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     657
     658        ds_window_destroy(wnd);
     659        ds_seat_destroy(seat);
     660        ds_client_destroy(client);
     661        ds_display_destroy(disp);
     662}
     663
     664/** Test ds_window_post_unfocus_event() */
     665PCUT_TEST(window_post_unfocus_event)
     666{
     667        gfx_context_t *gc;
     668        ds_display_t *disp;
     669        ds_client_t *client;
     670        ds_seat_t *seat;
     671        ds_window_t *wnd;
     672        display_wnd_params_t params;
     673        errno_t rc;
     674
     675        rc = gfx_context_new(&dummy_ops, NULL, &gc);
     676        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     677
     678        rc = ds_display_create(gc, df_none, &disp);
     679        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     680
     681        rc = ds_client_create(disp, NULL, NULL, &client);
     682        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     683
     684        rc = ds_seat_create(disp, &seat);
     685        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     686
     687        display_wnd_params_init(&params);
     688        params.rect.p0.x = params.rect.p0.y = 0;
     689        params.rect.p1.x = params.rect.p1.y = 1;
     690
     691        rc = ds_window_create(client, &params, &wnd);
     692        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     693
     694        rc = ds_window_post_focus_event(wnd);
     695        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     696
     697        ds_window_destroy(wnd);
     698        ds_seat_destroy(seat);
     699        ds_client_destroy(client);
     700        ds_display_destroy(disp);
     701}
     702
    625703/** Test ds_window_move_req() */
    626704PCUT_TEST(window_move_req)
  • uspace/srv/hid/display/types/display/window.h

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    107107        /** Window caption */
    108108        char *caption;
     109        /** Number of foci */
     110        unsigned nfocus;
    109111} ds_window_t;
    110112
  • uspace/srv/hid/display/window.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    678678errno_t ds_window_post_focus_event(ds_window_t *wnd)
    679679{
     680        errno_t rc;
     681        ds_wmclient_t *wmclient;
     682
    680683        log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_post_focus_event");
    681684
    682         return ds_client_post_focus_event(wnd->client, wnd);
     685        rc = ds_client_post_focus_event(wnd->client, wnd);
     686        if (rc != EOK)
     687                return rc;
     688
     689        /* Increase focus counter */
     690        ++wnd->nfocus;
     691
     692        /* Notify window managers about window information change */
     693        wmclient = ds_display_first_wmclient(wnd->display);
     694        while (wmclient != NULL) {
     695                ds_wmclient_post_wnd_changed_event(wmclient, wnd->id);
     696                wmclient = ds_display_next_wmclient(wmclient);
     697        }
     698
     699        return EOK;
    683700}
    684701
     
    690707errno_t ds_window_post_unfocus_event(ds_window_t *wnd)
    691708{
     709        errno_t rc;
     710        ds_wmclient_t *wmclient;
     711
    692712        log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_post_unfocus_event");
    693713
    694         return ds_client_post_unfocus_event(wnd->client, wnd);
     714        rc = ds_client_post_unfocus_event(wnd->client, wnd);
     715        if (rc != EOK)
     716                return rc;
     717
     718        /* Decrease focus counter */
     719        --wnd->nfocus;
     720
     721        /* Notify window managers about window information change */
     722        wmclient = ds_display_first_wmclient(wnd->display);
     723        while (wmclient != NULL) {
     724                ds_wmclient_post_wnd_changed_event(wmclient, wnd->id);
     725                wmclient = ds_display_next_wmclient(wmclient);
     726        }
     727
     728        return EOK;
    695729}
    696730
  • uspace/srv/hid/display/wmops.c

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    145145
    146146        info->flags = wnd->flags;
     147        info->nfocus = wnd->nfocus;
    147148
    148149        ds_display_unlock(wmclient->display);
Note: See TracChangeset for help on using the changeset viewer.