From 02b18cf843d4bb20c311121bd0fc22287f4c8dc4 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 31 Dec 2004 06:01:35 +0000 Subject: [PATCH] Opengl_Window should not take the keyboard focus by force as soon the mouse enters its area (this messes up the processing of other windows shortcuts). Instead, it should only force the focus when it gets a mouse click. This is much nicer. --- Fltk/Colorbar_Window.cpp | 10 ++++++---- Fltk/Opengl_Window.cpp | 15 +++------------ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Fltk/Colorbar_Window.cpp b/Fltk/Colorbar_Window.cpp index 8a57ff1817..7fb87c668f 100644 --- a/Fltk/Colorbar_Window.cpp +++ b/Fltk/Colorbar_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Colorbar_Window.cpp,v 1.46 2004-12-31 04:04:50 geuzaine Exp $ +// $Id: Colorbar_Window.cpp,v 1.47 2004-12-31 06:01:35 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -352,13 +352,15 @@ int Colorbar_Window::handle(int event) switch (event) { + case FL_FOCUS: // accept focus events when asked + case FL_UNFOCUS: + return 1; + case FL_ENTER: - take_focus(); //force keyboard focus on the ColorbarWindow + take_focus(); // force keyboard focus as soon as the mouse enters return 1; case FL_LEAVE: - case FL_FOCUS: - case FL_UNFOCUS: return 1; case FL_SHORTCUT: diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp index de50b4add7..817f192c1e 100644 --- a/Fltk/Opengl_Window.cpp +++ b/Fltk/Opengl_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl_Window.cpp,v 1.43 2004-12-24 03:25:37 geuzaine Exp $ +// $Id: Opengl_Window.cpp,v 1.44 2004-12-31 06:01:35 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -132,16 +132,7 @@ int Opengl_Window::handle(int event) switch (event) { - case FL_ENTER: - take_focus(); //force keyboard focus on the Opengl_Window - return 1; - - case FL_LEAVE: - return 1; - - case FL_FOCUS: - return 1; - + case FL_FOCUS: // accept the focus when I'm asked if I want it case FL_UNFOCUS: return 1; @@ -154,6 +145,7 @@ int Opengl_Window::handle(int event) return Fl_Gl_Window::handle(event); case FL_PUSH: + take_focus(); // force keyboard focus when we click in the window FirstClick = 1; ibut = Fl::event_button(); xpos = Fl::event_x(); @@ -295,7 +287,6 @@ int Opengl_Window::handle(int event) ypos += ymov; return 1; - case FL_MOVE: xmov = Fl::event_x() - xpos; ymov = Fl::event_y() - ypos; -- GitLab