+2
-2
data/core/init.lua
+2
-2
data/core/init.lua
···
317
317
elseif type == "mousewheel" then
318
318
core.root_view:on_mouse_wheel(...)
319
319
elseif type == "filedropped" then
320
-
local mx, my = core.root_view.mouse.x, core.root_view.mouse.y
321
-
local ok, doc = core.try(core.open_doc, select(1, ...))
320
+
local filename, mx, my = ...
321
+
local ok, doc = core.try(core.open_doc, filename)
322
322
if ok then
323
323
local node = core.root_view.root_node:get_child_overlapping_point(mx, my)
324
324
node:set_active_view(node.active_view)
+6
-1
src/api/system.c
+6
-1
src/api/system.c
···
36
36
37
37
static int f_poll_event(lua_State *L) {
38
38
char buf[16];
39
+
int mx, my, wx, wy;
39
40
SDL_Event e;
40
41
41
42
top:
···
66
67
goto top;
67
68
68
69
case SDL_DROPFILE:
70
+
SDL_GetGlobalMouseState(&mx, &my);
71
+
SDL_GetWindowPosition(window, &wx, &wy);
69
72
lua_pushstring(L, "filedropped");
70
73
lua_pushstring(L, e.drop.file);
74
+
lua_pushnumber(L, mx - wx);
75
+
lua_pushnumber(L, my - wy);
71
76
SDL_free(e.drop.file);
72
-
return 2;
77
+
return 4;
73
78
74
79
case SDL_KEYDOWN:
75
80
lua_pushstring(L, "keypressed");