From dc9518ee1348faa9eee568419745ffcdca0656bc Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 2 Mar 2010 18:39:15 +0000 Subject: [PATCH] If hidden-timeout=1 is set in gfxboot.cfg, then try to display a splash window before the main window, displaying the contents of access.pcx at the bottom of the screen. If the timeout expires on this screen, then the default menu item will be booted without ever showing the main menu; conversely, any key press will show the main menu. The idea of this is to avoid everyone having to see a complicated main menu, while offering a visual indication that you need to press a key to get to it. --- boot.config | 1 + common.inc | 52 ++++++++++++++++++++++++++++++----------- debian/changelog | 7 ++++++ install.config | 1 + splash.inc | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ timeout.inc | 2 ++ window.inc | 8 +++++-- 7 files changed, 117 insertions(+), 15 deletions(-) create mode 100644 splash.inc diff --git a/boot.config b/boot.config index 9f9c2b0..8a3782e 100644 --- a/boot.config +++ b/boot.config @@ -24,5 +24,6 @@ %% include keytables.inc %% include langnames.inc %% include locale.inc +%% include splash.inc diff --git a/common.inc b/common.inc index 9556fc6..1ba838a 100644 --- a/common.inc +++ b/common.inc @@ -476,26 +476,47 @@ ] def pop } { pop } ifelse + "hidden-timeout" getgfxconfig dup .undef ne { + % display just the main and access logos and wait for a keypress; if + % timeout expires, boot without showing the menu + pop /timeout.hidden true def + } { pop } ifelse + + % Move the logo down 84 pixels to centre it. This is obviously a gross + % hack. To fix this, we need to move to smaller logo images which are + % positioned on the screen in code, rather than doing the positioning in + % the image files. + timeout.hidden { + 0 0 moveto 0 0 0 84 image + 0 84 + } { 0 0 } ifelse + moveto 0 0 clip.size image /menu.args exch def /menu.texts exch def /menu.humans exch def - window.main - dup window.init - window.show + timeout.hidden { + window.splash + dup window.init + window.show + } { + window.main + dup window.init + window.show - 32+64bit_source not { + 32+64bit_source not { - 64bit { - 64bit_source not { notimeout 32bit_popup } if - } { - 64bit_source { notimeout 64bit_popup } if - } ifelse + 64bit { + 64bit_source not { notimeout /timeout.hidden false def 32bit_popup } if + } { + 64bit_source { notimeout /timeout.hidden false def 64bit_popup } if + } ifelse - } if + } if - lang.displayed not { panel.lang } if + lang.displayed not { panel.lang } if + } ifelse 50 sound.setvolume "startup.mod" findfile dup .undef ne { @@ -925,8 +946,6 @@ } def /init { - 0 0 moveto currentpoint clip.size image - small_layout { /head.x 70 def /head.y 141 def @@ -1321,6 +1340,13 @@ /small_layout screen.size pop 640 eq def +/access.file "access.pcx" findfile def +access.file dup .undef ne { + setimage image.size /access.height exch def /access.width exch def +} { + pop /access.height .undef def /access.height .undef def +} ifelse + "splash.pcx" findfile dup .undef eq { pop "back.jpg" findfile } if /background.file over def setimage loadpalette diff --git a/debian/changelog b/debian/changelog index 09aa947..396d2c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,13 @@ gfxboot-theme-ubuntu (0.9.3) UNRELEASED; urgency=low * Change "Ubuntu Netbook Remix" strings to "Ubuntu Netbook" (LP: #518718). Adjust translations where I could do so accurately. * Remove unused imgsize, showlogo, and readimage functions. + * If hidden-timeout=1 is set in gfxboot.cfg, then try to display a splash + window before the main window, displaying the contents of access.pcx at + the bottom of the screen. If the timeout expires on this screen, then + the default menu item will be booted without ever showing the main menu; + conversely, any key press will show the main menu. The idea of this is + to avoid everyone having to see a complicated main menu, while offering + a visual indication that you need to press a key to get to it. -- Colin Watson Thu, 25 Feb 2010 12:48:21 +0000 diff --git a/install.config b/install.config index bce61e3..bab169c 100644 --- a/install.config +++ b/install.config @@ -24,4 +24,5 @@ %% include keytables.inc %% include langnames.inc %% include locale.inc +%% include splash.inc diff --git a/splash.inc b/splash.inc new file mode 100644 index 0000000..0b2ecda --- /dev/null +++ b/splash.inc @@ -0,0 +1,61 @@ +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% +% Splash screen (hidden-timeout mode). +% +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Create new splash window. +% +% ( ) ==> ( window ) +% +/window.splash { + widget.size array + dup .type t_splash put +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Initialize splash window. +% +% ( window ) ==> ( ) +% +/splash.init { + pop +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Draw splash window. +% +% ( window ) ==> ( ) +% +/splash.show { + window.push + + access.file dup .undef ne { + setimage + screen.size exch access.width sub 2 div exch access.height sub + moveto 0 0 access.width access.height image + + background.file setimage + } { pop } ifelse +} def + + +% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +% Handle keyboard input. +% +% ( key_in ) ==> ( key_out ) +% +/splash.input { + /timeout.hidden false def + 0 0 moveto background.file setimage 0 0 image.size image + window.done + window.main + dup window.init + window.show + lang.displayed not { panel.lang } if + pop 0 +} def diff --git a/timeout.inc b/timeout.inc index a1c9453..7589a37 100644 --- a/timeout.inc +++ b/timeout.inc @@ -12,6 +12,7 @@ timeout.seconds timeout.current eq { return } if /timeout.current timeout.seconds def + timeout.hidden { return } if white setcolor @@ -43,3 +44,4 @@ /timeout.x { head.x } def /timeout.y { head.y } def +/timeout.hidden false def diff --git a/window.inc b/window.inc index 34d195c..8163c81 100644 --- a/window.inc +++ b/window.inc @@ -101,8 +101,9 @@ % window types /t_dialog 100 def /t_help 101 def -/t_main 102 def -/t_xmenu 103 def +/t_splash 102 def +/t_main 103 def +/t_xmenu 104 def % actions /actNothing 0 def @@ -151,6 +152,7 @@ window.current .type get dup t_dialog eq { exch dialog.input exch } if dup t_help eq { exch help.input exch } if + dup t_splash eq { exch splash.input exch } if dup t_main eq { exch main.input exch } if dup t_xmenu eq { exch xmenu.input exch } if pop @@ -181,6 +183,7 @@ dup .type get dup t_dialog eq { pop dialog.init return } if dup t_help eq { pop help.init return } if + dup t_splash eq { pop splash.init return } if dup t_main eq { pop main.init return } if dup t_xmenu eq { pop xmenu.init return } if pop @@ -196,6 +199,7 @@ dup .type get dup t_dialog eq { pop dialog.show return } if dup t_help eq { pop help.show return } if + dup t_splash eq { pop splash.show return } if dup t_main eq { pop main.show return } if dup t_xmenu eq { pop xmenu.show return } if pop