bool QAcceptSocketsThread :: event(QEvent * event)
{
   if (event->type() == QMTT_SIGNAL_EVENT)
   {
      MessageRef next;

      // Check for any new messages from our HTTP thread
      while(GetNextReplyFromInternalThread(next) >= 0)
      {
         switch(next()->what)
         {
            case AST_EVENT_NEW_SOCKET_ACCEPTED:      
            {
               RefCountableRef tag;
               if (next()->FindTag(AST_NAME_SOCKET, tag) == B_NO_ERROR)
               {
                  ConstSocketRef sref(tag, false);
                  if (sref()) emit ConnectionAccepted(sref);
               }
            }
            break;
         }
      }
      return true;
   }
   else return QObject::event(event);
}
Beispiel #2
0
const char *LuaArgs::gets(int idx, const char *key, const char *Default)
{
	if (tbl > 0 && lua_checkstack(L, 1)) {
		lua_getfield(L, tbl, key);
		bool success = lua_isstring(L, -1) != 0;
		if (!success && idx > 0) {
			lua_pop(L, 1);
			lua_pushinteger(L, idx);
			lua_gettable(L, tbl);
			success = lua_isstring(L, -1) != 0;
		}
		if (success)
			Default = sref(-1);
		lua_pop(L, 1);
		return Default;
	} else {
		return gets(idx, Default);
	}
}
Beispiel #3
0
VdpStatus rgba_create(rgba_surface_t *rgba,
                      device_ctx_t *device,
                      uint32_t width,
                      uint32_t height,
                      VdpRGBAFormat format)
{
	if (format != VDP_RGBA_FORMAT_B8G8R8A8 && format != VDP_RGBA_FORMAT_R8G8B8A8)
		return VDP_STATUS_INVALID_RGBA_FORMAT;

	if (width < 1 || width > 8192 || height < 1 || height > 8192)
		return VDP_STATUS_INVALID_SIZE;

	rgba->device = sref(device);
	rgba->width = width;
	rgba->height = height;
	rgba->format = format;

	if (device->osd_enabled)
	{
		rgba->data = cedrus_mem_alloc(device->cedrus, width * height * 4);
		if (!rgba->data)
			return VDP_STATUS_RESOURCES;

		if(!device->g2d_enabled)
			vdp_pixman_ref(rgba);

		rgba->dirty.x0 = width;
		rgba->dirty.y0 = height;
		rgba->dirty.x1 = 0;
		rgba->dirty.y1 = 0;
		rgba_fill(rgba, NULL, 0x00000000);
		rgba->id = 1;
		rgba->gl = 0;
	}

	return VDP_STATUS_OK;
}
Beispiel #4
0
const char *LuaArgs::gets(int idx, const char *Default)
{
	return lua_isstring(L, idx)?
		sref(idx) :
		sref(Default);
}