Subject: Notification: incoming/1050

From: [email-masked]
Date: Tue, 24 Jun 2003 03:37:51 -0500

FVWM Bug Tracking notification

new message incoming/1050

Message summary for PR#1050
	From: [email-masked]
	Subject: focus lost after option menu selection
	Date: Tue, 24 Jun 2003 03:37:50 -0500
	0 replies 	0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

>From [email-masked] Tue Jun 24 03:37:50 2003
Date: Tue, 24 Jun 2003 03:37:50 -0500
From: [email-masked]
To: [email-masked]
Subject: focus lost after option menu selection

Full_Name: E. Weber
Version: 2.4.14
CVS_Date: 
OS: red hat linux 8.0
X_Server: Xfree86, Exceed
Submission from: (NULL) (53.122.197.194)

The problem appears while using Motif (version 2.2.3) option menus under
FVWM2 with the  Focus Follows Mouse option. (It doesn't appear with fvwm1
or with Click To Focus option).
Selecting option menu entries twice or more the option menu looses focus.
The related window is still the active window, but there isn't a focus in
the whole window. 
Focus reappears as the mouse is moved out of the window and in again.

The problem seems to be caused by calling XmAddWMProtocolCallback for Atom
WM_TAKE_FOCUS.
Reproduction of the problem can be done with the following code: 

#include <stdio.h>
#include <stdlib.h>
#include <Xm/Xm.h>
#include <Xm/PushB.h>
#include <Xm/RowColumn.h>
#include <Xm/RowColumn.h>
#include <Xm/Protocols.h>

void emptyCB(Widget widget, XtPointer clientDaten, XtPointer aufrufDaten)
{}

int main(int argc, char **argv)
{
	XtAppContext kontext;
	Widget	applShell;
	Widget  box, option_menu, menu, button1, button2;
	int ac=0;
	Arg al[64];

	applShell= XtAppInitialize( &kontext, "focustest", (XrmOptionDescRec*)
NULL, 0, &argc, argv, (String*) NULL, (Arg*) NULL, 0);
  	box= XtCreateManagedWidget("box", xmRowColumnWidgetClass, applShell,
(Arg*)NULL, 0);
  	option_menu = XmCreateOptionMenu ( box, (char *) "option_menu", al, ac
);
	menu = XmCreatePulldownMenu ( option_menu, (char *) "menu", al, ac );
	button1 = XtCreateManagedWidget("button1", xmPushButtonWidgetClass, menu,
(Arg*)NULL, 0);
	button2 = XtCreateManagedWidget("button2", xmPushButtonWidgetClass, menu,
(Arg*)NULL, 0);

	XtSetArg(al[ac], XmNsubMenuId, menu); ac++;
	XtSetValues(option_menu, al, ac);
	XtManageChild(option_menu);
    
	Atom  wm_take_focus = XInternAtom( XtDisplay( applShell ),"WM_TAKE_FOCUS",
True );
   	XmAddWMProtocolCallback( applShell, wm_take_focus,  emptyCB,
(XtPointer) NULL );
  
	XtRealizeWidget(applShell);
	XtAppMainLoop (kontext);
}

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]