FVWM: SloppyFocus is obsolete...

From: Kobus Retief <kobus.retief_at_telkomsa.net>
Date: Fri, 4 Feb 2005 22:00:08 +0200

Ola

Thanks to Thomas Adam and Tavis Ormandy for the pointers about the
PackWindow complex functions (in reply to my SnapWindow patch
<http://www.hpc.uh.edu/fvwm/archive/0502/msg00024.html>). I'm scanning
through the fvwm2rc as we speak. But speaking of complex functions...

Fvwm has SloppyFocus styles, FPGrabFocus, and all sorts of related funky
focus options. But I needed something a little more sophisticated. So,
without further ado:


################################################################################
# Automatic window focusing, raising and warping

Style * ClickToFocus, MouseFocusClickRaise


# Do a minimal-distance warp to inside the window's border -- distance
# inside (in pixels) can be specified as single parameter, defaults to
# 10.
DestroyFunc Warp_If_Outside
AddToFunc Warp_If_Outside
+ I PipeRead " \
                x=$[pointer.wx]; y=$[pointer.wy]; border=$0; \
                [[ ! "${border}" ]] && border=10; \
                [[ ${x} -lt ${border} ]] && x=${border}; \
                [[ ${y} -lt ${border} ]] && y=${border}; \
                [[ ${x} -gt $(($[w.width]-${border})) ]] && x=$(($[w.width]-${border})); \
                [[ ${y} -gt $(($[w.height]-${border})) ]] && y=$(($[w.height]-${border}));\
                echo WarpToWindow ${x}p ${y}p;"


DestroyFunc AutoRaise_Raise_Func
AddToFunc AutoRaise_Raise_Func
+ I Raise
+ I FlipFocus
+ I Warp_If_Outside

DestroyFunc AutoRaise_Add
AddToFunc AutoRaise_Add
+ I WindowId $* (CurrentDesk AcceptsFocus !Iconic) AutoRaise_Raise_Func

DestroyFunc AutoRaise_Destroy
AddToFunc AutoRaise_Destroy
+ I DeSchedule $*
+ I Prev (CurrentDesk AcceptsFocus !Iconic) AutoRaise_Raise_Func

DestroyFunc AutoRaise_Enter
AddToFunc AutoRaise_Enter
+ I WindowId $* Silent FlipFocus
+ I Schedule 750 $* WindowId $* Silent Raise

DestroyFunc AutoRaise_Leave
AddToFunc AutoRaise_Leave
+ I DeSchedule $*

*AutoRaise:PassId
*AutoRaise:add_window AutoRaise_Add
*AutoRaise:destroy_window AutoRaise_Destroy
*AutoRaise:enter_window AutoRaise_Enter
*AutoRaise:leave_window AutoRaise_Leave

Module FvwmEvent AutoRaise


################################################################################


So, what have we achieved? Without using SloppyFocus or any other
strange focusing options, fvwm is now configured to
a) Emulate SloppyFocus (without actually using it)
b) Emulate FvwmAuto (Autoraise windows after 750 miliseconds)
c) Emulate FPGrabFocus and FPReleaseFocus
d) Warp the mouse pointer to inside a newly created window, or back
        to the previously focused window on window destruction (I
        couldn't find any simple way to do this, leading to this
        solution).

Is it possible to emulate ALL fvwm's *Focus options (and a couple of
other Style settings) using FvwmEvent like this? If so, is it really a
good idea keeping these styles, since we're effectively duplicating
functionality? If the styles are removed, will fvwm be noticably
smaller and more memory-efficient? Shouldn't such a blatantly useful
module be integrated directly into fvwm, possibly through
automatically-called functions (i.e. FvwmAddWindow, FvwmEnterWindow,
analogous to InitFunction and its ilk)?

Oh, and most important, does anybody else have pointers to other cool
complex configuration ideas using FvwmEvent, Schedule, PipeRead and the
other less-commonly used options?

Cheers!
-- 
Kobus Retief
--
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 Feb 04 2005 - 14:01:42 GMT

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