Changes in uspace/srv/hid/display/main.c [913add60:1762ceb] in mainline
- File:
-
- 1 edited
-
uspace/srv/hid/display/main.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/main.c
r913add60 r1762ceb 1 1 /* 2 * Copyright (c) 20 22Jiri Svoboda2 * Copyright (c) 2019 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 47 47 #include <stdio.h> 48 48 #include <task.h> 49 #include <wndmgt_srv.h>50 49 #include "client.h" 51 50 #include "display.h" … … 56 55 #include "seat.h" 57 56 #include "window.h" 58 #include "wmclient.h"59 #include "wmops.h"60 57 61 58 static void display_client_conn(ipc_call_t *, void *); 62 59 static void display_client_ev_pending(void *); 63 static void display_wmclient_ev_pending(void *);64 static void display_gc_conn(ipc_call_t *, void *);65 static void display_wndmgt_conn(ipc_call_t *, void *);66 60 67 61 #ifdef CONFIG_DISP_DOUBLE_BUF … … 82 76 }; 83 77 84 static ds_wmclient_cb_t display_wmclient_cb = {85 .ev_pending = display_wmclient_ev_pending86 };87 88 78 static void display_client_ev_pending(void *arg) 89 79 { … … 91 81 92 82 display_srv_ev_pending(srv); 93 }94 95 static void display_wmclient_ev_pending(void *arg)96 {97 wndmgt_srv_t *srv = (wndmgt_srv_t *) arg;98 99 wndmgt_srv_ev_pending(srv);100 83 } 101 84 … … 107 90 ds_output_t *output = NULL; 108 91 gfx_context_t *gc = NULL; 109 port_id_t disp_port;110 port_id_t gc_port;111 port_id_t wm_port;112 92 errno_t rc; 113 93 … … 135 115 goto error; 136 116 137 rc = async_create_port(INTERFACE_DISPLAY, display_client_conn, disp, 138 &disp_port); 139 if (rc != EOK) 140 goto error; 141 142 rc = async_create_port(INTERFACE_GC, display_gc_conn, disp, &gc_port); 143 if (rc != EOK) 144 goto error; 145 146 rc = async_create_port(INTERFACE_WNDMGT, display_wndmgt_conn, disp, 147 &wm_port); 148 if (rc != EOK) 149 goto error; 117 async_set_fallback_port_handler(display_client_conn, disp); 150 118 151 119 rc = loc_server_register(NAME); … … 167 135 return EOK; 168 136 error: 169 // XXX destroy disp_port170 // XXX destroy gc_port171 // XXX destroy wm_port172 137 #if 0 173 138 if (disp->input != NULL) … … 189 154 { 190 155 display_srv_t srv; 156 sysarg_t wnd_id; 191 157 sysarg_t svc_id; 192 158 ds_client_t *client = NULL; 159 ds_window_t *wnd; 193 160 ds_display_t *disp = (ds_display_t *) arg; 161 gfx_context_t *gc; 194 162 errno_t rc; 195 163 … … 198 166 ipc_get_arg4(icall)); 199 167 168 (void) icall; 169 (void) arg; 170 200 171 svc_id = ipc_get_arg2(icall); 172 wnd_id = ipc_get_arg3(icall); 201 173 202 174 if (svc_id != 0) { 203 175 /* Create client object */ 204 ds_display_lock(disp);205 176 rc = ds_client_create(disp, &display_client_cb, &srv, &client); 206 ds_display_unlock(disp);207 177 if (rc != EOK) { 208 178 async_answer_0(icall, ENOMEM); … … 221 191 ds_client_destroy(client); 222 192 ds_display_unlock(disp); 223 } 224 } 225 226 /** Handle GC connection to display server */ 227 static void display_gc_conn(ipc_call_t *icall, void *arg) 228 { 229 sysarg_t wnd_id; 230 ds_window_t *wnd; 231 ds_display_t *disp = (ds_display_t *) arg; 232 gfx_context_t *gc; 233 234 log_msg(LOG_DEFAULT, LVL_DEBUG, "display_gc_conn arg1=%zu arg2=%zu arg3=%zu arg4=%zu.", 235 ipc_get_arg1(icall), ipc_get_arg2(icall), ipc_get_arg3(icall), 236 ipc_get_arg4(icall)); 237 238 wnd_id = ipc_get_arg3(icall); 239 240 /* Window GC connection */ 241 242 wnd = ds_display_find_window(disp, wnd_id); 243 if (wnd == NULL) { 244 async_answer_0(icall, ENOENT); 245 return; 246 } 247 248 /* 249 * XXX We need a way to make sure that the connection does 250 * not stay active after the window had been destroyed 251 */ 252 gc = ds_window_get_ctx(wnd); 253 gc_conn(icall, gc); 254 } 255 256 /** Handle window management connection to display server */ 257 static void display_wndmgt_conn(ipc_call_t *icall, void *arg) 258 { 259 ds_display_t *disp = (ds_display_t *) arg; 260 errno_t rc; 261 wndmgt_srv_t srv; 262 ds_wmclient_t *wmclient = NULL; 263 264 /* Create WM client object */ 265 ds_display_lock(disp); 266 rc = ds_wmclient_create(disp, &display_wmclient_cb, &srv, &wmclient); 267 ds_display_unlock(disp); 268 if (rc != EOK) { 269 async_answer_0(icall, ENOMEM); 270 return; 271 } 272 273 /* Set up protocol structure */ 274 wndmgt_srv_initialize(&srv); 275 srv.ops = &wndmgt_srv_ops; 276 srv.arg = wmclient; 277 278 /* Handle connection */ 279 wndmgt_conn(icall, &srv); 280 281 ds_display_lock(disp); 282 ds_wmclient_destroy(wmclient); 283 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 } 284 209 } 285 210
Note:
See TracChangeset
for help on using the changeset viewer.
