Thomas Adam wrote:
> On Thu, Jan 05, 2012 at 12:10:14PM +0100, Michael Großer wrote:
>> Does anyone know about this behaviour of FvwmIdent?
>> Is the reason known why FvwmIdent is that much damageable?
> 
> It's designed to work this way.
> 
> Look at the code:
> 
>       case KeyRelease:
>       if (is_key_pressed)
>       {
>               exit(0);
>       }
>       break;
> 
> If you press a key, and FvwmIdent is focused, we exit.
> 
>       case ButtonRelease:
>       if (is_button_pressed)
>       {
>               if (is_button_pressed == 2 &&
>                       Event.xbutton.button == 2)
>               {
>                       /* select a new window when
>                        * button 2 is pressed */
>                       SetMessageMask(
>                               fd, M_CONFIGURE_WINDOW   |
>                               M_WINDOW_NAME    |
>                               M_ICON_NAME      |
>                               M_RES_CLASS      |
>                               M_RES_NAME       |
>                               M_END_WINDOWLIST |
>                               M_CONFIG_INFO    |
>                               M_END_CONFIG_INFO|
>                               M_SENDCONFIG);
>                       SendText(fd, "Send_WindowList", 0);
>                       XDestroyWindow(dpy, main_win);
> 
> 
> If button two is pressed, we destroy the top-level window, and prompt for a 
> new window to select.
> 
>                       DestroyList();
>                       fvwmlib_get_target_window(
>                               dpy, screen, module->name,
>                                &(module->window), True);
>                       found = 0;
>                       return 1;
>               }
>               else
>               {
>                       exit(0);
> 
> Otherwise, all other button processes close FvwmIdent.
> 
> -- Thomas Adam

Hi!

This was very nice that you showed me the right piece of code.
Thank you for this.

If I were the initial author of FvwmIdent, I would have designed it so
that it would ignore all key presses and mouse button presses but
only a few:

- button 2 to destroy the top-level window and prompt for a new one
- button 3 to exit

What exactly is the advantage to exit when the user turns the mouse wheel
(button number something larger than 3) or when the user hits a Shift
key on the keyboard?

Anyway, if you want, then you can introduce a new option "DoNotExit"
to let FvwmIdent stay alive when the user hits another key or button
than mouse button 2 or 3 and "DoNotExit" is true.

The keyboard code could look like this:
> case KeyRelease:
> if (is_key_pressed)
> {
>   if (DoNotExit)
>   {
>     break;  /* or "return" or something else */
>   }
>   else
>   {
>     exit(0);
>   }
> }
> break;

Since now I understand why FvwmIdent disappears, I set a NeverFocus style
to prevent that keyboard events will be passed to FvwmIdent. This makes
FvwmIdent's behaviour acceptable for me for now.

At this point, this e-mail would end.

.
.
.
.
.
.

But another thing caused me to strike out a bit more and change something
more than I originally wanted.

When I additionally I set a StaysOnTop style to bring FvwmIdent on top,
I noticed that this does only work when I apply FvwmIdent on
xterms, but not on nedit, Iceweasel, FvwmIdent or some other instances.

So, I tried a lot of things, until I finally got a working solution:

- I called "DestroyStyle FvwmIdent" before I call "Style FvwmIdent
  StaysOnTop, NeverFocus"
  - no result
- I wrote a function "raiseFvwmIdent" (see attachments) to bring
  FvwmIdent on top
  - this only works when:
    - I use Schedule
    - I make FvwmIdent sticky and unsticky thereafter

The sticky and unsticky solution is a trick I found out in the year 2010.
But all these tricks show: If you look for things that could be improved
on FVWM, here are some:

- examine why a StaysOnTop style is not enough to bring FvwmIdent
  on top

- examine why I need a Stick Stick solution to bring any window
  on top

Since I found workarounds for all these "problems", the priority
of these things is not so much high. But it shows that there are
at least "some" sites that have to be tackled to make even FVWM
(the best window manager worldwide) perfect.



Attachments:
- 0012_FvwmIdent
  - my FvwmIdent code, which successfully makes FvwmIdent
    unfocusable and successfully brings it on top

- 0010_task_bar
  - my primary "task bar" from wich I call FvwmIdent

- 0011_emergency_tool
   - my second "task bar" for emergency purposes from wich
     I call FvwmIdent



Environment:
- still my old productive system based on Debian Lenny with
  fvwm 2.5.26



Best regards,
Michael
# define the styles for FvwmIdent
DestroyStyle FvwmIdent
Style FvwmIdent StaysOnTop, NeverFocus



# run FvwmIdent and put it on top
DestroyFunc run_FvwmIdent
AddToFunc run_FvwmIdent
+ I Module FvwmIdent FvwmIdent
+ I Schedule 200 Next ("FvwmIdent") raiseFvwmIdent
+ I Schedule 1000 Next ("FvwmIdent") raiseFvwmIdent

DestroyFunc raiseFvwmIdent
AddToFunc raiseFvwmIdent
+ I Layer 0 6
+ I Stick
+ I Stick
+ I Raise
Module FvwmIconMan

# Currently I use a total of 1 Icon Manager
*FvwmIconMan: NumManagers 1
*FvwmIconMan: Resolution page
*FvwmIconMan: ButtonGeometry 236x20
*FvwmIconMan: ManagerGeometry 2x3+502-0
*FvwmIconMan: ReliefThickness 0
*FvwmIconMan: Title Taskleiste

# Colors
*FvwmIconMan: Background rgb:1b/86/00
*FvwmIconMan: Foreground rgb:00/00/00
*FvwmIconMan: PlainButton flat rgb:00/00/00 rgb:88/88/88
*FvwmIconMan: FocusButton flat rgb:00/ff/ff rgb:00/00/ff
*FvwmIconMan: FocusAndSelectButton flat rgb:00/ff/ff rgb:77/77/00
*FvwmIconMan: SelectButton flat rgb:00/00/00 rgb:77/77/00
*FvwmIconMan: IconButton flat rgb:ff/ff/00 rgb:00/00/00
*FvwmIconMan: TitleButton flat rgb:00/ff/00 rgb:1b/86/00



# define the styles for the task list
Style FvwmIconMan Sticky, NoTitle, HandleWidth 0, NeverFocus, StaysOnBottom



# Bind an FvwmIdent to the right mouse button
*FvwmIconMan: Action Mouse 3 N sendcommand "run_FvwmIdent"
# Use this tool when you have an emergency
# 
# When you have an emergency: Press <Alt Gr> + <Win> + <F12>  (<MOD5> + <MOD4> 
+ <F12>)
# - an FvwmWinList will appear
# 
# When emergency is over: Press <Alt Gr> + <Win> + <F11>  (<MOD5> + <MOD4> + 
<F11>)
# - the FvwmWinList will disappear
# 
# Sometimes, Firefox crashes, and after the previous session is stored, 
sometimes some windows
# hide on an invisible viewport.
# 
# - Solution: Click with mouse button 1 on this window, and it will be moved to 
page 0 0.
# 
# Sometimes, OpenOffice hides dialog boxes (for example the "Function Wizard") 
on an invisible
# viewport forever (even after OpenOffice was exited and newly started).
# 
# - Solution: Click with mouse button 1 on this dialog box (the "Function 
Wizard"),
#             and it will be moved to page 0 0.
# 
# When one of your windows is iconified, and you cannot deiconify it, because a 
WindowListSkip
# style is assigned to it, then you can try this:
# 
# - Click with mouse button 2 on this window to iconify or deiconify it.



Key F12 A 45 start_emergency_tool
Key F11 A 45 kill_emergency_tool


# start the emergency tool
DestroyFunc start_emergency_tool
AddToFunc start_emergency_tool
+ I Module FvwmWinList


# kill the emergency tool
DestroyFunc kill_emergency_tool
AddToFunc kill_emergency_tool
+ I KillModule FvwmWinList





# window lister
*FvwmWinList: Back rgb:40/40/40
*FvwmWinList: Fore rgb:ff/ff/ff
*FvwmWinList: FocusBack rgb:ff/ff/ff
*FvwmWinList: FocusFore rgb:40/40/40
#*FvwmWinList: Font -*-new century schoolbook-bold-r-*-*-*-120-*-*-*-*-*-*
*FvwmWinList: Action Click1 Function DeiconifyRaiseFocusAndMoveToPage00
*FvwmWinList: Action Click2 Iconify
*FvwmWinList: Action Click3 run_FvwmIdent
#*FvwmWinList: UseSkipList
*FvwmWinList: UseIconNames
*FvwmWinList: Geometry +502-0
*FvwmWinList: MinWidth 473
*FvwmWinList: MaxWidth 473
*FvwmWinList: ButtonFrameWidth 1
#*FvwmWinList: ShowCurrentDesk

# makes the text left-aligned
*FvwmWinList: LeftJustify

# I don't know yet what this does. I simply let it be like this.
# *FvwmWinList: NoAnchor

# I don't know yet what this does. I simply let it be like this.
# *FvwmWinList: FollowWindowList

# I don't know yet what this does. I simply let it be like this.
*FvwmWinList: BorderReliefWidth 0

# pretend to be a taskbar
*FvwmWinList: NoIconAction SendToModule FvwmAnimate animate





# The emergency tool is supposed to get styles!
Style FvwmWinList Sticky, NoTitle, HandleWidth 0, NeverFocus, StaysOnTop





# for the "click 1" action
AddToFunc DeiconifyRaiseFocusAndMoveToPage00
+ I Iconify off
+ I Raise
+ I Focus
+ I MoveToPage 0 0

Reply via email to