summaryrefslogtreecommitdiffstats
path: root/examples/crtc-searching
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-13 20:16:14 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-13 20:16:14 +0100
commit3b283d550eaee8511ccf5ad81cad1a3fd8365a0d (patch)
tree8524da53b4ae1f209c53059487774ecbf429ceaf /examples/crtc-searching
parentupdate todo (diff)
downloadblueshift-3b283d550eaee8511ccf5ad81cad1a3fd8365a0d.tar.gz
blueshift-3b283d550eaee8511ccf5ad81cad1a3fd8365a0d.tar.bz2
blueshift-3b283d550eaee8511ccf5ad81cad1a3fd8365a0d.tar.xz
fix and demo drm support
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples/crtc-searching')
-rw-r--r--examples/crtc-searching7
1 files changed, 5 insertions, 2 deletions
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)