Emit mouse::move signals when we get a motionnotify

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-10-06 20:43:33 +02:00
parent ae8567bef3
commit 18799f32f8
3 changed files with 22 additions and 1 deletions

21
event.c
View File

@ -340,12 +340,31 @@ event_handle_destroynotify(xcb_destroy_notify_event_t *ev)
static void
event_handle_motionnotify(xcb_motion_notify_event_t *ev)
{
drawin_t *w;
client_t *c;
globalconf.timestamp = ev->time;
if(event_handle_mousegrabber(ev->root_x, ev->root_y, ev->state))
return;
#warning
if((c = client_getbyframewin(ev->event)))
{
luaA_object_push(globalconf.L, c);
lua_pushnumber(globalconf.L, ev->event_x);
lua_pushnumber(globalconf.L, ev->event_y);
luaA_object_emit_signal(globalconf.L, -3, "mouse::move", 2);
lua_pop(globalconf.L, 1);
}
if((w = drawin_getbywin(ev->event)))
{
luaA_object_push(globalconf.L, w);
lua_pushnumber(globalconf.L, ev->event_x);
lua_pushnumber(globalconf.L, ev->event_y);
luaA_object_emit_signal(globalconf.L, -3, "mouse::move", 2);
lua_pop(globalconf.L, 1);
}
}
/** The leave notify event handler.

View File

@ -163,6 +163,7 @@ local function setup_signals(wibox)
end
clone_signal("mouse::enter")
clone_signal("mouse::leave")
clone_signal("mouse::move")
clone_signal("property::border_color")
clone_signal("property::border_width")
clone_signal("property::buttons")

View File

@ -390,6 +390,7 @@ window_class_setup(lua_State *L)
signal_add(&window_class.signals, "property::type");
signal_add(&window_class.signals, "button::press");
signal_add(&window_class.signals, "button::release");
signal_add(&window_class.signals, "mouse::move");
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80