Author: manolo
Date: 2010-12-01 15:12:06 -0800 (Wed, 01 Dec 2010)
New Revision: 7935
Log:
Fix STR #2462.
Modified:
branches/branch-1.3/FL/Fl_Tooltip.H
branches/branch-1.3/src/Fl.cxx
branches/branch-1.3/src/Fl_Tooltip.cxx
branches/branch-1.3/src/Fl_cocoa.mm
Modified: branches/branch-1.3/FL/Fl_Tooltip.H
===================================================================
--- branches/branch-1.3/FL/Fl_Tooltip.H 2010-12-01 18:31:23 UTC (rev 7934)
+++ branches/branch-1.3/FL/Fl_Tooltip.H 2010-12-01 23:12:06 UTC (rev 7935)
@@ -83,6 +83,10 @@
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
Modified: branches/branch-1.3/src/Fl.cxx
===================================================================
--- branches/branch-1.3/src/Fl.cxx 2010-12-01 18:31:23 UTC (rev 7934)
+++ branches/branch-1.3/src/Fl.cxx 2010-12-01 23:12:06 UTC (rev 7935)
@@ -1042,9 +1042,25 @@
}
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
Modified: branches/branch-1.3/src/Fl_Tooltip.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Tooltip.cxx 2010-12-01 18:31:23 UTC (rev
7934)
+++ branches/branch-1.3/src/Fl_Tooltip.cxx 2010-12-01 23:12:06 UTC (rev
7935)
@@ -67,6 +67,14 @@
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;
Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2010-12-01 18:31:23 UTC (rev 7934)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2010-12-01 23:12:06 UTC (rev 7935)
@@ -614,7 +614,6 @@
- (BOOL)windowShouldClose:(FLWindow *)w;
- (BOOL)containsGLsubwindow;
- (void)setContainsGLsubwindow:(BOOL)contains;
-- (BOOL)canBecomeKeyWindow;
@end
@implementation FLWindow
@@ -651,16 +650,6 @@
{
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 @@
- (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;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit