// WM_COLORMAP_WINDOWS set
163659
func WmColormapWindowsSet(xu *xgbutil.XUtil, win xproto.Window,
	windows []xproto.Window) error {

	return xprop.ChangeProp32(xu, win, "WM_COLORMAP_WINDOWS", "WINDOW",
		xprop.WindowToInt(windows)...)
}
1277024
func wmapToWorkflow(wfMap *wmap.WorkflowMap) (*schedulerWorkflow, error) {
	wf := &schedulerWorkflow{}
	err := convertCollectionNode(wfMap.Collect, wf)
	if err != nil {
		return nil, err
	}
	// ***
	// TODO validate workflow makes sense here
	// - flows that don't end in publishers?
	// - duplicate child nodes anywhere?
	//***
	// Retain a copy of the original workflow map
	wf.workflowMap = wfMap
	return wf, nil
}
518610
func parseGWMetaMap(gwMetaBuf []byte) map[string]string {
	// Get gwMetaV1.Meta map.
	metaMapResult := gjson.GetBytes(gwMetaBuf, "meta").Map()
	metaMap := make(map[string]string)
	for key, valResult := range metaMapResult {
		metaMap[key] = valResult.String()
	}
	return metaMap
}
491640
func WmFullscreenMonitorsSet(xu *xgbutil.XUtil, win xproto.Window,
	edges *WmFullscreenMonitors) error {

	raw := make([]uint, 4)
	raw[0] = edges.Top
	raw[1] = edges.Bottom
	raw[2] = edges.Left
	raw[3] = edges.Right

	return xprop.ChangeProp32(xu, win, "_NET_WM_FULLSCREEN_MONITORS",
		"CARDINAL", raw...)
}
1021204
func (win *Window) LabelWrapColored(str string, color color.RGBA) {
	var bounds rect.Rect
	var text textWidget

	style := &win.ctx.Style
	panelAllocSpace(&bounds, win)
	item_padding := style.Text.Padding

	text.Padding.X = item_padding.X
	text.Padding.Y = item_padding.Y
	text.Background = win.style().Background
	text.Text = color
	win.widgets.Add(nstyle.WidgetStateInactive, bounds)
	widgetTextWrap(&win.cmds, bounds, []rune(str), &text, win.ctx.Style.Font)
}
1324782
func WmPingExtra(xu *xgbutil.XUtil, win xproto.Window, response bool,
	time xproto.Timestamp) error {

	pingAtom, err := xprop.Atm(xu, "_NET_WM_PING")
	if err != nil {
		return err
	}

	var evWindow xproto.Window
	if response {
		evWindow = xu.RootWin()
	} else {
		evWindow = win
	}

	return ClientEvent(xu, evWindow, "WM_PROTOCOLS", int(pingAtom), int(time),
		int(win))
}
866886
func (surface *Surface) GetColorKey() (key uint32, err error) {
	_key := (*C.Uint32)(unsafe.Pointer(&key))
	if C.SDL_GetColorKey(surface.cptr(), _key) != 0 {
		return key, GetError()
	}
	return key, nil
}
1049386
func (cfg *windowsCloudConfig) renderWindows() ([]byte, error) {
	winCmds := cfg.RunCmds()
	var script []byte
	newline := "\r\n"
	header := "#ps1_sysnative\r\n"
	script = append(script, header...)
	for _, cmd := range winCmds {
		script = append(script, newline...)
		script = append(script, cmd...)
	}
	return script, nil
}
445139
func resolveWindowSpec(spec *ast.WindowSpec, specs map[string]ast.WindowSpec, inStack map[string]bool) error {
	if inStack[spec.Name.L] {
		return errors.Trace(ErrWindowCircularityInWindowGraph)
	}
	if spec.Ref.L == "" {
		return nil
	}
	ref, ok := specs[spec.Ref.L]
	if !ok {
		return ErrWindowNoSuchWindow.GenWithStackByArgs(spec.Ref.O)
	}
	inStack[spec.Name.L] = true
	err := resolveWindowSpec(&ref, specs, inStack)
	if err != nil {
		return err
	}
	inStack[spec.Name.L] = false
	return mergeWindowSpec(spec, &ref)
}
6587
func (w *Waveform) SetBGColorFunction(function ColorFunc) error {
	return w.SetOptions(BGColorFunction(function))
}
132369
func WmUserTimeSet(xu *xgbutil.XUtil, win xproto.Window, userTime uint) error {
	return xprop.ChangeProp32(xu, win, "_NET_WM_USER_TIME", "CARDINAL",
		userTime)
}
1217613
func CountColor(color CHex, args ...interface{}) int {
	var (
		tolerance C.float = 0.01
		bitmap    C.MMBitmapRef
	)

	if len(args) > 0 {
		bitmap = args[0].(C.MMBitmapRef)
	} else {
		bitmap = CaptureScreen()
	}

	if len(args) > 1 {
		tolerance = C.float(args[1].(float64))
	}

	count := C.bitmap_count_of_color(bitmap, C.MMRGBHex(color), tolerance)
	if len(args) <= 0 {
		FreeBitmap(bitmap)
	}

	return int(count)
}
249732
func (win *Window) LabelWrap(str string) {
	win.LabelWrapColored(str, win.ctx.Style.Text.Color)
}
809588
func ActiveWindowSet(xu *xgbutil.XUtil, win xproto.Window) error {
	return xprop.ChangeProp32(xu, xu.RootWin(), "_NET_ACTIVE_WINDOW", "WINDOW",
		uint(win))
}
1374546
func WmUserTimeWindowSet(xu *xgbutil.XUtil, win xproto.Window,
	timeWin xproto.Window) error {

	return xprop.ChangeProp32(xu, win, "_NET_WM_USER_TIME_WINDOW", "CARDINAL",
		uint(timeWin))
}
1207517
func BgBrightWhite(arg interface{}) Value {
	if val, ok := arg.(Value); ok {
		return val.BgBrightWhite()
	}
	return value{value: arg, color: BrightBg | WhiteBg}
}
1171466
func GetColors(bitmap C.MMBitmapRef, x, y int) string {
	clo := GetColor(bitmap, x, y)

	return PadHex(clo)
}