Adventures in gtk-perl - tables and windows
- From: Mike Martin <redtux1 gmail com>
- To: gtk-perl-list <gtk-perl-list gnome org>
- Subject: Adventures in gtk-perl - tables and windows
- Date: Fri, 17 Sep 2010 00:54:23 +0100
Hi
After a frustrating couple of days googling I have come up with the
follwing bits of code to solve a couple of things which seem to have a
lot of questions on google but no answers. Comments apprieciated
1. getting widgets from a table matching co-ordinates (ie: row/column)
foreach my $w ($table->get_children){
my $leftcol=$capture{$media}->{table}->child_get_property($w,'left-attach');
# can be used for x=left,x=right,y=top,y=bottom as well
with obvious amendments to *attach argument ie:left/right/top/bottom#
$capture{$media}->{table}->remove($w) if $leftcol=~/4|5/; #
op where $leftcol equals criteria - 4 or 5 in this case
# used to remove widgets here but any op should work I think#
}
2. Getting list of windows from X with xid and name
my $s=Gtk2::Gdk::Screen->get_default or die print $!;
foreach my $w ($s->get_window_stack){
my $xid=$w->get_xid;
my @name=split /=/,`xprop -id $xid WM_NAME`;
print $name[1],"\n";
print $name,"\t",join "\t",$w->get_origin,"\t",join "\t",$w->get_size,"\n";
}
I cant find any way to get the X11 name from GDK, and I dont seem to
be alone, which is why I do a backticks to xprop
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]