Re: FVWM: fvwm-perl tutorial example

From: Richard Lister <ric_at_cns.georgetown.edu>
Date: Fri, 08 Nov 2002 14:17:10 -0500 (EST)

Peter McAlpine <pmcalpin_at_uoguelph.ca> wrote on Thu, 7 Nov 2002 22:24:34 -0500:
>
> Subject: FVWM: fvwm-perl tutorial example
>
> hey,
>
> I'm trying to write a Perl module... and am getting tripped up trying
> to figure out what the new page is upon a M_NEW_PAGE.
>
> My problem is that M_NEW_PAGE->_vp_width/height only give me the
> maximum width/height for the top left corner... but I need the top
> right to figure out what page was just switched to, don't I (I can't
> assume the screen res)? The only thing I can think of to fix this is
> to have DeskTopSize inputted as a config option.
>
> I tried using the module-flash _at_:
> ftp://ftp.fvwm.org/pub/fvwm/devel/sources/tests/perl/module-flash
>
> But it has the same problem I'm having, it doesn't report the correct
> page (as it claims it will).


Peter

I'm not quite sure what you're asking for. Are you trying to
figure out if a particular window is on the current page?
That's just a matter of comparing the window's coordinates
to the screen position. I can send code for that if you need it.

The page is just defined by the x and y coords of its top left,
as given by vp_x and vp_y. So the top left page is +0+0. I have
screen res of 1600x1200 so if I move down a page I am on +0+1200.
Move right and I am now on +1600+1200.

The problem for a module that doesn't load any X libraries is
finding out the screen resolution. It would be great if fvwm
passed this in e.g. M_CONFIG_INFO (future enhancement, anyone?).

I solve it in the following clunky manner:

  my $screen;

  open(XWININFO, "xwininfo -root|") || die "can't run xwininfo";
  while ( <XWININFO> ) {
    $screen->{w} = $1 if /Width:\s*(\d+)/;
    $screen->{h} = $1 if /Height:\s*(\d+)/;
  }
  close(XWININFO);

I would love a better solution if anyone has one :-)

Cheers
Ric


Richard J Lister
Dept of Neuroscience
Georgetown University Medical Center
http://cns.georgetown.edu/~ric/
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Fri Nov 08 2002 - 13:19:16 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:53 BST