mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
op: change Defer to only restore transformation state
It turns out restoring all operation state from the moment Defer is executed is too much; for example, a right-click pop-up needs the transformation, but not the current clip. Change Defer to only restore the transformation, and reset all other state. Other combinations may be needed in future; we'll deal with them then, possibly by exposing the load state mask. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+15
-1
@@ -57,7 +57,7 @@ const (
|
||||
TypeKeyFocusLen = 1 + 1
|
||||
TypeKeySoftKeyboardLen = 1 + 1
|
||||
TypeSaveLen = 1 + 4
|
||||
TypeLoadLen = 1 + 4
|
||||
TypeLoadLen = 1 + 1 + 4
|
||||
TypeAuxLen = 1
|
||||
TypeClipLen = 1 + 4*4 + 1
|
||||
TypeProfileLen = 1
|
||||
@@ -67,6 +67,20 @@ const (
|
||||
TypeDashLen = 1 + 4 + 1
|
||||
)
|
||||
|
||||
// StateMask is a bitmask of state types a load operation
|
||||
// should restore.
|
||||
type StateMask uint8
|
||||
|
||||
const (
|
||||
TransformState StateMask = 1 << iota
|
||||
|
||||
AllState = ^StateMask(0)
|
||||
)
|
||||
|
||||
// InitialStateID is the ID for saving and loading
|
||||
// the initial operation state.
|
||||
const InitialStateID = 0
|
||||
|
||||
func (t OpType) Size() int {
|
||||
return [...]int{
|
||||
TypeMacroLen,
|
||||
|
||||
Reference in New Issue
Block a user