Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 5d62130 in mainline


Ignore:
Timestamp:
2022-11-13T10:56:43Z (3 weeks ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
a130983
Parents:
a5c7b865
Message:

Taskbar should be always on top

We add support for topmost windows and make the taskbar window topmost.

Location:
uspace
Files:
7 edited

Legend:

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

    ra5c7b865 r5d62130  
    134134        params.style &= ~ui_wds_titlebar;
    135135
     136        /* Window is not obscured by other windows */
     137        params.flags |= ui_wndf_topmost;
     138
    136139        /* Prevent taskbar window from being listed in taskbar */
    137140        params.flags |= ui_wndf_system;
  • uspace/lib/display/include/types/display/wndparams.h

    ra5c7b865 r5d62130  
    4242        /** Popup window (capture events, no focus) */
    4343        wndf_popup = 0x1,
     44        /** Topmost window */
     45        wndf_topmost = 0x2,
    4446        /** Set specific initial window position */
    45         wndf_setpos = 0x2,
     47        wndf_setpos = 0x4,
    4648        /** Window is maximized */
    47         wndf_maximized = 0x4,
     49        wndf_maximized = 0x8,
    4850        /** Special system window */
    49         wndf_system = 0x8
     51        wndf_system = 0x10
    5052} display_wnd_flags_t;
    5153
  • uspace/lib/ui/include/types/ui/window.h

    ra5c7b865 r5d62130  
    6767        /** Popup window */
    6868        ui_wndf_popup = 0x1,
     69        /** Topmost window */
     70        ui_wndf_topmost = 0x2,
    6971        /** Special system window */
    70         ui_wndf_system = 0x2
     72        ui_wndf_system = 0x4
    7173} ui_wnd_flags_t;
    7274
  • uspace/lib/ui/src/window.c

    ra5c7b865 r5d62130  
    228228        if ((params->flags & ui_wndf_popup) != 0)
    229229                dparams.flags |= wndf_popup;
     230        if ((params->flags & ui_wndf_topmost) != 0)
     231                dparams.flags |= wndf_topmost;
    230232        if ((params->flags & ui_wndf_system) != 0)
    231233                dparams.flags |= wndf_system;
  • uspace/srv/hid/display/display.c

    ra5c7b865 r5d62130  
    313313}
    314314
     315/** Add window to window list.
     316 *
     317 * Topmost windows are enlisted before any other window. Non-topmost
     318 * windows are enlisted before any other non-topmost window.
     319 *
     320 * @param display Display
     321 * @param wnd Window
     322 */
     323void ds_display_enlist_window(ds_display_t *display, ds_window_t *wnd)
     324{
     325        ds_window_t *w;
     326
     327        assert(wnd->display == display);
     328        assert(!link_used(&wnd->ldwindows));
     329
     330        if ((wnd->flags & wndf_topmost) == 0) {
     331                /* Find the first non-topmost window */
     332                w = ds_display_first_window(display);
     333                while (w != NULL && (w->flags & wndf_topmost) != 0)
     334                        w = ds_display_next_window(w);
     335
     336                if (w != NULL)
     337                        list_insert_before(&wnd->ldwindows, &w->ldwindows);
     338                else
     339                        list_append(&wnd->ldwindows, &display->windows);
     340        } else {
     341                /* Insert at the beginning */
     342                list_prepend(&wnd->ldwindows, &display->windows);
     343        }
     344
     345}
     346
    315347/** Add window to display.
    316348 *
     
    326358
    327359        wnd->display = display;
    328         list_prepend(&wnd->ldwindows, &display->windows);
     360        ds_display_enlist_window(display, wnd);
    329361
    330362        /* Notify window managers about the new window */
     
    369401
    370402        list_remove(&wnd->ldwindows);
    371         list_prepend(&wnd->ldwindows, &wnd->display->windows);
     403        ds_display_enlist_window(wnd->display, wnd);
    372404}
    373405
  • uspace/srv/hid/display/display.h

    ra5c7b865 r5d62130  
    6767extern ds_window_t *ds_display_find_window(ds_display_t *, ds_wnd_id_t);
    6868extern ds_window_t *ds_display_window_by_pos(ds_display_t *, gfx_coord2_t *);
     69extern void ds_display_enlist_window(ds_display_t *, ds_window_t *);
    6970extern void ds_display_add_window(ds_display_t *, ds_window_t *);
    7071extern void ds_display_remove_window(ds_window_t *);
  • uspace/srv/hid/display/test/display.c

    ra5c7b865 r5d62130  
    195195}
    196196
     197/** Test ds_display_enlist_window() */
     198PCUT_TEST(display_enlist_window)
     199{
     200        ds_display_t *disp;
     201        ds_client_t *client;
     202        ds_seat_t *seat;
     203        ds_window_t *w0;
     204        ds_window_t *w1;
     205        ds_window_t *w2;
     206        ds_window_t *w3;
     207        ds_window_t *w;
     208        display_wnd_params_t params;
     209        bool called_cb = false;
     210        errno_t rc;
     211
     212        rc = ds_display_create(NULL, df_none, &disp);
     213        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     214
     215        rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
     216        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     217
     218        rc = ds_seat_create(disp, &seat);
     219        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     220
     221        display_wnd_params_init(&params);
     222        params.rect.p0.x = params.rect.p0.y = 0;
     223        params.rect.p1.x = params.rect.p1.y = 100;
     224
     225        /* Regular windows */
     226
     227        rc = ds_window_create(client, &params, &w0);
     228        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     229
     230        rc = ds_window_create(client, &params, &w1);
     231        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     232
     233        /* Topmost windows */
     234
     235        params.flags |= wndf_topmost;
     236
     237        rc = ds_window_create(client, &params, &w2);
     238        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     239
     240        rc = ds_window_create(client, &params, &w3);
     241        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     242
     243        /* Delist w1 and w2 */
     244        list_remove(&w1->ldwindows);
     245        list_remove(&w2->ldwindows);
     246
     247        /* Enlist the windows back and check their order */
     248        ds_display_enlist_window(disp, w1);
     249        ds_display_enlist_window(disp, w2);
     250
     251        w = ds_display_first_window(disp);
     252        PCUT_ASSERT_EQUALS(w2, w);
     253        w = ds_display_next_window(w);
     254        PCUT_ASSERT_EQUALS(w3, w);
     255        w = ds_display_next_window(w);
     256        PCUT_ASSERT_EQUALS(w1, w);
     257        w = ds_display_next_window(w);
     258        PCUT_ASSERT_EQUALS(w0, w);
     259        w = ds_display_next_window(w);
     260        PCUT_ASSERT_EQUALS(NULL, w);
     261
     262        ds_window_destroy(w0);
     263        ds_window_destroy(w1);
     264        ds_window_destroy(w2);
     265        ds_window_destroy(w3);
     266        ds_seat_destroy(seat);
     267        ds_client_destroy(client);
     268        ds_display_destroy(disp);
     269}
     270
    197271/** Test ds_display_window_to_top() */
    198272PCUT_TEST(display_window_to_top)
Note: See TracChangeset for help on using the changeset viewer.