Re: Gtk2::TreeView get_path_at_pos doesn't return array on Windows

2010-03-21 Thread Terence Ferraro
Attached are the dmake test results from stock Glib-1.222 and Gtk2-1.221 .
Only change I made was that I had to remove GtkRecentChooser from the Gtk2
test suite as it was hanging the test.

On Sat, Mar 20, 2010 at 10:16 AM, Torsten Schoenfeld kaffeeti...@gmx.dewrote:

 On 03.02.2010 04:51, Terence J. Ferraro wrote:

 This is an old thread, but I wanted to reply so that the solution at
 least gets indexed in case anyone else ever runs into this problem.

 I myself ran into this about a year ago and found that if you comment
 out the: if (GIMME_V == G_ARRAY) { ... }

 within the get_path_at_pos routine in GtkTreeView.xs and instead
 unconditionally return the array, you now get what you want on Windows.
 Never really cared to investigate why since this solution just works.


 That's weird.  Because the GIMME_V business is standard XS stuff that is
 used in many places throughout Glib and Gtk2.  Does the Glib test suite pass
 on the same that shows the weird get_path_at_pos behavior? Especially
 Glib/t/filename.t, which exercises filename_from_uri which also uses
 GIMME_V.
 ___
 gtk-perl-list mailing list
 gtk-perl-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-perl-list

C:\strawberry\perl\bin\perl.exe -MExtUtils::Command::MM -e test_harness(0, 
'blib\lib', 'blib\arch') t/*.t
t/1.t .. ok
t/2.t .. ok
t/3.t .. ok
t/4.t .. ok
t/5.t .. ok
t/6.t .. ok

#   Failed test at t/64bit.t line 25.
#  got: '1'
# expected: '-9223372036854775807'

#   Failed test at t/64bit.t line 26.
#  got: '-1'
# expected: '9223372036854775807'

#   Failed test at t/64bit.t line 35.
#  got: '4294967295'
# expected: '18446744073709551615'

#   Failed test at t/64bit.t line 46.
#  got: '1'
# expected: '-9223372036854775807'

#   Failed test at t/64bit.t line 48.
#  got: '-1'
# expected: '9223372036854775807'

#   Failed test at t/64bit.t line 53.
#  got: '4294967295'
# expected: '18446744073709551615'
# Looks like you failed 6 tests of 12.
t/64bit.t .. 
Dubious, test returned 6 (wstat 1536, 0x600)
Failed 6/12 subtests 
t/7.t .. ok
t/8.t .. ok
t/9.t .. ok
t/a.t .. ok
t/b.t .. ok
t/c.t .. ok
t/d.t .. ok

#   Failed test at t/e.t line 229.
#  got: '1'
# expected: '2'

#   Failed test 'value 30 value unchanged'
#   at t/e.t line 231.
#  got: undef
# expected: '30'

#   Failed test 'clamp 70 down to be in range'
#   at t/e.t line 235.
#  got: undef
# expected: '50'

#   Failed test 'clamp -70 down to be in range'
#   at t/e.t line 238.
#  got: undef
# expected: '20'
# Looks like you failed 4 tests of 243.
t/e.t .. 
Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/243 subtests 
t/f.t .. ok
t/filename.t ... ok

#   Failed test at t/g.t line 155.
#  got: undef
# expected: 'C:\test\Glib-1.222\tmp.ini'
# Looks like you failed 1 test of 33.
t/g.t .. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/33 subtests 
t/h.t .. ok
t/lazy_loader.t  ok
t/make_helper.t  ok
t/options.t  ok
t/signal_emission_hooks.t .. ok
t/signal_marshal.t . ok
t/signal_query.t ... ok
t/tied_definedness.t ... ok

Test Summary Report
---
t/64bit.t(Wstat: 1536 Tests: 12 Failed: 6)
  Failed tests:  2-3, 7, 9-10, 12
  Non-zero exit status: 6
t/e.t(Wstat: 1024 Tests: 243 Failed: 4)
  Failed tests:  234, 236, 238, 240
  Non-zero exit status: 4
t/g.t(Wstat: 256 Tests: 33 Failed: 1)
  Failed test:  32
  Non-zero exit status: 1
Files=26, Tests=828,  8 wallclock secs ( 0.14 usr +  0.44 sys =  0.58 CPU)
Result: FAIL
Failed 3/26 test programs. 11/828 subtests failed.
dmake:  Error code 255, while making 'test_dynamic'
C:\strawberry\perl\bin\perl.exe -MExtUtils::Command::MM -e test_harness(0, 
'blib\lib', 'blib\arch') t/*.t
# Testing Gtk2 1.221
#Running against gtk+ 2.18.5
#   Compiled against gtk+ 2.18.5
#   and pango 1.26.1
GLib-WARNING **: g_set_prgname() called multiple times at t/00.Gtk2.t line 72.
GLib-WARNING **: g_set_prgname() called multiple times at t/00.Gtk2.t line 171.
t/00.Gtk2.t  ok
t/01.GtkWindow.t ... ok
t/02.GtkContainer.t  ok
GLib-WARNING **: g_set_prgname() called multiple times at t/Gdk.t line 17.
Gdk-WARNING **: gdk_set_sm_client_id blub at t/Gdk.t line 62.
Gdk-WARNING **: gdk_set_sm_client_id NULL at t/Gdk.t line 63.
t/Gdk.t  ok
t/GdkCairo.t ... ok
Gdk-WARNING **: 

Re: Gtk2::TreeView get_path_at_pos doesn't return array on Windows

2010-03-20 Thread Torsten Schoenfeld

On 03.02.2010 04:51, Terence J. Ferraro wrote:

This is an old thread, but I wanted to reply so that the solution at
least gets indexed in case anyone else ever runs into this problem.

I myself ran into this about a year ago and found that if you comment
out the: if (GIMME_V == G_ARRAY) { ... }

within the get_path_at_pos routine in GtkTreeView.xs and instead
unconditionally return the array, you now get what you want on Windows.
Never really cared to investigate why since this solution just works.


That's weird.  Because the GIMME_V business is standard XS stuff that is 
used in many places throughout Glib and Gtk2.  Does the Glib test suite 
pass on the same that shows the weird get_path_at_pos behavior? 
Especially Glib/t/filename.t, which exercises filename_from_uri which 
also uses GIMME_V.

___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gtk2::TreeView get_path_at_pos doesn't return array on Windows

2010-02-02 Thread Terence J. Ferraro
This is an old thread, but I wanted to reply so that the solution at 
least gets indexed in case anyone else ever runs into this problem.


I myself ran into this about a year ago and found that if you comment 
out the: if (GIMME_V == G_ARRAY) { ... }


within the get_path_at_pos routine in GtkTreeView.xs and instead 
unconditionally return the array, you now get what you want on Windows. 
Never really cared to investigate why since this solution just works.


Hope this helps..


On 07/15/2009 03:20 PM, Peter Juhasz wrote:

(I was instructed on Perlmonks to post this problem here.)

I'm writing a Gtk2-Perl app with a Gtk2::Ex::Simple::List (which is
derived from TreeView, hence the title).

I want to set up one of the columns in a special way, specifically, I
want this column to hold values from a short list, and each click on a
cell in this column should toggle the next value from the
pre-specified list. Run the attached code for clarification.

Obviously, for this I need to know which column did the user click into.

I found TreeView's get_path_at_pos method, which, according to the
documentation:
In scalar context, returns the Gtk2::TreePath, in array context, adds
the Gtk2::TreeViewColumn, and $x and $y translated to be relative to
the cell.

On Linux, this works fine and I can get the column number. However, on
Windows (with newest Camelbox), get_path_at_pos doesn't seem to work
in array context! All it gives back is the path object. (On Linux I
use the latest Perl 5.10 package that comes from the Ubuntu
repository, together with a reasonably recent Gtk2-Perl bundle from
CPAN. On Windows I installed the full Camelbox on a virgin machine.)

The code, which demonstrates both my intent (on Linux, where it works)
and the problem (on Windows, where it doesn't) is below:


#!/usr/bin/perl
use strict;
use warnings;
use Gtk2 -init;
use Gtk2::Ex::Simple::List;
use Glib ':constants';

my %activity_list = (
O =  'span color=#7f7f00bOne/b/span',
M =  'span color=#7f007fbTwo/b/span',
U =  'span color=#007f7fbFive/b/span',
E =  'span color=#007f00bThree, Sir, Three!/b/span',
A =  'span color=#ffbBOOM/b/span'
);
my %activity_order = ('O' =  'M', 'M' =  'U', 'U' =  'E', 'E' =  'A',
'A' =  'O');
my %activities_rev = reverse %activity_list;

my $win = Gtk2::Window-new;
$win-set_border_width (6);
$win-signal_connect (delete_event =  sub { Gtk2-main_quit; });
my $tslist = Gtk2::Ex::Simple::List-new (
 Special column =  'markup',
Normal column =  'text'
 );
$win-add ($tslist);
$tslist-get_selection-set_mode ('single');
$tslist-set_reorderable(FALSE);
$tslist-set_column_editable (0, FALSE);
$tslist-set_column_editable (1, TRUE);
my $dtslist = $tslist-{data};
push @$dtslist, [ $activity_list{O}, text ], [ $activity_list{M}, text2 ];
my @columns = $tslist-get_columns;

 replace the workaround below from here...
$tslist-signal_connect('button-release-event' = sub {
my ($self, $event) = @_;
my ($path, $column, $cell_x, $cell_y) = $tslist-get_path_at_pos
($event-x, $event-y ); #--- !
if ($path) {
if ($column == $columns[0]) {
my $row = $path-to_string;
my $value = $dtslist-[$row][0];
$dtslist-[$row][0] =
$activity_list{$activity_order{$activities_rev{$value}}};
}
}
});
 ...to here

$win-show_all;
Gtk2-main;



I've since found a workaround:

I simply query the column widths for each column (these may have
changed, because the user could have resized them), make an array that
holds the cumulative column boundary positions, then check if the
click was between the borders of the special column.

The relevant part to be replaced in the code above follows.


$tslist-signal_connect('button-release-event' = sub {
my ($self, $event) = @_;
my ($path, $column, $cell_x, $cell_y) = $tslist-get_path_at_pos
($event-x, $event-y ); #--- !
my @widths;
$widths[0] = $columns[0]-get_width();
for my $i (1..$#columns) {
$widths[$i] = $widths[$i-1] + 
$columns[$i]-get_width();
}
if ($path) {
if ($event-x  0 and $event-x  $widths[0]) {
my $row = $path-to_string;
my $value = $dtslist-[$row][0];
$dtslist-[$row][0] =
$activity_list{$activity_order{$activities_rev{$value}}};
}
}
});


(You may ask why I prefer this kind of interface to the popup-menu
style (e.g. as in cellrenderer_popup.pl in the 

Re: Gtk2::TreeView get_path_at_pos doesn't return array on Windows

2009-07-16 Thread Dave Howorth
Peter Juhasz wrote:
 (I was instructed on Perlmonks to post this problem here.)
 
 I'm writing a Gtk2-Perl app with a Gtk2::Ex::Simple::List (which is
 derived from TreeView, hence the title).
 
 I want to set up one of the columns in a special way, specifically, I
 want this column to hold values from a short list, and each click on a
 cell in this column should toggle the next value from the
 pre-specified list. Run the attached code for clarification.
 
 Obviously, for this I need to know which column did the user click into.

Thanks for the nice example, which works for me on Linux. I don't have a
 M$ box so can't help you with why it doesn't work there. But maybe
there's a neater other way. Have you tried:

 my ($path, $column) = $tslist-get_cursor;

instead of get_path_at_pos() ?

Cheers, Dave
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Gtk2::TreeView get_path_at_pos doesn't return array on Windows

2009-07-15 Thread Peter Juhasz
(I was instructed on Perlmonks to post this problem here.)

I'm writing a Gtk2-Perl app with a Gtk2::Ex::Simple::List (which is
derived from TreeView, hence the title).

I want to set up one of the columns in a special way, specifically, I
want this column to hold values from a short list, and each click on a
cell in this column should toggle the next value from the
pre-specified list. Run the attached code for clarification.

Obviously, for this I need to know which column did the user click into.

I found TreeView's get_path_at_pos method, which, according to the
documentation:
In scalar context, returns the Gtk2::TreePath, in array context, adds
the Gtk2::TreeViewColumn, and $x and $y translated to be relative to
the cell.

On Linux, this works fine and I can get the column number. However, on
Windows (with newest Camelbox), get_path_at_pos doesn't seem to work
in array context! All it gives back is the path object. (On Linux I
use the latest Perl 5.10 package that comes from the Ubuntu
repository, together with a reasonably recent Gtk2-Perl bundle from
CPAN. On Windows I installed the full Camelbox on a virgin machine.)

The code, which demonstrates both my intent (on Linux, where it works)
and the problem (on Windows, where it doesn't) is below:


#!/usr/bin/perl
use strict;
use warnings;
use Gtk2 -init;
use Gtk2::Ex::Simple::List;
use Glib ':constants';

my %activity_list = (
O = 'span color=#7f7f00bOne/b/span',
M = 'span color=#7f007fbTwo/b/span',
U = 'span color=#007f7fbFive/b/span',
E = 'span color=#007f00bThree, Sir, Three!/b/span',
A = 'span color=#ffbBOOM/b/span'
);
my %activity_order = ('O' = 'M', 'M' = 'U', 'U' = 'E', 'E' = 'A',
'A' = 'O');
my %activities_rev = reverse %activity_list;

my $win = Gtk2::Window-new;
$win-set_border_width (6);
$win-signal_connect (delete_event = sub { Gtk2-main_quit; });
my $tslist = Gtk2::Ex::Simple::List-new (
Special column = 'markup',
Normal column = 'text'
);
$win-add ($tslist);
$tslist-get_selection-set_mode ('single');
$tslist-set_reorderable(FALSE);
$tslist-set_column_editable (0, FALSE);
$tslist-set_column_editable (1, TRUE);
my $dtslist = $tslist-{data};
push @$dtslist, [ $activity_list{O}, text ], [ $activity_list{M}, text2 ];
my @columns = $tslist-get_columns;

 replace the workaround below from here...
$tslist-signal_connect('button-release-event' =sub {
my ($self, $event) = @_;
my ($path, $column, $cell_x, $cell_y) = $tslist-get_path_at_pos
($event-x, $event-y ); # --- !
if ($path) {
if ($column == $columns[0]) {
my $row = $path-to_string;
my $value = $dtslist-[$row][0];
$dtslist-[$row][0] =
$activity_list{$activity_order{$activities_rev{$value}}};
}
}
});
 ...to here

$win-show_all;
Gtk2-main;



I've since found a workaround:

I simply query the column widths for each column (these may have
changed, because the user could have resized them), make an array that
holds the cumulative column boundary positions, then check if the
click was between the borders of the special column.

The relevant part to be replaced in the code above follows.


$tslist-signal_connect('button-release-event' =sub {
my ($self, $event) = @_;
my ($path, $column, $cell_x, $cell_y) = $tslist-get_path_at_pos
($event-x, $event-y ); # --- !
my @widths;
$widths[0] = $columns[0]-get_width();
for my $i (1..$#columns) {
$widths[$i] = $widths[$i-1] + 
$columns[$i]-get_width();
}
if ($path) {
if ($event-x  0 and $event-x  $widths[0]) {
my $row = $path-to_string;
my $value = $dtslist-[$row][0];
$dtslist-[$row][0] =
$activity_list{$activity_order{$activities_rev{$value}}};
}
}
});


(You may ask why I prefer this kind of interface to the popup-menu
style (e.g. as in cellrenderer_popup.pl in the examples).
Well, I felt that this interface, where the user just has to click a
few times, is better than the one where the user needs to examine the
popup list, select his choice and position the mouse on it. This is
especially true with *computerwise doubleplus-unenlightened* users who
have poor mouse control.)

For reference, I first posted this on Perlmonks at
http://www.perlmonks.org/?node_id=780082 .
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org