chore: change the timing for saving window position changes.

This commit is contained in:
Lykin 2023-12-16 01:21:30 +08:00
parent 8f15656f37
commit c5abaa6573
5 changed files with 15 additions and 16 deletions

View File

@ -63,7 +63,7 @@ func (s *systemService) SelectFile(title string) (resp types.JSResp) {
func (s *systemService) loopWindowEvent() {
var fullscreen, maximised, minimised, normal bool
var width, height, posx, posy int
var width, height int
var dirty bool
for {
time.Sleep(300 * time.Millisecond)
@ -84,12 +84,6 @@ func (s *systemService) loopWindowEvent() {
dirty = true
}
if x, y := runtime.WindowGetPosition(s.ctx); x != posx || y != posy {
// window position changed
posx, posy = x, y
dirty = true
}
if m := runtime.WindowIsMaximised(s.ctx); m != maximised {
maximised = m
dirty = true
@ -118,7 +112,6 @@ func (s *systemService) loopWindowEvent() {
if !fullscreen && !minimised {
// save window size and position
Preferences().SaveWindowSize(width, height, maximised)
Preferences().SaveWindowPosition(posx, posy)
}
}
}

View File

@ -132,10 +132,11 @@ func autoDecode(str string) (value, resultDecode string) {
return
}
if value, ok = decodeBrotli(str); ok {
resultDecode = types.DECODE_BROTLI
return
}
// FIXME: skip decompress with brotli due to incorrect format checking
//if value, ok = decodeBrotli(str); ok {
// resultDecode = types.DECODE_BROTLI
// return
//}
}
}

View File

@ -78,7 +78,7 @@ const onCopyKey = () => {
<div class="content-toolbar flex-box-h">
<n-input-group>
<redis-type-tag :binary-key="binaryKey" :type="props.keyType" size="large" />
<n-input v-model:value="props.keyPath" readonly>
<n-input v-model:value="props.keyPath" :title="props.keyPath" readonly>
<template #suffix>
<icon-button
:icon="Refresh"

View File

@ -2,7 +2,7 @@
import { computed, h, reactive, ref, watch } from 'vue'
import { types, typesColor } from '@/consts/support_redis_type.js'
import useDialog from 'stores/dialog'
import { get, isEmpty, keys, map } from 'lodash'
import { get, isEmpty, keys, map, trim } from 'lodash'
import NewStringValue from '@/components/new_value/NewStringValue.vue'
import NewHashValue from '@/components/new_value/NewHashValue.vue'
import NewListValue from '@/components/new_value/NewListValue.vue'
@ -132,7 +132,7 @@ const onAdd = async () => {
const { success, msg, nodeKey } = await browserStore.setKey({
server,
db,
key,
key: trim(key),
keyType: type,
value,
ttl,

View File

@ -73,9 +73,14 @@ func main() {
services.GA().Startup(version)
},
OnDomReady: func(ctx context.Context) {
runtime2.WindowShow(ctx)
x, y := prefSvc.GetWindowPosition(ctx)
runtime2.WindowSetPosition(ctx, x, y)
runtime2.WindowShow(ctx)
},
OnBeforeClose: func(ctx context.Context) (prevent bool) {
x, y := runtime2.WindowGetPosition(ctx)
prefSvc.SaveWindowPosition(x, y)
return false
},
OnShutdown: func(ctx context.Context) {
browserSvc.Stop()