mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-20 05:33:47 -04:00
render: apply a dimmed overlay while in Unicode input mode
This commit is contained in:
parent
a36848a4ad
commit
e249b52abd
3 changed files with 36 additions and 8 deletions
|
|
@ -43,6 +43,10 @@
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Added
|
### Added
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
* Window is now dimmed while in Unicode input mode.
|
||||||
|
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
||||||
33
render.c
33
render.c
|
|
@ -1466,10 +1466,21 @@ static void
|
||||||
render_overlay(struct terminal *term)
|
render_overlay(struct terminal *term)
|
||||||
{
|
{
|
||||||
struct wl_surf_subsurf *overlay = &term->window->overlay;
|
struct wl_surf_subsurf *overlay = &term->window->overlay;
|
||||||
|
bool unicode_mode_active = false;
|
||||||
|
|
||||||
|
/* Check if unicode mode is active on at least one seat focusing
|
||||||
|
* this terminal instance */
|
||||||
|
tll_foreach(term->wl->seats, it) {
|
||||||
|
if (it->item.unicode_mode.active) {
|
||||||
|
unicode_mode_active = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const enum overlay_style style =
|
const enum overlay_style style =
|
||||||
term->is_searching ? OVERLAY_SEARCH :
|
term->is_searching ? OVERLAY_SEARCH :
|
||||||
term->flash.active ? OVERLAY_FLASH :
|
term->flash.active ? OVERLAY_FLASH :
|
||||||
|
unicode_mode_active ? OVERLAY_UNICODE_MODE :
|
||||||
OVERLAY_NONE;
|
OVERLAY_NONE;
|
||||||
|
|
||||||
if (likely(style == OVERLAY_NONE)) {
|
if (likely(style == OVERLAY_NONE)) {
|
||||||
|
|
@ -1488,9 +1499,21 @@ render_overlay(struct terminal *term)
|
||||||
|
|
||||||
pixman_image_set_clip_region32(buf->pix[0], NULL);
|
pixman_image_set_clip_region32(buf->pix[0], NULL);
|
||||||
|
|
||||||
pixman_color_t color = style == OVERLAY_SEARCH
|
pixman_color_t color;
|
||||||
? (pixman_color_t){0, 0, 0, 0x7fff}
|
|
||||||
: (pixman_color_t){.red=0x7fff, .green=0x7fff, .blue=0, .alpha=0x7fff};
|
switch (style) {
|
||||||
|
case OVERLAY_NONE:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OVERLAY_SEARCH:
|
||||||
|
case OVERLAY_UNICODE_MODE:
|
||||||
|
color = (pixman_color_t){0, 0, 0, 0x7fff};
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OVERLAY_FLASH:
|
||||||
|
color = (pixman_color_t){.red=0x7fff, .green=0x7fff, .blue=0, .alpha=0x7fff};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Bounding rectangle of damaged areas - for wl_surface_damage_buffer() */
|
/* Bounding rectangle of damaged areas - for wl_surface_damage_buffer() */
|
||||||
pixman_box32_t damage_bounds;
|
pixman_box32_t damage_bounds;
|
||||||
|
|
@ -1517,7 +1540,7 @@ render_overlay(struct terminal *term)
|
||||||
* region that needs to be *cleared* in this frame.
|
* region that needs to be *cleared* in this frame.
|
||||||
*
|
*
|
||||||
* Finally, the union of the two “diff” regions above, gives
|
* Finally, the union of the two “diff” regions above, gives
|
||||||
* us the total region affecte by a change, in either way. We
|
* us the total region affected by a change, in either way. We
|
||||||
* use this as the bounding box for the
|
* use this as the bounding box for the
|
||||||
* wl_surface_damage_buffer() call.
|
* wl_surface_damage_buffer() call.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1605,7 +1628,7 @@ render_overlay(struct terminal *term)
|
||||||
else if (buf == term->render.last_overlay_buf &&
|
else if (buf == term->render.last_overlay_buf &&
|
||||||
style == term->render.last_overlay_style)
|
style == term->render.last_overlay_style)
|
||||||
{
|
{
|
||||||
xassert(style == OVERLAY_FLASH);
|
xassert(style == OVERLAY_FLASH || style == OVERLAY_UNICODE_MODE);
|
||||||
shm_did_not_use_buf(buf);
|
shm_did_not_use_buf(buf);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -289,9 +289,10 @@ enum term_surface {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum overlay_style {
|
enum overlay_style {
|
||||||
OVERLAY_NONE = 0,
|
OVERLAY_NONE,
|
||||||
OVERLAY_SEARCH = 1,
|
OVERLAY_SEARCH,
|
||||||
OVERLAY_FLASH = 2,
|
OVERLAY_FLASH,
|
||||||
|
OVERLAY_UNICODE_MODE,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef tll(struct ptmx_buffer) ptmx_buffer_list_t;
|
typedef tll(struct ptmx_buffer) ptmx_buffer_list_t;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue