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