Пример #1
0
    /**
     * This just creates a default window.
     */
    Window::Window(int existingWindowId) : 
      isDisposed(false), window(NULL), iWindowId(-1),
      iOldWindowId(0), iCurrentControlId(3000), bModal(false), m_actionEvent(true),
      canPulse(false), existingWindow(true), destroyAfterDeInit(false)
    {
      XBMC_TRACE;
      SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);

      if (existingWindowId == -1)
      {
        // in this case just do the other constructor.
        canPulse = true;
        existingWindow = false;

        setWindow(new Interceptor<CGUIWindow>("CGUIWindow",this,getNextAvailableWindowId()));
      }
      else
      {
        // user specified window id, use this one if it exists
        // It is not possible to capture key presses or button presses
        CGUIWindow* pWindow = g_windowManager.GetWindow(existingWindowId);
        if (!pWindow)
          throw WindowException("Window id does not exist");

        setWindow(new ProxyExistingWindowInterceptor(pWindow));
      }
    }
Пример #2
0
int cellGcmSetPrepareFlip(mem_ptr_t<CellGcmContextData> ctxt, u32 id)
{
	cellGcmSys.Log("cellGcmSetPrepareFlip(ctx=0x%x, id=0x%x)", ctxt.GetAddr(), id);

	if(id >= 8)
	{
		return CELL_GCM_ERROR_FAILURE;
	}

	GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH);

	u32 current = re(ctxt->current);
	u32 end = re(ctxt->end);

	if(current + 8 >= end)
	{
		ConLog.Warning("bad flip!");
		cellGcmCallback(ctxt.GetAddr(), current + 8 - end);
	}

	current = re(ctxt->current);
	Memory.Write32(current, 0x3fead | (1 << 18));
	Memory.Write32(current + 4, id);
	re(ctxt->current, current + 8);

	if(ctxt.GetAddr() == gcm_info.context_addr)
	{
		CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
		re(ctrl.put, re(ctrl.put) + 8);
	}

	return id;
}
Пример #3
0
 long Window::getWidth()
 {
   XBMC_TRACE;
   SingleLockWithDelayGuard gslock(g_graphicsContext, languageHook);
   RESOLUTION_INFO resInfo = ref(window)->GetCoordsRes();
   return resInfo.iWidth;
 }
Пример #4
0
 void Window::addControls(std::vector<Control*> pControls)
 {
   XBMC_TRACE;
   SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);
   int count = 1; int size = pControls.size();
   for (std::vector<Control*>::iterator iter = pControls.begin(); iter != pControls.end(); count++, ++iter)
     doAddControl(*iter,NULL, count == size);
 }
Пример #5
0
 String Window::getProperty(const char* key)
 {
   XBMC_TRACE;
   SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);
   std::string lowerKey = key;
   StringUtils::ToLower(lowerKey);
   std::string value = ref(window)->GetProperty(lowerKey).asString();
   return value;
 }
Пример #6
0
    void Window::setProperty(const char* key, const String& value)
    {
      XBMC_TRACE;
      SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);
      std::string lowerKey = key;
      StringUtils::ToLower(lowerKey);

      ref(window)->SetProperty(lowerKey, value);
    }
Пример #7
0
    void Window::setCoordinateResolution(long res)
    {
      XBMC_TRACE;
      if (res < RES_HDTV_1080i || res > RES_AUTORES)
        throw WindowException("Invalid resolution.");

      SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);
      ref(window)->SetCoordsRes(g_graphicsContext.GetResInfo((RESOLUTION)res));
    }
Пример #8
0
 long Window::getFocusId()
 {
   XBMC_TRACE;
   SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);
   int iControlId = ref(window)->GetFocusedControlID();
   if(iControlId == -1)
     throw WindowException("No control in this window has focus");
   return (long)iControlId;
 }
Пример #9
0
    void Window::clearProperty(const char* key)
    {
      XBMC_TRACE;
      if (!key) return;
      SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);

      std::string lowerKey = key;
      StringUtils::ToLower(lowerKey);
      ref(window)->SetProperty(lowerKey, "");
    }
Пример #10
0
    Control* Window::getFocus()
    {
      XBMC_TRACE;
      SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);

      int iControlId = ref(window)->GetFocusedControlID();
      if(iControlId == -1)
        throw WindowException("No control in this window has focus");
      // Sine I'm already holding the lock theres no reason to give it to GetFocusedControlID
      return GetControlById(iControlId,NULL);
    }
Пример #11
0
int cellGcmCallback(u32 context_addr, u32 count)
{
	GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH); // could stall on exit

	CellGcmContextData& ctx = (CellGcmContextData&)Memory[context_addr];
	CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];

	const s32 res = ctx.current - ctx.begin - ctrl.put;

	if(res > 0) Memory.Copy(ctx.begin, ctx.current - res, res);

	ctx.current = ctx.begin + res;

	ctrl.put = res;
	ctrl.get = 0;
	
	return CELL_OK;
}
Пример #12
0
 void Window::clearProperties()
 {
   XBMC_TRACE;
   SingleLockWithDelayGuard gslock(g_graphicsContext,languageHook);
   ref(window)->ClearProperties();
 }
Пример #13
0
    void Window::dispose()
    {
      XBMC_TRACE;

      //! @todo rework locking
      // Python GIL and g_graphicsContext are deadlock happy
      // dispose is called from GUIWindowManager and in this case DelayGuard must not be used.
      if (!g_application.IsCurrentThread())
      {
        SingleLockWithDelayGuard gslock(g_graphicsContext, languageHook);
      }

      if (!isDisposed)
      {
        isDisposed = true;

        // no callbacks are possible any longer
        //   - this will be handled by the parent constructor

        // first change to an existing window
        if (!existingWindow)
        {
          if (ACTIVE_WINDOW == iWindowId && !g_application.m_bStop)
          {
            if(g_windowManager.GetWindow(iOldWindowId))
            {
              g_windowManager.ActivateWindow(iOldWindowId);
            }
            // old window does not exist anymore, switch to home
            else g_windowManager.ActivateWindow(WINDOW_HOME);
          }

        }
        else
        {
          //! @bug
          //! This is an existing window, so no resources are free'd.  Note that
          //! THIS WILL FAIL for any controls newly created by python - they will
          //! remain after the script ends.  Ideally this would be remedied by
          //! a flag in Control that specifies that it was python created - any python
          //! created controls could then be removed + free'd from the window.
          //! how this works with controlgroups though could be a bit tricky.
        }

        // and free our list of controls
        std::vector<AddonClass::Ref<Control> >::iterator it = vecControls.begin();
        while (it != vecControls.end())
        {
          AddonClass::Ref<Control> pControl = *it;
          // initialize control to zero
          pControl->pGUIControl = NULL;
          pControl->iControlId = 0;
          pControl->iParentId = 0;
          ++it;
        }

        if (!existingWindow)
        {
          if (window)
          {
            if (g_windowManager.IsWindowVisible(ref(window)->GetID()))
            {
              destroyAfterDeInit = true;
              close();
            }
            else
              g_windowManager.Delete(ref(window)->GetID());
          }
        }

        vecControls.clear();
      }
    }