While fumbling around in awful.mouse, i noticed that my previous patch left
some useless variables and their assignments in awful.mouse.client.dragtotag().
Also i noticed that the function wouldn't work if the target tag's screen and
the client's screen were different. The attached patch fixes both of these
issues.

-- 
    Gregor Best
From 2b14d69ebd4e2a3b0a70a75ba495a0b594f50b75 Mon Sep 17 00:00:00 2001
From: Gregor Best <[EMAIL PROTECTED]>
Date: Tue, 9 Dec 2008 17:25:59 +0100
Subject: [PATCH] awful.mouse: clean up client.dragtotag and make it work for c.screen != t.screen

Signed-off-by: Gregor Best <[EMAIL PROTECTED]>
---
 lib/awful/mouse.lua.in |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lib/awful/mouse.lua.in b/lib/awful/mouse.lua.in
index c4f8166..ef56788 100644
--- a/lib/awful/mouse.lua.in
+++ b/lib/awful/mouse.lua.in
@@ -162,29 +162,28 @@ end
 --- Move a client to a tag by drag'n'dropping it over a taglist widget
 -- @param c The client to move
 function client.dragtotag(c)
-    local m_c = capi.mouse.coords()
-    local dist_x = 0
-    local dist_y = 0
-
     capi.mousegrabber.run(function (mouse)
                               local button_down = false
                               for k, v in ipairs(mouse.buttons) do
                                   if v then
                                       button_down = true
-                                      dist_x = mouse.x - dist_x
-                                      dist_y = mouse.y - dist_y
                                   end
                               end
                               if not button_down then
                                   local w = widget_under_pointer()
                                   if w and widget.taglist.gettag(w) then
-                                      aclient.movetotag(widget.taglist.gettag(w), c)
+                                      local t = widget.taglist.gettag(w)
+                                      if t.screen ~= c.screen then
+                                          aclient.movetoscreen(c, t.screen)
+                                      end
+                                      aclient.movetotag(t, c)
                                   end
                                   return false
                               end
                               return true
                           end, "fleur")
 end
+
 --- Get a client corner coordinates.
 -- @param c The client to get corner from, focused one by default.
 -- @param corner The corner to use: auto, top_left, top_right, bottom_left,
-- 
1.6.0.4

Attachment: signature.asc
Description: PGP signature

Reply via email to