Skip to content

Commit 16681fb

Browse files
authored
docs: add missing documentation for clipboard methods (#23862)
1 parent 7faf1bf commit 16681fb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

vlib/clipboard/x11/clipboard.c.v

+5
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,20 @@ fn new_x11_clipboard(selection AtomType) &Clipboard {
203203
return cb
204204
}
205205

206+
// check_availability returns `true` if the clipboard is available for use.
206207
pub fn (cb &Clipboard) check_availability() bool {
207208
return cb.display != C.NULL
208209
}
209210

211+
// free releases the clipboard resources.
210212
pub fn (mut cb Clipboard) free() {
211213
C.XDestroyWindow(cb.display, cb.window)
212214
cb.window = Window(0)
213215
// FIXME: program hangs when closing display
214216
// XCloseDisplay(cb.display)
215217
}
216218

219+
// clear clears the clipboard (sets it to an empty string).
217220
pub fn (mut cb Clipboard) clear() {
218221
cb.mutex.lock()
219222
C.XSetSelectionOwner(cb.display, cb.selection, Window(0), C.CurrentTime)
@@ -223,6 +226,7 @@ pub fn (mut cb Clipboard) clear() {
223226
cb.mutex.unlock()
224227
}
225228

229+
// has_ownership returns `true` if the `Clipboard` has the content ownership.
226230
pub fn (cb &Clipboard) has_ownership() bool {
227231
return cb.is_owner
228232
}
@@ -248,6 +252,7 @@ pub fn (mut cb Clipboard) set_text(text string) bool {
248252
return cb.is_owner
249253
}
250254

255+
// get_text returns the current entry as a `string` from the clipboard.
251256
pub fn (mut cb Clipboard) get_text() string {
252257
if cb.window == Window(0) {
253258
return ''

0 commit comments

Comments
 (0)