1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

all: C++ compiler support

This commit is contained in:
Uwe Krüger
2020-05-18 15:51:36 +02:00
committed by GitHub
parent 857276e81f
commit 9a237c3e82
32 changed files with 268 additions and 150 deletions

View File

@ -10,7 +10,8 @@ import math
#include <X11/Xlib.h>
// X11
struct C.Display{}
[typedef]
struct C.Display
[typedef]
struct C.Atom
@ -33,7 +34,7 @@ fn C.XCreateSimpleWindow(d &Display, root C.Window, x int, y int, width u32, hei
fn C.XOpenDisplay(name byteptr) &C.Display
fn C.XConvertSelection(d &Display, selection C.Atom, target C.Atom, property C.Atom, requestor Window, time int) int
fn C.XSync(d &Display, discard int) int
fn C.XGetWindowProperty(d &Display, w Window, property C.Atom, offset i64, length i64, delete int, req_type C.Atom, actual_type_return &C.Atom, actual_format_return &int, nitems &i64, bytes_after_return &i64, prop_return &byteptr) int
fn C.XGetWindowProperty(d &Display, w Window, property C.Atom, offset i64, length i64, delete int, req_type C.Atom, actual_type_return &C.Atom, actual_format_return &int, nitems &u64, bytes_after_return &u64, prop_return &byteptr) int
fn C.XDeleteProperty(d &Display, w Window, property C.Atom) int
fn C.DefaultScreen() int
fn C.RootWindow() voidptr
@ -46,10 +47,10 @@ fn todo_del(){}
[typedef]
struct C.XSelectionRequestEvent{
mut:
selection C.Atom
display &C.Display /* Display the event was read from */
owner C.Window
requestor C.Window
selection C.Atom
target C.Atom
property C.Atom
time int
@ -59,9 +60,9 @@ struct C.XSelectionRequestEvent{
struct C.XSelectionEvent{
mut:
@type int
selection C.Atom
display &C.Display /* Display the event was read from */
requestor C.Window
selection C.Atom
target C.Atom
property C.Atom
time int
@ -81,13 +82,13 @@ struct C.XDestroyWindowEvent {
}
[typedef]
struct C.XEvent{
union C.XEvent{
mut:
@type int
xdestroywindow C.XDestroyWindowEvent
xselectionclear C.XSelectionClearEvent
xselectionrequest C.XSelectionRequestEvent
xselection C.XSelectionEvent
xselectionclear C.XSelectionClearEvent
xdestroywindow C.XDestroyWindowEvent
}
const (
@ -287,7 +288,7 @@ fn (mut cb Clipboard) start_listener(){
if !cb.transmit_selection(&xse) {
xse.property = new_atom(C.None)
}
C.XSendEvent(cb.display, xse.requestor, 0, C.PropertyChangeMask, &xse)
C.XSendEvent(cb.display, xse.requestor, 0, C.PropertyChangeMask, voidptr(&xse))
C.XFlush(cb.display)
}
}
@ -340,8 +341,8 @@ fn (mut cb Clipboard) intern_atoms(){
fn read_property(d &C.Display, w C.Window, p C.Atom) Property {
actual_type := C.Atom(0)
actual_format := 0
nitems := 0
bytes_after := 0
nitems := u64(0)
bytes_after := u64(0)
ret := byteptr(0)
mut read_bytes := 1024
for {