mirror of
https://github.com/vlang/v.git
synced 2025-09-12 00:46:55 -04:00
docs: add missing documentation for clipboard methods (#23862)
This commit is contained in:
parent
7faf1bf1d9
commit
16681fbd6b
@ -203,10 +203,12 @@ fn new_x11_clipboard(selection AtomType) &Clipboard {
|
|||||||
return cb
|
return cb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check_availability returns `true` if the clipboard is available for use.
|
||||||
pub fn (cb &Clipboard) check_availability() bool {
|
pub fn (cb &Clipboard) check_availability() bool {
|
||||||
return cb.display != C.NULL
|
return cb.display != C.NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// free releases the clipboard resources.
|
||||||
pub fn (mut cb Clipboard) free() {
|
pub fn (mut cb Clipboard) free() {
|
||||||
C.XDestroyWindow(cb.display, cb.window)
|
C.XDestroyWindow(cb.display, cb.window)
|
||||||
cb.window = Window(0)
|
cb.window = Window(0)
|
||||||
@ -214,6 +216,7 @@ pub fn (mut cb Clipboard) free() {
|
|||||||
// XCloseDisplay(cb.display)
|
// XCloseDisplay(cb.display)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear clears the clipboard (sets it to an empty string).
|
||||||
pub fn (mut cb Clipboard) clear() {
|
pub fn (mut cb Clipboard) clear() {
|
||||||
cb.mutex.lock()
|
cb.mutex.lock()
|
||||||
C.XSetSelectionOwner(cb.display, cb.selection, Window(0), C.CurrentTime)
|
C.XSetSelectionOwner(cb.display, cb.selection, Window(0), C.CurrentTime)
|
||||||
@ -223,6 +226,7 @@ pub fn (mut cb Clipboard) clear() {
|
|||||||
cb.mutex.unlock()
|
cb.mutex.unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// has_ownership returns `true` if the `Clipboard` has the content ownership.
|
||||||
pub fn (cb &Clipboard) has_ownership() bool {
|
pub fn (cb &Clipboard) has_ownership() bool {
|
||||||
return cb.is_owner
|
return cb.is_owner
|
||||||
}
|
}
|
||||||
@ -248,6 +252,7 @@ pub fn (mut cb Clipboard) set_text(text string) bool {
|
|||||||
return cb.is_owner
|
return cb.is_owner
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get_text returns the current entry as a `string` from the clipboard.
|
||||||
pub fn (mut cb Clipboard) get_text() string {
|
pub fn (mut cb Clipboard) get_text() string {
|
||||||
if cb.window == Window(0) {
|
if cb.window == Window(0) {
|
||||||
return ''
|
return ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user