mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
more C fn definitions
This commit is contained in:
parent
f4fe90ea6d
commit
81c17e55a6
@ -105,3 +105,7 @@ fn C.GetFileAttributesW(lpFileName byteptr) u32
|
|||||||
fn C.RegQueryValueExW(hKey voidptr, lpValueName &u16, lpReserved &u32, lpType &u32, lpData byteptr, lpcbData &u32) int
|
fn C.RegQueryValueExW(hKey voidptr, lpValueName &u16, lpReserved &u32, lpType &u32, lpData byteptr, lpcbData &u32) int
|
||||||
fn C.RegOpenKeyExW(hKey voidptr, lpSubKey &u16, ulOptions u32, samDesired u32, phkResult voidptr) int
|
fn C.RegOpenKeyExW(hKey voidptr, lpSubKey &u16, ulOptions u32, samDesired u32, phkResult voidptr) int
|
||||||
fn C.RemoveDirectory() int
|
fn C.RemoveDirectory() int
|
||||||
|
fn C.GetStdHandle()
|
||||||
|
fn C.SetConsoleMode()
|
||||||
|
fn C._putsws()
|
||||||
|
fn C.wprintf()
|
||||||
|
@ -32,6 +32,8 @@ fn C.XConvertSelection(d &Display, selection Atom, target Atom, property Atom, r
|
|||||||
fn C.XSync(d &Display, discard int) int
|
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.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.XDeleteProperty(d &Display, w Window, property Atom) int
|
||||||
|
fn C.DefaultScren() int
|
||||||
|
|
||||||
struct C.XSelectionRequestEvent{
|
struct C.XSelectionRequestEvent{
|
||||||
mut:
|
mut:
|
||||||
selection Atom
|
selection Atom
|
||||||
@ -39,7 +41,7 @@ struct C.XSelectionRequestEvent{
|
|||||||
owner Window
|
owner Window
|
||||||
requestor Window
|
requestor Window
|
||||||
target Atom
|
target Atom
|
||||||
property Atom
|
property Atom
|
||||||
time int
|
time int
|
||||||
}
|
}
|
||||||
struct C.XSelectionEvent{
|
struct C.XSelectionEvent{
|
||||||
@ -49,7 +51,7 @@ struct C.XSelectionEvent{
|
|||||||
display &Display /* Display the event was read from */
|
display &Display /* Display the event was read from */
|
||||||
requestor Window
|
requestor Window
|
||||||
target Atom
|
target Atom
|
||||||
property Atom
|
property Atom
|
||||||
time int
|
time int
|
||||||
}
|
}
|
||||||
struct C.XSelectionClearEvent{
|
struct C.XSelectionClearEvent{
|
||||||
@ -115,7 +117,7 @@ fn new_clipboard() &Clipboard {
|
|||||||
return new_x11_clipboard(.clipboard)
|
return new_x11_clipboard(.clipboard)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize a new clipboard of the given selection type.
|
// Initialize a new clipboard of the given selection type.
|
||||||
// We can initialize multiple clipboard instances and use them separately
|
// We can initialize multiple clipboard instances and use them separately
|
||||||
fn new_x11_clipboard(selection atom_type) &Clipboard {
|
fn new_x11_clipboard(selection atom_type) &Clipboard {
|
||||||
if !(selection in [.clipboard, .primary, .secondary]) {
|
if !(selection in [.clipboard, .primary, .secondary]) {
|
||||||
@ -295,7 +297,7 @@ fn (cb mut Clipboard) start_listener(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
C.PropertyNotify {}
|
C.PropertyNotify {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -340,7 +342,7 @@ fn (cb &Clipboard) pick_target(prop Property) Atom {
|
|||||||
//The list of targets is a list of atoms, so it should have type XA_ATOM
|
//The list of targets is a list of atoms, so it should have type XA_ATOM
|
||||||
//but it may have the type TARGETS instead.
|
//but it may have the type TARGETS instead.
|
||||||
if((prop.actual_type != cb.get_atom(.xa_atom) && prop.actual_type != cb.get_atom(.targets)) || prop.actual_format != 32)
|
if((prop.actual_type != cb.get_atom(.xa_atom) && prop.actual_type != cb.get_atom(.targets)) || prop.actual_format != 32)
|
||||||
{
|
{
|
||||||
//This would be really broken. Targets have to be an atom list
|
//This would be really broken. Targets have to be an atom list
|
||||||
//and applications should support this. Nevertheless, some
|
//and applications should support this. Nevertheless, some
|
||||||
//seem broken (MATLAB 7, for instance), so ask for STRING
|
//seem broken (MATLAB 7, for instance), so ask for STRING
|
||||||
@ -396,7 +398,7 @@ fn (cb &Clipboard) get_target_index(target Atom) int {
|
|||||||
if atom == target {return i}
|
if atom == target {return i}
|
||||||
}
|
}
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (cb &Clipboard) get_supported_targets() []Atom {
|
fn (cb &Clipboard) get_supported_targets() []Atom {
|
||||||
return cb.get_atoms(atom_type.utf8_string, .xa_string, .text, .text_plain, .text_html)
|
return cb.get_atoms(atom_type.utf8_string, .xa_string, .text, .text_plain, .text_html)
|
||||||
@ -409,7 +411,7 @@ fn new_atom(value int) &Atom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn create_xwindow(display &Display) Window {
|
fn create_xwindow(display &Display) Window {
|
||||||
N := int(C.DefaultScreen(display))
|
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))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user