summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Tooltip.H4
-rw-r--r--src/Fl.cxx22
-rw-r--r--src/Fl_Tooltip.cxx8
-rw-r--r--src/Fl_cocoa.mm12
4 files changed, 32 insertions, 14 deletions
diff --git a/FL/Fl_Tooltip.H b/FL/Fl_Tooltip.H
index f6f04979c..9b039aee9 100644
--- a/FL/Fl_Tooltip.H
+++ b/FL/Fl_Tooltip.H
@@ -83,6 +83,10 @@ public:
static Fl_Color textcolor() { return textcolor_; }
/** Sets the color of the text in the tooltip. The default is black. */
static void textcolor(Fl_Color c) { textcolor_ = c; }
+#ifdef __APPLE__
+ // the unique tooltip window
+ static Fl_Window* current_window(void);
+#endif
// These should not be public, but Fl_Widget::tooltip() needs them...
// fabien: made it private with only a friend function access
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 6bd2ef80d..902d09b43 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1042,9 +1042,25 @@ int Fl::handle(int e, Fl_Window* window)
}
if (modal() && wi != modal()) wi = 0;
if (grab()) wi = grab();
- {Fl_Widget* pbm = belowmouse();
- int ret = (wi && send(e, wi, window));
- if (pbm != belowmouse()) {
+ { int ret;
+ Fl_Widget* pbm = belowmouse();
+#ifdef __APPLE__
+ if (fl_mac_os_version < 0x1050) {
+ // before 10.5, mouse moved events aren't sent to borderless windows such as tooltips
+ Fl_Window *tooltip = Fl_Tooltip::current_window();
+ int inside = 0;
+ if (tooltip && tooltip->shown() ) { // check if a tooltip window is currently opened
+ // check if mouse is inside the tooltip
+ inside = (Fl::event_x_root() >= tooltip->x() && Fl::event_x_root() < tooltip->x() + tooltip->w() &&
+ Fl::event_y_root() >= tooltip->y() && Fl::event_y_root() < tooltip->y() + tooltip->h() );
+ }
+ // if inside, send event to tooltip window instead of background window
+ if (inside) ret = send(e, tooltip, window);
+ else ret = (wi && send(e, wi, window));
+ } else
+#endif
+ ret = (wi && send(e, wi, window));
+ if (pbm != belowmouse()) {
#ifdef DEBUG
printf("Fl::handle(e=%d, window=%p);\n", e, window);
#endif // DEBUG
diff --git a/src/Fl_Tooltip.cxx b/src/Fl_Tooltip.cxx
index 63d99e51d..4216f39c7 100644
--- a/src/Fl_Tooltip.cxx
+++ b/src/Fl_Tooltip.cxx
@@ -67,6 +67,14 @@ Fl_Widget* Fl_Tooltip::widget_ = 0;
static Fl_TooltipBox *window = 0;
static int Y,H;
+#ifdef __APPLE__
+// returns the unique tooltip window
+Fl_Window *Fl_Tooltip::current_window(void)
+{
+ return (Fl_Window*)window;
+}
+#endif
+
void Fl_TooltipBox::layout() {
fl_font(Fl_Tooltip::font(), Fl_Tooltip::size());
int ww, hh;
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 96f65329f..6d2cf6b5b 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -614,7 +614,6 @@ static void do_timer(CFRunLoopTimerRef timer, void* data)
- (BOOL)windowShouldClose:(FLWindow *)w;
- (BOOL)containsGLsubwindow;
- (void)setContainsGLsubwindow:(BOOL)contains;
-- (BOOL)canBecomeKeyWindow;
@end
@implementation FLWindow
@@ -651,16 +650,6 @@ static void do_timer(CFRunLoopTimerRef timer, void* data)
{
containsGLsubwindow = contains;
}
-- (BOOL)canBecomeKeyWindow
-{
- // before 10.5, the default impl of canBecomeKeyWindow is not OK for tooltip windows
- // we return YES for these windows
- BOOL retval;
- Fl_Window *flw = (Fl_Window*)[self getFl_Window];
- if(fl_mac_os_version < 0x1050 && flw->tooltip_window()) retval = YES;
- else retval = [super canBecomeKeyWindow];
- return retval;
-}
@end
/*
@@ -1666,6 +1655,7 @@ static void q_set_window_title(NSWindow *nsw, const char * name ) {
- (void)mouseDown:(NSEvent *)theEvent;
- (void)rightMouseDown:(NSEvent *)theEvent;
- (void)otherMouseDown:(NSEvent *)theEvent;
+- (void)mouseMoved:(NSEvent *)theEvent;
- (void)mouseDragged:(NSEvent *)theEvent;
- (void)rightMouseDragged:(NSEvent *)theEvent;
- (void)otherMouseDragged:(NSEvent *)theEvent;