Subject: FVWM: Modules Programming

From: Elad Eyal <[email-masked]>
Date: Wed, 13 Aug 1997 18:14:16 +0300 (IDT)

Good morning,

	I've decided to take my first shot at X "programming" by writing a
module I described here (on fvwm list) a few days ago. The idea is a
module which will let you move and resize a window in one drag of the
mouse - the way you draw a rectangle in a paint program. I have now a
module which let one draw a rubberband frame on the root. Now I have 
a few questions:

1. Is there a definite source of information about module programming, in
addition to copy-and-pasting from existing modules?

2. How do I tell fvwm (from within a module) to move and resize a window?
Preferably, I'd want fvwm to it simultanously, altough if not possible, a
resize-followed-by-a-move should be good enough. 

3. Is there a way to get from fvwm the XORVALUE value?

If anyone wants to take a loot and comment on the source, the whole 5K of
it are available as http://www.cs.bgu.ac.il/~elad/GEOM.tar.gz (or by mail
from me). It compiles nicely under SunOS, and runs nicely with fvwm2-95
v2.0.43a.

Thanks, 

 _
(_  /  _    /          ( E-mail pigeons nest in binary trees )
(__/__(/\_(/

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Eric Brandwine <[email-masked]>
Date: Wed, 13 Aug 1997 11:33:29 -0400 (EDT)

> addition to copy-and-pasting from existing modules?
There was a great article on it in the X Resource, Issue 12 I believe.
Maybe it was 14.  I think that there are a couple of web pages as well.

> resize-followed-by-a-move should be good enough. 
unmap the window, resize it, move it, remap it.  Look in FvwmPager code.
That module has to be able to move windows.

Good luck!

ericb

---

From: Richard Lister <[email-masked]>
Date: Wed, 13 Aug 1997 13:29:57 -0400

On Wed, 13 Aug 1997 18:14:16 +0300 (IDT)
Elad Eyal <[email-masked]> 
> addition to copy-and-pasting from existing modules?

Yes. Look at docs/modules.tex in the fvwm2 distribution.

Ric

Richard J Lister, Georgetown Institute for Cognitive and Computational Sciences
Georgetown University Medical Center, Washington, DC.
Phone: 202-687 2878
Email: [email-masked] 
Web: http://www.giccs.georgetown.edu/
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: "Richard A. Guay" <[email-masked]>
Date: Wed, 13 Aug 1997 13:56:30 +0000

> Yes. Look at docs/modules.tex in the fvwm2 distribution.

That document is very dated!  It does not list half of the messages 
that can be send to/from Fvwm.  I had to take apart other modules to 
fully understand what is going on.  Also, look at the source code 
<wherever fvwm is>/fvwm/lib/module.c for some utility code that helps 
writing modules.

Richard A. Guay
Network Administrator and ASIC Design Engineer
ASIC International Inc.
[email-masked]
http://www.asicint.com

---

From: Brady Montz <[email-masked]>
Date: 13 Aug 1997 11:20:55 -0700

> Yes. Look at docs/modules.tex in the fvwm2 distribution.

I think this may be out of date, since a couple new message types were
added. Nothing fundamental changed though, and it's unlikely he'd use the new
message types (which are M_STRING, and M_MINI_ICON).

Elad should also look at how other modules do things. When I started writing
FvwmIconMan, I found most of the available modules were coded pretty
poorly. Things have gotten better since then. You might look at FvwmForm,
FvwmIconMan, and FvwmButtons. Basically you need to figure out:

1. How to read the fvwmrc file (link in fvwmlib, and use the stuff in Parse.c
   and use GetConfigLine in Module.c). If you want to get into slick ways to
   parse the config lines, you're on your own :-). I don't think any of the
   modules really do a correct/clean job of it, including mine. I intend to
   rewrite how FvwmIconMan tokenizes things, so if you come up with something
   clever, please let me know.
2. How to set up things to receive events from fvwm and X (use
   XConnectionNumber to find the X socket, and use select to switch between
   reading X events and fvwm events. You probably can get away with just
   ignoring fvwm events while rubberbanding). You will need to keep tabs on
   where the various windows are though. It would be really cool if your
   module could do some SmartPlacement like stuff to keep minimize
   overlapping. I don't use smartplacement myself, but I bet some people would
   like this.
3. How to send and receive messages to/from fvwm. (use ReadFvwmPacket in
   fvwmlib, and then you might use the unions that I defined in FvwmIconMan,
   or that the FvwmForm module uses to get at the fields).
4. How to set up the Imakefile (cut and paste). If you plan on making this
   module into something that you'll be spending a lot of time tinkering with
   and making cool - which I would recommend since there's a lot of room for
   the module you have planned to grow (in other words, please make it cool!)
   then you might look into setting things up so you can compile your module
   both with and without the fvwm source around. I can send you how I do
   things if you like. Basically I have two Imakefiles, and a private copy of
   fvwmlib and some ifdef's here and there.

As for things I could see this module doing: "smart resizing" like smart
placement, so as I rubberband my window, my outline gets "guided" by the
module to stay clear of other windows. Not sure how this would work exactly,
but it could be cool. Having the module remember former locations/sizes of
windows, so I could move a window back to previous configutions
quickly. Having some keybindings during the rubberband process that would
maximize horizontally/vertically, move window all the way to the
left/top/bottom/right of the screen, move window to a given desk or page, etc.
Basically, everything anyone might want to do while moving or resizing a
window. 

-- 
 Brady Montz
 [email-masked]

---

From: "Charles Hines" <[email-masked]>
Date: Wed, 13 Aug 1997 15:35:22 -0400

>>>>> "Brady" == Brady Montz <[email-masked]> writes:

Brady> Richard Lister <[email-masked]> writes:
....
>> Yes. Look at docs/modules.tex in the fvwm2 distribution.

Brady> I think this may be out of date, since a couple new message
Brady> types were added. Nothing fundamental changed though, and it's
Brady> unlikely he'd use the new message types (which are M_STRING,
Brady> and M_MINI_ICON).

It is definitely out of date.  I'd like to fix that somewhat in one of
the upcoming betas...

Brady> Elad should also look at how other modules do things. When I
Brady> started writing FvwmIconMan, I found most of the available
Brady> modules were coded pretty poorly. Things have gotten better
Brady> since then. You might look at FvwmForm, FvwmIconMan, and
Brady> FvwmButtons.

Yup - other modules are the best "docs" right now.

Brady> Basically you need to figure out:
....
Brady> 3. How to send and receive messages to/from fvwm. (use
Brady>    ReadFvwmPacket in fvwmlib, and then you might use the unions
Brady>    that I defined in FvwmIconMan, or that the FvwmForm module
Brady>    uses to get at the fields).

Acually, I noticed not too long ago that you were doing that, and I
think that's a really good idea.  As part of a cleanup of the existing
module interface, I'd like to make something like that (structs &
funcs to work with them) standard in libfvwm.a for any module to use.

Chuck

*******************************************************************************
Charles K. Hines <[email-masked]>
IBM Logic Synthesis Developer [BooleDozer (TM)]
Martial Arts Instructor [Modern Arnis, Presas Style Filipino Martial Arts]

         "Go back to sleep, Chuck.  You're just havin' a nightmare
             -- of course, we ARE still in Hell." (Gary Larson)
*******************************************************************************
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Kai Grossjohann <[email-masked]>
Date: Wed, 13 Aug 1997 23:15:58 +0200

>>>>> On 13 Aug 1997, Brady Montz said:

  Brady> As for things I could see this module doing: "smart resizing"
  Brady> like smart placement, so as I rubberband my window, my
  Brady> outline gets "guided" by the module to stay clear of other
  Brady> windows. Not sure how this would work exactly, but it could
  Brady> be cool.

Of course, "smart move" is also nice.

  Brady> Having the module remember former locations/sizes of
  Brady> windows, so I could move a window back to previous
  Brady> configutions quickly. Having some keybindings during the
  Brady> rubberband process that would maximize
  Brady> horizontally/vertically, move window all the way to the
  Brady> left/top/bottom/right of the screen, move window to a given
  Brady> desk or page, etc.  Basically, everything anyone might want
  Brady> to do while moving or resizing a window.

That'd be great!  Mouse button "chords" could also be used with nice
results, like twm does.  There, hitting any second mouse button while
doing a move aborts the move.

kai
-- 
Signature?  What signature?

---

From: Elad Eyal <[email-masked]>
Date: Wed, 13 Aug 1997 23:23:39 +0300 (IDT)

Good morning,

> 4. How to set up the Imakefile (cut and paste). If you plan on making this

Ahh! Panic mode on. And I thought it would be a quick'n'dirty
five-minuter. Let's see.. I have a working thing already. Code looks like,
grab pointer. draw rubberband (copied from fvwm code and
removed all function-calls which resisted the link), ungrab mouse,
XMoveResizeWindow(), XSync() (That damn XSync costed me hours of
misunderstandings), return. 

I'm working now on complying to client's resizing constraints. Apparntely
fvwm won't tell you about the window's aspect ratio requirements..? I will
disturb myself later with such things as configuratablity. 

Size report... let's see... 24K tar. Mostly prob'ly borrowed code. Have to
catch the bus home now. Thanks everybody for the many good replies and
advices!
 _
(_  /  _    /          ( E-mail pigeons nest in binary trees )
(__/__(/\_(/