srctree

Gregory Mullen parent e37af094
init commit

filename was Deleted added: 88, removed: 3, total 85
@@ -0,0 +1,3 @@
`zig build test`
 
`zig build -p ~/.config/obs-studio/plugins/`
 
filename was Deleted added: 88, removed: 3, total 85
@@ -0,0 +1,35 @@
const std = @import("std");
 
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
 
const lib = b.addSharedLibrary(.{
.name = "obs-sway-focus",
.root_source_file = .{ .path = "src/root.zig" },
.target = target,
.optimize = optimize,
});
lib.linkLibC();
// b.installArtifact(lib);
b.getInstallStep().dependOn(
&b.addInstallArtifact(lib, .{
.dest_dir = .{ .override = std.Build.InstallDir{ .custom = "" } },
.dest_sub_path = "obs-sway-focus/bin/64bit/obs-sway-focus.so",
}).step,
);
 
const lib_unit_tests = b.addTest(.{
.root_source_file = .{ .path = "src/root.zig" },
.target = target,
.optimize = optimize,
});
 
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
 
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_lib_unit_tests.step);
}
 
filename was Deleted added: 88, removed: 3, total 85
@@ -0,0 +1,47 @@
const std = @import("std");
 
pub const obs = @cImport({
@cInclude("obs/util/base.h");
@cInclude("obs/obs-module.h");
@cInclude("obs/obs-config.h");
@cInclude("obs/obs-data.h");
@cInclude("obs/obs-properties.h");
@cInclude("obs/obs-service.h");
});
 
const PLUGIN_VERSION = "0.0.0";
var obs_module_pointer: ?*obs.obs_module_t = null;
export fn obs_module_set_pointer(module: ?*obs.obs_module_t) void {
obs_module_pointer = module;
}
 
export fn obs_current_module() ?*obs.obs_module_t {
return obs_module_pointer;
}
 
export fn obs_module_ver() u32 {
return obs.LIBOBS_API_VER;
}
 
export fn obs_module_author() [*:0]const u8 {
return "grayhatter";
}
 
export fn obs_module_name() [*:0]const u8 {
return "obs-sway-focus";
}
 
export fn obs_module_description() [*:0]const u8 {
return "it does stuff";
}
// TODO
// thread
// socket
// send message
// get messages
// get windows
// poll socket
// trigger scene on event
// stall on remove for min seconds
 
test "basic add functionality" {}