Fix issue #32 (#33)

* update documentation

* Fix typo

* Added some examples

* changed window names

* Minor fix

* Added mfb_update_events to all platforms. Checked on Windows, X11 and Wayland

* simplify CMake

* Upgrade to CMake 3.5, simplify script and generalize it
Now the users only have to add_directory and link_libraries(minifb) in CMake

* Renamed typo scrool by scroll
Added some checks
Removed some warnings

* fix issue 32
This commit is contained in:
Daniel Collin
2020-03-05 18:51:57 +01:00
committed by GitHub
parent 219e7d0c20
commit 4286f055c6
5 changed files with 59 additions and 22 deletions

View File

@ -565,17 +565,27 @@ mfb_open(const char *title, unsigned width, unsigned height)
int fd = -1;
SWindowData *window_data = (SWindowData *) malloc(sizeof(SWindowData));
if(window_data == 0x0) {
return 0x0;
}
memset(window_data, 0, sizeof(SWindowData));
SWindowData_Way *window_data_way = (SWindowData_Way *) malloc(sizeof(SWindowData_Way));
if(window_data_way == 0x0) {
free(window_data);
return 0x0;
}
memset(window_data_way, 0, sizeof(SWindowData_Way));
window_data->specific = window_data_way;
window_data_way->shm_format = -1u;
window_data_way->display = wl_display_connect(0x0);
if (!window_data_way->display)
if (!window_data_way->display) {
free(window_data);
free(window_data_way);
return 0x0;
}
window_data_way->registry = wl_display_get_registry(window_data_way->display);
wl_registry_add_listener(window_data_way->registry, &registry_listener, window_data);