Re: wrong default clip for Gtk::DrawingArea

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

 



hi;

the regression should be fixed by commit
f3bd78a3cfff64cd0a043091e07bf46cd178cf0c, which will be in the GTK+
3.14.2 release.

your code, nevertheless, has some serious issues.

you cannot simply expect to get the GdkWindow of a widget from any
signal handler, then create a cairo context from it and draw. that's
something that barely used to work in GTK+ 2.x, and an "undefined
behaviour" we keep in GTK+ 3.x only because big applications, like
Gnumeric, still rely on that grey area.

you should only ever draw in the GtkWidget::draw signal handler, using
the cairo context that is being given to you, which already sets up
the clip region and transformation matrix.

ciao,
 Emmanuele.


On 15 October 2014 19:13, Detlef Reichl <detlef.reichl@xxxxxxx> wrote:
> 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
>
>
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> https://mail.gnome.org/mailman/listinfo/gtk-list



-- 
http://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux