Пример #1
0
func (r *Runtime) init() {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	r.goid = goid.Get()

	r.jsrt = C.JS_NewRuntime(C.uint32(r.maxbytes))
	if r.jsrt == nil {
		r.initChan <- false
		return
	}

	r.workChan = make(chan jswork, 20)
	r.closeChan = make(chan int, 1)
	r.ctxDisposeChan = make(chan *Context, 50)
	r.objDisposeChan = make(chan *Object, 100)
	r.aryDisposeChan = make(chan *Array, 100)
	r.valDisposeChan = make(chan *Value, 100)
	r.sptDisposeChan = make(chan *Script, 100)

	runtime.SetFinalizer(r, func(r *Runtime) {
		r.Dispose()
	})

	r.initChan <- true

L:
	for {
		select {
		case work := <-r.workChan:
			work.callback()
			work.resultChan <- 1
		case ctx := <-r.ctxDisposeChan:
			C.JS_DestroyContext(ctx.jscx)
		case obj := <-r.objDisposeChan:
			C.JS_RemoveObjectRoot(obj.cx.jscx, &obj.obj)
		case ary := <-r.aryDisposeChan:
			C.JS_RemoveObjectRoot(ary.cx.jscx, &ary.obj)
		case val := <-r.valDisposeChan:
			C.JS_RemoveValueRoot(val.cx.jscx, &val.val)
		case spt := <-r.sptDisposeChan:
			C.JS_RemoveObjectRoot(spt.cx.jscx, &spt.obj)
		case _ = <-r.closeChan:
			break L
		}
	}

	C.JS_DestroyRuntime(r.jsrt)
}
Пример #2
0
// MessageOpen creates a new MessageChannel
func MessageOpen(proto uint32) MessageChannel {
	return C.Message_Open(C.uint32(proto))
}
Пример #3
0
//export preConnect
func preConnect(instance *C.freerdp) C.boolean {
	settings := instance.settings
	context := (*rdpContext)(unsafe.Pointer(instance.context))

	settings.hostname = C.CString(*context.settings.hostname)
	settings.username = C.CString(*context.settings.username)
	settings.password = C.CString(*context.settings.password)
	settings.width = C.uint32(context.settings.width)
	settings.height = C.uint32(context.settings.height)

	settings.port = C.uint32(3389)
	settings.ignore_certificate = C.boolean(1)

	settings.performance_flags = (C.PERF_DISABLE_WALLPAPER | C.PERF_DISABLE_THEMING | C.PERF_DISABLE_MENUANIMATIONS | C.PERF_DISABLE_FULLWINDOWDRAG)

	settings.connection_type = C.CONNECTION_TYPE_BROADBAND_HIGH

	settings.rfx_codec = C.boolean(0)
	settings.fastpath_output = C.boolean(1)
	settings.color_depth = C.uint32(16)
	settings.frame_acknowledge = C.boolean(1)
	settings.large_pointer = C.boolean(1)
	settings.glyph_cache = C.boolean(0)
	settings.bitmap_cache = C.boolean(0)
	settings.offscreen_bitmap_cache = C.boolean(0)

	settings.order_support[C.NEG_DSTBLT_INDEX] = 0
	settings.order_support[C.NEG_PATBLT_INDEX] = 1
	settings.order_support[C.NEG_SCRBLT_INDEX] = 1
	settings.order_support[C.NEG_MEMBLT_INDEX] = 0
	settings.order_support[C.NEG_MEM3BLT_INDEX] = 0
	settings.order_support[C.NEG_ATEXTOUT_INDEX] = 0
	settings.order_support[C.NEG_AEXTTEXTOUT_INDEX] = 0
	settings.order_support[C.NEG_DRAWNINEGRID_INDEX] = 0
	settings.order_support[C.NEG_LINETO_INDEX] = 0
	settings.order_support[C.NEG_MULTI_DRAWNINEGRID_INDEX] = 0
	settings.order_support[C.NEG_OPAQUE_RECT_INDEX] = 1
	settings.order_support[C.NEG_SAVEBITMAP_INDEX] = 0
	settings.order_support[C.NEG_WTEXTOUT_INDEX] = 0
	settings.order_support[C.NEG_MEMBLT_V2_INDEX] = 0
	settings.order_support[C.NEG_MEM3BLT_V2_INDEX] = 0
	settings.order_support[C.NEG_MULTIDSTBLT_INDEX] = 0
	settings.order_support[C.NEG_MULTIPATBLT_INDEX] = 0
	settings.order_support[C.NEG_MULTISCRBLT_INDEX] = 0
	settings.order_support[C.NEG_MULTIOPAQUERECT_INDEX] = 1
	settings.order_support[C.NEG_FAST_INDEX_INDEX] = 0
	settings.order_support[C.NEG_POLYGON_SC_INDEX] = 0
	settings.order_support[C.NEG_POLYGON_CB_INDEX] = 0
	settings.order_support[C.NEG_POLYLINE_INDEX] = 0
	settings.order_support[C.NEG_FAST_GLYPH_INDEX] = 0
	settings.order_support[C.NEG_ELLIPSE_SC_INDEX] = 0
	settings.order_support[C.NEG_ELLIPSE_CB_INDEX] = 0
	settings.order_support[C.NEG_GLYPH_INDEX_INDEX] = 0
	settings.order_support[C.NEG_GLYPH_WEXTTEXTOUT_INDEX] = 0
	settings.order_support[C.NEG_GLYPH_WLONGTEXTOUT_INDEX] = 0
	settings.order_support[C.NEG_GLYPH_WLONGEXTTEXTOUT_INDEX] = 0

	context.clrconv = C.freerdp_clrconv_new(C.CLRCONV_ALPHA | C.CLRCONV_INVERT)

	return 1
}