summary refs log tree commit diff
path: root/src/xfixes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/xfixes.zig')
-rw-r--r--src/xfixes.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/xfixes.zig b/src/xfixes.zig
new file mode 100644
index 0000000..9eb8afc
--- /dev/null
+++ b/src/xfixes.zig
@@ -0,0 +1,18 @@
+const x11 = @import("x11.zig");
+const Atom = x11.Atom;
+const Display = x11.Display;
+const False = x11.False;
+const Window = x11.Window;
+const getAtom = x11.getAtom;
+
+const xfixes = @cImport({ @cInclude("X11/extensions/Xfixes.h"); });
+const SET_SELECTION_OWNER = xfixes.XFixesSetSelectionOwnerNotifyMask;
+
+extern fn XFixesSelectSelectionInput(display: *Display, window: Window,
+                                     selection: Atom, event_mask: c_ulong) void;
+
+pub fn getSelection(display: *Display, window: Window,
+                    selection: [*c]const u8) void {
+    const atom = getAtom(display, selection, False);
+    XFixesSelectSelectionInput(display, window, atom, SET_SELECTION_OWNER);
+}