void OnFocusInEvent(X11.XFocusChangeEvent ev) { var title = WindowIndexByFrame[ev.window].title; var frame = ev.window; Xlib.XSetWindowBorder(this.display, frame, this.Colours.ActiveFrameColor); Xlib.XSetWindowBackground(this.display, title, this.Colours.ActiveTitleColor); Xlib.XSetWindowBorder(this.display, title, this.Colours.ActiveTitleBorder); Xlib.XClearWindow(this.display, title); // Force colour update UpdateWindowTitle(title); //Redraw the title, purged by clearing. }
// Annoyingly, this event fires when an application quits itself, resuling in some bad window errors. void OnFocusOutEvent(X11.XFocusChangeEvent ev) { var title = WindowIndexByFrame[ev.window].title; var frame = ev.window; if (Status.Failure == Xlib.XSetWindowBorder(this.display, frame, this.Colours.InactiveTitleBorder)) { return; // If the windows have been destroyed asynchronously, cut this short. } Xlib.XSetWindowBackground(this.display, title, this.Colours.InactiveTitleColor); Xlib.XSetWindowBorder(this.display, title, this.Colours.InactiveFrameColor); Xlib.XClearWindow(this.display, title); UpdateWindowTitle(title); SetFocusTrap(WindowIndexByFrame[ev.window].child); }