Changeset 1766326 in mainline for uspace/app/taskbar


Ignore:
Timestamp:
2022-10-18T09:06:07Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7a05d924
Parents:
0761448
git-author:
Jiri Svoboda <jiri@…> (2022-10-17 17:05:56)
git-committer:
Jiri Svoboda <jiri@…> (2022-10-18 09:06:07)
Message:

Window management plumbing

Location:
uspace/app/taskbar
Files:
6 edited

Legend:

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

    r0761448 r1766326  
    4646{
    4747        const char *display_spec = UI_ANY_DEFAULT;
     48        const char *wndmgt_svc = WNDMGT_DEFAULT;
    4849        taskbar_t *taskbar;
    4950        errno_t rc;
     
    6162
    6263                        display_spec = argv[i++];
     64                } else if (str_cmp(argv[i], "-w") == 0) {
     65                        ++i;
     66                        if (i >= argc) {
     67                                printf("Argument missing.\n");
     68                                print_syntax();
     69                                return 1;
     70                        }
     71
     72                        wndmgt_svc = argv[i++];
    6373                } else {
    6474                        printf("Invalid option '%s'.\n", argv[i]);
     
    7383        }
    7484
    75         rc = taskbar_create(display_spec, &taskbar);
     85        rc = taskbar_create(display_spec, wndmgt_svc, &taskbar);
    7686        if (rc != EOK)
    7787                return 1;
  • uspace/app/taskbar/meson.build

    r0761448 r1766326  
    2727#
    2828
    29 deps = [ 'ui' ]
     29deps = [ 'ui', 'wndmgt' ]
    3030src = files(
    3131        'clock.c',
  • uspace/app/taskbar/taskbar.c

    r0761448 r1766326  
    4242#include <ui/ui.h>
    4343#include <ui/window.h>
     44#include <wndmgt.h>
    4445#include "clock.h"
    4546#include "taskbar.h"
     
    6768 *
    6869 * @param display_spec Display specification
     70 * @param wndmgt_svc Window management service (or WNDMGT_DEFAULT)
    6971 * @param rtaskbar Place to store pointer to new task bar
    7072 * @return @c EOK on success or an error coe
    7173 */
    72 errno_t taskbar_create(const char *display_spec, taskbar_t **rtaskbar)
     74errno_t taskbar_create(const char *display_spec, const char *wndmgt_svc,
     75    taskbar_t **rtaskbar)
    7376{
    7477        ui_wnd_params_t params;
     
    8386                rc = ENOMEM;
    8487                goto error;
     88        }
     89
     90        if (wndmgt_svc != NULL) {
     91                rc = wndmgt_open(wndmgt_svc, NULL, NULL, &taskbar->wndmgt);
     92                if (rc != EOK)
     93                        goto error;
    8594        }
    8695
     
    215224        if (taskbar->ui != NULL)
    216225                ui_destroy(taskbar->ui);
     226        if (taskbar->wndmgt != NULL)
     227                wndmgt_close(taskbar->wndmgt);
    217228        return rc;
    218229
     
    226237        ui_window_destroy(taskbar->window);
    227238        ui_destroy(taskbar->ui);
     239        if (taskbar->wndmgt != NULL)
     240                wndmgt_close(taskbar->wndmgt);
    228241}
    229242
  • uspace/app/taskbar/taskbar.h

    r0761448 r1766326  
    3838
    3939#include <errno.h>
     40#include <wndmgt.h>
    4041#include "types/taskbar.h"
    4142
    42 extern errno_t taskbar_create(const char *display_spec, taskbar_t **);
     43extern errno_t taskbar_create(const char *, const char *, taskbar_t **);
    4344extern void taskbar_destroy(taskbar_t *);
    4445
  • uspace/app/taskbar/test/taskbar.c

    r0761448 r1766326  
    4141        taskbar_t *taskbar;
    4242
    43         rc = taskbar_create(UI_DISPLAY_NULL, &taskbar);
     43        rc = taskbar_create(UI_DISPLAY_NULL, NULL, &taskbar);
    4444        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    4545
  • uspace/app/taskbar/types/taskbar.h

    r0761448 r1766326  
    5757        /** Clock */
    5858        taskbar_clock_t *clock;
     59        /** Window management service */
     60        wndmgt_t *wndmgt;
    5961} taskbar_t;
    6062
Note: See TracChangeset for help on using the changeset viewer.