Fix several build warnings and minor bugs

This commit is contained in:
Cameron Gutman
2022-11-20 19:20:42 -06:00
parent 56f84ab662
commit 098f53cd0b
11 changed files with 16 additions and 18 deletions

View File

@@ -240,12 +240,14 @@ void *HandleMouseEmulation(void* param)
deltaY = pow((float)rawY / 32767.0f * MOUSE_EMULATION_MOTION_MULTIPLIER, 3);
// Enforce deadzones
deltaX = abs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0;
deltaY = abs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0;
deltaX = fabs(deltaX) > MOUSE_EMULATION_DEADZONE ? deltaX - MOUSE_EMULATION_DEADZONE : 0;
deltaY = fabs(deltaY) > MOUSE_EMULATION_DEADZONE ? deltaY - MOUSE_EMULATION_DEADZONE : 0;
if (deltaX != 0 || deltaY != 0)
LiSendMouseMoveEvent(deltaX, -deltaY);
}
return NULL;
}
static bool evdev_handle_event(struct input_event *ev, struct input_device *dev) {
@@ -923,7 +925,7 @@ void evdev_map(char* device) {
buf += sprintf(buf, "%02x", ((unsigned char*) guid)[i]);
struct mapping map;
strncpy(map.name, libevdev_get_name(evdev), sizeof(map.name));
strncpy(map.name, name, sizeof(map.name));
strncpy(map.guid, str_guid, sizeof(map.guid));
libevdev_free(evdev);

View File

@@ -36,7 +36,6 @@ static struct mapping* defaultMappings;
static struct udev *udev;
static struct udev_monitor *udev_mon;
static int udev_fd;
static int inputRotate;
static int udev_handle(int fd) {

View File

@@ -381,7 +381,7 @@ int main(int argc, char* argv[]) {
if (config.pin > 0 && config.pin <= 9999) {
sprintf(pin, "%04d", config.pin);
} else {
sprintf(pin, "%d%d%d%d", (int)random() % 10, (int)random() % 10, (int)random() % 10, (int)random() % 10);
sprintf(pin, "%d%d%d%d", (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10, (unsigned)random() % 10);
}
printf("Please enter the following PIN on the target PC: %s\n", pin);
fflush(stdout);

View File

@@ -82,6 +82,7 @@ void sdl_loop() {
case SDL_TOGGLE_FULLSCREEN:
fullscreen_flags ^= SDL_WINDOW_FULLSCREEN;
SDL_SetWindowFullscreen(window, fullscreen_flags);
break;
case SDL_MOUSE_GRAB:
SDL_ShowCursor(SDL_ENABLE);
SDL_SetRelativeMouseMode(SDL_TRUE);

View File

@@ -143,7 +143,6 @@ void egl_init(EGLNativeDisplayType native_display, NativeWindowType native_windo
GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertex_shader, 1, &vertex_source, NULL);
glCompileShader(vertex_shader);
GLint maxLength = 0;
GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragment_shader, 1, &fragment_source, NULL);

View File

@@ -65,6 +65,7 @@ int vaapi_init_lib() {
int vaapi_init(AVCodecContext* decoder_ctx) {
decoder_ctx->get_format = va_get_format;
decoder_ctx->get_buffer2 = va_get_buffer;
return 0;
}
void vaapi_queue(AVFrame* dec_frame, Window win, int width, int height) {