Tool for laying out displays on Linux
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
1.0 KiB

<?php
namespace App;
class Screen
{
protected $_outputs;
protected $_driver;
public function __construct(array $outputs, ILayoutDriver $driver)
{
$this->_outputs = $outputs;
$this->_driver = $driver;
}
protected function getOutputName(): ?string
{
foreach ($this->_outputs as $output)
{
if ($this->_driver->isConnected($output))
return $output;
}
return null;
}
public function isConnected(): bool
{
return !empty($this->getOutputName());
}
public function isPrimary(): bool
{
return $this->_driver->isPrimary($this->getOutputName());
}
public function getDimensions(): array
{
return $this->_driver->getDimensions($this->getOutputName());
}
public function getOffset(): array
{
return $this->_driver->getOffset($this->getOutputName());
}
public function setOffset(int $x, int $y): void
{
$this->_driver->setOffset($this->getOutputName(), $x, $y);
}
public function setDimensions(int $w, int $h): void
{
$this->_driver->setDimensions($this->getOutputName(), $w, $h);
}
}