Beispiel #1
0
    def __init__(self, core: Core, wlr_output: wlrOutput):
        self.core = core
        self.renderer = core.renderer
        self.wlr_output = wlr_output
        wlr_output.data = self
        self.output_layout = self.core.output_layout
        self._damage: OutputDamage = OutputDamage(wlr_output)
        self.wallpaper = None
        self.transform_matrix = wlr_output.transform_matrix
        self.x, self.y = self.output_layout.output_coords(wlr_output)

        self.add_listener(wlr_output.destroy_event, self._on_destroy)
        self.add_listener(self._damage.frame_event, self._on_frame)

        # The layers enum indexes into this list to get a list of surfaces
        self.layers: List[List[Static]] = [
            [] for _ in range(len(LayerShellV1Layer))
        ]

        # This is run during tests, when we want to fix the output's geometry
        if wlr_output.is_headless and "PYTEST_CURRENT_TEST" in os.environ:
            assert len(core.outputs) < 2, "This should not be reached"
            if not core.outputs:
                # First test output
                wlr_output.set_custom_mode(800, 600, 0)
            else:
                # Secound test output
                wlr_output.set_custom_mode(640, 480, 0)
            wlr_output.commit()
Beispiel #2
0
    def _on_new_output(self, _listener, wlr_output: wlrOutput):
        logger.debug("Signal: backend new_output_event")
        if wlr_output.modes != []:
            mode = wlr_output.preferred_mode()
            if mode is None:
                logger.error("New output has no output mode")
                return
            wlr_output.set_mode(mode)
            wlr_output.enable()
            wlr_output.commit()

        self.outputs.append(output.Output(self, wlr_output))
        self.output_layout.add_auto(wlr_output)
Beispiel #3
0
    def server_new_output(self, listener, output: Output) -> None:
        output.init_render(self._allocator, self._renderer)

        if output.modes != []:
            mode = output.preferred_mode()
            if mode is None:
                logger.error("Got no output mode")
                return
            output.set_mode(mode)
            output.enable()
            output.commit()

        self.outputs.append(output)
        self._output_layout.add_auto(output)

        output.frame_event.add(Listener(self.output_frame))
Beispiel #4
0
    def _on_new_output(self, _listener, wlr_output: wlrOutput):
        logger.debug("Signal: backend new_output_event")
        if wlr_output.modes != []:
            mode = wlr_output.preferred_mode()
            if mode is None:
                logger.error("New output has no output mode")
                return
            wlr_output.set_mode(mode)
            wlr_output.enable()
            wlr_output.commit()

        self.outputs.append(Output(self, wlr_output))
        # Put new output at far right
        layout_geo = self.output_layout.get_box()
        self.output_layout.add(wlr_output, layout_geo.width, 0)

        if not self._current_output:
            self._current_output = self.outputs[0]
Beispiel #5
0
    def server_new_output(self, listener, output: Output) -> None:
        if output.modes != []:
            mode = output.preferred_mode()
            if mode is None:
                logger.error("Got no output mode")
                return
            output.set_mode(mode)
            output.enable()

            if not output.commit():
                logger.error("Unable to commit output")
                return

        self.outputs.append(output)
        self._output_layout.add_auto(output)

        output.frame_event.add(Listener(self.output_frame))