Changeset 1766326 in mainline for uspace/srv/hid/display/main.c


Ignore:
Timestamp:
2022-10-18T09:06:07Z (19 months 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/main.c

    r0761448 r1766326  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4747#include <stdio.h>
    4848#include <task.h>
     49#include <wndmgt_srv.h>
    4950#include "client.h"
    5051#include "display.h"
     
    5556#include "seat.h"
    5657#include "window.h"
     58#include "wmops.h"
    5759
    5860static void display_client_conn(ipc_call_t *, void *);
    5961static void display_client_ev_pending(void *);
     62static void display_gc_conn(ipc_call_t *, void *);
     63static void display_wndmgt_conn(ipc_call_t *, void *);
    6064
    6165#ifdef CONFIG_DISP_DOUBLE_BUF
     
    9094        ds_output_t *output = NULL;
    9195        gfx_context_t *gc = NULL;
     96        port_id_t disp_port;
     97        port_id_t gc_port;
     98        port_id_t wm_port;
    9299        errno_t rc;
    93100
     
    115122                goto error;
    116123
    117         async_set_fallback_port_handler(display_client_conn, disp);
     124        rc = async_create_port(INTERFACE_DISPLAY, display_client_conn, disp,
     125            &disp_port);
     126        if (rc != EOK)
     127                goto error;
     128
     129        rc = async_create_port(INTERFACE_GC, display_gc_conn, disp, &gc_port);
     130        if (rc != EOK)
     131                goto error;
     132
     133        rc = async_create_port(INTERFACE_WNDMGT, display_wndmgt_conn, disp,
     134            &wm_port);
     135        if (rc != EOK)
     136                goto error;
    118137
    119138        rc = loc_server_register(NAME);
     
    135154        return EOK;
    136155error:
     156        // XXX destroy disp_port
     157        // XXX destroy gc_port
     158        // XXX destroy wm_port
    137159#if 0
    138160        if (disp->input != NULL)
     
    154176{
    155177        display_srv_t srv;
    156         sysarg_t wnd_id;
    157178        sysarg_t svc_id;
    158179        ds_client_t *client = NULL;
    159         ds_window_t *wnd;
    160180        ds_display_t *disp = (ds_display_t *) arg;
    161         gfx_context_t *gc;
    162181        errno_t rc;
    163182
     
    166185            ipc_get_arg4(icall));
    167186
    168         (void) icall;
    169         (void) arg;
    170 
    171187        svc_id = ipc_get_arg2(icall);
    172         wnd_id = ipc_get_arg3(icall);
    173188
    174189        if (svc_id != 0) {
     
    191206                ds_client_destroy(client);
    192207                ds_display_unlock(disp);
    193         } else {
    194                 /* Window GC connection */
    195 
    196                 wnd = ds_display_find_window(disp, wnd_id);
    197                 if (wnd == NULL) {
    198                         async_answer_0(icall, ENOENT);
    199                         return;
    200                 }
    201 
    202                 /*
    203                  * XXX We need a way to make sure that the connection does
    204                  * not stay active after the window had been destroyed
    205                  */
    206                 gc = ds_window_get_ctx(wnd);
    207                 gc_conn(icall, gc);
    208         }
     208        }
     209}
     210
     211/** Handle GC connection to display server */
     212static void display_gc_conn(ipc_call_t *icall, void *arg)
     213{
     214        sysarg_t wnd_id;
     215        ds_window_t *wnd;
     216        ds_display_t *disp = (ds_display_t *) arg;
     217        gfx_context_t *gc;
     218
     219        log_msg(LOG_DEFAULT, LVL_DEBUG, "display_gc_conn arg1=%zu arg2=%zu arg3=%zu arg4=%zu.",
     220            ipc_get_arg1(icall), ipc_get_arg2(icall), ipc_get_arg3(icall),
     221            ipc_get_arg4(icall));
     222
     223        wnd_id = ipc_get_arg3(icall);
     224
     225        /* Window GC connection */
     226
     227        wnd = ds_display_find_window(disp, wnd_id);
     228        if (wnd == NULL) {
     229                async_answer_0(icall, ENOENT);
     230                return;
     231        }
     232
     233        /*
     234         * XXX We need a way to make sure that the connection does
     235         * not stay active after the window had been destroyed
     236         */
     237        gc = ds_window_get_ctx(wnd);
     238        gc_conn(icall, gc);
     239}
     240
     241/** Handle window management connection to display server */
     242static void display_wndmgt_conn(ipc_call_t *icall, void *arg)
     243{
     244        wndmgt_srv_t srv;
     245
     246        /* Set up protocol structure */
     247        wndmgt_srv_initialize(&srv);
     248        srv.ops = &wndmgt_srv_ops;
     249        srv.arg = NULL; // XXX
     250
     251        /* Handle connection */
     252        wndmgt_conn(icall, &srv);
    209253}
    210254
Note: See TracChangeset for help on using the changeset viewer.