You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ui.go
    path of file: ./repos/darktile/vendor/github.com/hajimehoshi/ebiten/v2/internal/uidriver/glfw
    
    the code of the file until where you have to start completion: // Copyright 2015 Hajime Hoshi
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in complia
    
func (u *UserInterface) update() (float64, float64, bool, error) {
	if u.err != nil {
		return 0, 0, false, u.err
	}

	if u.window.ShouldClose() {
		return 0, 0, false, driver.RegularTermination
	}

	if u.isInitFullscreen() {
		w, h := u.window.GetSize()
		u.setWindowSize(w, h, true)
		u.setInitFullscreen(false)
	}

	// Initialize vsync after SetMonitor is called. See the comment in updateVsync.
	// Calling this inside setWindowSize didn't work (#1363).
	if !u.fpsModeInited {
		u.fpsMode = u.getInitFPSMode()
		u.updateVsync()
		u.fpsModeInited = true
	}

	outsideWidth, outsideHeight, outsideSizeChanged := u.updateSize()

	if u.fpsMode != driver.FPSModeVsyncOffMinimum {
		// TODO: Updating the input can be skipped when clock.Update returns 0 (#1367).
		glfw.PollEvents()
	} else {
		glfw.WaitEvents()
	}
	u.input.update(u.window, u.context)

	for !u.isRunnableOnUnfocused() && u.window.GetAttrib(glfw.Focused) == 0 && !u.window.ShouldClose() {
		if err := hooks.SuspendAudio(); err != nil {
			return 0, 0, false, err
		}
		// Wait for an arbitrary period to avoid busy loop.
		time.Sleep(time.Second / 60)
		glfw.PollEvents()
	}
	if err := hooks.ResumeAudio(); err != nil {
		return 0, 0, false, err
	}

	return outsideWidth, outsideHeight, outsideSizeChanged, nil
}