wrong default clip for Gtk::DrawingArea



Hi,

I have a problem with an self created widget, based on Gtk::DrawingArea.
It was introduced with a change to version 3.14.1 (debian version is
3.14.1-1; ruby-gtk shows as Gtk::VERSION [3, 14, 1]).

If I place the drawing area in box (vertical) below an other widget, all
drawing with cairo is clipped on the bottom side of the drawing area, as
much as the widgets above the area are tall.

Here is a simple ruby-gtk example that shows this behavior.


#!/usr/bin/env ruby

require 'gtk3'

win = Gtk::Window.new
win.set_default_size 400, 400
box = Gtk::Box.new :vertical
win.add box

button = Gtk::Button.new :label => 'click me'
box.pack_start button, :expand => false, :fill => false

area = Gtk::DrawingArea.new
box.pack_start area, :expand => true, :fill => true

button.signal_connect(:clicked) do
    cc = area.window.create_cairo_context
#    cc.reset_clip
    cc.set_source_rgb 1, 1, 1
    cc.paint
    cc.set_source_rgb 0, 0, 0
    allo = area.allocation
    cc.rectangle 10, 10, allo.width - 20, allo.height - 20
    cc.stroke
end

win.show_all
Gtk.main


If I uncomment the line 18 to reset the clipping of the cairo context,
The drawing fills as expected the complete drawing area. So my
assumption is, that gtk creates a default clip region, that is in this
case wrong. Or is this behavior expected, and if so, what is the
preferred way to handle it?

Cheers, detlef




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]