summaryrefslogtreecommitdiffstats
path: root/examples/threaded
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-14 03:06:20 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-14 03:08:02 +0100
commit581dbd784a5f6bdd1b064e44e27066ce687f5dd8 (patch)
tree47ea9153c1079ea6abe53b043451ab2efba6cd6b /examples/threaded
parentreduce allocations in drm (diff)
downloadblueshift-581dbd784a5f6bdd1b064e44e27066ce687f5dd8.tar.gz
blueshift-581dbd784a5f6bdd1b064e44e27066ce687f5dd8.tar.bz2
blueshift-581dbd784a5f6bdd1b064e44e27066ce687f5dd8.tar.xz
add ttymode support for all examples missing it and uses randr or vidmode, except the xmonad example becuase xmonad does not run in tty1.10
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--examples/threaded7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/threaded b/examples/threaded
index e70d33e..68914ec 100644
--- a/examples/threaded
+++ b/examples/threaded
@@ -70,7 +70,8 @@ interpol, purify = None, None
fade_ = None
# randr is not threadsafe, and absolutely not if you have multiple screens.
-# This semaphore is used to make sure that two threads are not accessing randr at the same time.
+# drm can be threadsafe but is by default not.
+# This semaphore is used to make sure that two threads are not accessing randr or drm at the same time.
flush_semaphore = threading.Semaphore()
@@ -103,7 +104,7 @@ def adjust(m):
# Flush settings to monitor.
flush_semaphore.acquire()
- randr(m)
+ (drm if ttymode else randr)(m)
flush_semaphore.release()
# Signal thread completion.
@@ -185,7 +186,7 @@ def reset():
gamma(gamma_red[m], gamma_green[m], gamma_blue[m])
# Flush settings to monitor.
- randr(m)
+ (drm if ttymode else randr)(m)
# Set transition time, 0 on high day and 5 seconds on high night.