-
Notifications
You must be signed in to change notification settings - Fork 16
wayland, x11: add setPrimaryText and getPrimaryText #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,6 +211,14 @@ pub const Window = struct { | |
| self.backend.getClipboardText(clipboardTextFn, clipboard_text_fn_data); | ||
| } | ||
|
|
||
| pub fn setPrimaryText(self: *Window, text: []const u8) void { | ||
| self.backend.setPrimaryText(text); | ||
| } | ||
|
|
||
| pub fn getPrimaryText(self: *Window, clipboardTextFn: *const fn (?*anyopaque, []const u8) void, clipboard_text_fn_data: ?*anyopaque) void { | ||
| self.backend.getPrimaryText(clipboardTextFn, clipboard_text_fn_data); | ||
| } | ||
|
|
||
|
Comment on lines
+214
to
+221
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than add functions that are only useful on Unix, I think I would rather adapt the existing clipboard API to support the primary selection. The Wayland implementations of Something like: pub const Window = struct {
pub fn getClipboardText(self: *Window, text: []const u8, options: ClipboardOptions) void;
};
pub const ClipboardOptions = struct {
/// `.primary` is only supported on X11 and Wayland.
selection: enum { clipboard, primary } = .clipboard,
}; |
||
| pub fn getDropData(self: *Window, allocator: std.mem.Allocator) DropData { | ||
| assertFeature(.drop); | ||
| return self.backend.getDropData(allocator); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
XFlushis probably good here, but I think setting CLIPBOARD should also set PRIMARY. From https://specifications.freedesktop.org/clipboard/latest/: