[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/07: installer: Avoid flicker in network page.
From: |
John Darrington |
Subject: |
05/07: installer: Avoid flicker in network page. |
Date: |
Sun, 19 Feb 2017 12:30:55 -0500 (EST) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit dbad5a3d7aa08f60cbae54b57cd89be9a055673f
Author: John Darrington <address@hidden>
Date: Sun Feb 19 14:19:24 2017 +0100
installer: Avoid flicker in network page.
* gnu/system/installer/network.scm (network-page-init): Cache the flags
of all interfaces, and refresh the menu only if they have changed.
---
gnu/system/installer/network.scm | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/gnu/system/installer/network.scm b/gnu/system/installer/network.scm
index 60ae111..a4ffbff 100644
--- a/gnu/system/installer/network.scm
+++ b/gnu/system/installer/network.scm
@@ -162,8 +162,13 @@
(refresh* (inner (page-wwin page)))
(menu-refresh (page-datum page 'menu)))
+(define (if-flags ifce)
+ (network-interface-flags
+ (socket SOCK_STREAM AF_INET 0)
+ (assq-ref ifce 'name)))
(define (network-page-init p)
+ (define prev-flags (map-in-order if-flags (interfaces)))
(let* ((s (page-surface p))
(pr (make-boxed-window #f
(- (getmaxy s) 4) (- (getmaxx s) 2)
@@ -196,9 +201,7 @@
(format #f "~55a ~a"
(name->description (assq-ref datum 'name))
(if (zero? (logand IFF_RUNNING
- (network-interface-flags
- (socket SOCK_STREAM AF_INET 0)
- (assq-ref datum 'name))))
+ (if-flags datum)))
(gettext "Down")
(gettext "Running")))))))
@@ -208,7 +211,15 @@
;; Raise sigalarm every second to refresh the menu
- (sigaction SIGALRM (lambda (_) (menu-redraw menu)))
+ (sigaction SIGALRM (lambda (_)
+ (let ((flags
+ (map-in-order
+ if-flags
+ (interfaces))))
+
+ (when (not (equal? prev-flags flags))
+ (set! prev-flags flags)
+ (menu-redraw menu)))))
(setitimer ITIMER_REAL 1 0 1 0)
(push-cursor (page-cursor-visibility p))
- branch wip-installer updated (c2eaa77 -> e7c2d41), John Darrington, 2017/02/19
- 06/07: installer: Return to network page after passphrase entry., John Darrington, 2017/02/19
- 01/07: installer: Make the install attempts counter global., John Darrington, 2017/02/19
- 03/07: installer: Specify a pid file for wpa_supplicant., John Darrington, 2017/02/19
- 05/07: installer: Avoid flicker in network page.,
John Darrington <=
- 07/07: installer: Add procudure for starting a wireless interface., John Darrington, 2017/02/19
- 02/07: installer: Kill old dhclient instance before starting new one., John Darrington, 2017/02/19
- 04/07: installer: Create dedicated module to maintainer the page stack., John Darrington, 2017/02/19