From 3b283d550eaee8511ccf5ad81cad1a3fd8365a0d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 13 Mar 2014 20:16:14 +0100 Subject: fix and demo drm support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- examples/crtc-searching | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'examples/crtc-searching') diff --git a/examples/crtc-searching b/examples/crtc-searching index c7be89f..0539f0e 100644 --- a/examples/crtc-searching +++ b/examples/crtc-searching @@ -7,6 +7,9 @@ # but `Screen.crtc_count` is much more effective. +# Check if we are in X or TTY. +ttymode = not (('DISPLAY' in os.environ) and (':' in os.environ['DISPLAY'])) + # We want to use the ad-hoc mode options. uses_adhoc_opts = True @@ -52,7 +55,7 @@ if parser.opts['--help'] is not None: # Find CRTC:s. -screens = list_screens() +screens = list_screens('drm' if ttymode else 'randr') outputs = [] # Find CRTC:s by name. @@ -79,5 +82,5 @@ for output in outputs: gamma(*gamma_) # Apply adjustments. - randr(output.crtc, screen = output.screen) + (drm if ttymode else randr)(output.crtc, screen = output.screen) -- cgit v1.2.3-70-g09d2