File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -106,14 +106,16 @@ pub fn Xev(comptime bes: []const AllBackend) type {
106106
107107 /// Manually set the backend to use, but if the backend is not
108108 /// available, this will not change the backend in use.
109- pub fn prefer (be : AllBackend ) void {
109+ pub fn prefer (be : AllBackend ) bool {
110110 inline for (bes ) | candidate | {
111111 if (candidate == be ) {
112112 const api = candidate .Api ();
113113 if (api .available ()) backend = subset (candidate );
114- return ;
114+ return true ;
115115 }
116116 }
117+
118+ return false ;
117119 }
118120
119121 pub const Loop = struct {
@@ -214,7 +216,7 @@ pub fn Xev(comptime bes: []const AllBackend) type {
214216
215217 test "prefer" {
216218 const testing = std .testing ;
217- prefer (bes [0 ]);
219+ try testing . expect ( prefer (bes [0 ]) );
218220 inline for (bes ) | be | {
219221 if (@intFromEnum (be ) == @intFromEnum (backend )) {
220222 try testing .expect (be .Api ().available ());
You can’t perform that action at this time.
0 commit comments