using namespace display_server;
-/*
- 1. MyCompositor and DSCompositor are created.
- 2. DSCompositor probes the InputDevice and the OutputDevice at the creation time.
- 3. DSCompositor sends the InputAdd/Remove signals and the OutputAdd/Remove signal.
- 4. MyCompositor gets those signals and set up outputs and inputs.
- 5. MyCompositor configures the canvases with zones and outputs.
- 6. MyCompositor configures the the seats with zones.
-*/
-
-// DSCompositor ()
-// initialization/deinitialize TDM
-// initialization/deinitialize libinput
-// initialization/deinitialize wl_server
-// initialization event_loop
-// call the output callbacks ( OutputAdd, OutputRemove, OutputResolutionSet)
-// call the output callbacks ( InputAdd, InputRemove )
-// plugins loading???
-
-// policyArea or screenArea ?
-// policyRegion or screenRegion ?
-// policyZone or screenZone ?
-// displayArea or outputArea ?
-// displayRegion or outputRegion ?
-// displayZone or outputZone ?
-
-// DSCompositor listen signals. OutputAdd/Remove/ResolutionSet and InputAdd/Remove.
-// compositor->connectSignal(DSOuptut::ADD_SIGNAL, DSCompositor::OutputAdd);
-// compositor->connectSignal(IDSOutput::REMOVE_SIGNAL, DSCompositor::OutputRemove);
-// compositor->connectSignal(IDSOutput::RESOLUTION_SET_SIGNAL, DSCompositor::OutputResolutionSet);
-// compositor->connectSignal(DSInput::ADD_SIGNAL, DSCompositor::InputAdd);
-// compositor->connectSignal(DSInput::REMOVE_SIGNAL, DSCompositor::InputRemove);
-
+// MyCompositor has to inherit DSCompositor.
class MyCompositor : public DSCompositor
{
public:
virtual ~MyCompositor()
{}
+ // The _onInitialized is called when the DSCompositor is ready to run.
+ // Make a seat and a policy area. Attach the seat to the policy area.
+ // Attach the policy area and the display area to canvas and return it.
std::shared_ptr<DSCanvas> _onInitialized() override
{
int width = __displayArea->getWidth();
return __canvas;
}
+ // The _onOutputAdded is called when the IDSOutput is added.
void _onOutputAdded(std::shared_ptr<IDSOutput> output) override
{
// set the resolution.
__displayArea = std::make_shared<DSDisplayArea>(output);
}
+ // The _onOutputAdded is called when the IDSOutput is removed.
void _onOutputRemoved(std::shared_ptr<IDSOutput> output) override
{
__displayArea.reset(); // delete shared_ptr
}
+ // TODO:
void _onInputAdded(std::shared_ptr<DSInput> input) override
- {
- }
+ {}
+ // TODO:
void _onInputRemoved(std::shared_ptr<DSInput> input) override
- {
- }
+ {}
private:
std::shared_ptr<DSCanvas> __canvas;