mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/restorable: remove 'volatile' attribute when restorable is not used
This commit is contained in:
parent
4bfcbc878c
commit
9bdc89d40f
@ -169,9 +169,11 @@ func NewImage(width, height int, imageType ImageType) *Image {
|
||||
}
|
||||
|
||||
var attribute string
|
||||
switch imageType {
|
||||
case ImageTypeVolatile:
|
||||
attribute = "volatile"
|
||||
if needsRestoration() {
|
||||
switch imageType {
|
||||
case ImageTypeVolatile:
|
||||
attribute = "volatile"
|
||||
}
|
||||
}
|
||||
i := &Image{
|
||||
image: graphicscommand.NewImage(width, height, imageType == ImageTypeScreen, attribute),
|
||||
|
@ -43,6 +43,7 @@ type Window interface {
|
||||
IsClosingHandled() bool
|
||||
SetMousePassthrough(enabled bool)
|
||||
IsMousePassthrough() bool
|
||||
RequestAttention()
|
||||
}
|
||||
|
||||
type nullWindow struct{}
|
||||
@ -128,3 +129,6 @@ func (*nullWindow) SetMousePassthrough(enabled bool) {
|
||||
func (*nullWindow) IsMousePassthrough() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (*nullWindow) RequestAttention() {
|
||||
}
|
||||
|
@ -506,3 +506,19 @@ func (w *glfwWindow) IsMousePassthrough() bool {
|
||||
})
|
||||
return v
|
||||
}
|
||||
|
||||
func (w *glfwWindow) RequestAttention() {
|
||||
if w.ui.isTerminated() {
|
||||
return
|
||||
}
|
||||
if !w.ui.isRunning() {
|
||||
// Do nothing
|
||||
return
|
||||
}
|
||||
w.ui.mainThread.Call(func() {
|
||||
if w.ui.isTerminated() {
|
||||
return
|
||||
}
|
||||
w.ui.window.RequestAttention()
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user