Merge pull request #3363 from sclu1034/issue/keygrabber_timer
Stop timer when stopping keygrabber
This commit is contained in:
commit
f4fb055512
|
@ -474,12 +474,20 @@ function keygrabber:start()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Stop the keygrabber.
|
--- Stop the keygrabber.
|
||||||
|
--
|
||||||
|
-- Also stops any `timeout`.
|
||||||
|
--
|
||||||
-- @method stop
|
-- @method stop
|
||||||
-- @emits stopped
|
-- @emits stopped
|
||||||
-- @emits property::current_instance
|
-- @emits property::current_instance
|
||||||
function keygrabber:stop(_stop_key, _stop_mods) -- (at)function disables ldoc params
|
function keygrabber:stop(_stop_key, _stop_mods) -- (at)function disables ldoc params
|
||||||
keygrab.stop(self.grabber)
|
keygrab.stop(self.grabber)
|
||||||
|
|
||||||
|
local timer = self._private.timer
|
||||||
|
if timer and timer.started then
|
||||||
|
timer:stop()
|
||||||
|
end
|
||||||
|
|
||||||
if self.stop_callback then
|
if self.stop_callback then
|
||||||
self.stop_callback(
|
self.stop_callback(
|
||||||
self.current_instance, _stop_key, _stop_mods, self.sequence
|
self.current_instance, _stop_key, _stop_mods, self.sequence
|
||||||
|
|
|
@ -99,11 +99,13 @@ function timer:start()
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Stop the timer.
|
--- Stop the timer.
|
||||||
|
--
|
||||||
|
-- Does nothing if the timer isn't running.
|
||||||
|
--
|
||||||
-- @method stop
|
-- @method stop
|
||||||
-- @emits stop
|
-- @emits stop
|
||||||
function timer:stop()
|
function timer:stop()
|
||||||
if self.data.source_id == nil then
|
if self.data.source_id == nil then
|
||||||
gdebug.print_error(traceback("timer not started"))
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
glib.source_remove(self.data.source_id)
|
glib.source_remove(self.data.source_id)
|
||||||
|
|
Loading…
Reference in New Issue