Files
bsnes/ruby/input/xlib.cpp
T
Tim Allen 5da4532771 Update to v106r55 release.
byuu says:

Everything *should* be working again, but of course that won't
actually be the case. Here's where things stand:

  - bsnes, higan, icarus, and genius compile and run fine on FreeBSD
    with GTK
  - ruby video and audio drivers are untested on Windows, macOS, and
    Linux
  - hiro is untested on macOS
  - bsnes' status bar is not showing up properly with hiro/qt
  - bsnes and higan's about screen is not showing up properly with
    hiro/qt (1x1 window size)
  - bsnes on Windows crashes often when saving states, and I'm not sure
    why ... it happens inside Encode::RLE
  - bsnes on Windows crashes with ruby.input.windows (unsure why)
  - bsnes on Windows fails to show the verified emblem on the status bar
    properly
  - hiro on Windows flickers when changing tabs

To build the Windows bsnes and higan ports, use

    ruby="video.gdi audio.directsound"

Compilation error logs for Linux will help me fix the inevitable list of
typos there. I can fix the typos on other platforms, I just haven't
gotten to it yet.
2018-08-05 19:00:15 +10:00

60 lines
1.5 KiB
C++

#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include "keyboard/xlib.cpp"
#include "mouse/xlib.cpp"
struct InputXlib : InputDriver {
InputXlib& self = *this;
InputXlib(Input& super) : InputDriver(super), keyboard(super), mouse(super) {}
~InputXlib() { terminate(); }
auto create() -> bool override {
return initialize();
}
auto driver() -> string override { return "Xlib"; }
auto ready() -> bool override { return isReady; }
auto hasContext() -> bool override { return true; }
auto setContext(uintptr context) -> bool override { return initialize(); }
auto acquired() -> bool override { return mouse.acquired(); }
auto acquire() -> bool override { return mouse.acquire(); }
auto release() -> bool override { return mouse.release(); }
auto poll() -> vector<shared_pointer<HID::Device>> override {
vector<shared_pointer<HID::Device>> devices;
keyboard.poll(devices);
mouse.poll(devices);
return devices;
}
auto rumble(uint64_t id, bool enable) -> bool override {
return false;
}
private:
auto initialize() -> bool {
terminate();
if(!self.context) return false;
if(!keyboard.initialize()) return false;
if(!mouse.initialize(self.context)) return false;
return isReady = true;
}
auto terminate() -> void {
isReady = false;
keyboard.terminate();
mouse.terminate();
}
bool isReady = false;
InputKeyboardXlib keyboard;
InputMouseXlib mouse;
};