Skip Menu |

This queue is for tickets about the Gtk2-Ex-Xor CPAN distribution.

Report information
The Basics
Id: 39125
Status: resolved
Priority: 0/
Queue: Gtk2-Ex-Xor

People
Owner: Nobody in particular
Requestors: zentara1 [...] sbcglobal.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Dosn't work on Canvas widgets
Date: Tue, 9 Sep 2008 11:46:06 -0400
To: bug-Gtk2-Ex-Xor [...] rt.cpan.org
From: zentara <zentara1 [...] sbcglobal.net>
Hi, I tried to setup the Crosshairs on a Gnome2::Canvas and a Goo::Canvas, but the lines and cursor are invisible. I remember in some similar maillist emails you said the graphic's context wasn't setup. Do you know a work-around for canvases? #!/usr/bin/perl use strict; use warnings; use Gtk2 '-init'; use Gnome2::Canvas; use Gtk2::Ex::CrossHair; my $mw = Gtk2::Window->new('toplevel'); $mw->signal_connect (destroy => sub { Gtk2->main_quit }); my $vbox = Gtk2::VBox->new(0,0); $mw->add ($vbox); my $canvas = Gnome2::Canvas->new(); my $white = Gtk2::Gdk::Color->new (0xFFFF,0xFFFF,0xFFFF); my $green = Gtk2::Gdk::Color->new (0x0000,0xFFFF,0x0000); my $black = Gtk2::Gdk::Color->new (0x0000,0x0000,0x0000); $canvas->modify_bg('normal',$white); $canvas->modify_fg('active',$green); $canvas->modify_base('active',$green); $mw->set_default_size( 400, 300 ); $vbox->pack_start ($canvas, 1,1,1); my $status = Gtk2::Label->new; $vbox->pack_start ($status, 0,1,0); my $cross = Gtk2::Ex::CrossHair->new (widget => $canvas, #foreground => '#00ff00', foreground => $green, ); $cross->signal_connect (moved => sub { my ($cross, $widget, $x, $y) = @_; if (defined $x) { $status->set_text ("now at $x,$y"); } else { $status->set_text (''); } }); $canvas->add_events ('button-press-mask'); $canvas->signal_connect (button_press_event => sub { my ($canvas, $event) = @_; $cross->start ($event); return 0; }); $mw->show_all; Gtk2->main; __END__ zentara -- I'm not really a human, but I play one on earth. http://zentara.net/Remember_How_Lucky_You_Are.html
CC: bug-Gtk2-Ex-Xor [...] rt.cpan.org
Subject: Re: [rt.cpan.org #39125] Dosn't work on Canvas widgets
Date: Thu, 11 Sep 2008 10:43:32 +1000
To: zentara1 [...] sbcglobal.net
From: Kevin Ryde <user42 [...] zip.com.au>
"zentara via RT" <bug-Gtk2-Ex-Xor@rt.cpan.org> writes: Show quoted text
> > I tried to setup the Crosshairs on a Gnome2::Canvas and a Goo::Canvas, > but the lines and cursor are invisible.
Thanks. I see for GtkLayout (of which GnomeCanvas is a subclass) I should be drawing into "$layout->bin_window" child, not the plain "$layout->window". Show quoted text
> Do you know a work-around for canvases?
I've got some other subwindow hacks, so I think all it needs to hit the right one is *Gtk2::Layout::Gtk2_Ex_Xor_window = \&Gtk2::Layout::bin_window; Putting that at the start of your sample program seems to work for me. If it does for you too then I'll upload a new one in a couple of days.
CC: bug-Gtk2-Ex-Xor [...] rt.cpan.org
Subject: Re: [rt.cpan.org #39125] Dosn't work on Canvas widgets
Date: Thu, 11 Sep 2008 10:43:32 +1000
To: zentara1 [...] sbcglobal.net
From: Kevin Ryde <user42 [...] zip.com.au>
"zentara via RT" <bug-Gtk2-Ex-Xor@rt.cpan.org> writes: Show quoted text
> > I tried to setup the Crosshairs on a Gnome2::Canvas and a Goo::Canvas, > but the lines and cursor are invisible.
Thanks. I see for GtkLayout (of which GnomeCanvas is a subclass) I should be drawing into "$layout->bin_window" child, not the plain "$layout->window". Show quoted text
> Do you know a work-around for canvases?
I've got some other subwindow hacks, so I think all it needs to hit the right one is *Gtk2::Layout::Gtk2_Ex_Xor_window = \&Gtk2::Layout::bin_window; Putting that at the start of your sample program seems to work for me. If it does for you too then I'll upload a new one in a couple of days.
CC: bug-Gtk2-Ex-Xor [...] rt.cpan.org
Subject: Re: [rt.cpan.org #39125] Dosn't work on Canvas widgets
Date: Fri, 12 Sep 2008 11:05:25 +1000
To: zentara <zentara1 [...] sbcglobal.net>
From: Kevin Ryde <user42 [...] zip.com.au>
zentara <zentara1@sbcglobal.net> writes: Show quoted text
> > I took a quick look at the Goo manpages, and it is a Gtk2::Container, not > a Gtk2::Layout.
It also keeps and moves a secret "canvas_window" subwindow, which is why drawing on the main window is no good. :-( The same trick as for GtkEntry gets something on screen. But both canvases then are not right if they've been scrolled around. Hmm. The drawing can be offset ok, but I wonder how the coordinates should be reported. I guess widget-relative would be consistent, as long as there's enough funcs to convert to a canvas logical position (or TextView line/column, etc).
Hopefully all good in new version 3.