summaryrefslogtreecommitdiff
path: root/themes/SuSE/dia_video.inc
diff options
context:
space:
mode:
Diffstat (limited to 'themes/SuSE/dia_video.inc')
-rw-r--r--themes/SuSE/dia_video.inc192
1 files changed, 192 insertions, 0 deletions
diff --git a/themes/SuSE/dia_video.inc b/themes/SuSE/dia_video.inc
new file mode 100644
index 0000000..73f4c12
--- /dev/null
+++ b/themes/SuSE/dia_video.inc
@@ -0,0 +1,192 @@
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+%
+% Video mode selection dialog.
+%
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Some global vars.
+%
+% We have kernel splash images for at least these sizes.
+/video.splashsizes [
+ 640 480
+ 800 600
+ 1024 768
+ 1280 1024
+] def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Create sort key for video modes.
+%
+% ( vm_index ) ==> ( sort_index )
+%
+/vmsortindex {
+ video.modes.list exch get
+ dup
+ 1 get 16 shl
+ exch 2 get add
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Swap video mode entries.
+% (Helper for video mode sorting.)
+%
+% ( vm_index_1 vm_index_2 ) ==> ( )
+%
+/vmsortexch {
+ over video.modes.list exch get
+ over video.modes.list exch get
+ video.modes.list
+ 5 -1 roll rot put
+ video.modes.list 3 1 roll put
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Check if we have a splash in that resolution.
+%
+% ( video_mode_list_entry ) ==> ( true|false )
+%
+/video.havesplash {
+ false exch
+
+ 0 2 video.splashsizes length 1 sub {
+ over over over
+ 2 get rot 1 get rot video.splashsizes exch get eq
+ rot 1 add video.splashsizes exch get rot eq and
+ { exch pop true exch exit } if
+ } for
+
+ pop
+
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Build video mode list.
+%
+% ( ) ==> ( )
+%
+/video.init {
+ /xmenu.video .xm_size array def
+
+ /xmenu xmenu.video def
+
+ videomodes 1 add dup array /video.modes.text exch def array /video.modes.list exch def
+ xmenu .xm_list video.modes.text put
+
+ % add text mode entry
+
+ % [ mode width height supported ]
+ video.modes.list 0 [ 0 0 0 1 ] put
+
+ videomodes 0 gt {
+ 0 1 videomodes 1 sub {
+ video.modes.list exch [ over getvideomode ] exch 1 add exch put
+ } for
+ } if
+
+ % sort video.modes.list
+
+ video.modes.list length 1 gt {
+ 0 1 video.modes.list length 2 sub {
+ dup 1 add 1 video.modes.list length 1 sub {
+ over vmsortindex over vmsortindex gt {
+ over over vmsortexch
+ } if
+ pop
+ } for
+ pop
+ } for
+ } if
+
+ % create mode strings
+
+ 0 1 video.modes.list length 1 sub {
+ video.modes.text exch
+ dup video.modes.list exch get
+ dup 1 get 0 eq {
+ pop "Text Mode" put
+ } {
+ 32 string dup rot
+ dup 2 get exch 1 get
+ "%d x %d" 32 5 -1 roll snprintf
+ put
+ } ifelse
+ } for
+
+ % select first mode
+ xmenu .xm_current 0 put
+
+ % select largest mode the monitor supports
+
+ 0 1 video.modes.list length 1 sub {
+ video.modes.list over get
+ dup 3 get 0 gt exch video.havesplash and {
+ xmenu .xm_current rot put
+ } {
+ pop
+ } ifelse
+ } for
+
+ pmenu.init
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Update video mode.
+%
+% ( ) ==> ( )
+%
+/video.update {
+ /xmenu xmenu.video def
+
+ /window.action actRedrawPanel def
+
+ pmenu.update
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Show video menu.
+%
+% ( ) => ( )
+%
+/panel.video {
+ "videomode" help.setcontext
+
+ window.xmenu
+ dup .xmenu xmenu.video put
+ dup .xmenu.update /video.update put
+ dup window.init
+ window.show
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Return width of video entry.
+%
+% ( ) => ( width )
+%
+/panel.video.width {
+ /xmenu xmenu.video def
+
+ pmenu.width
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Redraw panel entry.
+%
+% ( panel ) => ( )
+%
+/panel.video.update {
+ /xmenu xmenu.video def
+
+ pmenu.panel.update
+} def
+
+