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() { func (s *systemService) loopWindowEvent() {
var fullscreen, maximised, minimised, normal bool var fullscreen, maximised, minimised, normal bool
var width, height, posx, posy int var width, height int
var dirty bool var dirty bool
for { for {
time.Sleep(300 * time.Millisecond) time.Sleep(300 * time.Millisecond)
@ -84,12 +84,6 @@ func (s *systemService) loopWindowEvent() {
dirty = true 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 { if m := runtime.WindowIsMaximised(s.ctx); m != maximised {
maximised = m maximised = m
dirty = true dirty = true
@ -118,7 +112,6 @@ func (s *systemService) loopWindowEvent() {
if !fullscreen && !minimised { if !fullscreen && !minimised {
// save window size and position // save window size and position
Preferences().SaveWindowSize(width, height, maximised) Preferences().SaveWindowSize(width, height, maximised)
Preferences().SaveWindowPosition(posx, posy)
} }
} }
} }

View File

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

View File

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

View File

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

View File

@ -73,9 +73,14 @@ func main() {
services.GA().Startup(version) services.GA().Startup(version)
}, },
OnDomReady: func(ctx context.Context) { OnDomReady: func(ctx context.Context) {
runtime2.WindowShow(ctx)
x, y := prefSvc.GetWindowPosition(ctx) x, y := prefSvc.GetWindowPosition(ctx)
runtime2.WindowSetPosition(ctx, x, y) 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) { OnShutdown: func(ctx context.Context) {
browserSvc.Stop() browserSvc.Stop()