1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757
|
/*
* Copyright © 2014 David FORT <contact@hardening-consulting.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include <sys/mman.h>
#include "uwac-priv.h"
#include "uwac-utils.h"
#include "uwac-os.h"
#define UWAC_INITIAL_BUFFERS 3
static int bppFromShmFormat(enum wl_shm_format format)
{
switch (format)
{
case WL_SHM_FORMAT_ARGB8888:
case WL_SHM_FORMAT_XRGB8888:
default:
return 4;
}
}
static void buffer_release(void* data, struct wl_buffer* buffer)
{
UwacBuffer* uwacBuffer = (UwacBuffer*)data;
uwacBuffer->used = false;
}
static const struct wl_buffer_listener buffer_listener =
{
buffer_release
};
void UwacWindowDestroyBuffers(UwacWindow* w)
{
int i;
for (i = 0; i < w->nbuffers; i++)
{
UwacBuffer* buffer = &w->buffers[i];
#ifdef HAVE_PIXMAN_REGION
pixman_region32_fini(&buffer->damage);
#else
region16_uninit(&buffer->damage);
#endif
wl_buffer_destroy(buffer->wayland_buffer);
}
w->nbuffers = 0;
free(w->buffers);
w->buffers = NULL;
}
int UwacWindowShmAllocBuffers(UwacWindow* w, int nbuffers, int allocSize, uint32_t width,
uint32_t height, enum wl_shm_format format);
static void xdg_handle_configure(void *data,
struct xdg_toplevel *xdg_toplevel,
int32_t width,
int32_t height,
struct wl_array *states)
{
UwacWindow* window = (UwacWindow*)data;
UwacConfigureEvent* event;
int ret, surfaceState;
enum xdg_toplevel_state* state;
surfaceState = 0;
wl_array_for_each(state, states)
{
switch (*state)
{
case XDG_TOPLEVEL_STATE_MAXIMIZED:
surfaceState |= UWAC_WINDOW_MAXIMIZED;
break;
case XDG_TOPLEVEL_STATE_FULLSCREEN:
surfaceState |= UWAC_WINDOW_FULLSCREEN;
break;
case XDG_TOPLEVEL_STATE_ACTIVATED:
surfaceState |= UWAC_WINDOW_ACTIVATED;
break;
case XDG_TOPLEVEL_STATE_RESIZING:
surfaceState |= UWAC_WINDOW_RESIZING;
break;
default:
break;
}
}
window->surfaceStates = surfaceState;
event = (UwacConfigureEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CONFIGURE);
if (!event)
{
assert(uwacErrorHandler(window->display, UWAC_ERROR_NOMEMORY,
"failed to allocate a configure event\n"));
return;
}
event->window = window;
event->states = surfaceState;
if (width && height)
{
event->width = width;
event->height = height;
UwacWindowDestroyBuffers(window);
window->width = width;
window->stride = width * bppFromShmFormat(window->format);
window->height = height;
ret = UwacWindowShmAllocBuffers(window, UWAC_INITIAL_BUFFERS, window->stride * height,
width, height, window->format);
if (ret != UWAC_SUCCESS)
{
assert(uwacErrorHandler(window->display, ret, "failed to reallocate a wayland buffers\n"));
window->drawingBuffer = window->pendingBuffer = NULL;
return;
}
window->drawingBuffer = window->pendingBuffer = &window->buffers[0];
}
else
{
event->width = window->width;
event->height = window->height;
}
}
static void xdg_handle_close(void *data,
struct xdg_toplevel *xdg_toplevel)
{
UwacCloseEvent* event;
UwacWindow* window = (UwacWindow*)data;
event = (UwacCloseEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CLOSE);
if (!event)
{
assert(uwacErrorHandler(window->display, UWAC_ERROR_INTERNAL,
"failed to allocate a close event\n"));
return;
}
event->window = window;
}
static const struct xdg_toplevel_listener xdg_toplevel_listener =
{
xdg_handle_configure,
xdg_handle_close,
};
#if BUILD_IVI
static void ivi_handle_configure(void* data, struct ivi_surface* surface,
int32_t width, int32_t height)
{
UwacWindow* window = (UwacWindow*)data;
UwacConfigureEvent* event;
int ret;
event = (UwacConfigureEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CONFIGURE);
if (!event)
{
assert(uwacErrorHandler(window->display, UWAC_ERROR_NOMEMORY,
"failed to allocate a configure event\n"));
return;
}
event->window = window;
event->states = 0;
if (width && height)
{
event->width = width;
event->height = height;
UwacWindowDestroyBuffers(window);
window->width = width;
window->stride = width * bppFromShmFormat(window->format);
window->height = height;
ret = UwacWindowShmAllocBuffers(window, UWAC_INITIAL_BUFFERS, window->stride * height,
width, height, window->format);
if (ret != UWAC_SUCCESS)
{
assert(uwacErrorHandler(window->display, ret, "failed to reallocate a wayland buffers\n"));
window->drawingBuffer = window->pendingBuffer = NULL;
return;
}
window->drawingBuffer = window->pendingBuffer = &window->buffers[0];
}
else
{
event->width = window->width;
event->height = window->height;
}
}
static const struct ivi_surface_listener ivi_surface_listener =
{
ivi_handle_configure,
};
#endif
void shell_ping(void* data, struct wl_shell_surface* surface, uint32_t serial)
{
wl_shell_surface_pong(surface, serial);
}
void shell_configure(void* data, struct wl_shell_surface* surface, uint32_t edges,
int32_t width, int32_t height)
{
UwacWindow* window = (UwacWindow*)data;
UwacConfigureEvent* event;
int ret;
event = (UwacConfigureEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_CONFIGURE);
if (!event)
{
assert(uwacErrorHandler(window->display, UWAC_ERROR_NOMEMORY,
"failed to allocate a configure event\n"));
return;
}
event->window = window;
event->states = 0;
if (width && height)
{
event->width = width;
event->height = height;
UwacWindowDestroyBuffers(window);
window->width = width;
window->stride = width * bppFromShmFormat(window->format);
window->height = height;
ret = UwacWindowShmAllocBuffers(window, UWAC_INITIAL_BUFFERS, window->stride * height,
width, height, window->format);
if (ret != UWAC_SUCCESS)
{
assert(uwacErrorHandler(window->display, ret, "failed to reallocate a wayland buffers\n"));
window->drawingBuffer = window->pendingBuffer = NULL;
return;
}
window->drawingBuffer = window->pendingBuffer = &window->buffers[0];
}
else
{
event->width = window->width;
event->height = window->height;
}
}
void shell_popup_done(void* data, struct wl_shell_surface* surface)
{
}
static const struct wl_shell_surface_listener shell_listener =
{
shell_ping,
shell_configure,
shell_popup_done
};
int UwacWindowShmAllocBuffers(UwacWindow* w, int nbuffers, int allocSize, uint32_t width,
uint32_t height, enum wl_shm_format format)
{
int ret = UWAC_SUCCESS;
UwacBuffer* newBuffers;
int i, fd;
void* data;
struct wl_shm_pool* pool;
newBuffers = realloc(w->buffers, (w->nbuffers + nbuffers) * sizeof(UwacBuffer));
if (!newBuffers)
return UWAC_ERROR_NOMEMORY;
w->buffers = newBuffers;
memset(w->buffers + w->nbuffers, 0, sizeof(UwacBuffer) * nbuffers);
fd = uwac_create_anonymous_file(allocSize * nbuffers);
if (fd < 0)
{
return UWAC_ERROR_INTERNAL;
}
data = mmap(NULL, allocSize * nbuffers, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED)
{
ret = UWAC_ERROR_NOMEMORY;
goto error_mmap;
}
pool = wl_shm_create_pool(w->display->shm, fd, allocSize * nbuffers);
if (!pool)
{
munmap(data, allocSize * nbuffers);
ret = UWAC_ERROR_NOMEMORY;
goto error_mmap;
}
for (i = 0; i < nbuffers; i++)
{
UwacBuffer* buffer = &w->buffers[w->nbuffers + i];
#ifdef HAVE_PIXMAN_REGION
pixman_region32_init(&buffer->damage);
#else
region16_init(&buffer->damage);
#endif
buffer->data = data + (allocSize * i);
buffer->wayland_buffer = wl_shm_pool_create_buffer(pool, allocSize * i, width, height, w->stride,
format);
wl_buffer_add_listener(buffer->wayland_buffer, &buffer_listener, buffer);
}
wl_shm_pool_destroy(pool);
w->nbuffers += nbuffers;
error_mmap:
close(fd);
return ret;
}
UwacBuffer* UwacWindowFindFreeBuffer(UwacWindow* w)
{
int i, ret;
for (i = 0; i < w->nbuffers; i++)
{
if (!w->buffers[i].used)
{
w->buffers[i].used = true;
return &w->buffers[i];
}
}
ret = UwacWindowShmAllocBuffers(w, 2, w->stride * w->height, w->width, w->height, w->format);
if (ret != UWAC_SUCCESS)
{
w->display->last_error = ret;
return NULL;
}
w->buffers[i].used = true;
return &w->buffers[i];
}
static UwacReturnCode UwacWindowSetDecorations(UwacWindow *w)
{
if (!w || !w->display)
return UWAC_ERROR_INTERNAL;
if (w->display->deco_manager) {
w->deco = zxdg_decoration_manager_v1_get_toplevel_decoration(
w->display->deco_manager, w->xdg_toplevel);
if (!w->deco) {
uwacErrorHandler(w->display, UWAC_NOT_FOUND, "Current window manager does not allow decorating with SSD");
}
else
zxdg_toplevel_decoration_v1_set_mode(w->deco, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
else if (w->display->kde_deco_manager) {
w->kde_deco = org_kde_kwin_server_decoration_manager_create(w->display->kde_deco_manager, w->surface);
if (!w->kde_deco) {
uwacErrorHandler(w->display, UWAC_NOT_FOUND, "Current window manager does not allow decorating with SSD");
}
else
org_kde_kwin_server_decoration_request_mode(w->kde_deco, ORG_KDE_KWIN_SERVER_DECORATION_MODE_SERVER);
}
return UWAC_SUCCESS;
}
UwacWindow* UwacCreateWindowShm(UwacDisplay* display, uint32_t width, uint32_t height,
enum wl_shm_format format)
{
UwacWindow* w;
int allocSize, ret;
if (!display)
{
return NULL;
}
w = zalloc(sizeof(*w));
if (!w)
{
display->last_error = UWAC_ERROR_NOMEMORY;
return NULL;
}
w->display = display;
w->format = format;
w->width = width;
w->height = height;
w->stride = width * bppFromShmFormat(format);
allocSize = w->stride * height;
ret = UwacWindowShmAllocBuffers(w, UWAC_INITIAL_BUFFERS, allocSize, width, height, format);
if (ret != UWAC_SUCCESS)
{
display->last_error = ret;
goto out_error_free;
}
w->buffers[0].used = true;
w->drawingBuffer = &w->buffers[0];
w->surface = wl_compositor_create_surface(display->compositor);
if (!w->surface)
{
display->last_error = UWAC_ERROR_NOMEMORY;
goto out_error_surface;
}
wl_surface_set_user_data(w->surface, w);
if (display->xdg_base)
{
w->xdg_surface = xdg_wm_base_get_xdg_surface(display->xdg_base, w->surface);
if (!w->xdg_surface)
{
display->last_error = UWAC_ERROR_NOMEMORY;
goto out_error_shell;
}
w->xdg_toplevel = xdg_surface_get_toplevel(w->xdg_surface);
if (!w->xdg_toplevel)
{
display->last_error = UWAC_ERROR_NOMEMORY;
goto out_error_shell;
}
assert(w->xdg_surface);
xdg_toplevel_add_listener(w->xdg_toplevel, &xdg_toplevel_listener, w);
}
#if BUILD_IVI
else if (display->ivi_application)
{
w->ivi_surface = ivi_application_surface_create(display->ivi_application, 1, w->surface);
assert(w->ivi_surface);
ivi_surface_add_listener(w->ivi_surface, &ivi_surface_listener, w);
}
#endif
#if BUILD_FULLSCREEN_SHELL
else if (display->fullscreen_shell)
{
zwp_fullscreen_shell_v1_present_surface(display->fullscreen_shell, w->surface,
ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER, NULL);
}
#endif
else
{
w->shell_surface = wl_shell_get_shell_surface(display->shell, w->surface);
assert(w->shell_surface);
wl_shell_surface_add_listener(w->shell_surface, &shell_listener, w);
wl_shell_surface_set_toplevel(w->shell_surface);
}
wl_list_insert(display->windows.prev, &w->link);
display->last_error = UWAC_SUCCESS;
UwacWindowSetDecorations(w);
return w;
out_error_shell:
wl_surface_destroy(w->surface);
out_error_surface:
UwacWindowDestroyBuffers(w);
out_error_free:
free(w);
return NULL;
}
UwacReturnCode UwacDestroyWindow(UwacWindow** pwindow)
{
UwacWindow* w;
assert(pwindow);
w = *pwindow;
UwacWindowDestroyBuffers(w);
if (w->deco)
zxdg_toplevel_decoration_v1_destroy(w->deco);
if (w->kde_deco)
org_kde_kwin_server_decoration_destroy(w->kde_deco);
if (w->xdg_surface)
xdg_surface_destroy(w->xdg_surface);
#if BUILD_IVI
if (w->ivi_surface)
ivi_surface_destroy(w->ivi_surface);
#endif
if (w->opaque_region)
wl_region_destroy(w->opaque_region);
if (w->input_region)
wl_region_destroy(w->input_region);
wl_surface_destroy(w->surface);
wl_list_remove(&w->link);
free(w);
*pwindow = NULL;
return UWAC_SUCCESS;
}
UwacReturnCode UwacWindowSetOpaqueRegion(UwacWindow* window, uint32_t x, uint32_t y, uint32_t width,
uint32_t height)
{
assert(window);
if (window->opaque_region)
wl_region_destroy(window->opaque_region);
window->opaque_region = wl_compositor_create_region(window->display->compositor);
if (!window->opaque_region)
return UWAC_ERROR_NOMEMORY;
wl_region_add(window->opaque_region, x, y, width, height);
wl_surface_set_opaque_region(window->surface, window->opaque_region);
return UWAC_SUCCESS;
}
UwacReturnCode UwacWindowSetInputRegion(UwacWindow* window, uint32_t x, uint32_t y, uint32_t width,
uint32_t height)
{
assert(window);
if (window->input_region)
wl_region_destroy(window->input_region);
window->input_region = wl_compositor_create_region(window->display->compositor);
if (!window->input_region)
return UWAC_ERROR_NOMEMORY;
wl_region_add(window->input_region, x, y, width, height);
wl_surface_set_input_region(window->surface, window->input_region);
return UWAC_SUCCESS;
}
void* UwacWindowGetDrawingBuffer(UwacWindow* window)
{
return window->drawingBuffer->data;
}
static void frame_done_cb(void* data, struct wl_callback* callback, uint32_t time);
static const struct wl_callback_listener frame_listener =
{
frame_done_cb
};
static void UwacSubmitBufferPtr(UwacWindow* window, UwacBuffer* buffer)
{
UINT32 nrects, i;
#ifdef HAVE_PIXMAN_REGION
const pixman_box32_t* box;
#else
const RECTANGLE_16* box;
#endif
wl_surface_attach(window->surface, buffer->wayland_buffer, 0, 0);
#if 0
#ifdef HAVE_PIXMAN_REGION
box = pixman_region32_rectangles(&buffer->damage, &nrects);
for (i = 0; i < nrects; i++, box++)
wl_surface_damage(window->surface, box->x1, box->y1, (box->x2 - box->x1), (box->y2 - box->y1));
#else
box = region16_rects(&buffer->damage, &nrects);
for (i = 0; i < nrects; i++, box++)
wl_surface_damage(window->surface, box->left, box->top, (box->right - box->left),
(box->bottom - box->top));
#endif
#else
wl_surface_damage(window->surface, 0, 0, window->width, window->height);
#endif
struct wl_callback* frame_callback = wl_surface_frame(window->surface);
wl_callback_add_listener(frame_callback, &frame_listener, window);
wl_surface_commit(window->surface);
#ifdef HAVE_PIXMAN_REGION
pixman_region32_clear(&buffer->damage);
#else
region16_clear(&buffer->damage);
#endif
}
static void frame_done_cb(void* data, struct wl_callback* callback, uint32_t time)
{
UwacWindow* window = (UwacWindow*)data;
UwacFrameDoneEvent* event;
wl_callback_destroy(callback);
window->pendingBuffer = NULL;
event = (UwacFrameDoneEvent*)UwacDisplayNewEvent(window->display, UWAC_EVENT_FRAME_DONE);
if (event)
event->window = window;
}
UwacReturnCode UwacWindowAddDamage(UwacWindow* window, uint32_t x, uint32_t y, uint32_t width,
uint32_t height)
{
#ifdef HAVE_PIXMAN_REGION
if (!pixman_region32_union_rect(&window->drawingBuffer->damage, &window->drawingBuffer->damage, x,
y, width, height))
#else
RECTANGLE_16 box;
box.left = x;
box.top = y;
box.right = x + width;
box.bottom = y + height;
if (!region16_union_rect(&window->drawingBuffer->damage, &window->drawingBuffer->damage, &box))
#endif
return UWAC_ERROR_INTERNAL;
return UWAC_SUCCESS;
}
UwacReturnCode UwacWindowGetDrawingBufferGeometry(UwacWindow* window, UwacSize* geometry, size_t* stride)
{
if (!window || !window->drawingBuffer)
return UWAC_ERROR_INTERNAL;
if (geometry)
{
geometry->width = window->width;
geometry->height = window->height;
}
if (stride)
*stride = window->stride;
return UWAC_SUCCESS;
}
UwacReturnCode UwacWindowSubmitBuffer(UwacWindow* window, bool copyContentForNextFrame)
{
UwacBuffer* drawingBuffer = window->drawingBuffer;
if (window->pendingBuffer)
return UWAC_SUCCESS;
window->pendingBuffer = window->drawingBuffer;
window->drawingBuffer = UwacWindowFindFreeBuffer(window);
if (!window->drawingBuffer)
return UWAC_ERROR_NOMEMORY;
if (copyContentForNextFrame)
memcpy(window->drawingBuffer->data, window->pendingBuffer->data, window->stride * window->height);
UwacSubmitBufferPtr(window, drawingBuffer);
return UWAC_SUCCESS;
}
UwacReturnCode UwacWindowGetGeometry(UwacWindow* window, UwacSize* geometry)
{
assert(window);
assert(geometry);
geometry->width = window->width;
geometry->height = window->height;
return UWAC_SUCCESS;
}
UwacReturnCode UwacWindowSetFullscreenState(UwacWindow* window, UwacOutput* output,
bool isFullscreen)
{
if (window->xdg_toplevel)
{
if (isFullscreen)
{
xdg_toplevel_set_fullscreen(window->xdg_toplevel, output ? output->output : NULL);
}
else
{
xdg_toplevel_unset_fullscreen(window->xdg_toplevel);
}
}
else if (window->shell_surface)
{
if (isFullscreen)
{
wl_shell_surface_set_fullscreen(window->shell_surface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
0,
output ? output->output : NULL);
}
else
{
wl_shell_surface_set_toplevel(window->shell_surface);
}
}
return UWAC_SUCCESS;
}
void UwacWindowSetTitle(UwacWindow* window, const char* name)
{
if (window->xdg_toplevel)
xdg_toplevel_set_title(window->xdg_toplevel, name);
else if (window->shell_surface)
wl_shell_surface_set_title(window->shell_surface, name);
}
|