-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move GateEngineDependencies inside GateEngine package
- Loading branch information
Showing
109 changed files
with
88,978 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
Sources/GateEngineDependencies/LinuxSupport/LinuxExtensions/Include/X11.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "X11/Xlib.h" | ||
|
||
// Non-variadic wrappers | ||
XIC XCreateIC_Ext(XIM im, Window window); |
10 changes: 10 additions & 0 deletions
10
Sources/GateEngineDependencies/LinuxSupport/LinuxExtensions/Include/ioctl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <sys/ioctl.h> | ||
|
||
// Non-variadic wrappers | ||
int ioctl_value(int fd, int request, int value); | ||
int ioctl_ptr(int fd, int request, void* ptr); | ||
|
||
int EVIOCGBIT(int ev, int len); | ||
int EVIOCGABS(int abs); | ||
int EVIOCGKEY(int len); | ||
int EVIOCGID(); |
12 changes: 12 additions & 0 deletions
12
Sources/GateEngineDependencies/LinuxSupport/LinuxExtensions/X11.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
// Window & Rendering | ||
#include "Include/X11.h" | ||
|
||
// X11 Non-variadic wrapper | ||
XIC XCreateIC_Ext(XIM im, Window window) { | ||
return XCreateIC(im, | ||
XNInputStyle, XIMPreeditNothing | XIMStatusNothing, | ||
XNClientWindow, window, | ||
XNFocusWindow, window, | ||
NULL); | ||
} |
42 changes: 42 additions & 0 deletions
42
Sources/GateEngineDependencies/LinuxSupport/LinuxExtensions/ioctl.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Game Controllers | ||
#include "Include/ioctl.h" | ||
#include <linux/types.h> | ||
|
||
struct input_absinfo { | ||
int value; | ||
__s32 minimum; | ||
__s32 maximum; | ||
__s32 fuzz; | ||
__s32 flat; | ||
__s32 resolution; | ||
}; | ||
|
||
struct input_id { | ||
__u16 bustype; | ||
__u16 vendor; | ||
__u16 product; | ||
__u16 version; | ||
}; | ||
|
||
int ioctl_ptr(int fd, int request, void* ptr) { | ||
return ioctl(fd, request, ptr); | ||
} | ||
int ioctl_value(int fd, int request, int value) { | ||
return ioctl(fd, request, value); | ||
} | ||
|
||
int EVIOCGBIT(int ev, int len) { | ||
return _IOC(_IOC_READ, 'E', 0x20 + (ev), len); | ||
} | ||
|
||
int EVIOCGABS(int abs) { | ||
return _IOR('E', 0x40 + (abs), struct input_absinfo); | ||
} | ||
|
||
int EVIOCGKEY(int len) { | ||
return _IOC(_IOC_READ, 'E', 0x18, len); | ||
} | ||
|
||
int EVIOCGID() { | ||
return _IOR('E', 0x02, struct input_id); | ||
} |
6 changes: 6 additions & 0 deletions
6
Sources/GateEngineDependencies/LinuxSupport/LinuxImports/module.modulemap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module LinuxImportsGFX [system] { | ||
header "shim.h" | ||
link "X11" | ||
link "GLX" | ||
export * | ||
} |
20 changes: 20 additions & 0 deletions
20
Sources/GateEngineDependencies/LinuxSupport/LinuxImports/shim.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Window & Rendering | ||
#include <GL/glx.h> | ||
#include <X11/Xlib.h> | ||
|
||
/* This isn't defined in older Linux kernel headers */ | ||
#ifndef SYN_DROPPED | ||
#define SYN_DROPPED 3 | ||
#endif | ||
#ifndef BTN_DPAD_UP | ||
#define BTN_DPAD_UP 0x220 | ||
#endif | ||
#ifndef BTN_DPAD_DOWN | ||
#define BTN_DPAD_DOWN 0x221 | ||
#endif | ||
#ifndef BTN_DPAD_LEFT | ||
#define BTN_DPAD_LEFT 0x222 | ||
#endif | ||
#ifndef BTN_DPAD_RIGHT | ||
#define BTN_DPAD_RIGHT 0x223 | ||
#endif |
2 changes: 2 additions & 0 deletions
2
Sources/GateEngineDependencies/LinuxSupport/LinuxSupport/LinuxSupport.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@_exported import Glibc | ||
@_exported import LinuxImports |
6 changes: 6 additions & 0 deletions
6
Sources/GateEngineDependencies/LinuxSupport/LinuxSupport/X11.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import LinuxExtensions | ||
|
||
@_transparent | ||
public func XCreateIC(_ im: XIM, _ window: Window) -> XIC { | ||
return XCreateIC_Ext(im, window) | ||
} |
28 changes: 28 additions & 0 deletions
28
Sources/GateEngineDependencies/LinuxSupport/LinuxSupport/ioctl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import LinuxExtensions | ||
|
||
@_transparent | ||
public func ioctl(_ fd: Int32, _ request: Int32, _ ptr: UnsafeMutableRawPointer) -> Int32 { | ||
return ioctl_ptr(fd, request, ptr) | ||
} | ||
|
||
@_transparent | ||
public func ioctl(_ fd: Int32, _ request: Int32, _ value: Int32) -> Int32 { | ||
return ioctl_value(fd, request, value) | ||
} | ||
|
||
@_transparent | ||
public func EVIOCGBIT(_ ev: Int32, _ len: Int32) -> Int32 { | ||
return LinuxExtensions.EVIOCGBIT(ev, len) | ||
} | ||
|
||
@_transparent | ||
public func EVIOCGABS(_ abs: Int32) -> Int32 { | ||
return LinuxExtensions.EVIOCGABS(abs) | ||
} | ||
|
||
@_transparent | ||
public func EVIOCGKEY(_ len: Int32) -> Int32 { | ||
return LinuxExtensions.EVIOCGKEY(len) | ||
} | ||
|
||
public let EVIOCGID: Int32 = LinuxExtensions.EVIOCGID() |
Oops, something went wrong.