please apply
thanks
john

-- 
"Mathemeticians stand on each other's shoulders while computer scientists
 stand on each other's toes."
        - Richard Hamming
Index: src/BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.198
diff -u -r1.198 BufferView_pimpl.C
--- src/BufferView_pimpl.C      2002/02/04 11:30:24     1.198
+++ src/BufferView_pimpl.C      2002/02/07 01:07:46
@@ -157,6 +157,8 @@
                .connect(slot(this, &BufferView::Pimpl::workAreaKeyPress));
        workarea_.selectionRequested
                .connect(slot(this, &BufferView::Pimpl::selectionRequested)); 
+       workarea_.selectionLost
+               .connect(slot(this, &BufferView::Pimpl::selectionLost));
        
        cursor_timeout.timeout.connect(slot(this,
                                            &BufferView::Pimpl::cursorToggle));
@@ -750,6 +752,15 @@
        if (!sel.empty()) {
                workarea_.putClipboard(sel);
        }
+}
+
+ 
+void BufferView::Pimpl::selectionLost()
+{
+       hideCursor();
+       toggleSelection();
+       bv_->getLyXText()->clearSelection();
+       showCursor(); 
 }
 
  
Index: src/BufferView_pimpl.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.h,v
retrieving revision 1.43
diff -u -r1.43 BufferView_pimpl.h
--- src/BufferView_pimpl.h      2002/01/13 17:28:41     1.43
+++ src/BufferView_pimpl.h      2002/02/07 01:07:46
@@ -80,6 +80,8 @@
        ///
        void selectionRequested();
        ///
+       void selectionLost();
+       ///
        void enterView();
        ///
        void leaveView();
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.549
diff -u -r1.549 ChangeLog
--- src/ChangeLog       2002/02/06 15:12:39     1.549
+++ src/ChangeLog       2002/02/07 01:08:00
@@ -1,3 +1,11 @@
+2002-02-06  John Levon  <[EMAIL PROTECTED]>
+
+       * WorkArea.h:
+       * WorkArea.C:
+       * BufferView_pimpl.h:
+       * BufferView_pimpl.C: clear our selection when X tells us we've lost
+         the X selection.
+ 
 2002-02-06  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
        * lyxfunc.C (getStatus): fix status message for disabled commands. 
Index: src/WorkArea.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/WorkArea.C,v
retrieving revision 1.59
diff -u -r1.59 WorkArea.C
--- src/WorkArea.C      2002/01/21 12:16:56     1.59
+++ src/WorkArea.C      2002/02/07 01:08:03
@@ -577,11 +577,16 @@
 
 void WorkArea::event_cb(XEvent * xev)
 {
-       if (xev->type != SelectionRequest)
-               return;
- 
-       selectionRequested.emit();
-       return;
+       switch (xev->type) {
+               case SelectionRequest:
+                       lyxerr[Debug::GUI] << "X requested selection." << endl;
+                       selectionRequested.emit();
+                       break;
+               case SelectionClear:
+                       lyxerr[Debug::GUI] << "Lost selection." << endl;
+                       selectionLost.emit();
+                       break; 
+       }
 }
 
 
Index: src/WorkArea.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/WorkArea.h,v
retrieving revision 1.28
diff -u -r1.28 WorkArea.h
--- src/WorkArea.h      2002/01/14 12:56:04     1.28
+++ src/WorkArea.h      2002/02/07 01:08:03
@@ -128,6 +128,8 @@
        SigC::Signal3<void, int, int, unsigned int> workAreaTripleClick;
        /// emitted when an X client has requested our selection
        SigC::Signal0<void> selectionRequested;
+       /// emitted when another X client has stolen our selection
+       SigC::Signal0<void> selectionLost;
  
        /// handles SelectionRequest X Event, to fill the clipboard
        void event_cb(XEvent * xev);

Reply via email to