Exemplo n.º 1
0
void Compositor::create()
{
    setRetainedSelectionEnabled(true);

    QWaylandCompositor::create();

    // Add a valid mode for the output
    QWaylandOutput *output = defaultOutput();
    QWaylandOutputMode defaultMode(QSize(output->window()->size()), 25000);
    output->addMode(defaultMode, true);
    output->setCurrentMode(defaultMode);

    QWaylandXdgShell *xdgShell = new QWaylandXdgShell(this);
    //xdgShell->setFocusPolicy(QWaylandShell::ManualFocus);
//    connect(xdgShell, &QWaylandXdgShell::xdgSurfaceCreated, this, &Compositor::onXdgSurfaceCreated);
    connect(xdgShell, &QWaylandXdgShell::toplevelCreated, this, &Compositor::onXdgToplevelCreated);

    connect(this, &QWaylandCompositor::surfaceCreated, this, &Compositor::onSurfaceCreated);

    QQuickWindow *defaultOutputWindow = static_cast<QQuickWindow*>(defaultOutput()->window());
    connect(defaultOutputWindow, &QQuickWindow::afterRendering, this, &Compositor::readContent, Qt::DirectConnection);

    mSurfaceExtension = new QtWayland::SurfaceExtensionGlobal(this);
    connect(mSurfaceExtension, &QtWayland::SurfaceExtensionGlobal::extendedSurfaceReady, this, &Compositor::onExtendedSurfaceReady);

    QtWayland::QtKeyExtensionGlobal *pKeyExtension = new QtWayland::QtKeyExtensionGlobal(this);

    QWaylandXdgDecorationManagerV1 *mXdgDecorationManagerV1 = new QWaylandXdgDecorationManagerV1();
    mXdgDecorationManagerV1->setExtensionContainer(this);
    mXdgDecorationManagerV1->initialize();
    mXdgDecorationManagerV1->setPreferredMode(QWaylandXdgToplevel::ServerSideDecoration);

    mRecorder = new RecorderManager(this);
}
Exemplo n.º 2
0
void Compositor::onXdgToplevelCreated(QWaylandXdgToplevel *toplevel, QWaylandXdgSurface *shellSurface)
//void Compositor::onXdgSurfaceCreated(QWaylandXdgSurface *shellSurface)
{
    unsigned int windowId = mNextWindowId++;
    QWaylandSurface *surface = shellSurface->surface();

    qDebug() << Q_FUNC_INFO << "windowId" << windowId << surface;

    QQuickWindow *defaultOutputWindow = static_cast<QQuickWindow*>(defaultOutput()->window());
    CompositorWindow *window = new CompositorWindow(windowId, defaultOutputWindow->contentItem());

    window->setOutput(defaultOutput()); //useful ?
    window->setFlag(QQuickItem::ItemIsFocusScope, true);
    // window->setUseTextureAlpha(true);

    window->initialize(shellSurface);
    window->setSize(surface->size());
    window->setTouchEventsEnabled(true);

    mWindows.insert(windowId, window);

    connect(window, &CompositorWindow::readyChanged, this, &Compositor::windowIsReady);
    connect(window, &QWaylandQuickItem::surfaceDestroyed, this, &Compositor::onSurfaceDestroyed);

    window->sendWindowIdToClient();
}
Exemplo n.º 3
0
int main(int argc, char* argv[])
{
  bool options [3] = {false, false, false}; //option flags. {human-readable, search, search by criteria}
  string filename = "", criteria = ""; //search criteria
  RankSystem ranksystem;

  if (!ranksystem.sysCheck()) {
    cout << "Failed to read the rank system from rank.conf.\n";
    return 0;
  }

  //Command line argument processing.
  for (int argument = 1; argument < argc; argument++) {
    if ((string) argv[argument] == "-i" 
	|| (string) argv[argument] == "--input") {
      if ((argument+1)<argc) {
	filename = argv[++argument];
      }
      else {helpText(); return 0;}
    }
    else if ((string) argv[argument] == "-h" 
	     || (string) argv[argument] == "--human-readable") {
      options[0] = true;
    }
    else if ((string) argv[argument] == "-s"
	     || (string) argv[argument] == "search") {
      options[1] = true;
    }
    else if ((string) argv[argument] == "-sc" 
	     || (string) argv[argument] == "--search-by-criteria") {
      if ((argument+1)<argc) {
	criteria = argv[++argument];
	options[2] = true;
      }
      else {helpText(); return 0;}
    }
    else {
      helpText();
      return 0;
    }
  }
  Rank rank(options, filename);

  rank.doRanks(ranksystem.getRankInfo());

  if (options[0] && !options[1] && !options[2]) humanOutput(rank.getRankees());
  if (!options[0] && !options[1] && !options[2]) defaultOutput(rank.getRankees());

  return 0;
}
Exemplo n.º 4
0
void Compositor::readContent()
{
    mRecorder->recordFrame(defaultOutput()->window());
}
Exemplo n.º 5
0
bool MEMORY_EEPROM::getNetworkInfo(DeviceInfo *device)
{
    unsigned int i;
    boolean valid = false;
    
    // Read EEPROM data
    for(i=0;i<sizeof(DeviceInfo);i++)
    {
      ((byte*) device)[i] = EEPROM.read(i);
    }

    // Ip Default
    if (device->ip == IPAddress(0xFFFFFFFF))
    {
       defaultOutput(true);
       Serial.println(F("Using Default IP - 192.168.1.200"));
       device->ip = IPAddress(192,168,1,200);
    }

    // Gateway Default
    if (device->gateway == IPAddress(0xFFFFFFFF))
    {
       defaultOutput(true);
       Serial.println(F("Using Default Gateway - 192.168.1.1"));
       device->gateway = IPAddress(192,168,1,1);
    }
    
    // Subnet Default
    if (device->subnet == IPAddress(0xFFFFFFFF))
    {
       defaultOutput(true);
       Serial.println(F("Using Default Subnet IP - 255.255.255.0"));
       device->subnet = IPAddress(255,255,255,0);
    }
    
    // Server Default
    if (device->server == IPAddress(0xFFFFFFFF))
    {
       defaultOutput(true);
       Serial.println(F("Using Default Server - 192.168.1.2"));
       device->server = IPAddress(192,168,1,2);
    }
    
    // Mac Address Default
    if(device->mac[0] != 0x02 || device->mac[1] != 0x08 || device->mac[2] != 0xDC)
    {
       defaultOutput(true);
       Serial.println(F("Using Default Mac Address - 02:08:DC:EF:FE:ED"));
       // Static OUI (Organizationally Unique Identifier)
       device->mac[0] = 0x02;
       device->mac[1] = 0x08;
       device->mac[2] = 0xDC;
       // NIC (Network Interface Controller)
       device->mac[3] = 0xEF;
       device->mac[4] = 0xFE;
       device->mac[5] = 0xED;
    }
    
    // Device Name Default
    valid = false;
    for(i=0;i<MEMORY_DEVICE_NAME_MAX_LENGTH && !valid;i++)
    {
        if((byte) device->deviceName[i] != 0xff)
        {
            valid = true;
        }
    }
    if(!valid)
    {
       defaultOutput(true);
       Serial.println(F("Using Default Name - default"));
       device->deviceName[0] = 'd';
       device->deviceName[1] = 'e';
       device->deviceName[2] = 'f';
       device->deviceName[3] = 'a';
       device->deviceName[4] = 'u';
       device->deviceName[5] = 'l';
       device->deviceName[6] = 't';
       device->deviceName[7] = '\0'; // End char
    }
    
    
    // Device Id Default
    if (device->id == 0xFFFF)
    {
       defaultOutput(true);
       Serial.println(F("Using Default Id - 0"));
       device->id = 0;
    }
    
    defaultOutput(false);
    return true;
}