Browse Source

Fix STR #2462.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7935 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/49/head
Manolo Gouy 15 years ago
parent
commit
17963c0475
  1. 4
      FL/Fl_Tooltip.H
  2. 20
      src/Fl.cxx
  3. 8
      src/Fl_Tooltip.cxx
  4. 12
      src/Fl_cocoa.mm

4
FL/Fl_Tooltip.H

@ -83,6 +83,10 @@ public: @@ -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

20
src/Fl.cxx

@ -1042,8 +1042,24 @@ int Fl::handle(int e, Fl_Window* window) @@ -1042,8 +1042,24 @@ 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));
{ 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);

8
src/Fl_Tooltip.cxx

@ -67,6 +67,14 @@ Fl_Widget* Fl_Tooltip::widget_ = 0; @@ -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;

12
src/Fl_cocoa.mm

@ -614,7 +614,6 @@ static void do_timer(CFRunLoopTimerRef timer, void* data) @@ -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) @@ -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 ) { @@ -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;

Loading…
Cancel
Save