git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit ae1d3ddf6c1b48065d4311366ba3c837bc8382d8
parent a005ebe417303a3b58c67ab35ebbe5d19fc0c7dc
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sun, 31 Jul 2022 13:30:21 +0300

Work around a Wayland bug – wait for mouse up before creating a new window #470

Diffstat:
MMakefile9+++++++++
MOpenDialog/gtk.c13+++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -274,6 +274,10 @@ endif $(OBJ)/SDL/%.dep: SDL/% -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@ + +$(OBJ)/OpenDialog/%.dep: OpenDialog/% + -@$(MKDIR) -p $(dir $@) + $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@ $(OBJ)/%.dep: % -@$(MKDIR) -p $(dir $@) @@ -289,6 +293,11 @@ $(OBJ)/SDL/%.c.o: SDL/%.c -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(FAT_FLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -c $< -o $@ +$(OBJ)/OpenDialog/%.c.o: OpenDialog/%.c + -@$(MKDIR) -p $(dir $@) + $(CC) $(CFLAGS) $(FAT_FLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -c $< -o $@ + + $(OBJ)/%.c.o: %.c -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(FAT_FLAGS) -c $< -o $@ diff --git a/OpenDialog/gtk.c b/OpenDialog/gtk.c @@ -1,4 +1,5 @@ #include "open_dialog.h" +#include <SDL.h> #include <stdlib.h> #include <stdio.h> #include <dlfcn.h> @@ -51,8 +52,18 @@ if (symbol == NULL) goto lazy_error void nop(){} +static void wait_mouse_up(void) +{ + while (true) { + if (!(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT))) break; + SDL_Event event; + SDL_PollEvent(&event); + } +} + char *do_open_rom_dialog(void) { + wait_mouse_up(); static void *handle = NULL; TRY_DLOPEN("libgtk-3.so"); @@ -129,6 +140,7 @@ lazy_error: char *do_open_folder_dialog(void) { + wait_mouse_up(); static void *handle = NULL; TRY_DLOPEN("libgtk-3.so"); @@ -261,6 +273,7 @@ lazy_error: char *do_save_recording_dialog(unsigned frequency) { + wait_mouse_up(); static void *handle = NULL; TRY_DLOPEN("libgtk-3.so");

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.