Skip to content

Commit

Permalink
Fix: Suppress warning about secure coding for restorable state in mac…
Browse files Browse the repository at this point in the history
…OS. (#506)
  • Loading branch information
akiyosi committed Nov 18, 2023
1 parent cbf44b1 commit aac516f
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 9 deletions.
2 changes: 2 additions & 0 deletions editor/editor.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ func InitEditor(options Options, args []string) {
e.putLog("start generating the application")
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
e.app = widgets.NewQApplication(len(os.Args), os.Args)
setMyApplicationDelegate()

e.app.SetDoubleClickInterval(0)
e.putLog("finished generating the application")

Expand Down
30 changes: 30 additions & 0 deletions editor/editor_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package editor

/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
@interface MyApplicationDelegate : NSObject <NSApplicationDelegate>
@end
@implementation MyApplicationDelegate
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app {
return YES;
}
@end
void SetMyApplicationDelegate() {
NSApplication *app = [NSApplication sharedApplication];
app.delegate = [[MyApplicationDelegate alloc] init];
[app activateIgnoringOtherApps:YES]; // make application foreground
}
*/
import "C"

func setMyApplicationDelegate() {
C.SetMyApplicationDelegate()
}
7 changes: 7 additions & 0 deletions editor/editor_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build linux || freebsd
// +build linux freebsd

package editor

func setMyApplicationDelegate() {
}
4 changes: 4 additions & 0 deletions editor/editor_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package editor

func setMyApplicationDelegate() {
}
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.20
require (
github.com/BurntSushi/toml v1.3.2
github.com/akiyosi/goqtframelesswindow v0.0.0-20230716140237-a341d42df3c8
github.com/akiyosi/qt v0.0.0-20230718095223-7e4e923f23fa
github.com/akiyosi/qt v0.0.0-20230719061055-7747cdc680f3
github.com/akiyosi/short_path v0.2.1
github.com/atotto/clipboard v0.1.4
github.com/bluele/gcache v0.0.2
Expand All @@ -16,8 +16,8 @@ require (
)

require (
github.com/akiyosi/qt/internal/binding/files/docs/5.12.0 v0.0.0-20230718095223-7e4e923f23fa // indirect
github.com/akiyosi/qt/internal/binding/files/docs/5.13.0 v0.0.0-20230718095223-7e4e923f23fa // indirect
github.com/akiyosi/qt/internal/binding/files/docs/5.12.0 v0.0.0-20230719061055-7747cdc680f3 // indirect
github.com/akiyosi/qt/internal/binding/files/docs/5.13.0 v0.0.0-20230719061055-7747cdc680f3 // indirect
github.com/akiyosi/w32 v0.0.0-20221111133244-de73be0c7b36 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190411002643-bd77b112433e // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/akiyosi/goqtframelesswindow v0.0.0-20230716140237-a341d42df3c8 h1:yOqvoxofnHODBxSo9/l030IFNPJ7H/cKyzycHj+LkJQ=
github.com/akiyosi/goqtframelesswindow v0.0.0-20230716140237-a341d42df3c8/go.mod h1:739mXLJTAy19GBfA3Z2gitVRHX5NVqrVqygAMPVB21E=
github.com/akiyosi/qt v0.0.0-20230718095223-7e4e923f23fa h1:/TcUmwcQfCdp/TtrXGTgY4qBe2pnpMrQOMKmuCOrJvc=
github.com/akiyosi/qt v0.0.0-20230718095223-7e4e923f23fa/go.mod h1:/M/wktam+Uyed7ahwhO+8zsEAe3FWZGA8eq5Sh+QePA=
github.com/akiyosi/qt/internal/binding/files/docs/5.12.0 v0.0.0-20230718095223-7e4e923f23fa h1:TfqsKoPqZkeMvE2n6qNLqPb/uyEiMpV73e7MwGZsUPk=
github.com/akiyosi/qt/internal/binding/files/docs/5.12.0 v0.0.0-20230718095223-7e4e923f23fa/go.mod h1:o1Ta8fcOD7ED+UFh1S2sJGmMYyZgY/0Nhqkayiw9EOI=
github.com/akiyosi/qt/internal/binding/files/docs/5.13.0 v0.0.0-20230718095223-7e4e923f23fa h1:1Y/Gr5IZkjmWJ9HElu4XAIrN+b3ss0SSmoA6/kvhP5s=
github.com/akiyosi/qt/internal/binding/files/docs/5.13.0 v0.0.0-20230718095223-7e4e923f23fa/go.mod h1:zr7ZzZXZ4UI9WpxGsiaq0S9OHCjo+H/7vU2Oyi6RRWw=
github.com/akiyosi/qt v0.0.0-20230719061055-7747cdc680f3 h1:S1QcbpgrpaJ0XbcNEMhJthmqrqtc7sEfYCqOA5UoVrs=
github.com/akiyosi/qt v0.0.0-20230719061055-7747cdc680f3/go.mod h1:/M/wktam+Uyed7ahwhO+8zsEAe3FWZGA8eq5Sh+QePA=
github.com/akiyosi/qt/internal/binding/files/docs/5.12.0 v0.0.0-20230719061055-7747cdc680f3 h1:CxbG3v48jGLCIMAEbi93USqKgRidyTQ6phy5K9ZDl+E=
github.com/akiyosi/qt/internal/binding/files/docs/5.12.0 v0.0.0-20230719061055-7747cdc680f3/go.mod h1:o1Ta8fcOD7ED+UFh1S2sJGmMYyZgY/0Nhqkayiw9EOI=
github.com/akiyosi/qt/internal/binding/files/docs/5.13.0 v0.0.0-20230719061055-7747cdc680f3 h1:4rrVdzbWIPr/GnF8XiDKvfUT4hi1Pqbo6WxT4JqK3W0=
github.com/akiyosi/qt/internal/binding/files/docs/5.13.0 v0.0.0-20230719061055-7747cdc680f3/go.mod h1:zr7ZzZXZ4UI9WpxGsiaq0S9OHCjo+H/7vU2Oyi6RRWw=
github.com/akiyosi/short_path v0.2.1 h1:1IiEQDNISfLOzs8A4+95vSgAN1Ch2IQY4wUpjZzWU/U=
github.com/akiyosi/short_path v0.2.1/go.mod h1:9ZdnJCTktFi81KorFR9Zihrn8pmRD1UIx0HjASMCu1U=
github.com/akiyosi/w32 v0.0.0-20221111133244-de73be0c7b36 h1:anLmpiDCKkXZv9D7iYznS3dkYS1BPlaMVGy+65azxj8=
Expand Down

0 comments on commit aac516f

Please sign in to comment.