diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-15 13:14:18 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-17 08:29:14 +1000 |
commit | 0e2cc0af3049c6d1b91bda3081238e2e723e81b7 (patch) | |
tree | 34a18b12524c8de5bf68712162071abe3e574d71 /sway/desktop/output.c | |
parent | Merge pull request #1995 from RedSoxFan/fix-1985 (diff) | |
download | sway-0e2cc0af3049c6d1b91bda3081238e2e723e81b7.tar.gz sway-0e2cc0af3049c6d1b91bda3081238e2e723e81b7.tar.zst sway-0e2cc0af3049c6d1b91bda3081238e2e723e81b7.zip |
Implement show_marks
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r-- | sway/desktop/output.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index b12130d9..57d71d5e 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -317,7 +317,7 @@ damage_finish: | |||
317 | static void render_container_simple_border_normal(struct sway_output *output, | 317 | static void render_container_simple_border_normal(struct sway_output *output, |
318 | pixman_region32_t *output_damage, | 318 | pixman_region32_t *output_damage, |
319 | struct sway_container *con, struct border_colors *colors, | 319 | struct sway_container *con, struct border_colors *colors, |
320 | struct wlr_texture *title_texture) { | 320 | struct wlr_texture *title_texture, struct wlr_texture *marks_texture) { |
321 | struct wlr_box box; | 321 | struct wlr_box box; |
322 | float color[4]; | 322 | float color[4]; |
323 | 323 | ||
@@ -413,6 +413,25 @@ static void render_container_simple_border_normal(struct sway_output *output, | |||
413 | render_texture(output->wlr_output, output_damage, title_texture, | 413 | render_texture(output->wlr_output, output_damage, title_texture, |
414 | &texture_box, matrix, 1.0); | 414 | &texture_box, matrix, 1.0); |
415 | } | 415 | } |
416 | |||
417 | // Marks | ||
418 | if (config->show_marks && marks_texture) { | ||
419 | float output_scale = output->wlr_output->scale; | ||
420 | struct wlr_box texture_box; | ||
421 | wlr_texture_get_size(marks_texture, | ||
422 | &texture_box.width, &texture_box.height); | ||
423 | texture_box.x = (box.x + box.width) * output_scale - texture_box.width; | ||
424 | texture_box.y = (box.y + box.height) | ||
425 | * output_scale - texture_box.height; | ||
426 | |||
427 | float matrix[9]; | ||
428 | wlr_matrix_project_box(matrix, &texture_box, | ||
429 | WL_OUTPUT_TRANSFORM_NORMAL, | ||
430 | 0.0, output->wlr_output->transform_matrix); | ||
431 | |||
432 | render_texture(output->wlr_output, output_damage, marks_texture, | ||
433 | &texture_box, matrix, 1.0); | ||
434 | } | ||
416 | } | 435 | } |
417 | 436 | ||
418 | /** | 437 | /** |
@@ -501,20 +520,24 @@ static void render_container_simple(struct sway_output *output, | |||
501 | if (child->sway_view->border != B_NONE) { | 520 | if (child->sway_view->border != B_NONE) { |
502 | struct border_colors *colors; | 521 | struct border_colors *colors; |
503 | struct wlr_texture *title_texture; | 522 | struct wlr_texture *title_texture; |
523 | struct wlr_texture *marks_texture; | ||
504 | if (focus == child || parent_focused) { | 524 | if (focus == child || parent_focused) { |
505 | colors = &config->border_colors.focused; | 525 | colors = &config->border_colors.focused; |
506 | title_texture = child->title_focused; | 526 | title_texture = child->title_focused; |
527 | marks_texture = child->sway_view->marks_focused; | ||
507 | } else if (seat_get_focus_inactive(seat, con) == child) { | 528 | } else if (seat_get_focus_inactive(seat, con) == child) { |
508 | colors = &config->border_colors.focused_inactive; | 529 | colors = &config->border_colors.focused_inactive; |
509 | title_texture = child->title_focused_inactive; | 530 | title_texture = child->title_focused_inactive; |
531 | marks_texture = child->sway_view->marks_focused_inactive; | ||
510 | } else { | 532 | } else { |
511 | colors = &config->border_colors.unfocused; | 533 | colors = &config->border_colors.unfocused; |
512 | title_texture = child->title_unfocused; | 534 | title_texture = child->title_unfocused; |
535 | marks_texture = child->sway_view->marks_unfocused; | ||
513 | } | 536 | } |
514 | 537 | ||
515 | if (child->sway_view->border == B_NORMAL) { | 538 | if (child->sway_view->border == B_NORMAL) { |
516 | render_container_simple_border_normal(output, damage, | 539 | render_container_simple_border_normal(output, damage, |
517 | child, colors, title_texture); | 540 | child, colors, title_texture, marks_texture); |
518 | } else { | 541 | } else { |
519 | render_container_simple_border_pixel(output, damage, child, | 542 | render_container_simple_border_pixel(output, damage, child, |
520 | colors); | 543 | colors); |