Subject: FVWM: FVWM focus bug?

From: Danny Sung <[email-masked]>
Date: Tue, 30 Apr 1996 20:55:29 -0700

I'm having a rather peculiar problem with FVWM (at least I think
it's fvwm's fault, since other window managers don't seem to
have a problem).  For some reason, the focus will never go onto a
program that I write.  I've tried setting 'Style "*" ClickToFocus'
and SloppyFocus.  Neither have any affect.  Whether I move the mouse
onto the window, select the window title bar, resize, whatever.

Here are the relevant files (a sample X program that has this problem,
and my ~/.fvwmrc file):

------------------------------------------------------
# Imakefile
PROGRAMS = xtest

SRCS1 = xtest.c 
OBJS1 = xtest.o

CCOPTIONS = -pedantic -Wall

LOCAL_LIBRARIES1 = $(XLIB) $(XTOOLLIB) $(XAWLIB) $(XMULIB) \
	-lm $(EXTRA_LDOPTIONS)
DEPLIBS1 = $(DEPXLIB) $(DEPXTOOLLIB) $(DEPXAWLIB) $(DEPXMULIB) 

ComplexProgramTarget_1(xtest,$(LOCAL_LIBRARIES1),)
------------------------------------------------------
/* xtest.c */
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/Command.h>

void cb_quit(Widget w, XtPointer client_data, XtPointer call_data);

int main(int argc, char *argv[])
{
	XtAppContext app_context;
	Widget toplevel, quit;
	toplevel = XtVaAppInitialize(&app_context,
		"Xtest", NULL, 0, &argc, argv, NULL, NULL);

	quit = XtCreateManagedWidget("quit", commandWidgetClass, 
		toplevel, 0, 0);
	XtAddCallback(quit, XtNcallback, cb_quit, NULL);

	XtRealizeWidget(toplevel);

	XtAppMainLoop(app_context);
	return(0);
}

void cb_quit(Widget w, XtPointer client_data, XtPointer call_data)
{
	exit(0);
}

------------------------------------------------------

# Win95'ish FVWM rc for fvwm-2

# Apparantly, you can retrieve sample .fvwmrc's from 
# 	ftp://ftp.best.com/pub/tdgilman/Fvwmrcs
# you can also submit your favourite .fvwmrc to
#	[email-masked] 
# if you want to.

# Path definitions
ModulePath /usr/lib/X11/fvwm
PixmapPath /usr/include/X11/pixmaps/:/usr/local/include/X11/pixmaps/
IconPath   /usr/include/X11/bitmaps/

### Tool button definitions ###
# Main window options
	Mouse 0	1    	A      	Menu Window-Ops2 Close
# Kill Window
ButtonStyle 2 13 20x25@0 30x25@0 50x45@0  70x25@0 80x25@0 55x50@0  80x75@0 70x75@0 50x55@0  30x75@0 20x75@0 45x50@0 20x25@0 # X
	Mouse 1	2	A	Close
	Mouse 2	2	A	Close
	Mouse 3	2	A	Close
# Minimize
ButtonStyle 6 5 25x75@0 65x75@0   65x72@0 25x72@0 25x75@0 # minimize
	Mouse 1	6	A	Iconify
	Mouse 2	6	A	Iconify
	Mouse 3	6	A	Iconify
# Maximize
# To fully simulate W95, we need a special
# case for the maximize button
ButtonStyle 4 10 25x25@0 75x25@0 75x75@0 25x75@0 25x25@0   25x30@-1 75x30@0 75x28@0 25x28@0 25x30@0  # maximize
	Mouse 1 4	A	MaxFunc
	Mouse 2 4	A	MaxFunc
	Mouse 3 4	A	MaxFunc
#	The above commands are duplicated in the function RestoreFunc.  Remember
#	to change both if making changes.

#old style
#ButtonStyle 4 11 25x25@0 75x25@0 75x75@0 25x75@0 25x25@0   25x30@0 75x30@0 75x28@0 25x28@0 25x30@0 25x25@0
#ButtonStyle 2 13 20x25@0 30x25@0 50x45@0  70x25@0 80x25@0 55x50@0  80x75@0 70x75@0 50x55@0  30x75@0 20x75@0 45x50@0 20x25@0 # X
#ButtonStyle 6 5 25x75@0 65x75@0   65x72@0 25x72@0 25x75@0  # minimize
# Some new button styles:
# Cross
# ButtonStyle 2 13 20x25@0 30x25@0 50x45@0  70x25@0 80x25@0 55x50@0  80x75@0 70x75@0 50x55@0  30x75@0 20x75@0 45x50@0  20x25@0
# A forward Slash
# ButtonStyle  2  5  80x25@0 75x20@1 20x75@1 25x80@1 80x25@0

###  These are some default button styles that come with FVWM
# small up triangle
#ButtonStyle 2 4 50x35@1 65x65@0 35x65@0 50x35@1
# small down triangle
#ButtonStyle 4 4 50x65@1 35x35@1 65x35@1 50x65@0
# large up triangle
#ButtonStyle 2 4 50x25@1 75x75@0 25x75@0 50x25@1
# large down triangle
#ButtonStyle 4 4 50x75@1 25x25@1 75x25@1 50x75@0
# big box
#ButtonStyle 2 5 25x25@1 25x75@1 75x75@0 75x25@0 25x25@1
# little box
#ButtonStyle 8 5 40x40@1 60x40@1 60x60@0 40x60@0 40x40@1
# tall box
#ButtonStyle 6 5 40x25@1 60x25@1 60x75@0 40x75@0 40x25@1
# dot
#ButtonStyle 4 5 45x45@1 55x45@1 55x55@0 45x55@0 45x45@1
# an up arrow:
#ButtonStyle 2 8 40x80@1 40x50@1 20x50@1 50x20@1 80x50@0 60x50@0 60x80@0 40x80@0
# an X
#ButtonStyle 2 13 26x29@1 34x21@1 50x35@1 70x21@1 79x29@1 63x48@0 79x65@1 70x75@0 50x61@0 34x75@0 26x65@0 44x48@1 26x29@0

EdgeResistance	250	128
WindowFont	-adobe-helvetica-*-r-*-*-13-20-*-*-*-*-*-*
IconFont	-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
MenuStyle	black	grey76	black	-adobe-times-bold-r-*-*-14-*-*-*-*-*-*-* fvwm
EdgeScroll	100	100

HilightColor	black	grey76
TitleFocusColor	white	NavyBlue
TitleUnfocusColor	Grey76	Grey51
TitleJustify	left

#DeskTopSize	2x2
DeskTopSize	1x1
ClickTime	750

ColormapFocus	FollowsMouse

# default parameters
Style "*"		BorderWidth 5, HandleWidth 5
Style "*"		Icon unknown1.xpm, Color Black/grey76
Style "*"		ActivePlacement, SmartPlacement
Style "*"		MWMFunctions,MWMDecor,HintOverride, MWMBorder
Style "*"		DecorateTransient,IconBox 0 -10 -280 -1
Style "*"		SmartPlacement, RandomPlacement
# default fvwm (modules, etc.) parameters
Style "Fvwm*"		NoTitle, NoHandles, Sticky, WindowListSkip,
Style "Fvwm*"		BorderWidth 0,CirculateSkipIcon
Style "Fvwm Pager"	StaysOnTop
Style "FvwmPager"	StaysOnTop
Style "FvwmBanner"	StaysOnTop
Style "FvwmButtons"	NoTitle, NoHandles, Sticky, WindowListSkip
Style "FvwmButtons"	BorderWidth 0, CirculateSkip
Style "FvwmButtons"	Icon toolbox.xpm,ClickToFocus

# application parameters
Style "*lock"		NoTitle, NoHandles, Sticky, WindowListSkip
Style "*lock"		RandomPlacement
#Style "*load"		NoTitle
Style "*load"		NoTitle, Sticky, WindowListSkip,ClickToFocus
Style "xbiff"		NoTitle, Sticky, WindowListSkip,ClickToFocus
Style "Maker"		StartsOnDesk 1,RandomPlacement,ClickToFocus
Style "matlab"		StartsOnDesk 3
Style "signal"		StartsOnDesk 3 
Style "rxvt"		Icon  term.xpm,SloppyFocus,IconBox -70 1 -1 -140
#Style "XTerm"		Icon xterm.xpm,IconBox -70 1 -1 -140
#Style "XTerm"		Color black/#aa80aa,MWMBorder,MWMButtons
Style "Appointment"	Icon datebook.xpm, NoButton 2, NoButton 4,ClickToFocus
Style "xcalc"		Icon xcalc.xpm, NoButton 2,RandomPlacement,ClickToFocus
Style "xmh"		Icon mail1.xpm, NoIconTitle,StickyIcon
Style "xmh"		RandomPlacement, StartsOnDesk 2, NoButton 2
Style "xman"		Icon xman.xpm,RandomPlacement,ClickToFocus
Style "xvgr"		Icon graphs.xpm,RandomPlacement,ClickToFocus
Style "matlab"		Icon math4.xpm,ClickToFocus
Style "xmag"		Icon mag_glass.xpm,RandomPlacement, ClickToFocus
Style "xgraph"		Icon graphs.xpm,RandomPlacement,ClickToFocus
Style "sppeed6"		Icon math3.xpm,NoTitle,ClickToFocus
Style "sppeed6_user"	Icon math4.xpm,NoTitle
Style "xmosaic"		NoPPosition, color Green/Yellow,ClickToFocus

# Windows Style keymaps
Key Escape	A	C	WindowList
Key Tab		A	M	Next [*] focus
Key Tab		A	SM	Prev [*] focus

Key Left	A	C	Scroll -100 0
Key Right	A	C	Scroll +100 +0
Key Up		A	C	Scroll +0   -100
Key Down	A	C	Scroll +0   +100
Key Left	A	M	Scroll -10 +0
Key Right	A	M	Scroll +10 +0
Key Up		A	M	Scroll +0   -10
Key Down	A	M	Scroll +0   +10
Key Left	A	SC	CursorMove -1 0
Key Right	A	SC	CursorMove +1 +0
Key Up		A	SC	CursorMove +0   -1
Key Down	A	SC	CursorMove +0   +1
Key Left	A	SM	CursorMove -10 +0
Key Right	A	SM	CursorMove +10 +0
Key Up		A	SM	CursorMove +0   -10
Key Down	A	SM	CursorMove +0   +10
Key KP_F1	A	M	Popup "Utilities"
Key KP_F2	A	M	Popup "Window-Ops"
Key KP_F3	A	M	Module FvwmWinList 
Key KP_F4	A	M	Iconify
Key F5		A	M	Move        100p 100p
Key F6		A	M	Resize   10 10
Key F7		A	M	Next [*] focus
Key F8		A	M	Prev [*] focus
Key F10 	A	A	Next [CurrentDesk rxvt]Focus
Key F11 	A	A	Prev [CurrentDesk rxvt]Focus
Key F15		FTIWS	A	Raise

Mouse 1	R	A	Menu Utilities Nop
Mouse 2	R	A	Menu Window-Ops Nop
Mouse 3	R	A	WindowList
Mouse 1	F	A	Resize-or-Raise
Mouse 1	TS	A	Move-or-Raise
Mouse 1	I	A	Move-or-Iconify
Mouse 2	I	A	Iconify
Mouse 2	FST	A	Menu Window-Ops2 Nop
Mouse 3	TSIF	A	RaiseLower

#Mouse 0	1	A      	Menu Window-Ops2 Close
#Mouse 0	2	A     	Maximize-Func
#Mouse 0	4	A     	Iconify

########################Initialization Functions ############################
AddToFunc InitFunction 	  "I" Module FvwmButtons
+			  "I" exec xsetroot -mod 2 2 -fg turquoise4 -bg DarkCyan

AddToFunc RestartFunction "I" Module FvwmButtons
+			  "I" exec xsetroot -mod 2 2 -fg turquoise4 -bg DarkCyan

########################Menus ########################################
AddToMenu Utilities	"Utilities"	Title 	
+			"Shells"		Popup Shells-Popup
+			"AnsiXterm (7x14)" Exec exec /usr/local/X11/ansi_xterm -sb -sl 300 -j -ls -fn 7x14 -r &
+			"Xterm"		Exec  exec xterm -e tcsh &
+			"Rxvt"		Exec  exec rxvt &
+			"Remote Logins"	Popup Remote-Logins
+			"Top"		Exec  exec rxvt -T Top -n Top -e top &
+			"Calculator"	Exec  exec xcalc &
+			"Xman"		Exec  exec xman &
+			"Xmag"		Exec  exec xmag &
+			"emacs"		Exec  exec xemacs &
+                       "Mail"          MailFunction xmh "-font fixed"
+			""		Nop
+			"Modules"	Popup Module-Popup
+			""		Nop		
+			"Exit Fvwm"	Popup Quit-Verify
AddToMenu Window-Ops	"Window Ops"	Title		
+			"Move"		Move-or-Raise2
+			"Resize"	Resize-or-Raise2
+			"Raise"		Raise
+			"Lower"		Lower 
+		 	"(De)Iconify"	Iconify
+			"(Un)Stick"	Stick		
+			"(Un)Maximize"	maximize_func
+			""		Nop  
+			"Delete"	Delete	 
+			"Close"		Close	 
+			"Destroy"	Destroy
+			""		Nop		
+			"Refresh Screen" Refresh		
AddToMenu Window-Ops2	"Move"		Move-or-Raise
+			"Resize"	Resize-or-Raise
+			"Raise"		Raise   	
+			"Lower"		Lower   	
+			"Iconify"	Iconify 	
+			"(Un)Stick"	Stick		
+			""		Nop     	
+			"Delete"	Delete	
+			"Close"		Close	  	
+			"Destroy"	Destroy 	
+			""		Nop 		
+			"ScrollBar" 	Module FvwmScroll 2 2	
+			"Print"         PrintFunction

AddToMenu Remote-Logins	"dopey"	 Exec rsh dopey rxvt -display $HOSTDISPLAY &
+			"snoopy" Exec rsh snoopy rxvt -display $HOSTDISPLAY &
+			"grumpy" Exec rsh grumpy rxvt -display $HOSTDISPLAY &
+			"happy"	 Exec rsh happy rxvt -display $HOSTDISPLAY &
+			"bailey" Exec rsh bailey rxvt -display $HOSTDISPLAY &
+			"barnum" Exec rsh barnum rxvt -display $HOSTDISPLAY &
+			"joker"	 Exec rsh joker rxvt -display $HOSTDISPLAY &
+			"signal" Exec rxterm signal

AddToMenu Module-Popup	"Modules"	Title	
+			"Button-Bar"	Module	FvwmButtons
+			"Clean-Up"	Module	FvwmClean
+			"Identify"	Module	FvwmIdent
+			"SaveDesktop"	Module  FvwmSave
+			"Debug"		Module	FvwmDebug
+			"Pager"		Module  FvwmPager 0 1
+			"WinList"	Module  FvwmWinList
+			"Background"	Module  FvwmBacker
+			"IconBox"	Module	FvwmIconBox
+			"Banner"	Module	FvwmBanner
+			"Talk"  	Module	FvwmTalk
+			"Prompt"	Module	FvwmPrompt "hello" raise
+			"Audio"		Module	FvwmAudio

AddToMenu Quit-Verify 	"Really Quit Fvwm?" Title	
+		      	"Yes, Really Quit"  Quit	
+		      	"Restart Fvwm"	    Restart fvwm	
+		      	"Start twm"         Restart twm
+		      	"Start mwm"    	    Restart mwm
+	      	      	"Start olwm"        Restart /usr/openwin/bin/olwm
+		        "Start tvtwm"       Restart vtwm
+		      	"Start dummy"       Restart xterm
+		      	""		    Nop	
+		      	"No, Don't Quit"    Nop	

########################Functions ########################################

AddToFunc MailFunction	   "I" Next [$0] Iconify -1
+		           "I" Next [$0] focus
+			   "I" None [$0] Exec $0 $1

AddToFunc Move-or-Raise		"I" Raise
+				"M" Move
+  				"D" Lower

AddToFunc Move-or-Raise2	"M" Raise
+				"M" Move
+  				"D" Lower

AddToFunc Maximize-Func		"M" Maximize	 0 100
+				"C" Maximize	 0 80
+				"D" Maximize	 100 100

AddToFunc Move-or-Iconify	"I" Raise
+				"M" Move
+				"D" Iconify

AddToFunc Resize-or-Raise	"I" Raise
+				"M" Resize
+				"D" Lower

AddToFunc Resize-or-Raise2	"M" Raise
+				"M" Resize
+				"D" Lower

AddToFunc PrintFunction		"I" Raise
+				"I" Exec xdpr -id $w

AddToFunc MaxFunc
+		"I"	Maximize
+		"I"	Mouse			1	4	A	RestoreFunc
+		"I"	Mouse			2	4	A	RestoreFunc
+		"I"	Mouse			3	4	A	RestoreFunc
+		"I"	ButtonStyle 4 14 25x40@0 65x40@0 65x75@0 25x75@0 25x40@0   65x45@-1 25x45@0    40x40@-1 40x25@0  75x25@0 75x60@0 65x60@0   75x30@-1 40x30@0

# old style
#+		"I"	ButtonStyle 4 20 25x40@0 65x40@0 65x75@0 25x75@0 25x40@0   25x45@0 65x45@0 65x43@0 25x43@0 25x45@0 25x40@0    40x40@0  40x25@0  75x25@0 75x27@0 40x27@0 40x30@0  75x30@0 75x60@0 65x60@0

AddToFunc RestoreFunc
+		"I"	Maximize
+		"I"	Mouse			1	4	A	MaxFunc
+		"I"	Mouse			2	4	A	MaxFunc
+		"I"	Mouse			3	4	A	MaxFunc
+		"I"	ButtonStyle 4 11 25x25@0 75x25@0 75x75@0 25x75@0 25x25@0   25x30@0 75x30@0 75x28@0 25x28@0 25x30@0 25x25@0

# The above 3 calls are duplicated at init time.  Remember to change
# both if making changes.

################## FvwmButtons button-bar ################################
# Colors
*FvwmButtonsFore Black
*FvwmButtonsBack grey65

# Font
*FvwmButtonsFont -adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
# Geometry - really likes to pick its own size, but giving a position is OK
#*FvwmButtonsGeometry -1-1
*FvwmButtonsGeometry 100x50+0+0

# Layout: specify rows or columns, not both
#*FvwmButtonsRows 2
*FvwmButtonsRows 1

# xterm or rxvts on remote machines can be done like this
# Output re-direction is csh style, not sh style
# You will want to substitute your own hosts here!

# *FvwmButtons	Dopey	rterm.xpm	Exec "XTerm" rsh dopey "exec rxvt -T dopey -display $HOSTDISPLAY </dev/null >&/dev/null & "&
# *FvwmButtons	Grumpy	rterm.xpm	Exec "XTerm" rsh grumpy "exec rxvt -T grumpy -display $HOSTDISPLAY </dev/null >&/dev/null & "&
# *FvwmButtons	Snoopy	rterm.xpm	Exec "XTerm" rsh snoopy "exec rxvt -T snoopy -display $HOSTDISPLAY </dev/null >&/dev/null & "&
# *FvwmButtons	signal	rterm.xpm	Exec "XTerm" rxterm signal &
# *FvwmButtons	mail	mail2.xpm	Function MailFunction xmh "-font fixed"

# *FvwmButtons whatever  clock.xpm   Swallow "Clock" Exec rclock -bg \#908090 -geometry -1500-1500 -font -*-times-*-r-*-*-17-*-*-*-*-*-*-* -mailupdate 10 &
*FvwmButtons(2x1) -	whatever	Swallow	"FvwmPager" Module FvwmPager 0 1

########################## Window-Identifier ###############################
# Just choose colors and a fonts
*FvwmIdentBack		MidnightBlue
*FvwmIdentFore		Yellow
*FvwmIdentFont		-adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*

########################### Pager #########################################
*FvwmPagerBack		#908090
*FvwmPagerFore		#484048
*FvwmPagerFont		-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
*FvwmPagerHilight	#cab3ca
*FvwmPagerGeometry	-1-1
*FvwmPagerLabel		0	Misc
*FvwmPagerLabel		1	Maker
*FvwmPagerLabel		2	Mail
*FvwmPagerLabel		3	Matlab
*FvwmPagerSmallFont	5x8

##########################FvwmWinList##################################
*FvwmWinListBack	#908090
*FvwmWinListFore	Black
*FvwmWinListFont	-adobe-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*
*FvwmWinListAction	Click1 Iconify -1,Focus
*FvwmWinListAction	Click2 Iconify
*FvwmWinListAction	Click3 Module "FvwmIdent" FvwmIdent
*FvwmWinListUseSkipList	
*FvwmWinListGeometry	+0-1
                                      
*FvwmBackerDesk		0	-solid steelblue
*FvwmBackerDesk		1	-solid midnightblue

*FvwmScrollBack		grey40
*FvwmScrollFore		green

############################################################
############################################################
# Note that icons are shown in the module
#    only if NoIcon commnand is applied.
#Style     "*"  NoIcon

############################################################
*FvwmIconBoxIconBack    #cfcfcf
*FvwmIconBoxIconHiFore  black
*FvwmIconBoxIconHiBack  LightSkyBlue
*FvwmIconBoxBack        #5f9ea0
#*FvwmIconBoxFore       blue
*FvwmIconBoxGeometry    5x1+0+0
*FvwmIconBoxMaxIconSize 64x38
*FvwmIconBoxFont        -adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*
*FvwmIconBoxSortIcons
*FvwmIconBoxPadding     4
*FvwmIconBoxLines       10
*FvwmIconBoxSBWidth     11
*FvwmIconBoxPlacement   Left Top
*FvwmIconBoxPixmap      fvwm.xpm
#*FvwmIconBoxHideSC Horizontal
*FvwmIconBoxSetWMIconSize
*FvwmIconBoxHilightFocusWin
*FvwmIconBoxMouse       1       Click           RaiseLower
*FvwmIconBoxMouse       1       DoubleClick     Iconify
*FvwmIconBoxMouse       2       Click           Iconify -1, Focus
*FvwmIconBoxMouse       3       Click           Module "FvwmIdent" Fvw
*FvwmIconBoxKey         r       RaiseLower
*FvwmIconBoxKey         space   Iconify
*FvwmIconBoxKey         d       Close
*FvwmIconBoxKey         n       Next
*FvwmIconBoxKey         p       Prev
*FvwmIconBoxKey         h       Left
*FvwmIconBoxKey         j       Down
*FvwmIconBoxKey         k       Up
*FvwmIconBoxKey         l       Right
#
# Icon file specifications
#
# Mostly, you don't have to specify icon files, as FvwmIconBox now
# reads icon files specified in Style commands.
#
*FvwmIconBox            "Fvwm*"         -

# Audio configuration

*FvwmAudioPlayCmd	builtin-rplay
*FvwmAudioDir		/usr/lib/sounds
*FvwmAudioDelay		1
*FvwmAudioRplayHost	mom
*FvwmAudioRplayPriority	0
*FvwmAudioRplayVolume	127

# Modules to start up
Module			FvwmAudio

------------------------------------------------------

Note that TitleFocusColor, TitleFocusColor, TitleUnfocusColor, and
TitleJustify are my hacks (does anyone want the diffs?  I haven't
had time to clean them up, but they're getting the job done at least).
I'm pretty sure that my changes aren't what's causing the problem.
I just tried it with a clean 2.0.42 and new-system.fvwmrc in the
sample.fvwmrc/ directory, and "xtest" had the same problem, so the
problem is most likely not my changes.

In any case, it's only programs that I write that have this problem.
Any other program I compile or run doesn't seem to exhibit this
behavior.

BTW, I'm using XFree86-3.0.2 and Linux v1.3.88.  Any insight into this
matter would be greatly appreciated.

Thanks,
Danny Sung
--
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].