THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#1051 - (Properly) re-add window shapes
User who did this - Uli Schlachter (psychon)

----------
The following commit should finish the implementation of the C side for this:

commit 56c57979056ec23cbd4982f3b81f6d80895fbe46
Author: Uli Schlachter <psyc...@znc.in>
Date:   Fri Jan 3 16:51:16 2014 +0100

    Finish C-side support for window shapes (FS#1051)
    
    A drawin's and a client's bounding and clip shape can now be queried and is
    returned as a cairo surface.  Also, a client window's shape (e.g. xeyes 
setting
    its own shape) can be queried via c.shape_client_bounding and
    c.shape_client_clip.  All of these properties now emit signals when changed.
    
    (This also silently fixes a bug in luaA_drawin_set_shape_bounding() which 
forgot
    to include the drawin's border in its size calculation)
    
    Signed-off-by: Uli Schlachter <psyc...@znc.in>

What is still missing is the lua side of things. Something should automatically 
handle client shapes and apply them to clients, so that xeyes looks more sane. 
Here is my local hack for this which I dumped into the manage hook:

    local gears = require("gears")
    local cairo = require("lgi").cairo
    local translate = function(shape, geom, border)
       if not shape then return end
       local s = gears.surface(shape)
       local cr = cairo.Context(s)
       local _, t = c:titlebar_top()
       local _, b = c:titlebar_bottom()
       local _, l = c:titlebar_left()
       local _, r = c:titlebar_right()
       print(t,b,l,r)
       local img_width = geom.width + 2*border
       local img_height = geom.height + 2*border
       local result = cairo.ImageSurface(cairo.Format.ARGB32, img_width, 
img_height)
       local cr = cairo.Context(result)

       -- Fill everything (this paints the titlebars and border)
       cr:paint()
       cr:set_operator(cairo.Operator.SOURCE)

       -- Draw the client's shape in the middle
       cr:translate(border + l, border + t)
       cr:set_source_surface(s, 0, 0)
       cr:rectangle(0, 0, geom.width - l - r, geom.height - t - b)
       cr:fill()

       local c = cairo.Context(cairo.ImageSurface(cairo.Format.RGB24, 
img_width, img_height))
       c:set_source_rgb(1, 1, 1)
       c:mask(cairo.Pattern.create_for_surface(result, 0, 0))
       print(c:get_group_target():write_to_png("/tmp/t.png"))

       return result
    end
    local update_bounding = function()
       local res = translate(c.client_shape_bounding, c:geometry(), 
c.border_width)
       c.shape_bounding = res and res._native
       if res then res:finish() end
    end
    local update_clip = function()
       local res = translate(c.client_shape_clip, c:geometry(), 0)
       c.shape_clip = res and res._native
       if res then res:finish() end
    end
    local update_shapes = function()
       update_bounding()
       update_clip()
    end
    c:connect_signal("property::shape_client_bounding", function()
       update_bounding()
    end)
    c:connect_signal("property::shape_client_clip", function()
       update_clip()
    end)
    c:connect_signal("property::width", update_shapes)
    c:connect_signal("property::height", update_shapes)
    update_shapes()

----------

More information can be found at the following URL:
https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1051#comment3785

You are receiving this message because you have requested it from the Flyspray 
bugtracking system.  If you did not expect this message or don't want to 
receive mails in future, you can change your notification settings at the URL 
shown above.

--
To unsubscribe, send mail to awesome-devel-unsubscr...@naquadah.org.

Reply via email to