mouse: Avoid an error when the client is killed while moving

to reproduce:

1) spawn an xterm
2) enter 'sleep 10 && killall xterm'
3) start moving the terminal

There will be an error

(found by a yet to be commited integration test)
This commit is contained in:
Emmanuel Lepage Vallee 2016-04-27 19:48:03 -04:00
parent 76313263b6
commit 693a87ef2e
4 changed files with 10 additions and 0 deletions

View File

@ -41,6 +41,8 @@ function floating.mouse_resize_handler(c, corner, x, y)
end
capi.mousegrabber.run(function (_mouse)
if not c.valid then return false end
_mouse.x = _mouse.x + coordinates_delta.x
_mouse.y = _mouse.y + coordinates_delta.y
for _, v in ipairs(_mouse.buttons) do

View File

@ -30,6 +30,8 @@ function magnifier.mouse_resize_handler(c, corner, x, y)
local prev_coords = {}
capi.mousegrabber.run(function (_mouse)
if not c.valid then return false end
for _, v in ipairs(_mouse.buttons) do
if v then
prev_coords = { x =_mouse.x, y = _mouse.y }

View File

@ -85,6 +85,8 @@ local function mouse_resize_handler(c, _, _, _, orientation)
local prev_coords = {}
capi.mousegrabber.run(function (_mouse)
if not c.valid then return false end
_mouse.x = _mouse.x + coordinates_delta.x
_mouse.y = _mouse.y + coordinates_delta.y
for _, v in ipairs(_mouse.buttons) do

View File

@ -174,6 +174,8 @@ function mouse.client.move(c, snap, finished_cb)
local fixed_y = c.maximized_vertical
capi.mousegrabber.run(function (_mouse)
if not c.valid then return false end
for _, v in ipairs(_mouse.buttons) do
if v then
local lay = layout.get(c.screen)
@ -218,6 +220,8 @@ mouse.client.dragtotag = { }
-- @param c The client to move
function mouse.client.dragtotag.border(c)
capi.mousegrabber.run(function (_mouse)
if not c.valid then return false end
local button_down = false
for _, v in ipairs(_mouse.buttons) do
if v then button_down = true end