Skip to content

Commit

Permalink
Fixed editor demo redraw bug (actually same fix as somebody else made).
Browse files Browse the repository at this point in the history
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
  • Loading branch information
spitzak committed Feb 26, 1999
1 parent bdbc0b8 commit f19b6ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
6 changes: 4 additions & 2 deletions 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).
//
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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 $".
//
21 changes: 7 additions & 14 deletions 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).
//
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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 $".
//

0 comments on commit f19b6ee

Please sign in to comment.