Skip to content

Commit

Permalink
Merge pull request #555 from BDisp/curses-resize-color
Browse files Browse the repository at this point in the history
Fixed resizing update and correct the Toplevel colors without colors.
  • Loading branch information
tig authored May 27, 2020
2 parents 353baf7 + 67f2518 commit 05c9ec7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions Terminal.Gui/Drivers/CursesDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ public override void Init (Action terminalResized)
TopTee = Curses.ACS_TTEE;
BottomTee = Curses.ACS_BTEE;

Colors.TopLevel = new ColorScheme ();
Colors.Base = new ColorScheme ();
Colors.Dialog = new ColorScheme ();
Colors.Menu = new ColorScheme ();
Expand All @@ -496,6 +497,11 @@ public override void Init (Action terminalResized)
Curses.StartColor ();
Curses.UseDefaultColors ();

Colors.TopLevel.Normal = MakeColor (Curses.COLOR_GREEN, Curses.COLOR_BLACK);
Colors.TopLevel.Focus = MakeColor (Curses.COLOR_WHITE, Curses.COLOR_CYAN);
Colors.TopLevel.HotNormal = MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_BLACK);
Colors.TopLevel.HotFocus = MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_CYAN);

Colors.Base.Normal = MakeColor (Curses.COLOR_WHITE, Curses.COLOR_BLUE);
Colors.Base.Focus = MakeColor (Curses.COLOR_BLACK, Curses.COLOR_CYAN);
Colors.Base.HotNormal = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_BLUE);
Expand All @@ -522,6 +528,10 @@ public override void Init (Action terminalResized)
Colors.Error.HotNormal = Curses.A_BOLD | MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_RED);
Colors.Error.HotFocus = Colors.Error.HotNormal;
} else {
Colors.TopLevel.Normal = Curses.COLOR_GREEN;
Colors.TopLevel.Focus = Curses.COLOR_WHITE;
Colors.TopLevel.HotNormal = Curses.COLOR_YELLOW;
Colors.TopLevel.HotFocus = Curses.COLOR_YELLOW;
Colors.Base.Normal = Curses.A_NORMAL;
Colors.Base.Focus = Curses.A_REVERSE;
Colors.Base.HotNormal = Curses.A_BOLD;
Expand All @@ -539,12 +549,6 @@ public override void Init (Action terminalResized)
Colors.Error.HotNormal = Curses.A_BOLD | Curses.A_REVERSE;
Colors.Error.HotFocus = Curses.A_REVERSE;
}
Colors.TopLevel = new ColorScheme ();

Colors.TopLevel.Normal = MakeColor (Curses.COLOR_GREEN, Curses.COLOR_BLACK);
Colors.TopLevel.Focus = MakeColor (Curses.COLOR_WHITE, Curses.COLOR_CYAN);
Colors.TopLevel.HotNormal = MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_BLACK);
Colors.TopLevel.HotFocus = MakeColor (Curses.COLOR_YELLOW, Curses.COLOR_CYAN);
}

static int MapColor (Color color)
Expand Down
4 changes: 2 additions & 2 deletions Terminal.Gui/MonoCurses/mainloop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void UpdatePollMap ()
poll_dirty = false;

pollmap = new Pollfd [descriptorWatchers.Count];
int i = 0;
int i = 0;
foreach (var fd in descriptorWatchers.Keys) {
pollmap [i].fd = fd;
pollmap [i].events = (short)descriptorWatchers [fd].Condition;
Expand All @@ -208,7 +208,7 @@ bool IMainLoopDriver.EventsPending (bool wait)

while (true) {
n = poll (pollmap, (uint)pollmap.Length, 0);
if (n > 0) {
if (pollmap != null) {
break;
}
if (mainLoop.idleHandlers.Count > 0 || CkeckTimeout (wait, ref pollTimeout)) {
Expand Down

0 comments on commit 05c9ec7

Please sign in to comment.