Skip to content
Snippets Groups Projects
Commit b5d1c1c8 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Fix event handling for arrow keys in Opengl_Window (required only for

FLTK >= 1.1)
parent ca96b524
Branches
Tags
No related merge requests found
// $Id: GUI.cpp,v 1.155 2002-02-22 16:44:09 geuzaine Exp $ // $Id: GUI.cpp,v 1.156 2002-02-22 17:40:58 geuzaine Exp $
// To make the interface as visually consistent as possible, please: // To make the interface as visually consistent as possible, please:
// - use the IW, BB, BH, BW and WB values // - use the IW, BB, BH, BW and WB values
...@@ -506,7 +506,19 @@ int GUI::global_shortcuts(int event){ ...@@ -506,7 +506,19 @@ int GUI::global_shortcuts(int event){
show = !show; show = !show;
return 1; return 1;
} }
else if(Fl::test_shortcut(FL_Left)){ else if(arrow_shortcuts()){
return 1;
}
return 0;
}
// Test the arrow shortcuts (this is not in the global_shortcuts)
// since it is used elsewhere (where we want to override widget
// navigation: necessary since FLTK>=1.1)
int GUI::arrow_shortcuts(){
if(Fl::test_shortcut(FL_Left)){
ManualPlay(1,-1); ManualPlay(1,-1);
return 1; return 1;
} }
...@@ -522,8 +534,6 @@ int GUI::global_shortcuts(int event){ ...@@ -522,8 +534,6 @@ int GUI::global_shortcuts(int event){
ManualPlay(0,1); ManualPlay(0,1);
return 1; return 1;
} }
return 0; return 0;
} }
......
...@@ -234,6 +234,7 @@ public: ...@@ -234,6 +234,7 @@ public:
void set_title(char *str); void set_title(char *str);
void add_handler(); void add_handler();
int global_shortcuts(int event); int global_shortcuts(int event);
int arrow_shortcuts();
void reset_visibility(); void reset_visibility();
int selection, try_selection, quit_selection, end_selection; int selection, try_selection, quit_selection, end_selection;
......
// $Id: Opengl_Window.cpp,v 1.19 2001-11-19 14:24:02 geuzaine Exp $ // $Id: Opengl_Window.cpp,v 1.20 2002-02-22 17:40:58 geuzaine Exp $
#include "Gmsh.h" #include "Gmsh.h"
#include "Numeric.h" #include "Numeric.h"
...@@ -114,6 +114,23 @@ int Opengl_Window::handle(int event) { ...@@ -114,6 +114,23 @@ int Opengl_Window::handle(int event) {
switch (event) { switch (event) {
case FL_ENTER :
take_focus(); //force keyboard focus on the Opengl_Window
return 1;
case FL_LEAVE :
case FL_FOCUS :
case FL_UNFOCUS :
return 1;
case FL_SHORTCUT :
case FL_KEYBOARD :
// this overrides the default navigation
if(WID->arrow_shortcuts()){
return 1;
}
return Fl_Gl_Window::handle(event);
case FL_PUSH: case FL_PUSH:
FirstClick = 1; FirstClick = 1;
ibut = Fl::event_button(); ibut = Fl::event_button();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment