// Hide console on windows without removing it unlike -H windowsgui.
17624
func HideConsole(hide bool) {
	var k32 = syscall.NewLazyDLL("kernel32.dll")
	var cw = k32.NewProc("GetConsoleWindow")
	var u32 = syscall.NewLazyDLL("user32.dll")
	var sw = u32.NewProc("ShowWindow")
	hwnd, _, _ := cw.Call()
	if hwnd == 0 {
		return
	}
	if hide {
		var SW_HIDE uintptr = 0
		sw.Call(hwnd, SW_HIDE)
	} else {
		var SW_RESTORE uintptr = 9
		sw.Call(hwnd, SW_RESTORE)
	}
}
431942
func (writer *ConsoleWriter) Close() {
	writer.lock.Lock()
	defer writer.lock.Unlock()

	if writer.closed {
		return
	}

	writer.blog.flush()
	writer.blog = nil
	writer.closed = true
}
1069169
func (_class ConsoleClass) Create(sessionID SessionRef, args ConsoleRecord) (_retval ConsoleRef, _err error) {
	_method := "console.create"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_argsArg, _err := convertConsoleRecordToXen(fmt.Sprintf("%s(%s)", _method, "args"), args)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _argsArg)
	if _err != nil {
		return
	}
	_retval, _err = convertConsoleRefToGo(_method + " -> ", _result.Value)
	return
}
981717
public void hide() {
        console.out().print("\33[" + 1 + ";" + terminal.getHeight() + ";r");
        //Erase screen doesn't behave well on windows.
        for (int l = 1; l <= terminal.getHeight(); l++) {
            console.out().print(ansi().cursor(l, 1));
            console.out().print(ansi().eraseLine(Erase.FORWARD));
        }
        console.out().print(ansi().cursor(1, 1));
        flush();
        try {
            terminal.restore();
        } catch (Exception e) {
            //noop
        }
    }
807008
func (im *Image) Window(parent xproto.Window) *xwindow.Window {
	win := xwindow.Must(xwindow.Create(im.X, parent))
	win.Resize(im.Bounds().Dx(), im.Bounds().Dy())

	im.XSurfaceSet(win.Id)
	im.XDraw()
	im.XPaint(win.Id)
	im.Destroy()

	return win
}
660465
func (_class ConsoleClass) Destroy(sessionID SessionRef, self ConsoleRef) (_err error) {
	_method := "console.destroy"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertConsoleRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _selfArg)
	return
}
1197432
func WmDesktopSet(xu *xgbutil.XUtil, win xproto.Window, desk uint) error {
	return xprop.ChangeProp32(xu, win, "_NET_WM_DESKTOP", "CARDINAL",
		uint(desk))
}
1238479
func (t *ConsoleTarget) Open(io.Writer) error {
	t.Filter.Init()
	if t.Writer == nil {
		return errors.New("ConsoleTarget.Writer cannot be nil")
	}
	if runtime.GOOS == "windows" {
		t.ColorMode = false
	}
	return nil
}
720976
func (c *Conn) hideOffset() (offset int64, whence int) {
	c.mutex.Lock()
	offset = c.offset
	c.mutex.Unlock()
	switch offset {
	case -1:
		offset = 0
		whence = 2
	case -2:
		offset = 0
		whence = 0
	default:
		whence = 1
	}
	return
}
1156568
func (a *MovFnAggregation) Window(window int) *MovFnAggregation {
	a.window = window
	return a
}
408847
func (sp *SendAudio) KeyboardHide(kb ReplyKeyboardHide) *SendAudio {
	var rmi ReplyMarkupInt = kb
	sp.ReplyMarkup = &rmi
	return sp
}
963521
func NewHideKeyboard(selective bool) ReplyKeyboardHide {
	log.Println("NewHideKeyboard is deprecated, please use NewRemoveKeyboard")

	return ReplyKeyboardHide{
		HideKeyboard: true,
		Selective:    selective,
	}
}
172072
func Close() {
	// we ignore errors here, because we can't really do anything about them
	Clear(0, 0)
	Flush()

	// stop event producer
	cancel_comm <- true
	set_event(interrupt)
	select {
	case <-input_comm:
	default:
	}
	<-cancel_done_comm

	set_console_screen_buffer_size(out, orig_size)
	set_console_window_info(out, &orig_window)
	set_console_cursor_info(out, &orig_cursor_info)
	set_console_cursor_position(out, coord{})
	set_console_mode(in, orig_mode)
	syscall.Close(in)
	syscall.Close(out)
	syscall.Close(interrupt)
	IsInit = false
}
1099565
func NewScreen() (Screen, error) {
	// Windows is happier if we try for a console screen first.
	if s, _ := NewConsoleScreen(); s != nil {
		return s, nil
	} else if s, e := NewTerminfoScreen(); s != nil {
		return s, nil
	} else {
		return nil, e
	}
}
97979
func ConsolesHandler(c *router.Context, projectID string) error {
	// Get consoles related to this project and filter out all builders.
	cons, err := common.GetProjectConsoles(c.Context, projectID)
	if err != nil {
		return err
	}
	if err := filterUnauthorizedBuildersFromConsoles(c.Context, cons); err != nil {
		return errors.Annotate(err, "error authorizing user").Err()
	}

	type fullConsole struct {
		ProjectID string
		Def       *config.Console
		Render    consoleRenderer
	}
	var consoles []fullConsole
	summaryMap, err := buildsource.GetConsoleSummariesFromDefs(c.Context, cons, projectID)
	if err != nil {
		return err
	}
	for _, con := range cons {
		summary, ok := summaryMap[con.ConsoleID()]
		if !ok {
			logging.Errorf(c.Context, "console summary for %s not found", con.ConsoleID())
			continue
		}
		respConsole, err := consolePreview(c.Context, summary, &con.Def)
		if err != nil {
			logging.WithError(err).Errorf(c.Context, "failed to generate resp console")
			continue
		}
		full := fullConsole{
			ProjectID: con.ProjectID(),
			Def:       &con.Def,
			Render:    consoleRenderer{respConsole},
		}
		consoles = append(consoles, full)
	}

	var reload *int
	if tReload := GetReload(c.Request, -1); tReload >= 0 {
		reload = &tReload
	}

	templates.MustRender(c.Context, c.Writer, "pages/builder_groups.html", templates.Args{
		"ProjectID": projectID,
		"Consoles":  consoles,
		"Reload":    reload,
	})
	return nil
}
128213
func (module *BBPWMModule) Disable() error {
	for _, openPin := range module.openPins {
		openPin.closePin()
	}
	return nil
}
1211817
func FindWindow(str string) win.HWND {
	hwnd := win.FindWindow(nil, syscall.StringToUTF16Ptr(str))

	return hwnd
}