File tree 1 file changed +5
-0
lines changed
1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -203,17 +203,20 @@ fn new_x11_clipboard(selection AtomType) &Clipboard {
203
203
return cb
204
204
}
205
205
206
+ // check_availability returns `true` if the clipboard is available for use.
206
207
pub fn (cb &Clipboard) check_availability () bool {
207
208
return cb.display != C.NULL
208
209
}
209
210
211
+ // free releases the clipboard resources.
210
212
pub fn (mut cb Clipboard) free () {
211
213
C.XDestroyWindow (cb.display, cb.window)
212
214
cb.window = Window (0 )
213
215
// FIXME: program hangs when closing display
214
216
// XCloseDisplay(cb.display)
215
217
}
216
218
219
+ // clear clears the clipboard (sets it to an empty string).
217
220
pub fn (mut cb Clipboard) clear () {
218
221
cb.mutex.lock ()
219
222
C.XSetSelectionOwner (cb.display, cb.selection, Window (0 ), C.CurrentTime)
@@ -223,6 +226,7 @@ pub fn (mut cb Clipboard) clear() {
223
226
cb.mutex.unlock ()
224
227
}
225
228
229
+ // has_ownership returns `true` if the `Clipboard` has the content ownership.
226
230
pub fn (cb &Clipboard) has_ownership () bool {
227
231
return cb.is_owner
228
232
}
@@ -248,6 +252,7 @@ pub fn (mut cb Clipboard) set_text(text string) bool {
248
252
return cb.is_owner
249
253
}
250
254
255
+ // get_text returns the current entry as a `string` from the clipboard.
251
256
pub fn (mut cb Clipboard) get_text () string {
252
257
if cb.window == Window (0 ) {
253
258
return ''
You can’t perform that action at this time.
0 commit comments