gamemode: revert commit 41ddd22 for gamescope.zig
This commit is contained in:
parent
db186847a7
commit
377842aef8
1 changed files with 4 additions and 5 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const mach = @import("main.zig");
|
|
||||||
|
|
||||||
const log = std.log.scoped(.gamemode);
|
const log = std.log.scoped(.gamemode);
|
||||||
|
|
||||||
|
|
@ -8,7 +7,7 @@ test {
|
||||||
std.testing.refAllDeclsRecursive(@This());
|
std.testing.refAllDeclsRecursive(@This());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const LoadError = error{ MissingSymbol, LibraryNotFound } || std.DynLib.Error;
|
pub const LoadError = error{MissingSymbol} || std.DynLib.Error;
|
||||||
pub const Error = error{ RequestFailed, RequestRejected };
|
pub const Error = error{ RequestFailed, RequestRejected };
|
||||||
|
|
||||||
pub const Status = enum(u8) {
|
pub const Status = enum(u8) {
|
||||||
|
|
@ -101,9 +100,9 @@ const linux_impl = struct {
|
||||||
pub fn tryInit() LoadError!void {
|
pub fn tryInit() LoadError!void {
|
||||||
if (state == .init) return;
|
if (state == .init) return;
|
||||||
|
|
||||||
var dl = mach.dynLibOpen("libgamemode.so.0") catch |e| switch (e) {
|
var dl = std.DynLib.open("libgamemode.so.0") catch |e| switch (e) {
|
||||||
// backwards-compatibility for old gamemode versions
|
// backwards-compatibility for old gamemode versions
|
||||||
error.LibraryNotFound => try mach.dynLibOpen("libgamemode.so"),
|
error.FileNotFound => try std.DynLib.open("libgamemode.so"),
|
||||||
else => return e,
|
else => return e,
|
||||||
};
|
};
|
||||||
errdefer dl.close();
|
errdefer dl.close();
|
||||||
|
|
@ -129,7 +128,7 @@ const linux_impl = struct {
|
||||||
.failed => return false,
|
.failed => return false,
|
||||||
.uninit => {
|
.uninit => {
|
||||||
tryInit() catch |e| {
|
tryInit() catch |e| {
|
||||||
if (e != error.LibraryNotFound) {
|
if (e != error.FileNotFound) {
|
||||||
log.warn("Loading gamemode: '{}'. Disabling libgamemode support.", .{e});
|
log.warn("Loading gamemode: '{}'. Disabling libgamemode support.", .{e});
|
||||||
}
|
}
|
||||||
state = .failed;
|
state = .failed;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue