Changeset 913add60 in mainline for uspace/srv/hid/display/display.c
- Timestamp:
- 2022-10-31T10:53:53Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b92d4b
- Parents:
- 7cc30e9
- git-author:
- Jiri Svoboda <jiri@…> (2022-10-30 10:53:48)
- git-committer:
- Jiri Svoboda <jiri@…> (2022-10-31 10:53:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/display.c
r7cc30e9 r913add60 45 45 #include "cursimg.h" 46 46 #include "cursor.h" 47 #include "display.h" 47 48 #include "seat.h" 48 49 #include "window.h" 49 #include " display.h"50 #include "wmclient.h" 50 51 51 52 static gfx_context_t *ds_display_get_unbuf_gc(ds_display_t *); … … 96 97 fibril_mutex_initialize(&disp->lock); 97 98 list_initialize(&disp->clients); 99 list_initialize(&disp->wmclients); 98 100 disp->next_wnd_id = 1; 99 101 list_initialize(&disp->ddevs); … … 115 117 { 116 118 assert(list_empty(&disp->clients)); 119 assert(list_empty(&disp->wmclients)); 117 120 assert(list_empty(&disp->seats)); 118 121 /* XXX destroy cursors */ … … 203 206 204 207 return list_get_instance(link, ds_client_t, lclients); 208 } 209 210 /** Add WM client to display. 211 * 212 * @param disp Display 213 * @param wmclient WM client 214 */ 215 void ds_display_add_wmclient(ds_display_t *disp, ds_wmclient_t *wmclient) 216 { 217 assert(wmclient->display == NULL); 218 assert(!link_used(&wmclient->lwmclients)); 219 220 wmclient->display = disp; 221 list_append(&wmclient->lwmclients, &disp->wmclients); 222 } 223 224 /** Remove WM client from display. 225 * 226 * @param wmclient WM client 227 */ 228 void ds_display_remove_wmclient(ds_wmclient_t *wmclient) 229 { 230 list_remove(&wmclient->lwmclients); 231 wmclient->display = NULL; 232 } 233 234 /** Get first WM client in display. 235 * 236 * @param disp Display 237 * @return First WM client or @c NULL if there is none 238 */ 239 ds_wmclient_t *ds_display_first_wmclient(ds_display_t *disp) 240 { 241 link_t *link = list_first(&disp->wmclients); 242 243 if (link == NULL) 244 return NULL; 245 246 return list_get_instance(link, ds_wmclient_t, lwmclients); 247 } 248 249 /** Get next WM client in display. 250 * 251 * @param wmclient Current WM client 252 * @return Next WM client or @c NULL if there is none 253 */ 254 ds_wmclient_t *ds_display_next_wmclient(ds_wmclient_t *wmclient) 255 { 256 link_t *link = list_next(&wmclient->lwmclients, 257 &wmclient->display->wmclients); 258 259 if (link == NULL) 260 return NULL; 261 262 return list_get_instance(link, ds_wmclient_t, lwmclients); 205 263 } 206 264 … … 262 320 void ds_display_add_window(ds_display_t *display, ds_window_t *wnd) 263 321 { 322 ds_wmclient_t *wmclient; 323 264 324 assert(wnd->display == NULL); 265 325 assert(!link_used(&wnd->ldwindows)); … … 267 327 wnd->display = display; 268 328 list_prepend(&wnd->ldwindows, &display->windows); 329 330 /* Notify window managers about the new window */ 331 wmclient = ds_display_first_wmclient(display); 332 while (wmclient != NULL) { 333 ds_wmclient_post_wnd_added_event(wmclient, wnd->id); 334 wmclient = ds_display_next_wmclient(wmclient); 335 } 269 336 } 270 337 … … 275 342 void ds_display_remove_window(ds_window_t *wnd) 276 343 { 344 ds_wmclient_t *wmclient; 345 ds_display_t *display; 346 347 display = wnd->display; 348 277 349 list_remove(&wnd->ldwindows); 278 350 wnd->display = NULL; 351 352 /* Notify window managers about the removed window */ 353 wmclient = ds_display_first_wmclient(display); 354 while (wmclient != NULL) { 355 ds_wmclient_post_wnd_removed_event(wmclient, wnd->id); 356 wmclient = ds_display_next_wmclient(wmclient); 357 } 358 } 359 360 /** Move window to top. 361 * 362 * @param display Display 363 * @param wnd Window 364 */ 365 void ds_display_window_to_top(ds_window_t *wnd) 366 { 367 assert(wnd->display != NULL); 368 assert(link_used(&wnd->ldwindows)); 369 370 list_remove(&wnd->ldwindows); 371 list_prepend(&wnd->ldwindows, &wnd->display->windows); 279 372 } 280 373
Note:
See TracChangeset
for help on using the changeset viewer.