lib/rabbit/renderer/display/mask.rb in rabbit-2.1.6 vs lib/rabbit/renderer/display/mask.rb in rabbit-2.1.7

- old
+ new

@@ -29,38 +29,33 @@ set_hole end def set_hole if @mask_size <= 0 - @window.shape_combine_mask(nil, 0, 0) + @window.shape_combine_region(nil) else - setup_mask if @mask.nil? - w, h = width, height - @mask.draw_rectangle(@set_gc, true, 0, 0, w, h) - mw = w * @mask_size - mh = h * @mask_size - mx = (w - mw) / 2 - my = (h - mh) / 2 - @mask.draw_rectangle(@xor_gc, true, mx, my, mw, mh) - @window.shape_combine_mask(@mask, 0, 0) + _size = size + w, h = _size.real_width, _size.real_height + @mask = Cairo::Region.new + @mask.union!(0, 0, w, h) + if @mask_size < 1.0 + mw = w * @mask_size + mh = h * @mask_size + mx = (w - mw) / 2 + my = (h - mh) / 2 + @mask.subtract!(mx, my, mw, mh) + else + @mask.subtract!(0, 0, w - 1, h) + end + @window.shape_combine_region(@mask) end + redraw update_title # for xfwm end private def init_mask - @mask = nil @mask_size = 0 - end - - def setup_mask - @mask = Gdk::Pixmap.new(nil, width, height, 1) - @xor_gc = Gdk::GC.new(@mask) - @xor_gc.set_function(Gdk::GC::INVERT) - @set_gc = Gdk::GC.new(@mask) - @set_gc.set_function(Gdk::GC::SET) - @clear_gc = Gdk::GC.new(@mask) - @clear_gc.set_function(Gdk::GC::CLEAR) end end end end end