Intercepting an event

Hi !

A module can subscribe to any events, like new_page. However, when the module has received this event, the page has already changed. I would like to intercept the event and change page myself (or not change page at all).

As a dumb example, here is an illustration using FvwmEvent :

DestroyModuleConfig FE-DontMove: *
*FE-DontMove: Cmd Function
*FE-DontMove: new_page DontMove
      
Module FvwmEvent FE-DontMove

DestroyFunc DontMove
AddToFunc   DontMove
+ I GotoPage 0 0

With this setup, the window on page 0,0 flickers because when I move to next page, fvwm first moves to the next page then go back on page 0,0. In my module, I would like to not to have to go back on page 0,0 when receiving new_page event: I want to be able to inhibit this event.

Is it possible ?

No! A module might decide to listen for a change of desk or page via the setmask() method, but not always. FvwmEvent is an example which does.

So why bother defining for it in the first place?

Sure – just don’t define anything for it in the first place. What is it though you’re trying to do?

– Thomas Adam

Suppose that I have a desk of 6 pages and I don’t want the user to be able to go to the last page. I can define my own GotoPage function that will test the current page and disallow move to the last page and use this function to let the user navigate through pages. However, if there is a FvwmPager, the user can click on the last page and the only way I have to disallow it is to cancel the action after receiving the new_page event. For a fraction of second, the user will see the last page then it will see the previous page.

So I would like to write a simple module that will handle new_page event in place of fvwm.

Don’t have a FvwmPager. You can’t do what you want because the page doesn’t hand out callbacks like you’d get if you were switching to another page via a key-binding. At best you’ll have to live with the flicker or hack FvwmPager to do this utterly bizarre requirement.

– Thomas Adam

This is not a so bizarre requirement. :slight_smile: I am trying to achieve something like your FvwmDX but I would like to keep FvwmPager since I heavily rely on it.

The idea is to have a desktop that contains every window except ones that have to be currently displayed. Those windows (that need to be displayed) will be moved to a hidden desktop (hidden because there will be no FvwmPager for it) with only one page and this is this one that will be displayed. new_page and new_desk events will be translated to moving windows out and in this desktop.

It is bizarre. Alternatively, just tell FvwmPager to only display certain Rows/Columns, or, easier, if you were using Desks and not Pages, you can tell FvwmPager when it starts up to display only a certain number.

– Thomas Adam