aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-11-10 15:58:42 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-11-10 15:58:42 +0100
commit9781b036f49da10f24b1c81f934fb3bfbbf03878 (patch)
treeace9ab60b369279ae9de5575c422e842193fef02
parent73963d6eda21fa7b45afe50cccf7b66e68fef7e6 (diff)
downloadxK-9781b036f49da10f24b1c81f934fb3bfbbf03878.tar.gz
xK-9781b036f49da10f24b1c81f934fb3bfbbf03878.tar.xz
xK-9781b036f49da10f24b1c81f934fb3bfbbf03878.zip
WIP: xA: figure out foreground
-rw-r--r--xA/xA.go29
1 files changed, 26 insertions, 3 deletions
diff --git a/xA/xA.go b/xA/xA.go
index 343474c..8150026 100644
--- a/xA/xA.go
+++ b/xA/xA.go
@@ -84,6 +84,14 @@ func init() {
func (t *customTheme) Color(
name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
+ /*
+ // Fyne may use a dark background with the Light variant,
+ // which makes the UI unusable.
+ if runtime.GOOS == "android" {
+ variant = theme.VariantDark
+ }
+ */
+
// Fuck this low contrast shit, text must be black.
if name == theme.ColorNameForeground &&
variant == theme.VariantLight {
@@ -191,6 +199,8 @@ var (
// Widgets:
+ inForeground = true
+
wWindow fyne.Window
wTopic *widget.RichText
wBufferList *widget.List
@@ -396,7 +406,7 @@ func convertItemFormatting(
case *RelayItemDataFlipUnderline:
cf.format.Underline = !cf.format.Underline
case *RelayItemDataFlipCrossedOut:
- // ¯\_(ツ)_/¯
+ // https://github.com/fyne-io/fyne/issues/1084
case *RelayItemDataFlipInverse:
*inverse = !*inverse
case *RelayItemDataFlipMonospace:
@@ -606,8 +616,8 @@ func relayProcessBufferLine(b *buffer, m *RelayEventDataBufferLine) {
// Retained mode is complicated.
display := (!m.IsUnimportant || !bc.hideUnimportant) &&
(b.bufferName == bufferCurrent || m.LeakToActive)
- toBottom := display // && bufferAtBottom()
- visible := display && toBottom // && ...
+ toBottom := display && bufferAtBottom()
+ visible := display && toBottom && inForeground // && log not visible
separate := display &&
!visible && bc.newMessages == 0 && bc.newUnimportantMessages == 0
@@ -957,6 +967,19 @@ func main() {
a := app.New()
a.Settings().SetTheme(&customTheme{})
wWindow = a.NewWindow(projectName)
+ wWindow.Resize(fyne.NewSize(640, 480))
+
+ a.Lifecycle().SetOnEnteredForeground(func() {
+ // TODO(p): Does this need locking?
+ inForeground = true
+ if b := bufferByName(bufferCurrent); b != nil {
+ b.highlighted = false
+ refreshIcon()
+ }
+ })
+ a.Lifecycle().SetOnExitedForeground(func() {
+ inForeground = false
+ })
// TODO(p): Consider using data bindings.
wBufferList = widget.NewList(func() int { return len(buffers) },