diff options
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r-- | sway/desktop/render.c | 217 |
1 files changed, 137 insertions, 80 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c index 8d4a701b..a38c6a07 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c | |||
@@ -49,13 +49,6 @@ static int scale_length(int length, int offset, float scale) { | |||
49 | return round((offset + length) * scale) - round(offset * scale); | 49 | return round((offset + length) * scale) - round(offset * scale); |
50 | } | 50 | } |
51 | 51 | ||
52 | static void scale_box(struct wlr_box *box, float scale) { | ||
53 | box->width = scale_length(box->width, box->x, scale); | ||
54 | box->height = scale_length(box->height, box->y, scale); | ||
55 | box->x = round(box->x * scale); | ||
56 | box->y = round(box->y * scale); | ||
57 | } | ||
58 | |||
59 | static void scissor_output(struct wlr_output *wlr_output, | 52 | static void scissor_output(struct wlr_output *wlr_output, |
60 | pixman_box32_t *rect) { | 53 | pixman_box32_t *rect) { |
61 | struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); | 54 | struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); |
@@ -73,7 +66,7 @@ static void scissor_output(struct wlr_output *wlr_output, | |||
73 | 66 | ||
74 | enum wl_output_transform transform = | 67 | enum wl_output_transform transform = |
75 | wlr_output_transform_invert(wlr_output->transform); | 68 | wlr_output_transform_invert(wlr_output->transform); |
76 | wlr_box_transform(&box, transform, ow, oh, &box); | 69 | wlr_box_transform(&box, &box, transform, ow, oh); |
77 | 70 | ||
78 | wlr_renderer_scissor(renderer, &box); | 71 | wlr_renderer_scissor(renderer, &box); |
79 | } | 72 | } |
@@ -164,7 +157,7 @@ static void render_drag_icons(struct sway_output *output, | |||
164 | 157 | ||
165 | // _box.x and .y are expected to be layout-local | 158 | // _box.x and .y are expected to be layout-local |
166 | // _box.width and .height are expected to be output-buffer-local | 159 | // _box.width and .height are expected to be output-buffer-local |
167 | static void render_rect(struct wlr_output *wlr_output, | 160 | void render_rect(struct wlr_output *wlr_output, |
168 | pixman_region32_t *output_damage, const struct wlr_box *_box, | 161 | pixman_region32_t *output_damage, const struct wlr_box *_box, |
169 | float color[static 4]) { | 162 | float color[static 4]) { |
170 | struct wlr_renderer *renderer = | 163 | struct wlr_renderer *renderer = |
@@ -197,7 +190,7 @@ damage_finish: | |||
197 | pixman_region32_fini(&damage); | 190 | pixman_region32_fini(&damage); |
198 | } | 191 | } |
199 | 192 | ||
200 | static void premultiply_alpha(float color[4], float opacity) { | 193 | void premultiply_alpha(float color[4], float opacity) { |
201 | color[3] *= opacity; | 194 | color[3] *= opacity; |
202 | color[0] *= color[3]; | 195 | color[0] *= color[3]; |
203 | color[1] *= color[3]; | 196 | color[1] *= color[3]; |
@@ -261,7 +254,7 @@ static void render_saved_view(struct sway_view *view, | |||
261 | }; | 254 | }; |
262 | 255 | ||
263 | struct wlr_box intersection; | 256 | struct wlr_box intersection; |
264 | bool intersects = wlr_box_intersection(&output_box, &box, &intersection); | 257 | bool intersects = wlr_box_intersection(&intersection, &output_box, &box); |
265 | if (!intersects) { | 258 | if (!intersects) { |
266 | return; | 259 | return; |
267 | } | 260 | } |
@@ -368,6 +361,10 @@ static void render_titlebar(struct sway_output *output, | |||
368 | children->items[children->length - 1] == con; | 361 | children->items[children->length - 1] == con; |
369 | double output_x = output->wlr_output->lx; | 362 | double output_x = output->wlr_output->lx; |
370 | double output_y = output->wlr_output->ly; | 363 | double output_y = output->wlr_output->ly; |
364 | int titlebar_border_thickness = config->titlebar_border_thickness; | ||
365 | int titlebar_h_padding = config->titlebar_h_padding; | ||
366 | int titlebar_v_padding = config->titlebar_v_padding; | ||
367 | enum alignment title_align = config->title_align; | ||
371 | 368 | ||
372 | // Single pixel bar above title | 369 | // Single pixel bar above title |
373 | memcpy(&color, colors->border, sizeof(float) * 4); | 370 | memcpy(&color, colors->border, sizeof(float) * 4); |
@@ -375,7 +372,7 @@ static void render_titlebar(struct sway_output *output, | |||
375 | box.x = x; | 372 | box.x = x; |
376 | box.y = y; | 373 | box.y = y; |
377 | box.width = width; | 374 | box.width = width; |
378 | box.height = TITLEBAR_BORDER_THICKNESS; | 375 | box.height = titlebar_border_thickness; |
379 | scale_box(&box, output_scale); | 376 | scale_box(&box, output_scale); |
380 | render_rect(output->wlr_output, output_damage, &box, color); | 377 | render_rect(output->wlr_output, output_damage, &box, color); |
381 | 378 | ||
@@ -391,45 +388,51 @@ static void render_titlebar(struct sway_output *output, | |||
391 | } | 388 | } |
392 | } | 389 | } |
393 | box.x = x + left_offset; | 390 | box.x = x + left_offset; |
394 | box.y = y + container_titlebar_height() - TITLEBAR_BORDER_THICKNESS; | 391 | box.y = y + container_titlebar_height() - titlebar_border_thickness; |
395 | box.width = width - left_offset - right_offset; | 392 | box.width = width - left_offset - right_offset; |
396 | box.height = TITLEBAR_BORDER_THICKNESS; | 393 | box.height = titlebar_border_thickness; |
397 | scale_box(&box, output_scale); | 394 | scale_box(&box, output_scale); |
398 | render_rect(output->wlr_output, output_damage, &box, color); | 395 | render_rect(output->wlr_output, output_damage, &box, color); |
399 | 396 | ||
400 | if (layout == L_TABBED) { | 397 | if (layout == L_TABBED) { |
401 | // Single pixel left edge | 398 | // Single pixel left edge |
402 | box.x = x; | 399 | box.x = x; |
403 | box.y = y + TITLEBAR_BORDER_THICKNESS; | 400 | box.y = y + titlebar_border_thickness; |
404 | box.width = TITLEBAR_BORDER_THICKNESS; | 401 | box.width = titlebar_border_thickness; |
405 | box.height = | 402 | box.height = |
406 | container_titlebar_height() - TITLEBAR_BORDER_THICKNESS * 2; | 403 | container_titlebar_height() - titlebar_border_thickness * 2; |
407 | scale_box(&box, output_scale); | 404 | scale_box(&box, output_scale); |
408 | render_rect(output->wlr_output, output_damage, &box, color); | 405 | render_rect(output->wlr_output, output_damage, &box, color); |
409 | 406 | ||
410 | // Single pixel right edge | 407 | // Single pixel right edge |
411 | box.x = x + width - TITLEBAR_BORDER_THICKNESS; | 408 | box.x = x + width - titlebar_border_thickness; |
412 | box.y = y + TITLEBAR_BORDER_THICKNESS; | 409 | box.y = y + titlebar_border_thickness; |
413 | box.width = TITLEBAR_BORDER_THICKNESS; | 410 | box.width = titlebar_border_thickness; |
414 | box.height = | 411 | box.height = |
415 | container_titlebar_height() - TITLEBAR_BORDER_THICKNESS * 2; | 412 | container_titlebar_height() - titlebar_border_thickness * 2; |
416 | scale_box(&box, output_scale); | 413 | scale_box(&box, output_scale); |
417 | render_rect(output->wlr_output, output_damage, &box, color); | 414 | render_rect(output->wlr_output, output_damage, &box, color); |
418 | } | 415 | } |
419 | 416 | ||
420 | size_t inner_width = width - TITLEBAR_H_PADDING * 2; | 417 | int inner_x = x - output_x + titlebar_h_padding; |
421 | int bg_y = y + TITLEBAR_BORDER_THICKNESS; | 418 | int bg_y = y + titlebar_border_thickness; |
419 | size_t inner_width = width - titlebar_h_padding * 2; | ||
420 | |||
421 | // output-buffer local | ||
422 | int ob_inner_x = round(inner_x * output_scale); | ||
423 | int ob_inner_width = scale_length(inner_width, inner_x, output_scale); | ||
422 | int ob_bg_height = scale_length( | 424 | int ob_bg_height = scale_length( |
423 | (TITLEBAR_V_PADDING - TITLEBAR_BORDER_THICKNESS) * 2 + | 425 | (titlebar_v_padding - titlebar_border_thickness) * 2 + |
424 | config->font_height, bg_y, output_scale); | 426 | config->font_height, bg_y, output_scale); |
425 | 427 | ||
426 | // Marks | 428 | // Marks |
427 | int marks_ob_width = 0; // output-buffer-local | 429 | int ob_marks_x = 0; // output-buffer-local |
430 | int ob_marks_width = 0; // output-buffer-local | ||
428 | if (config->show_marks && marks_texture) { | 431 | if (config->show_marks && marks_texture) { |
429 | struct wlr_box texture_box; | 432 | struct wlr_box texture_box; |
430 | wlr_texture_get_size(marks_texture, | 433 | wlr_texture_get_size(marks_texture, |
431 | &texture_box.width, &texture_box.height); | 434 | &texture_box.width, &texture_box.height); |
432 | marks_ob_width = texture_box.width; | 435 | ob_marks_width = texture_box.width; |
433 | 436 | ||
434 | // The marks texture might be shorter than the config->font_height, in | 437 | // The marks texture might be shorter than the config->font_height, in |
435 | // which case we need to pad it as evenly as possible above and below. | 438 | // which case we need to pad it as evenly as possible above and below. |
@@ -437,9 +440,15 @@ static void render_titlebar(struct sway_output *output, | |||
437 | int ob_padding_above = floor(ob_padding_total / 2.0); | 440 | int ob_padding_above = floor(ob_padding_total / 2.0); |
438 | int ob_padding_below = ceil(ob_padding_total / 2.0); | 441 | int ob_padding_below = ceil(ob_padding_total / 2.0); |
439 | 442 | ||
440 | // Render texture | 443 | // Render texture. If the title is on the right, the marks will be on |
441 | texture_box.x = round((x - output_x + width - TITLEBAR_H_PADDING) | 444 | // the left. Otherwise, they will be on the right. |
442 | * output_scale) - texture_box.width; | 445 | if (title_align == ALIGN_RIGHT || texture_box.width > ob_inner_width) { |
446 | texture_box.x = ob_inner_x; | ||
447 | } else { | ||
448 | texture_box.x = ob_inner_x + ob_inner_width - texture_box.width; | ||
449 | } | ||
450 | ob_marks_x = texture_box.x; | ||
451 | |||
443 | texture_box.y = round((bg_y - output_y) * output_scale) + | 452 | texture_box.y = round((bg_y - output_y) * output_scale) + |
444 | ob_padding_above; | 453 | ob_padding_above; |
445 | 454 | ||
@@ -448,8 +457,8 @@ static void render_titlebar(struct sway_output *output, | |||
448 | WL_OUTPUT_TRANSFORM_NORMAL, | 457 | WL_OUTPUT_TRANSFORM_NORMAL, |
449 | 0.0, output->wlr_output->transform_matrix); | 458 | 0.0, output->wlr_output->transform_matrix); |
450 | 459 | ||
451 | if (inner_width * output_scale < texture_box.width) { | 460 | if (ob_inner_width < texture_box.width) { |
452 | texture_box.width = inner_width * output_scale; | 461 | texture_box.width = ob_inner_width; |
453 | } | 462 | } |
454 | render_texture(output->wlr_output, output_damage, marks_texture, | 463 | render_texture(output->wlr_output, output_damage, marks_texture, |
455 | &texture_box, matrix, con->alpha); | 464 | &texture_box, matrix, con->alpha); |
@@ -458,7 +467,7 @@ static void render_titlebar(struct sway_output *output, | |||
458 | memcpy(&color, colors->background, sizeof(float) * 4); | 467 | memcpy(&color, colors->background, sizeof(float) * 4); |
459 | premultiply_alpha(color, con->alpha); | 468 | premultiply_alpha(color, con->alpha); |
460 | box.x = texture_box.x + round(output_x * output_scale); | 469 | box.x = texture_box.x + round(output_x * output_scale); |
461 | box.y = round((y + TITLEBAR_BORDER_THICKNESS) * output_scale); | 470 | box.y = round((y + titlebar_border_thickness) * output_scale); |
462 | box.width = texture_box.width; | 471 | box.width = texture_box.width; |
463 | box.height = ob_padding_above; | 472 | box.height = ob_padding_above; |
464 | render_rect(output->wlr_output, output_damage, &box, color); | 473 | render_rect(output->wlr_output, output_damage, &box, color); |
@@ -470,24 +479,43 @@ static void render_titlebar(struct sway_output *output, | |||
470 | } | 479 | } |
471 | 480 | ||
472 | // Title text | 481 | // Title text |
473 | size_t title_ob_width = 0; // output-buffer-local | 482 | int ob_title_x = 0; // output-buffer-local |
483 | int ob_title_width = 0; // output-buffer-local | ||
474 | if (title_texture) { | 484 | if (title_texture) { |
475 | struct wlr_box texture_box; | 485 | struct wlr_box texture_box; |
476 | wlr_texture_get_size(title_texture, | 486 | wlr_texture_get_size(title_texture, |
477 | &texture_box.width, &texture_box.height); | 487 | &texture_box.width, &texture_box.height); |
478 | title_ob_width = texture_box.width; | 488 | ob_title_width = texture_box.width; |
479 | 489 | ||
480 | // The title texture might be shorter than the config->font_height, | 490 | // The title texture might be shorter than the config->font_height, |
481 | // in which case we need to pad it above and below. | 491 | // in which case we need to pad it above and below. |
482 | int ob_padding_above = round((config->font_baseline - | 492 | int ob_padding_above = round((config->font_baseline - |
483 | con->title_baseline + TITLEBAR_V_PADDING - | 493 | con->title_baseline + titlebar_v_padding - |
484 | TITLEBAR_BORDER_THICKNESS) * output_scale); | 494 | titlebar_border_thickness) * output_scale); |
485 | int ob_padding_below = ob_bg_height - ob_padding_above - | 495 | int ob_padding_below = ob_bg_height - ob_padding_above - |
486 | texture_box.height; | 496 | texture_box.height; |
487 | 497 | ||
488 | // Render texture | 498 | // Render texture |
489 | texture_box.x = | 499 | if (texture_box.width > ob_inner_width - ob_marks_width) { |
490 | round((x - output_x + TITLEBAR_H_PADDING) * output_scale); | 500 | texture_box.x = (title_align == ALIGN_RIGHT && ob_marks_width) |
501 | ? ob_marks_x + ob_marks_width : ob_inner_x; | ||
502 | } else if (title_align == ALIGN_LEFT) { | ||
503 | texture_box.x = ob_inner_x; | ||
504 | } else if (title_align == ALIGN_CENTER) { | ||
505 | // If there are marks visible, center between the edge and marks. | ||
506 | // Otherwise, center in the inner area. | ||
507 | if (ob_marks_width) { | ||
508 | texture_box.x = (ob_inner_x + ob_marks_x) / 2 | ||
509 | - texture_box.width / 2; | ||
510 | } else { | ||
511 | texture_box.x = ob_inner_x + ob_inner_width / 2 | ||
512 | - texture_box.width / 2; | ||
513 | } | ||
514 | } else { | ||
515 | texture_box.x = ob_inner_x + ob_inner_width - texture_box.width; | ||
516 | } | ||
517 | ob_title_x = texture_box.x; | ||
518 | |||
491 | texture_box.y = | 519 | texture_box.y = |
492 | round((bg_y - output_y) * output_scale) + ob_padding_above; | 520 | round((bg_y - output_y) * output_scale) + ob_padding_above; |
493 | 521 | ||
@@ -496,11 +524,10 @@ static void render_titlebar(struct sway_output *output, | |||
496 | WL_OUTPUT_TRANSFORM_NORMAL, | 524 | WL_OUTPUT_TRANSFORM_NORMAL, |
497 | 0.0, output->wlr_output->transform_matrix); | 525 | 0.0, output->wlr_output->transform_matrix); |
498 | 526 | ||
499 | int inner_x = x - output_x + TITLEBAR_H_PADDING; | 527 | if (ob_inner_width - ob_marks_width < texture_box.width) { |
500 | int ob_inner_width = scale_length(inner_width, inner_x, output_scale); | 528 | texture_box.width = ob_inner_width - ob_marks_width; |
501 | if (ob_inner_width - marks_ob_width < texture_box.width) { | ||
502 | texture_box.width = ob_inner_width - marks_ob_width; | ||
503 | } | 529 | } |
530 | |||
504 | render_texture(output->wlr_output, output_damage, title_texture, | 531 | render_texture(output->wlr_output, output_damage, title_texture, |
505 | &texture_box, matrix, con->alpha); | 532 | &texture_box, matrix, con->alpha); |
506 | 533 | ||
@@ -508,7 +535,7 @@ static void render_titlebar(struct sway_output *output, | |||
508 | memcpy(&color, colors->background, sizeof(float) * 4); | 535 | memcpy(&color, colors->background, sizeof(float) * 4); |
509 | premultiply_alpha(color, con->alpha); | 536 | premultiply_alpha(color, con->alpha); |
510 | box.x = texture_box.x + round(output_x * output_scale); | 537 | box.x = texture_box.x + round(output_x * output_scale); |
511 | box.y = round((y + TITLEBAR_BORDER_THICKNESS) * output_scale); | 538 | box.y = round((y + titlebar_border_thickness) * output_scale); |
512 | box.width = texture_box.width; | 539 | box.width = texture_box.width; |
513 | box.height = ob_padding_above; | 540 | box.height = ob_padding_above; |
514 | render_rect(output->wlr_output, output_damage, &box, color); | 541 | render_rect(output->wlr_output, output_damage, &box, color); |
@@ -519,50 +546,83 @@ static void render_titlebar(struct sway_output *output, | |||
519 | render_rect(output->wlr_output, output_damage, &box, color); | 546 | render_rect(output->wlr_output, output_damage, &box, color); |
520 | } | 547 | } |
521 | 548 | ||
549 | // Determine the left + right extends of the textures (output-buffer local) | ||
550 | int ob_left_x, ob_left_width, ob_right_x, ob_right_width; | ||
551 | if (ob_title_width == 0 && ob_marks_width == 0) { | ||
552 | ob_left_x = ob_inner_x; | ||
553 | ob_left_width = 0; | ||
554 | ob_right_x = ob_inner_x; | ||
555 | ob_right_width = 0; | ||
556 | } else if (ob_title_x < ob_marks_x) { | ||
557 | ob_left_x = ob_title_x; | ||
558 | ob_left_width = ob_title_width; | ||
559 | ob_right_x = ob_marks_x; | ||
560 | ob_right_width = ob_marks_width; | ||
561 | } else { | ||
562 | ob_left_x = ob_marks_x; | ||
563 | ob_left_width = ob_marks_width; | ||
564 | ob_right_x = ob_title_x; | ||
565 | ob_right_width = ob_title_width; | ||
566 | } | ||
567 | if (ob_left_x < ob_inner_x) { | ||
568 | ob_left_x = ob_inner_x; | ||
569 | } else if (ob_left_x + ob_left_width > ob_right_x + ob_right_width) { | ||
570 | ob_right_x = ob_left_x; | ||
571 | ob_right_width = ob_left_width; | ||
572 | } | ||
573 | |||
522 | // Filler between title and marks | 574 | // Filler between title and marks |
523 | box.width = | 575 | box.width = ob_right_x - ob_left_x - ob_left_width; |
524 | round(inner_width * output_scale) - title_ob_width - marks_ob_width; | ||
525 | if (box.width > 0) { | 576 | if (box.width > 0) { |
526 | box.x = round((x + TITLEBAR_H_PADDING) * output_scale) + title_ob_width; | 577 | box.x = ob_left_x + ob_left_width + round(output_x * output_scale); |
527 | box.y = round(bg_y * output_scale); | 578 | box.y = round(bg_y * output_scale); |
528 | box.height = ob_bg_height; | 579 | box.height = ob_bg_height; |
529 | render_rect(output->wlr_output, output_damage, &box, color); | 580 | render_rect(output->wlr_output, output_damage, &box, color); |
530 | } | 581 | } |
531 | 582 | ||
532 | // Padding left of title | 583 | // Padding on left side |
533 | left_offset = (layout == L_TABBED) * TITLEBAR_BORDER_THICKNESS; | 584 | left_offset = (layout == L_TABBED) * titlebar_border_thickness; |
534 | box.x = x + left_offset; | 585 | box.x = x + left_offset; |
535 | box.y = y + TITLEBAR_BORDER_THICKNESS; | 586 | box.y = y + titlebar_border_thickness; |
536 | box.width = TITLEBAR_H_PADDING - left_offset; | 587 | box.width = titlebar_h_padding - left_offset; |
537 | box.height = (TITLEBAR_V_PADDING - TITLEBAR_BORDER_THICKNESS) * 2 + | 588 | box.height = (titlebar_v_padding - titlebar_border_thickness) * 2 + |
538 | config->font_height; | 589 | config->font_height; |
539 | scale_box(&box, output_scale); | 590 | scale_box(&box, output_scale); |
591 | int left_x = ob_left_x + round(output_x * output_scale); | ||
592 | if (box.x + box.width < left_x) { | ||
593 | box.width += left_x - box.x - box.width; | ||
594 | } | ||
540 | render_rect(output->wlr_output, output_damage, &box, color); | 595 | render_rect(output->wlr_output, output_damage, &box, color); |
541 | 596 | ||
542 | // Padding right of marks | 597 | // Padding on right side |
543 | right_offset = (layout == L_TABBED) * TITLEBAR_BORDER_THICKNESS; | 598 | right_offset = (layout == L_TABBED) * titlebar_border_thickness; |
544 | box.x = x + width - TITLEBAR_H_PADDING; | 599 | box.x = x + width - titlebar_h_padding; |
545 | box.y = y + TITLEBAR_BORDER_THICKNESS; | 600 | box.y = y + titlebar_border_thickness; |
546 | box.width = TITLEBAR_H_PADDING - right_offset; | 601 | box.width = titlebar_h_padding - right_offset; |
547 | box.height = (TITLEBAR_V_PADDING - TITLEBAR_BORDER_THICKNESS) * 2 + | 602 | box.height = (titlebar_v_padding - titlebar_border_thickness) * 2 + |
548 | config->font_height; | 603 | config->font_height; |
549 | scale_box(&box, output_scale); | 604 | scale_box(&box, output_scale); |
605 | int right_rx = ob_right_x + ob_right_width + round(output_x * output_scale); | ||
606 | if (right_rx < box.x) { | ||
607 | box.width += box.x - right_rx; | ||
608 | box.x = right_rx; | ||
609 | } | ||
550 | render_rect(output->wlr_output, output_damage, &box, color); | 610 | render_rect(output->wlr_output, output_damage, &box, color); |
551 | 611 | ||
552 | if (connects_sides) { | 612 | if (connects_sides) { |
553 | // Left pixel in line with bottom bar | 613 | // Left pixel in line with bottom bar |
554 | box.x = x; | 614 | box.x = x; |
555 | box.y = y + container_titlebar_height() - TITLEBAR_BORDER_THICKNESS; | 615 | box.y = y + container_titlebar_height() - titlebar_border_thickness; |
556 | box.width = state->border_thickness * state->border_left; | 616 | box.width = state->border_thickness * state->border_left; |
557 | box.height = TITLEBAR_BORDER_THICKNESS; | 617 | box.height = titlebar_border_thickness; |
558 | scale_box(&box, output_scale); | 618 | scale_box(&box, output_scale); |
559 | render_rect(output->wlr_output, output_damage, &box, color); | 619 | render_rect(output->wlr_output, output_damage, &box, color); |
560 | 620 | ||
561 | // Right pixel in line with bottom bar | 621 | // Right pixel in line with bottom bar |
562 | box.x = x + width - state->border_thickness * state->border_right; | 622 | box.x = x + width - state->border_thickness * state->border_right; |
563 | box.y = y + container_titlebar_height() - TITLEBAR_BORDER_THICKNESS; | 623 | box.y = y + container_titlebar_height() - titlebar_border_thickness; |
564 | box.width = state->border_thickness * state->border_right; | 624 | box.width = state->border_thickness * state->border_right; |
565 | box.height = TITLEBAR_BORDER_THICKNESS; | 625 | box.height = titlebar_border_thickness; |
566 | scale_box(&box, output_scale); | 626 | scale_box(&box, output_scale); |
567 | render_rect(output->wlr_output, output_damage, &box, color); | 627 | render_rect(output->wlr_output, output_damage, &box, color); |
568 | } | 628 | } |
@@ -882,21 +942,11 @@ static void render_floating(struct sway_output *soutput, | |||
882 | } | 942 | } |
883 | } | 943 | } |
884 | 944 | ||
885 | static void render_dropzones(struct sway_output *output, | 945 | static void render_seatops(struct sway_output *output, |
886 | pixman_region32_t *damage) { | 946 | pixman_region32_t *damage) { |
887 | struct sway_seat *seat; | 947 | struct sway_seat *seat; |
888 | wl_list_for_each(seat, &server.input->seats, link) { | 948 | wl_list_for_each(seat, &server.input->seats, link) { |
889 | if (seat->operation == OP_MOVE_TILING && seat->op_target_node | 949 | seatop_render(seat, output, damage); |
890 | && node_get_output(seat->op_target_node) == output) { | ||
891 | float color[4]; | ||
892 | memcpy(&color, config->border_colors.focused.indicator, | ||
893 | sizeof(float) * 4); | ||
894 | premultiply_alpha(color, 0.5); | ||
895 | struct wlr_box box; | ||
896 | memcpy(&box, &seat->op_drop_box, sizeof(struct wlr_box)); | ||
897 | scale_box(&box, output->wlr_output->scale); | ||
898 | render_rect(output->wlr_output, damage, &box, color); | ||
899 | } | ||
900 | } | 950 | } |
901 | } | 951 | } |
902 | 952 | ||
@@ -950,7 +1000,7 @@ void output_render(struct sway_output *output, struct timespec *when, | |||
950 | if (fullscreen_con->view) { | 1000 | if (fullscreen_con->view) { |
951 | if (fullscreen_con->view->saved_buffer) { | 1001 | if (fullscreen_con->view->saved_buffer) { |
952 | render_saved_view(fullscreen_con->view, output, damage, 1.0f); | 1002 | render_saved_view(fullscreen_con->view, output, damage, 1.0f); |
953 | } else { | 1003 | } else if (fullscreen_con->view->surface) { |
954 | render_view_toplevels(fullscreen_con->view, | 1004 | render_view_toplevels(fullscreen_con->view, |
955 | output, damage, 1.0f); | 1005 | output, damage, 1.0f); |
956 | } | 1006 | } |
@@ -993,7 +1043,7 @@ void output_render(struct sway_output *output, struct timespec *when, | |||
993 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); | 1043 | &output->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]); |
994 | } | 1044 | } |
995 | 1045 | ||
996 | render_dropzones(output, damage); | 1046 | render_seatops(output, damage); |
997 | 1047 | ||
998 | struct sway_seat *seat = input_manager_current_seat(); | 1048 | struct sway_seat *seat = input_manager_current_seat(); |
999 | struct sway_container *focus = seat_get_focused_container(seat); | 1049 | struct sway_container *focus = seat_get_focused_container(seat); |
@@ -1012,15 +1062,22 @@ renderer_end: | |||
1012 | wlr_render_texture(renderer, root->debug_tree, | 1062 | wlr_render_texture(renderer, root->debug_tree, |
1013 | wlr_output->transform_matrix, 0, 40, 1); | 1063 | wlr_output->transform_matrix, 0, 40, 1); |
1014 | } | 1064 | } |
1015 | if (debug.damage == DAMAGE_HIGHLIGHT) { | ||
1016 | int width, height; | ||
1017 | wlr_output_transformed_resolution(wlr_output, &width, &height); | ||
1018 | pixman_region32_union_rect(damage, damage, 0, 0, width, height); | ||
1019 | } | ||
1020 | 1065 | ||
1021 | wlr_renderer_scissor(renderer, NULL); | 1066 | wlr_renderer_scissor(renderer, NULL); |
1022 | wlr_output_render_software_cursors(wlr_output, damage); | 1067 | wlr_output_render_software_cursors(wlr_output, damage); |
1023 | wlr_renderer_end(renderer); | 1068 | wlr_renderer_end(renderer); |
1069 | |||
1070 | int width, height; | ||
1071 | wlr_output_transformed_resolution(wlr_output, &width, &height); | ||
1072 | |||
1073 | if (debug.damage == DAMAGE_HIGHLIGHT) { | ||
1074 | pixman_region32_union_rect(damage, damage, 0, 0, width, height); | ||
1075 | } | ||
1076 | |||
1077 | enum wl_output_transform transform = | ||
1078 | wlr_output_transform_invert(wlr_output->transform); | ||
1079 | wlr_region_transform(damage, damage, transform, width, height); | ||
1080 | |||
1024 | if (!wlr_output_damage_swap_buffers(output->damage, when, damage)) { | 1081 | if (!wlr_output_damage_swap_buffers(output->damage, when, damage)) { |
1025 | return; | 1082 | return; |
1026 | } | 1083 | } |