View Ticket
Not logged in
Ticket Hash: f2c506c85a149b5f3cdebcbd2efefbba0bda8699
Title: Rendering in fullscreen landscape orientation
Status: Open Type: Incident
Severity: Cosmetic Priority: Low
Subsystem: Resolution: Open
Last Modified: 2019-03-13 01:00:55
Version Found In: f7afb8246e
User Comments:
anonymous added on 2019-03-12 18:45:15:
Android display setting: rotate screen
App has android:launchMode="singleInstance" and shows sdk.version 23

Built with bones f7afb8246e

App is activated (Desktop icon) and withdrawn (Key-Break) repeatedly.
Sometimes (<10%) the fullscreen window is not rendered when activated in landscape screen orientation.
App however is responsive - the exit button works -.
Device rotated clockwise: sometimes window has y-offset from top.
Device rotated anti-clockwise: sometimes window has x-offset from left, and very rarely window is rendered in both orientations side by side.
The offsets always appear when window is withdrawn in portrait orientation and device is rotated before app activation.

main.tcl
  package require Tk
  package require Borg
  array set ::os [borg osbuildinfo]
  set ::will 0
  set ::did 0
  set ::now 0
  set ::p_geo {}
  proc myclock {} {
  	set ::now [clock format [clock seconds] -format %H:%M:%S]
  	after 1000 {myclock}
  }
  myclock
  proc get_orientation {} {
  	array set dime [borg displaymetrics]
  	set ::w $dime(width)
  	set ::h $dime(height)
  	set ::portrait [expr {$::w < $::h}]
  	set ::portrait_old $::portrait
  	bind . <Configure>  {check_orientation %a %m %w %h}
  }
  proc check_orientation {a m w h} {
  	#borg log debug geo "check_orientation: a=$a m=$m w=$w h=$h"
  	set ::geo [wm geometry .]
  	array set dime [borg displaymetrics]
  	set ::w $dime(width)
  	set ::h $dime(height)
  	set ::rect [format "W x H : %d x %d" $::w $::h]
  	set ::portrait [expr {$::w < $::h}]
  	if {$::portrait != $::portrait_old} {
  		set ::portrait_old $::portrait
  		sdltk root 0 0
  		wm attributes . -fullscreen 1
  		set ::p_geo [format "%d %s" $::portrait $::rect]
  	}
  }
  proc my_withdraw {} {
  	if {!$::portrait} {
  		bind . <Configure> {}
  		pack forget .f
  		#after idle {wm attributes . -fullscreen 0}
  		#after idle {borg screenorientation portrait}
  		#after idle {sdltk root 0 0}
  		#after idle {wm geo . +0+0}
  		wm attributes . -fullscreen 0
  		borg screenorientation portrait
  		sdltk root 0 0
  		wm geo . +0+0
  	}
  	borg withdraw
  }
  proc my_willenter {} {
  	# make rotation sensitive again
  	borg screenorientation unspecified
  	incr ::will
  }
  proc my_didenter {} {
  	wm attributes . -fullscreen 1
  	pack .f -fill both -expand 1 -padx 2 -pady 2
  	if {0} {
  		# this increases probability of misplacement
  		after 1000 {bind . <Configure>  {check_orientation %a %m %w %h}}
  	} else {
  		bind . <Configure>  {check_orientation %a %m %w %h}
  	}
  	incr ::did
  }
  proc main {} {
  	sdltk textinput off
  	sdltk touchtranslate 0
  	wm attributes . -fullscreen 1
  	. configure -bg lightgreen
  	frame .f
  	pack [label .f.left -text { } -bg hotpink] -side left -fill y
  	pack [label .f.right -text { } -bg hotpink] -side right -fill y
  	set ::geo [wm geo .]
  	pack [label .f.geo -textvariable ::geo -bg bisque] -side top -fill x
  	frame .f.wd -bg silver
  	pack [label .f.wd.lwill -text ::will] -side left
  	pack [label .f.wd.will -textvariable ::will -bg white] -side left
  	pack [label .f.wd.ldid -text ::did] -side left
  	pack [label .f.wd.did -textvariable ::did -bg white] -side left
  	pack .f.wd -side top -fill x
  
  	pack [label .f.ti -text [clock format [clock seconds] -format "start: %H:%M:%S"] -bg skyblue] -side top
  	pack [label .f.now -textvariable ::now -bg white] -side top
  	pack [label .f.sdk -text "sdk.version $::os(version.sdk)" -bg white] -side top -fill x
  
  	set ::portrait -1
  	frame .f.o
  	pack [label .f.o.lorient -text portrait] -side left
  	pack [label .f.o.orient -textvariable ::p_geo -bg white] -side left
  	pack .f.o -side top -fill x
  
  	pack [label .f.footer -text bottom -fg white -bg green] -side bottom -fill x
  	pack [button .f.hide -text exit -command {exit}] -side bottom -fill both -expand 1
  
  	pack .f -fill both -expand 1 -padx 4 -pady 4
  	bind . <Key-Break> {my_withdraw}
  	bind . <<WillEnterForeground>> {my_willenter}
  	bind . <<DidEnterForeground>> {my_didenter}
  	after idle {get_orientation}
  }
  main

chw added on 2019-03-13 01:00:55:
It is not clear to me what your code should achieve and demonstrate.
IMO it's no good idea to do "sdltk root 0 0" arbitrarily since you
didn't change the root window anyway. Also there are lots of redundant
"wm attribute . -fullscreen", and so on. Finally, things are device
dependent, at least to make it more complicated. On my 10" tablet
(after removing the aforementioned things), it works. However, it's
not exactly brand new and reports API 19.