Consume the first mouse click?

I use mc (Midnight Commander) a lot in rxvt windows, but if you happen to click a column heading in mc it changes the sort order when all I wanted was to focus the window. (sloppy focus) Is it possible to define a window style where the first click in the window only focuses the window and doesn’t get passed to the application? Even that may prove to be a pain, right now I have mouse support turned off in mc altogether. Any other ideas?

[edit]: The first click in an unfocused window, I meant to say.

I like the signup capcha, saved a copy to study.

Alan

It’s not clear what you’re asking.

If you’re using SloppyFocus, then no amount of trying to coerce a click to the window will help with focus – it’s already focused by definition.

What is it you’re trying to do? See all manner of FP*Click styles in “man fvwm”.

– Thomas Adam

DestroyFunc StartFunction
AddToFunc   StartFunction
+ I Module FvwmEvent

DestroyFunc	HandleEnterWindow
AddToFunc	HandleEnterWindow
+ I PointerWindow (*Rxvt,mc*) SetEnv EnterMc

DestroyFunc	HandleLeaveWindow
AddToFunc	HandleLeaveWindow
+ I ThisWindow (*Rxvt,mc*) UnSetEnv EnterMc

AddToFunc	ActionOnMc
+ C Test (EnvIsSet EnterMc) Schedule 100 UnSetEnv EnterMc
+ C Test (!EnvIsSet EnterMc) FakeClick depth 0 press 1 wait 20 release 1


DestroyModuleConfig FvwmEvent:*
*FvwmEvent: Cmd
*FvwmEvent: enter_window HandleEnterWindow
*FvwmEvent: leave_window HandleLeaveWindow

Mouse (mc*) 1 W A ActionOnMc

I guess above code might solve your problem.

No. This is only complicating matters. I want to know what the problem is, and when I do, I all but guarantee you that one of the FP* options will work. BTW, your FvwmEvent idea is better-suited to FvwmAuto.

– Thomas Adam

It seems that FP* option won’t solve Alan’s problem, because the mouse click event is passed to MC, no matter which Focus Policy is chosen.
Perhaps the only way is to change the behavior of click event.

Yeah, you’re right. I don’t know there is such a module.
Here is the solution by FvwmAuto:

DestroyFunc StartFunction
AddToFunc   StartFunction
+ I Module FvwmAuto 0 "PointerWindow (*Rxvt,mc*) SetEnv EnterMc" "ThisWindow (*Rxvt,mc*) UnSetEnv EnterMc"

AddToFunc   ActionOnMc
+ C Test (EnvIsSet EnterMc) Schedule 100 UnSetEnv EnterMc
+ C Test (!EnvIsSet EnterMc) FakeClick depth 0 press 1 wait 20 release 1

mouse (mc*) 1 W A ActionOnMc

Don’t second-guess. You can still do this, but it will depend whether or not the focus of the window is important or not.

PointerWindow (foo|bar)

But then again, I’d use State for this.

Will only work if the underlying terminal allows synthetic events. Good luck with anything other than XTerm for that.

– Thomas Adam

Sorry to be unclear. What I’m looking for is to have the first click in an unfocused window only focus the window, not get passed through to the application(s) inside. In this case it’s mc in an rxvt window. I’d add it to the style of the rxvt window or define a new one. Focusing the window would consume the click, not pass it on.

Alan

Style foo ClickToFocus, ClickToFocusPassesClickOff

– Thomas Adam