mirror of
https://github.com/akiyosi/goneovim.git
synced 2025-08-30 22:49:29 +02:00
fixup
This commit is contained in:
parent
d755f6d1c2
commit
b2f0656fb1
4 changed files with 112 additions and 30 deletions
|
@ -56,6 +56,11 @@ type Cell struct {
|
||||||
|
|
||||||
type IntInt [2]int
|
type IntInt [2]int
|
||||||
|
|
||||||
|
// ExternalWin is
|
||||||
|
type ExternalWin struct {
|
||||||
|
widgets.QDialog
|
||||||
|
}
|
||||||
|
|
||||||
// Window is
|
// Window is
|
||||||
type Window struct {
|
type Window struct {
|
||||||
paintMutex sync.Mutex
|
paintMutex sync.Mutex
|
||||||
|
@ -93,7 +98,7 @@ type Window struct {
|
||||||
devicePixelRatio float64
|
devicePixelRatio float64
|
||||||
textCache gcache.Cache
|
textCache gcache.Cache
|
||||||
|
|
||||||
diag *widgets.QDialog
|
extwin *ExternalWin
|
||||||
font *Font
|
font *Font
|
||||||
background *RGBA
|
background *RGBA
|
||||||
width float64
|
width float64
|
||||||
|
@ -2154,9 +2159,9 @@ func (s *Screen) update() {
|
||||||
// s.windows.Delete(grid)
|
// s.windows.Delete(grid)
|
||||||
// }
|
// }
|
||||||
win.hide()
|
win.hide()
|
||||||
if win.diag != nil {
|
if win.extwin != nil {
|
||||||
win.diag.Hide()
|
win.extwin.Hide()
|
||||||
win.diag = nil
|
win.extwin = nil
|
||||||
}
|
}
|
||||||
s.windows.Delete(grid)
|
s.windows.Delete(grid)
|
||||||
}
|
}
|
||||||
|
@ -2914,42 +2919,38 @@ func (s *Screen) windowExternalPosition(args []interface{}) {
|
||||||
// winid := arg.([]interface{})[1].(nvim.Window)
|
// winid := arg.([]interface{})[1].(nvim.Window)
|
||||||
|
|
||||||
s.windows.Range(func(_, winITF interface{}) bool {
|
s.windows.Range(func(_, winITF interface{}) bool {
|
||||||
win := winITF.(*Window)
|
win := winITF.(*Window)
|
||||||
if win == nil {
|
if win == nil {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if win.grid == 1 {
|
if win.grid == 1 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if win.isMsgGrid {
|
if win.isMsgGrid {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if win.grid == gridid && !win.isExternal {
|
if win.grid == gridid && !win.isExternal {
|
||||||
win.isExternal = true
|
win.isExternal = true
|
||||||
diag := widgets.NewQDialog(nil, core.Qt__Dialog)
|
|
||||||
win.widget.SetParent(diag)
|
extwin := createExternalWin()
|
||||||
diag.ConnectKeyPressEvent(editor.keyPress)
|
win.widget.SetParent(extwin)
|
||||||
diag.ConnectResizeEvent(func(event *gui.QResizeEvent) {
|
extwin.ConnectKeyPressEvent(editor.keyPress)
|
||||||
height := diag.Height()
|
extwin.ConnectResizeEvent(func(event *gui.QResizeEvent) {
|
||||||
width := diag.Width()
|
height := extwin.Height()-10
|
||||||
|
width := extwin.Width()-10
|
||||||
cols := int((float64(width) / win.getFont().truewidth))
|
cols := int((float64(width) / win.getFont().truewidth))
|
||||||
rows := height / win.getFont().lineHeight
|
rows := height / win.getFont().lineHeight
|
||||||
_ = s.ws.nvim.TryResizeUIGrid(win.grid, cols, rows)
|
_ = s.ws.nvim.TryResizeUIGrid(win.grid, cols, rows)
|
||||||
})
|
})
|
||||||
diag.SetWindowFlag(core.Qt__WindowMaximizeButtonHint, false)
|
|
||||||
diag.SetWindowFlag(core.Qt__WindowMinimizeButtonHint, false)
|
|
||||||
diag.SetWindowFlag(core.Qt__WindowCloseButtonHint, false)
|
|
||||||
diag.SetWindowFlag(core.Qt__WindowContextHelpButtonHint, false)
|
|
||||||
|
|
||||||
win.background = s.ws.background.copy()
|
win.background = s.ws.background.copy()
|
||||||
diag.SetAutoFillBackground(true)
|
extwin.SetAutoFillBackground(true)
|
||||||
p := gui.NewQPalette()
|
p := gui.NewQPalette()
|
||||||
p.SetColor2(gui.QPalette__Background, s.ws.background.QColor())
|
p.SetColor2(gui.QPalette__Background, s.ws.background.QColor())
|
||||||
diag.SetPalette(p)
|
extwin.SetPalette(p)
|
||||||
|
|
||||||
diag.Show()
|
extwin.Show()
|
||||||
|
win.extwin = extwin
|
||||||
win.diag = diag
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
@ -3050,7 +3051,7 @@ func (w *Window) raise() {
|
||||||
if !w.isExternal {
|
if !w.isExternal {
|
||||||
editor.window.Raise()
|
editor.window.Raise()
|
||||||
} else if w.isExternal {
|
} else if w.isExternal {
|
||||||
w.diag.Raise()
|
w.extwin.Raise()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3148,6 +3149,13 @@ func (w *Window) move(col int, row int) {
|
||||||
y += w.s.ws.tabline.widget.Height()
|
y += w.s.ws.tabline.widget.Height()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if w.isExternal {
|
||||||
|
x += 5
|
||||||
|
y += 5
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
w.widget.Move2(x, y)
|
w.widget.Move2(x, y)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
49
editor/screen_darwin.go
Normal file
49
editor/screen_darwin.go
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
package editor
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo CFLAGS: -x objective-c
|
||||||
|
#cgo LDFLAGS: -framework Cocoa
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
void setNoButtonWindow(long *wid) {
|
||||||
|
NSView* view = (NSView*)wid;
|
||||||
|
NSWindow *window = view.window;
|
||||||
|
|
||||||
|
// Style
|
||||||
|
window.styleMask |= NSWindowStyleMaskTitled;
|
||||||
|
window.styleMask |= NSWindowStyleMaskResizable;
|
||||||
|
window.styleMask |= NSWindowStyleMaskMiniaturizable;
|
||||||
|
window.styleMask |= NSWindowStyleMaskFullSizeContentView;
|
||||||
|
|
||||||
|
// Appearance
|
||||||
|
window.opaque = NO;
|
||||||
|
window.backgroundColor = [NSColor clearColor];
|
||||||
|
window.hasShadow = YES;
|
||||||
|
|
||||||
|
// Don't show title bar
|
||||||
|
window.titlebarAppearsTransparent = YES;
|
||||||
|
// window.titleVisibility = NSWindowTitleHidden;
|
||||||
|
|
||||||
|
// Hidden native buttons
|
||||||
|
[[window standardWindowButton:NSWindowCloseButton] setHidden:YES];
|
||||||
|
[[window standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
|
||||||
|
[[window standardWindowButton:NSWindowZoomButton] setHidden:YES];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
func createExternalWin() *ExternalWin {
|
||||||
|
extwin := NewExternalWin(nil, 0)
|
||||||
|
extwin.SetContentsMargins(5, 5, 5, 5)
|
||||||
|
wid := extwin.WinId()
|
||||||
|
|
||||||
|
C.setNoButtonWindow((*C.long)(unsafe.Pointer(wid)))
|
||||||
|
|
||||||
|
return extwin
|
||||||
|
}
|
13
editor/screen_linux.go
Normal file
13
editor/screen_linux.go
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package editor
|
||||||
|
|
||||||
|
func createExternalWin() *ExternalWin {
|
||||||
|
extwin := NewExternalWin(nil, 0)
|
||||||
|
|
||||||
|
extwin.SetWindowFlag(core.Qt__WindowMaximizeButtonHint, false)
|
||||||
|
extwin.SetWindowFlag(core.Qt__WindowMinimizeButtonHint, false)
|
||||||
|
extwin.SetWindowFlag(core.Qt__WindowCloseButtonHint, false)
|
||||||
|
extwin.SetWindowFlag(core.Qt__WindowContextHelpButtonHint, false)
|
||||||
|
|
||||||
|
return extwin
|
||||||
|
}
|
||||||
|
|
12
editor/screen_windows.go
Normal file
12
editor/screen_windows.go
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package editor
|
||||||
|
|
||||||
|
func createExternalWin() *ExternalWin {
|
||||||
|
extwin := NewExternalWin(nil, 0)
|
||||||
|
|
||||||
|
extwin.SetWindowFlag(core.Qt__WindowMaximizeButtonHint, false)
|
||||||
|
extwin.SetWindowFlag(core.Qt__WindowMinimizeButtonHint, false)
|
||||||
|
extwin.SetWindowFlag(core.Qt__WindowCloseButtonHint, false)
|
||||||
|
extwin.SetWindowFlag(core.Qt__WindowContextHelpButtonHint, false)
|
||||||
|
|
||||||
|
return extwin
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue