diff --git a/event.c b/event.c index d53ff45c..ac9bb640 100644 --- a/event.c +++ b/event.c @@ -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. diff --git a/lib/wibox/init.lua.in b/lib/wibox/init.lua.in index ea4e6aec..07061639 100644 --- a/lib/wibox/init.lua.in +++ b/lib/wibox/init.lua.in @@ -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") diff --git a/objects/window.c b/objects/window.c index 6b6ba319..dea5987e 100644 --- a/objects/window.c +++ b/objects/window.c @@ -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