This ugly global variable seems to not be needed anymore. The functionality
(as declared in a comment removed in the patch) is nowadays taken care by
the frontends, who only send DRAG events if the PRESS event was inside the
workarea too.

Of course, I might be missing entirely the point ;-)

Tested with qt and xforms, seems to work fine (actually getting rid of it
fixes a bug). Comments?

Regards, Alfredo
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.273
diff -u -p -r1.273 text3.C
--- text3.C	2 Dec 2004 11:32:14 -0000	1.273
+++ text3.C	4 Dec 2004 23:07:54 -0000
@@ -83,10 +83,6 @@ using std::vector;
 
 extern string current_layout;
 
-// the selection possible is needed, that only motion events are
-// used, where the button press event was on the drawing area too
-bool selection_possible = false;
-
 
 namespace {
 
@@ -1084,7 +1080,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 
 	case LFUN_MOUSE_TRIPLE:
 		if (cmd.button() == mouse_button::button1) {
-			selection_possible = true;
 			cursorHome(cur);
 			cur.resetAnchor();
 			cursorEnd(cur);
@@ -1095,7 +1090,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 
 	case LFUN_MOUSE_DOUBLE:
 		if (cmd.button() == mouse_button::button1) {
-			selection_possible = true;
 			selectWord(cur, lyx::WHOLE_WORD_STRICT);
 			bv->haveSelection(cur.selection());
 		}
@@ -1106,7 +1100,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 		// Right click on a footnote flag opens float menu
 		if (cmd.button() == mouse_button::button3) {
 			cur.clearSelection();
-			selection_possible = false;
 			break;
 		}
 
@@ -1120,8 +1113,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 			paste_internally = true;
 		}
 
-		selection_possible = true;
-
 		// Clear the selection
 		cur.clearSelection();
 
@@ -1137,10 +1128,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 		// Set cursor here.
 		bv->cursor() = cur;
 
-		// Don't allow selection after a big jump.
-		//if (bv->fitCursor())
-		//	selection_possible = false;
-
 		// Insert primary selection with middle mouse
 		// if there is a local selection in the current buffer,
 		// insert this
@@ -1149,7 +1136,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 				bv->owner()->dispatch(FuncRequest(LFUN_PASTE));
 			else
 				bv->owner()->dispatch(FuncRequest(LFUN_PASTESELECTION, "paragraph"));
-			selection_possible = false;
 		}
 
 		break;
@@ -1159,14 +1145,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 		// Only use motion with button 1
 		//if (cmd.button() != mouse_button::button1)
 		//	return false;
-		// We want to use only motion events for which
-		// the button press event was on the drawing area too.
-		if (!selection_possible) {
-			lyxerr[Debug::ACTION] << "BufferView::Pimpl::"
-				"dispatch: no selection possible\n";
-			lyxerr << "BufferView::Pimpl::dispatch: no selection possible\n";
-			break;
-		}
 
 		// ignore motions deeper nested than the real anchor
 		LCursor & bvcur = cur.bv().cursor();
@@ -1205,8 +1183,6 @@ void LyXText::dispatch(LCursor & cur, Fu
 	}
 
 	case LFUN_MOUSE_RELEASE: {
-		selection_possible = false;
-
 		if (cmd.button() == mouse_button::button2)
 			break;
 
Index: lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.634
diff -u -p -r1.634 lyxfunc.C
--- lyxfunc.C	2 Dec 2004 11:32:13 -0000	1.634
+++ lyxfunc.C	4 Dec 2004 23:07:55 -0000
@@ -134,7 +134,6 @@ namespace biblio = lyx::biblio;
 
 extern BufferList bufferlist;
 extern LyXServer * lyxserver;
-extern bool selection_possible;
 
 extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
 
@@ -615,7 +614,6 @@ void LyXFunc::dispatch(FuncRequest const
 	// we have not done anything wrong yet.
 	errorstat = false;
 	dispatch_buffer.erase();
-	selection_possible = false;
 
 	bool update = true;
 

Reply via email to