clipboard: make compile on Linux
parent
81c17e55a6
commit
7cc21be7de
|
@ -15,7 +15,6 @@ import (
|
|||
struct C.Display
|
||||
struct C.Atom
|
||||
struct C.Window
|
||||
fn C.XFree()
|
||||
fn C.XInitThreads() int
|
||||
fn C.XCloseDisplay(d &Display)
|
||||
fn C.XFlush(d &Display)
|
||||
|
@ -32,7 +31,10 @@ fn C.XConvertSelection(d &Display, selection Atom, target Atom, property Atom, r
|
|||
fn C.XSync(d &Display, discard int) int
|
||||
fn C.XGetWindowProperty(d &Display, w Window, property Atom, offset i64, length i64, delete int, req_type Atom, actual_type_return &Atom, actual_format_return &int, nitems &i64, bytes_after_return &i64, prop_return &byteptr) int
|
||||
fn C.XDeleteProperty(d &Display, w Window, property Atom) int
|
||||
fn C.DefaultScren() int
|
||||
fn C.DefaultScreen() int
|
||||
fn C.RootWindow() voidptr
|
||||
fn C.BlackPixel() voidptr
|
||||
fn C.WhitePixel() voidptr
|
||||
|
||||
struct C.XSelectionRequestEvent{
|
||||
mut:
|
||||
|
@ -412,7 +414,8 @@ fn new_atom(value int) &Atom {
|
|||
|
||||
fn create_xwindow(display &Display) Window {
|
||||
N := C.DefaultScreen(display)
|
||||
return XCreateSimpleWindow(display, C.RootWindow(display, N), 0, 0, 1, 1, 0, C.BlackPixel(display, N), C.WhitePixel(display, N))
|
||||
return XCreateSimpleWindow(display, C.RootWindow(display, N), 0, 0, 1, 1,
|
||||
0, C.BlackPixel(display, N), C.WhitePixel(display, N))
|
||||
}
|
||||
|
||||
fn new_display() &Display {
|
||||
|
|
|
@ -9,11 +9,14 @@ struct C.WPARAM
|
|||
struct C.LPARAM
|
||||
struct C.LRESULT
|
||||
struct C.HGLOBAL
|
||||
struct C.HANDLE
|
||||
|
||||
struct C.WNDCLASSEX {
|
||||
cbSize int
|
||||
lpfnWndProc voidptr
|
||||
lpszClassName &u16
|
||||
}
|
||||
|
||||
fn C.RegisterClassEx(class WNDCLASSEX) int
|
||||
fn C.GetClipboardOwner() &HWND
|
||||
fn C.CreateWindowEx(dwExStyle i64, lpClassName &u16, lpWindowName &u16, dwStyle i64, x int, y int, nWidth int, nHeight int, hWndParent i64, hMenu voidptr, hInstance voidptr, lpParam voidptr) &HWND
|
||||
|
@ -118,7 +121,7 @@ fn (cb &Clipboard) set_text(text string) bool {
|
|||
GlobalFree(buf)
|
||||
return false
|
||||
} else {
|
||||
/* EmptyClipboard must be called to properly update clipboard ownership */
|
||||
// EmptyClipboard must be called to properly update clipboard ownership
|
||||
EmptyClipboard()
|
||||
if SetClipboardData(C.CF_UNICODETEXT, buf) == HANDLE(C.NULL) {
|
||||
println("SetClipboardData: Failed.")
|
||||
|
@ -127,7 +130,7 @@ fn (cb &Clipboard) set_text(text string) bool {
|
|||
return false
|
||||
}
|
||||
}
|
||||
/* CloseClipboard appears to change the sequence number... */
|
||||
// CloseClipboard appears to change the sequence number...
|
||||
CloseClipboard()
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -621,7 +621,7 @@ pub fn get_raw_line() string {
|
|||
max_line_chars := 256
|
||||
buf := &byte(malloc(max_line_chars*2))
|
||||
if is_atty(0) > 0 {
|
||||
h_input := C.GetStdHandle(STD_INPUT_HANDLE)
|
||||
h_input := C.GetStdHandle(C.STD_INPUT_HANDLE)
|
||||
mut nr_chars := u32(0)
|
||||
C.ReadConsole(h_input, buf, max_line_chars * 2, voidptr(&nr_chars), 0)
|
||||
return string_from_wide2(&u16(buf), int(nr_chars))
|
||||
|
|
Loading…
Reference in New Issue