The attached patch works around an xforms bug and appears to 
work beautifully. Ok to apply?

Angus
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.552
diff -u -p -r1.552 ChangeLog
--- src/frontends/xforms/ChangeLog	3 Oct 2002 11:25:00 -0000	1.552
+++ src/frontends/xforms/ChangeLog	3 Oct 2002 16:54:42 -0000
@@ -1,5 +1,22 @@
 2002-10-03  Angus Leeming  <[EMAIL PROTECTED]>
 
+	* FeedbackController.C (PrehandlerCB): re-compute the folder->x,
+	folder->y coords of a tabfolder when the mouse enters the folder.
+	This works around an xforms bug that manifests itslf as tooltips
+	appearing in their original position after the dialog has been
+	moved aside.
+
+	* FormAboutlyx.C (build):
+	* FormDocument.C (build):
+	* FormGraphics.C (build):
+	* FormPreferences.C (build):
+	* FormTabular.C (build): set the prehandler for tabfolders.
+
+	* form_graphics.fd: move the edge of the tabfolder in by 5 pixels
+	to ensure that the tabfolder prehandler is called.
+
+2002-10-03  Angus Leeming  <[EMAIL PROTECTED]>
+
 	* lyx_gui.C (start): ev.xany.type is of type 'int' so print it as a
 	decimal not a hexadecimal.
 
Index: src/frontends/xforms/FeedbackController.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FeedbackController.C,v
retrieving revision 1.12
diff -u -p -r1.12 FeedbackController.C
--- src/frontends/xforms/FeedbackController.C	5 Sep 2002 15:14:21 -0000	1.12
+++ src/frontends/xforms/FeedbackController.C	3 Oct 2002 16:54:42 -0000
@@ -73,10 +73,26 @@ void FeedbackController::MessageCB(FL_OB
 
 void FeedbackController::PrehandlerCB(FL_OBJECT * ob, int event, int key)
 {
-	if (event == FL_PUSH && key == 2 && ob->objclass == FL_INPUT) {
+	lyx::Assert(ob);
+
+	if (ob->objclass == FL_INPUT && event == FL_PUSH && key == 2) {
 		// Trigger an input event when pasting in an xforms input object
 		// using the middle mouse button.
 		InputCB(ob, 0);
+		
+	// This is very odd:
+	// event == FL_LEAVE when the mouse enters the folder and
+	// event == FL_ENTER are it leaves!
+	} else if (ob->objclass == FL_TABFOLDER && event == FL_LEAVE) {
+		// This prehandler is used to work-around an xforms bug.
+		// It updates the form->x, form->y coords of the active
+		// tabfolder when the mouse enters.
+		FL_FORM * const form = fl_get_active_folder(ob);
+		Window win = fl_prepare_form_window(form, 0, 0, "Folder");
+		if (win) {
+			FL_Coord w, h;
+			fl_get_wingeometry(win, &(form->x), &(form->y), &w, &h);
+		}
 
 	} else if (message_widget_ &&
 		   (event == FL_ENTER || event == FL_LEAVE)) {
Index: src/frontends/xforms/FormAboutlyx.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormAboutlyx.C,v
retrieving revision 1.15
diff -u -p -r1.15 FormAboutlyx.C
--- src/frontends/xforms/FormAboutlyx.C	5 Sep 2002 15:14:21 -0000	1.15
+++ src/frontends/xforms/FormAboutlyx.C	3 Oct 2002 16:54:42 -0000
@@ -68,6 +68,9 @@ void FormAboutlyx::build()
 	fl_addto_tabfolder(dialog_->tabfolder,_("Credits"),
 			   credits_->form);
 
+	// work-around xforms bug re update of folder->x, folder->y coords.
+	setPrehandler(dialog_->tabfolder);
+
 	// Manage the cancel/close button
 	bc().setCancel(dialog_->button_close);
 }
Index: src/frontends/xforms/FormDocument.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormDocument.C,v
retrieving revision 1.117
diff -u -p -r1.117 FormDocument.C
--- src/frontends/xforms/FormDocument.C	5 Sep 2002 15:14:22 -0000	1.117
+++ src/frontends/xforms/FormDocument.C	3 Oct 2002 16:54:42 -0000
@@ -331,6 +331,10 @@ void FormDocument::build()
 			   options_->form);
 	fbullet = fl_addto_tabfolder(dialog_->tabfolder,_("Bullets"),
 				     bullets_->form);
+
+	// work-around xforms bug re update of folder->x, folder->y coords.
+	setPrehandler(dialog_->tabfolder);
+
 	if ((XpmVersion < 4) || (XpmVersion == 4 && XpmRevision < 7)) {
 		lyxerr << _("Your version of libXpm is older than 4.7.\n"
 			    "The `bullet' tab of the document dialog "
Index: src/frontends/xforms/FormGraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormGraphics.C,v
retrieving revision 1.85
diff -u -p -r1.85 FormGraphics.C
--- src/frontends/xforms/FormGraphics.C	12 Sep 2002 08:44:23 -0000	1.85
+++ src/frontends/xforms/FormGraphics.C	3 Oct 2002 16:54:42 -0000
@@ -233,6 +233,9 @@ void FormGraphics::build()
 	fl_addto_tabfolder(dialog_->tabfolder, _("Bounding Box"), bbox_->form);
 	fl_addto_tabfolder(dialog_->tabfolder, _("Extra"), extra_->form);
 
+	// work-around xforms bug re update of folder->x, folder->y coords.
+	setPrehandler(dialog_->tabfolder);
+
 	// set the right default unit
 	switch (lyxrc.default_papersize) {
 	case BufferParams::PAPER_DEFAULT: break;
Index: src/frontends/xforms/FormPreferences.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormPreferences.C,v
retrieving revision 1.136
diff -u -p -r1.136 FormPreferences.C
--- src/frontends/xforms/FormPreferences.C	5 Sep 2002 15:14:22 -0000	1.136
+++ src/frontends/xforms/FormPreferences.C	3 Oct 2002 16:54:43 -0000
@@ -249,6 +249,13 @@ void FormPreferences::build()
 	fl_addto_tabfolder(lang_opts_tab_->tabfolder_inner,
 			   _("Language"),
 			   language_.dialog()->form);
+
+	// work-around xforms bug re update of folder->x, folder->y coords.
+	setPrehandler(look_n_feel_tab_->tabfolder_inner);
+	setPrehandler(converters_tab_->tabfolder_inner);
+	setPrehandler(inputs_tab_->tabfolder_inner);
+	setPrehandler(outputs_tab_->tabfolder_inner);
+	setPrehandler(lang_opts_tab_->tabfolder_inner);
 }
 
 
Index: src/frontends/xforms/FormTabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormTabular.C,v
retrieving revision 1.57
diff -u -p -r1.57 FormTabular.C
--- src/frontends/xforms/FormTabular.C	6 Sep 2002 13:41:19 -0000	1.57
+++ src/frontends/xforms/FormTabular.C	3 Oct 2002 16:54:43 -0000
@@ -145,6 +145,9 @@ void FormTabular::build()
 	fl_addto_tabfolder(dialog_->tabfolder, _("LongTable"),
 			   longtable_options_->form);
 
+	// work-around xforms bug re update of folder->x, folder->y coords.
+	setPrehandler(dialog_->tabfolder);
+
 	// Create the contents of the unit choices
 	// Don't include the "%" terms...
 	vector<string> units_vec = getLatexUnits();
Index: src/frontends/xforms/forms/form_graphics.fd
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/forms/form_graphics.fd,v
retrieving revision 1.35
diff -u -p -r1.35 form_graphics.fd
--- src/frontends/xforms/forms/form_graphics.fd	13 Sep 2002 01:58:05 -0000	1.35
+++ src/frontends/xforms/forms/form_graphics.fd	3 Oct 2002 16:54:43 -0000
@@ -34,7 +34,7 @@ argument: 
 --------------------
 class: FL_TABFOLDER
 type: TOP_TABFOLDER
-box: 0 5 400 260
+box: 0 10 400 255
 boxtype: FL_FRAME_BOX
 colors: FL_COL1 FL_COL1
 alignment: FL_ALIGN_TOP_LEFT

Reply via email to