add PLT_DISPLAY_BACKING_SCALE

Also, fix conversion of @2x bitmaps to pixbufs at 2.0 scale.
This commit is contained in:
Matthew Flatt 2015-08-03 18:47:20 -06:00
parent 63b27a8eeb
commit 54de09f30e
4 changed files with 16 additions and 2 deletions

BIN
dconf/user Normal file

Binary file not shown.

View File

@ -1024,4 +1024,10 @@ reported size of a window to be different than a size to which a
window has just been set. A ``point'' for font sizing is equivalent
to @racket[(/ 96 72)] drawing units.
On Unix, if the @indexed-envvar{PLT_DISPLAY_BACKING_SCALE} environment
variable is set to a positive real number, then it overrides any
system setting for @racketmodname[racket/gui] scaling. Menus, control
labels using the default label font, and non-label control parts will
not use the specified scale, however.
@history[#:changed "1.14" @elem{Added support for scaling on Unix.}]

View File

@ -55,7 +55,7 @@
(define-values (bm unscaled? usw ush)
(cond
[(= scale 1.0) (values orig-bm #f w h)]
[(= scale (send orig-bm get-backing-scale)) (values orig-bm #t w h)]
[(= scale (send orig-bm get-backing-scale)) (values orig-bm #t sw sh)]
[else (values (rescale orig-bm scale) #f sw sh)]))
(send bm get-argb-pixels 0 0 usw ush str #f #:unscaled? unscaled?)
(let ([mask (send bm get-loaded-mask)])

View File

@ -6,9 +6,17 @@
(provide get-interface-scale-factor)
(define (get-interface-scale-factor display-num)
(or (get-gnome-interface-scale-factor)
(or (get-environment-variable-scale-factor)
(get-gnome-interface-scale-factor)
1.0))
(define (get-environment-variable-scale-factor)
(define s (getenv "PLT_DISPLAY_BACKING_SCALE"))
(define n (and s (string->number s)))
(and (rational? n)
(positive? n)
(exact->inexact n)))
(define interface-settings
(let ([interface-schema "org.gnome.desktop.interface"])
(delay