mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-20 09:11:23 +02:00
Update to v094r28 release.
byuu says: This WIP substantially restructures the ruby API for the first time since that project started. It is my hope that with this restructuring, destruction of the ruby objects should now be deterministic, which should fix the crashing on closing the emulator on Linux. We'll see I guess ... either way, it removed two layers of wrappers from ruby, so it's a pretty nice code cleanup. It won't compile on Windows due to a few issues I didn't see until uploading the WIP, too lazy to upload another. But I fixed all the compilation issues locally, so it'll work on Windows again with the next WIP (unless I break something else.) (Kind of annoying that Linux defines glActiveTexture but Windows doesn't.)
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#ifndef RUBY_INPUT_MOUSE_RAWINPUT
|
||||
#define RUBY_INPUT_MOUSE_RAWINPUT
|
||||
|
||||
namespace ruby {
|
||||
|
||||
struct InputMouseRawInput {
|
||||
Input& input;
|
||||
InputMouseRawInput(Input& input) : input(input) {}
|
||||
|
||||
uintptr_t handle = 0;
|
||||
bool mouseAcquired = false;
|
||||
|
||||
@@ -24,7 +25,7 @@ struct InputMouseRawInput {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto unacquire() -> bool {
|
||||
auto release() -> bool {
|
||||
if(mouseAcquired == true) {
|
||||
mouseAcquired = false;
|
||||
ReleaseCapture();
|
||||
@@ -70,7 +71,7 @@ struct InputMouseRawInput {
|
||||
auto assign(unsigned groupID, unsigned inputID, int16_t value) -> void {
|
||||
auto& group = ms.hid->group(groupID);
|
||||
if(group.input(inputID).value() == value) return;
|
||||
if(input.onChange) input.onChange(ms.hid, groupID, inputID, group.input(inputID).value(), value);
|
||||
input.doChange(ms.hid, groupID, inputID, group.input(inputID).value(), value);
|
||||
group.input(inputID).setValue(value);
|
||||
}
|
||||
|
||||
@@ -114,10 +115,8 @@ struct InputMouseRawInput {
|
||||
}
|
||||
|
||||
auto term() -> void {
|
||||
unacquire();
|
||||
release();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -1,9 +1,10 @@
|
||||
#ifndef RUBY_INPUT_MOUSE_XLIB
|
||||
#define RUBY_INPUT_MOUSE_XLIB
|
||||
|
||||
namespace ruby {
|
||||
|
||||
struct InputMouseXlib {
|
||||
Input& input;
|
||||
InputMouseXlib(Input& input) : input(input) {}
|
||||
|
||||
shared_pointer<HID::Mouse> hid{new HID::Mouse};
|
||||
|
||||
uintptr_t handle = 0;
|
||||
@@ -42,7 +43,7 @@ struct InputMouseXlib {
|
||||
}
|
||||
}
|
||||
|
||||
auto unacquire() -> bool {
|
||||
auto release() -> bool {
|
||||
if(acquired()) {
|
||||
//restore cursor acceleration and release cursor
|
||||
XChangePointerControl(display, True, True, ms.numerator, ms.denominator, ms.threshold);
|
||||
@@ -59,7 +60,7 @@ struct InputMouseXlib {
|
||||
auto assign(unsigned groupID, unsigned inputID, int16_t value) -> void {
|
||||
auto& group = hid->group(groupID);
|
||||
if(group.input(inputID).value() == value) return;
|
||||
if(input.onChange) input.onChange(hid, groupID, inputID, group.input(inputID).value(), value);
|
||||
input.doChange(hid, groupID, inputID, group.input(inputID).value(), value);
|
||||
group.input(inputID).setValue(value);
|
||||
}
|
||||
|
||||
@@ -143,12 +144,10 @@ struct InputMouseXlib {
|
||||
}
|
||||
|
||||
auto term() -> void {
|
||||
unacquire();
|
||||
release();
|
||||
XFreeCursor(display, invisibleCursor);
|
||||
XCloseDisplay(display);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user