From f19b6ee3e4d30e9c6b121625a68b8fd215583f08 Mon Sep 17 00:00:00 2001 From: Bill Spitzak Date: Fri, 26 Feb 1999 07:07:56 +0000 Subject: [PATCH] Fixed editor demo redraw bug (actually same fix as somebody else made). Highlight is cleared if any other widget makes an X selection. git-svn-id: file:///fltk/svn/fltk/trunk@345 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl.cxx | 6 ++++-- src/Fl_Input_.cxx | 21 +++++++-------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/Fl.cxx b/src/Fl.cxx index 766f0bbc4..f45038c28 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl.cxx,v 1.19 1999/02/22 21:19:19 mike Exp $" +// "$Id: Fl.cxx,v 1.20 1999/02/26 07:07:55 bill Exp $" // // Main event handling code for the Fast Light Tool Kit (FLTK). // @@ -577,6 +577,8 @@ int Fl_Window::handle(int event) { void Fl::selection_owner(Fl_Widget *owner) { if (selection_owner_ && owner != selection_owner_) selection_owner_->handle(FL_SELECTIONCLEAR); + if (focus_ && owner != focus_ && focus_ != selection_owner_) + focus_->handle(FL_SELECTIONCLEAR); // clear non-X-selection highlight selection_owner_ = owner; } @@ -679,5 +681,5 @@ int fl_old_shortcut(const char* s) { } // -// End of "$Id: Fl.cxx,v 1.19 1999/02/22 21:19:19 mike Exp $". +// End of "$Id: Fl.cxx,v 1.20 1999/02/26 07:07:55 bill Exp $". // diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index 828f7ade6..a1899261c 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input_.cxx,v 1.17 1999/02/25 22:34:12 carl Exp $" +// "$Id: Fl_Input_.cxx,v 1.18 1999/02/26 07:07:56 bill Exp $" // // Common input widget routines for the Fast Light Tool Kit (FLTK). // @@ -396,20 +396,13 @@ int Fl_Input_::position(int p, int m) { if (p == position_ && m == mark_) return 0; if (Fl::selection_owner() == this) Fl::selection_owner(0); if (p != m) { - // new position is a selection -// This if doesn't seem to always work. I think that the position should -// should be updated even if the input isn't the focus widget widget or -// pushed(?). This change fixes the redraw bug in the editor demo after -// a find. -// if (Fl::focus()==this || Fl::pushed()==this) { - if (p != position_) minimal_update(position_, p); - if (m != mark_) minimal_update(mark_, m); -// } - } else if (Fl::focus() == this) { + if (p != position_) minimal_update(position_, p); + if (m != mark_) minimal_update(mark_, m); + } else { // new position is a cursor if (position_ == mark_) { // old position was just a cursor - if (!(damage()&FL_DAMAGE_EXPOSE)) { + if (Fl::focus() == this && !(damage()&FL_DAMAGE_EXPOSE)) { minimal_update(position_); erase_cursor_only = 1; } } else { // old position was a selection @@ -625,7 +618,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) { case FL_SELECTIONCLEAR: minimal_update(mark_, position_); - // mark_ = position_; + mark_ = position_; return 1; case FL_PASTE: { @@ -740,5 +733,5 @@ Fl_Input_::~Fl_Input_() { } // -// End of "$Id: Fl_Input_.cxx,v 1.17 1999/02/25 22:34:12 carl Exp $". +// End of "$Id: Fl_Input_.cxx,v 1.18 1999/02/26 07:07:56 bill Exp $". //