mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
Compare commits
7 Commits
b1cadbdd76
...
v0.4.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 718be79d9e | |||
| 0073e1a167 | |||
| 32ecec5538 | |||
| 6eb33b8a56 | |||
| 4617526e12 | |||
| dbc7a900bd | |||
| fb3ae95b28 |
@@ -60,10 +60,10 @@ func (c *d3d11Context) RenderTarget() (gpu.RenderTarget, error) {
|
||||
}
|
||||
|
||||
func (c *d3d11Context) Present() error {
|
||||
err := c.swchain.Present(1, 0)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return wrapErr(c.swchain.Present(1, 0))
|
||||
}
|
||||
|
||||
func wrapErr(err error) error {
|
||||
if err, ok := err.(d3d11.ErrorCode); ok {
|
||||
switch err.Code {
|
||||
case d3d11.DXGI_STATUS_OCCLUDED:
|
||||
@@ -84,7 +84,7 @@ func (c *d3d11Context) Refresh() error {
|
||||
}
|
||||
c.releaseFBO()
|
||||
if err := c.swchain.ResizeBuffers(0, 0, 0, d3d11.DXGI_FORMAT_UNKNOWN, 0); err != nil {
|
||||
return err
|
||||
return wrapErr(err)
|
||||
}
|
||||
c.width = width
|
||||
c.height = height
|
||||
|
||||
+2
-1
@@ -721,11 +721,12 @@ func (w *window) Configure(options []Option) {
|
||||
}
|
||||
|
||||
case Fullscreen:
|
||||
swpStyle |= windows.SWP_NOMOVE | windows.SWP_NOSIZE
|
||||
mi := windows.GetMonitorInfo(w.hwnd)
|
||||
x, y = mi.Monitor.Left, mi.Monitor.Top
|
||||
width = mi.Monitor.Right - mi.Monitor.Left
|
||||
height = mi.Monitor.Bottom - mi.Monitor.Top
|
||||
showMode = windows.SW_SHOW
|
||||
showMode = windows.SW_SHOWMAXIMIZED
|
||||
}
|
||||
windows.SetWindowLong(w.hwnd, windows.GWL_STYLE, style)
|
||||
windows.SetWindowPos(w.hwnd, 0, x, y, width, height, swpStyle)
|
||||
|
||||
+2
-1
@@ -904,6 +904,7 @@ func (w *Window) processEvent(d driver, e event.Event) bool {
|
||||
w.decorations.Config = e2.Config
|
||||
e2.Config = w.effectiveConfig()
|
||||
w.out <- e2
|
||||
case wakeupEvent:
|
||||
case event.Event:
|
||||
handled := w.queue.q.Queue(e2)
|
||||
if e, ok := e.(key.Event); ok && !handled {
|
||||
@@ -1035,9 +1036,9 @@ func (w *Window) decorate(d driver, e system.FrameEvent, o *op.Ops) (size, offse
|
||||
Metric: e.Metric,
|
||||
Constraints: layout.Exact(e.Size),
|
||||
}
|
||||
style.Layout(gtx)
|
||||
// Update the window based on the actions on the decorations.
|
||||
w.Perform(deco.Update(gtx))
|
||||
style.Layout(gtx)
|
||||
// Offset to place the frame content below the decorations.
|
||||
decoHeight := gtx.Dp(w.decorations.Config.decoHeight)
|
||||
if w.decorations.currentHeight != decoHeight {
|
||||
|
||||
+4
-4
@@ -446,13 +446,13 @@ func (a Axis) String() string {
|
||||
func (ct ClickKind) String() string {
|
||||
switch ct {
|
||||
case KindPress:
|
||||
return "TypePress"
|
||||
return "KindPress"
|
||||
case KindClick:
|
||||
return "TypeClick"
|
||||
return "KindClick"
|
||||
case KindCancel:
|
||||
return "TypeCancel"
|
||||
return "KindCancel"
|
||||
default:
|
||||
panic("invalid ClickType")
|
||||
panic("invalid ClickKind")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -53,8 +53,8 @@ func (b *Clickable) Click() {
|
||||
b.requestClicks++
|
||||
}
|
||||
|
||||
// Clicked reports whether there are pending clicks as would be
|
||||
// reported by Clicks. If so, Clicked removes the earliest click.
|
||||
// Clicked reports whether there are pending clicks. If so, Clicked
|
||||
// removes the earliest click.
|
||||
func (b *Clickable) Clicked(gtx layout.Context) bool {
|
||||
if len(b.clicks) > 0 {
|
||||
b.clicks = b.clicks[1:]
|
||||
|
||||
@@ -165,9 +165,6 @@ func (s ScrollbarStyle) layout(gtx layout.Context, axis layout.Axis, viewportSta
|
||||
if axis == layout.Horizontal {
|
||||
inset.Top, inset.Bottom, inset.Left, inset.Right = inset.Left, inset.Right, inset.Top, inset.Bottom
|
||||
}
|
||||
// Capture the outer constraints because layout.Stack will reset
|
||||
// the minimum to zero.
|
||||
outerConstraints := gtx.Constraints
|
||||
|
||||
return layout.Background{}.Layout(gtx,
|
||||
func(gtx layout.Context) layout.Dimensions {
|
||||
@@ -186,10 +183,9 @@ func (s ScrollbarStyle) layout(gtx layout.Context, axis layout.Axis, viewportSta
|
||||
s.Scrollbar.AddTrack(gtx.Ops)
|
||||
|
||||
paint.FillShape(gtx.Ops, s.Track.Color, clip.Rect(area).Op())
|
||||
return layout.Dimensions{}
|
||||
return layout.Dimensions{Size: gtx.Constraints.Min}
|
||||
},
|
||||
func(gtx layout.Context) layout.Dimensions {
|
||||
gtx.Constraints = outerConstraints
|
||||
return inset.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||
// Use axis-independent constraints.
|
||||
gtx.Constraints.Min = axis.Convert(gtx.Constraints.Min)
|
||||
|
||||
Reference in New Issue
Block a user