mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
app: [API] remove StageEvent and Stage
StageEvent served only redundant purposes: - To detect whether the window has focus. That is covered by key.FocusEvent. - To detect whether the window is currently visible. That is covered by the absence or presence of FrameEvents. - To detect when the window native handle is valid. That is covered by ViewEvent. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+6
-14
@@ -199,7 +199,7 @@ type window struct {
|
||||
dir f32.Point
|
||||
}
|
||||
|
||||
stage Stage
|
||||
configured bool
|
||||
lastFrameCallback *C.struct_wl_callback
|
||||
|
||||
animating bool
|
||||
@@ -549,7 +549,7 @@ func gio_onXdgSurfaceConfigure(data unsafe.Pointer, wmSurf *C.struct_xdg_surface
|
||||
w := callbackLoad(data).(*window)
|
||||
w.serial = serial
|
||||
C.xdg_surface_ack_configure(wmSurf, serial)
|
||||
w.setStage(StageRunning)
|
||||
w.configured = true
|
||||
w.draw(true)
|
||||
}
|
||||
|
||||
@@ -1738,10 +1738,7 @@ func (w *window) updateOutputs() {
|
||||
C.wl_surface_set_buffer_scale(w.surf, C.int32_t(w.scale))
|
||||
w.draw(true)
|
||||
}
|
||||
if !found {
|
||||
w.setStage(StagePaused)
|
||||
} else {
|
||||
w.setStage(StageRunning)
|
||||
if found {
|
||||
w.draw(true)
|
||||
}
|
||||
}
|
||||
@@ -1755,6 +1752,9 @@ func (w *window) getConfig() (image.Point, unit.Metric) {
|
||||
}
|
||||
|
||||
func (w *window) draw(sync bool) {
|
||||
if !w.configured {
|
||||
return
|
||||
}
|
||||
w.flushScroll()
|
||||
size, cfg := w.getConfig()
|
||||
if cfg == (unit.Metric{}) {
|
||||
@@ -1785,14 +1785,6 @@ func (w *window) draw(sync bool) {
|
||||
})
|
||||
}
|
||||
|
||||
func (w *window) setStage(s Stage) {
|
||||
if s == w.stage {
|
||||
return
|
||||
}
|
||||
w.stage = s
|
||||
w.ProcessEvent(StageEvent{Stage: s})
|
||||
}
|
||||
|
||||
func (w *window) display() *C.struct_wl_display {
|
||||
return w.disp.disp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user