Skip to content

Commit e3f6688

Browse files
committed
fix writing to framebuffer after console switch
1 parent 162e47e commit e3f6688

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/ConsoleApp.vala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ namespace Ev3devKit {
6868
Object ();
6969
init ();
7070
Ui.Screen.active_screen = new Ui.Screen ();
71+
notify["is-active"].connect ((s, p) => {
72+
Ui.Screen.can_draw = is_active;
73+
});
7174
}
7275

7376
public override bool event (Grx.Event event) {

src/ui/Screen.vala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ namespace Ev3devKit.Ui {
3737
Queue<uint?> key_queue;
3838
Context context;
3939

40+
/**
41+
* Hack to prevent drawing during console switching.
42+
*/
43+
internal static bool can_draw { get; set; default = true; }
44+
4045
/**
4146
* Gets and sets the foreground color.
4247
*
@@ -254,7 +259,7 @@ namespace Ev3devKit.Ui {
254259
*/
255260
protected bool draw () {
256261
handle_input ();
257-
if (dirty) {
262+
if (dirty && can_draw) {
258263
set_current_context (context);
259264
Window? top_window = null;
260265
Window? top_dialog = null;

0 commit comments

Comments
 (0)