summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2011-01-25 19:54:09 +0000
committerMatthias Melcher <fltk@matthiasm.com>2011-01-25 19:54:09 +0000
commit7b832a512e9bc39e39802cfc81ac7de7d32017a4 (patch)
treeaddee229f5f20b30bac288ab29c61bc415ace5e7 /src
parentece27e347c12b05feb8aa74ea809120b6f2f2519 (diff)
Added Fl::event_dispatch() which can add a function to FLTK that monitors all events before they reach Fl::handle(). STR 2532
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8314 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx10
-rw-r--r--src/fl_font_mac.cxx2
2 files changed, 10 insertions, 2 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 00ecaf788..06a819cea 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -89,6 +89,8 @@ int Fl::damage_,
char *Fl::e_text = (char *)"";
int Fl::e_length;
+Fl_Event_Dispatch Fl::e_dispatch = 0;
+
unsigned char Fl::options_[] = { 0, 0 };
unsigned char Fl::options_read_ = 0;
@@ -727,7 +729,7 @@ static handler_link *handlers = 0;
them returns non zero then the event is ignored. Events that cause
this to be called are:
- - FL_SHORTCUT events that are not recognized by any widget.
+ - FL_SHORTCUT events that are not recognized by any widget.
This lets you provide global shortcut keys.
- System events that FLTK does not recognize. See fl_xevent.
- \e Some other events when the widget FLTK selected returns
@@ -978,6 +980,12 @@ int Fl::handle(int e, Fl_Window* window)
widget uses the event.
*/
{
+ if (e_dispatch) {
+ int ret = e_dispatch(e, window);
+ if (ret)
+ return ret;
+ }
+
e_number = e;
if (fl_local_grab) return fl_local_grab(e);
diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx
index 222cc6a98..6002bc10a 100644
--- a/src/fl_font_mac.cxx
+++ b/src/fl_font_mac.cxx
@@ -312,7 +312,7 @@ if (fl_mac_os_version >= 0x1050) {
i++; // because a pair of UniChar's represent a single character
continue;
}
- unsigned int r = uni >> 7; // index of the character block containing uni
+ unsigned int r = uni >> 9; // index of the character block containing uni
if (!fl_fontsize->width[r]) { // this character block has not been hit yet
//fprintf(stderr,"r=%d size=%d name=%s\n",r,fl_fontsize->size, fl_fontsize->q_name);
// allocate memory to hold width of each character in the block