api/system: check if a window is created when firing DND events

This commit is contained in:
takase1121 2024-07-04 22:24:14 +08:00 committed by Takase
parent 3d0344393c
commit 77d443c53d
1 changed files with 3 additions and 2 deletions

View File

@ -228,8 +228,9 @@ top:
SDL_GetMouseState(&mx, &my);
lua_pushstring(L, "filedropped");
lua_pushstring(L, e.drop.file);
lua_pushinteger(L, mx * window_renderer->scale_x);
lua_pushinteger(L, my * window_renderer->scale_y);
// a DND into dock event fired before a window is created
lua_pushinteger(L, mx * (window_renderer ? window_renderer->scale_x : 0));
lua_pushinteger(L, my * (window_renderer ? window_renderer->scale_y : 0));
SDL_free(e.drop.file);
return 4;
}