mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibVT: Allow updating the window progress via an escape sequence
You can now request an update of the terminal's window progress by sending this escape sequence: <esc>]9;<value>;<max_value>;<escape><backslash> I'm sure we can find many interesting uses for this! :^)
This commit is contained in:
parent
e263dc8427
commit
165f69023b
6 changed files with 20 additions and 0 deletions
|
@ -47,6 +47,7 @@
|
|||
#include <LibGfx/Font.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -361,6 +362,14 @@ void TerminalWidget::paint_event(GUI::PaintEvent& event)
|
|||
}
|
||||
}
|
||||
|
||||
void TerminalWidget::set_window_progress(int value, int max)
|
||||
{
|
||||
float float_value = value;
|
||||
float float_max = max;
|
||||
float progress = (float_value / float_max) * 100.0f;
|
||||
window()->set_progress((int)roundf(progress));
|
||||
}
|
||||
|
||||
void TerminalWidget::set_window_title(const StringView& title)
|
||||
{
|
||||
if (!Utf8View(title).validate()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue