PLUGIN_API void Berkelium_destroy()
{
	--refCount;

	if(refCount == 0)
	{
		cerr << "Last reference to Berkelium destroyed: destroying the library" << endl;

		// Destroy the windows that still exist
		// Note: we update Berkelium after each destroy to ensure no messages are left in the message loop
		for(WindowMap::iterator it = windows.begin(); it != windows.end(); ++it)
		{
			delete it->second;
			Berkelium::update();
		}
		windows.clear();

		// Close the berkelium backend
		Berkelium::destroy();
		cerr << "... done destroying Berkelium" << endl;

		// Close the log file
		fclose(stderr);
	}
}
PLUGIN_API void Berkelium_Window_destroy(int windowID)
{
	WindowMap::iterator it = windows.find(windowID);
	if(it != windows.end())
	{
		delete it->second;
		windows.erase(it);
	}
}
UnityBerkeliumWindow *getWindow(int id)
{
	WindowMap::const_iterator it = windows.find(id);
	if(it == windows.end())
	{
		cerr << "Warning: no berkelium window found with ID " << id << "!" << endl;
		return 0;
	}

	return it->second;
}
Пример #4
0
EXPORT_CDECL(HICON) GetWindowIcon(HWND window, UINT32 size) {
  WindowMap::iterator iter = sWindowData.find(window);
  if (iter == sWindowData.end()) {
    if (IsTaskbarWindow(window)) {
      UpdateWindowData(window);
    }
    return nullptr;
  }
  if (size > 20 && iter->second.largeIcon != nullptr) {
    return iter->second.largeIcon;
  }
  return iter->second.smallIcon;
}
PLUGIN_API bool Berkelium_Window_create(int uniqueID, float *colors, bool transparency, int width, int height, char *url)
{
	if(windows.find(uniqueID) != windows.end())
	{
		cerr << "Error: a berkelium window with ID " << uniqueID << " already exists!" << endl;
		return false;
	}

	UnityBerkeliumWindow *pWindow = new UnityBerkeliumWindow(uniqueID, colors, transparency, width, height, url);

	cerr << "Berkelium window created: " << pWindow << " (size=" << width << ", " << height << "; url=" << url << ")" << endl;
	windows[uniqueID] = pWindow;

	return true;
}
Пример #6
0
void WindowMonitor::RunWindowMaintenance() {
  for (WindowMap::iterator iter = sWindowData.begin(); iter != sWindowData.end();) {
    if (!IsTaskbarWindow(iter->first)) {
      iter = sWindowData.erase(iter);
      continue;
    }

    if (iter->second.updateDuringMaintenance) {
      iter->second.updateDuringMaintenance = false;
      UpdateWindowData(iter->first);
    }

    ++iter;
  }
}
/// Получение окна
  Window& GetWindow (size_t id)
  {
    try
    {
      WindowMap::iterator iter = windows.find (id);

      if (iter == windows.end ())
        throw xtl::make_argument_exception ("", "window_id", id, "No window with such id");

      return *iter->second;
    }
    catch (xtl::exception& e)
    {
      e.touch ("render::scene::server::WindowManager::Impl::GetWindow");
      throw;
    }
  }
PLUGIN_API bool Berkelium_Window_create(int uniqueID, float *colors, int width, int height, char *url) // changed void* to float* since we know we're passing floats
{
	if(windows.find(uniqueID) != windows.end())
	{
		cerr << "Error: a berkelium window with ID " << uniqueID << " already exists!" << endl;
		return false;
	}

	// Unity uses floats for colors
	float *data = reinterpret_cast<float *>(colors);

	UnityBerkeliumWindow *pWindow = new UnityBerkeliumWindow(uniqueID, data, width, height, url);

	cerr << "Berkelium window created: " << pWindow << " (size=" << width << ", " << height << "; url=" << url << ")" << endl;
	windows[uniqueID] = pWindow;

	return true;
}
PLUGIN_API void Berkelium_destroy()
{
	--refCount;

	if(refCount == 0)
	{
		// Destroy the windows that still exist
		for(WindowMap::iterator it = windows.begin(); it != windows.end(); ++it)
			delete it->second;
		windows.clear();

		// Close the berkelium backend
		Berkelium::destroy();

		// Close the log file
		fclose(stderr);
	}
}
UnityBerkeliumWindow *getWindow(int id)
{
	WindowMap::const_iterator it = windows.find(id);
	return (it == windows.end()) ? 0 : it->second;
}