Don't display cursor when using gamepad

This commit is contained in:
loki
2019-12-25 20:57:23 +01:00
parent c11872f0f5
commit c3cba2bdad
7 changed files with 25 additions and 20 deletions

View File

@@ -22,16 +22,6 @@ using mic_t = util::safe_ptr<void, freeMic>;
using audio_t = util::safe_ptr<void, freeAudio>;
using input_t = util::safe_ptr<void, freeInput>;
struct gamepad_state_t {
std::uint16_t buttonFlags;
std::uint8_t lt;
std::uint8_t rt;
std::int16_t lsX;
std::int16_t lsY;
std::int16_t rsX;
std::int16_t rsY;
};
std::string get_local_ip();
void terminate_process(std::uint64_t handle);
@@ -40,7 +30,7 @@ mic_t microphone();
audio_t audio(mic_t &mic, std::uint32_t sample_size);
display_t display();
img_t snapshot(display_t &display);
img_t snapshot(display_t &display_void, bool cursor);
int32_t img_width(img_t &);
int32_t img_height(img_t &);

View File

@@ -115,7 +115,7 @@ display_t display() {
return display_t { new display_attr_t {} };
}
img_t snapshot(display_t &display_void) {
img_t snapshot(display_t &display_void, bool cursor) {
auto &display = *((display_attr_t*)display_void.get());
display.refresh();
@@ -127,6 +127,10 @@ img_t snapshot(display_t &display_void) {
AllPlanes, ZPixmap)
};
if(!cursor) {
return img_t { img };
}
XFixesCursorImage *overlay = XFixesGetCursorImage(display.display);
overlay->x -= overlay->xhot;
overlay->y -= overlay->yhot;

View File

@@ -26,11 +26,9 @@ struct input_raw_t {
uinput_t mouse_input;
display_t display;
gamepad_state_t gamepad_state;
};
//TODO: Use libevdev for keyboard and mouse, then any mention of X11 can be removed from linux_input.cpp
//TODO: Use libevdev for keyboard and mouse, then any mention of X11 can be removed from linux_evdev.cpp
struct display_attr_t {
display_attr_t() : display { XOpenDisplay(nullptr) }, window { DefaultRootWindow(display) }, attr {} {
XGetWindowAttributes(display, window, &attr);