mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +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
|
var attribute string
|
||||||
switch imageType {
|
if needsRestoration() {
|
||||||
case ImageTypeVolatile:
|
switch imageType {
|
||||||
attribute = "volatile"
|
case ImageTypeVolatile:
|
||||||
|
attribute = "volatile"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i := &Image{
|
i := &Image{
|
||||||
image: graphicscommand.NewImage(width, height, imageType == ImageTypeScreen, attribute),
|
image: graphicscommand.NewImage(width, height, imageType == ImageTypeScreen, attribute),
|
||||||
|
@ -43,6 +43,7 @@ type Window interface {
|
|||||||
IsClosingHandled() bool
|
IsClosingHandled() bool
|
||||||
SetMousePassthrough(enabled bool)
|
SetMousePassthrough(enabled bool)
|
||||||
IsMousePassthrough() bool
|
IsMousePassthrough() bool
|
||||||
|
RequestAttention()
|
||||||
}
|
}
|
||||||
|
|
||||||
type nullWindow struct{}
|
type nullWindow struct{}
|
||||||
@ -128,3 +129,6 @@ func (*nullWindow) SetMousePassthrough(enabled bool) {
|
|||||||
func (*nullWindow) IsMousePassthrough() bool {
|
func (*nullWindow) IsMousePassthrough() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (*nullWindow) RequestAttention() {
|
||||||
|
}
|
||||||
|
@ -506,3 +506,19 @@ func (w *glfwWindow) IsMousePassthrough() bool {
|
|||||||
})
|
})
|
||||||
return v
|
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()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -341,3 +341,7 @@ func SetWindowMousePassthrough(enabled bool) {
|
|||||||
func IsWindowMousePassthrough() bool {
|
func IsWindowMousePassthrough() bool {
|
||||||
return ui.Get().Window().IsMousePassthrough()
|
return ui.Get().Window().IsMousePassthrough()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RequestWindowAttention() {
|
||||||
|
ui.Get().Window().RequestAttention()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user