Files
gio/io/system/decoration.go
T
Elias Naur b53cdfef8d io/system: remove resize actions
Allowing clients to initiate resize gestures is a waste: macOS
doesn't support them, and the only reason we added them was to
implement client-side decorations for Wayland. Now all desktop
platforms implement resize gestures as needed, and we no longer
need the system.Action actions.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-06-25 18:41:32 +02:00

63 lines
1.5 KiB
Go

package system
import (
"strings"
)
// Action is a set of window decoration actions.
type Action uint
const (
// ActionMinimize minimizes a window.
ActionMinimize Action = 1 << iota
// ActionMaximize maximizes a window.
ActionMaximize
// ActionUnmaximize restores a maximized window.
ActionUnmaximize
// ActionFullscreen makes a window fullscreen.
ActionFullscreen
// ActionRaise requests that the platform bring this window to the top of all open windows.
// Some platforms do not allow this except under certain circumstances, such as when
// a window from the same application already has focus. If the platform does not
// support it, this method will do nothing.
ActionRaise
// ActionCenter centers the window on the screen.
// It is ignored in Fullscreen mode and on Wayland.
ActionCenter
// ActionClose closes a window.
// Only applicable on macOS, Windows, X11 and Wayland.
ActionClose
// ActionMove moves a window directed by the user.
ActionMove
)
func (a Action) String() string {
var buf strings.Builder
for b := Action(1); a != 0; b <<= 1 {
if a&b != 0 {
if buf.Len() > 0 {
buf.WriteByte('|')
}
buf.WriteString(b.string())
a &^= b
}
}
return buf.String()
}
func (a Action) string() string {
switch a {
case ActionMinimize:
return "ActionMinimize"
case ActionMaximize:
return "ActionMaximize"
case ActionUnmaximize:
return "ActionUnmaximize"
case ActionClose:
return "ActionClose"
case ActionMove:
return "ActionMove"
}
return ""
}