Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Tooltip causing app window to unfocus #797

Closed
wyhinton opened this issue Jul 18, 2021 · 5 comments
Closed

[BUG] Tooltip causing app window to unfocus #797

wyhinton opened this issue Jul 18, 2021 · 5 comments

Comments

@wyhinton
Copy link

wyhinton commented Jul 18, 2021

Describe the bug

Tooltip causing app window to "unfocus"

To Reproduce

use fltk::{app::*, group::*, frame::Frame, prelude::*, window::Window};
//fltk = "1.1.1"
fn main() {
    let app = App::default().with_scheme(Scheme::Gleam);
    let mut wind = Window::new(100, 100, 500, 500, "Hello from rust");
    let rows = 12;
    let cols = 14;
    let container= Pack::new(50,100,500,400,None);

    for x in 0..rows{
        let y_pos = x *15;
        let mut container= Pack::new(100,y_pos+100,500,25,None);
        container.end();
        container.set_type(PackType::Horizontal);
        container.set_spacing(5);

        for y in 0..cols{
			let ind = cols*x + y;
            let x_pos = y*15;
            let mut frame = Frame::new(x_pos, y_pos,20 as i32, 20 as i32+20, None);
			frame.set_tooltip(&format!("{}", ind));
            container.add(&frame);
			frame.set_label(&format!("{}", ind))
        }
    }
    container.end();
    wind.end();
    wind.show();

    app.run().unwrap();
}

Expected behavior

Window should stay in focus when tooltip shows.

Screenshots

Notice how the icon for the app "unfocuses" in the toolbar
tooltip_unfocus_issue

I'm guessing this has something to do with the tooltip being a window?

Desktop info

  • Windows 10 x64
@wyhinton wyhinton changed the title [BUG] [BUG] Tooltip causing app window to unfocus Jul 18, 2021
@MoAlyousef
Copy link
Collaborator

Yeah I can repro on windows with the following:

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Pack.H>

int main() {
  Fl_Window win(400, 300, "Window");
  Fl_Pack pack(160, 20, 80, 300);
  pack.spacing(5);
  for (int i = 0; i < 5; i++) {
    auto btn = new Fl_Button(0, 0, 0, 40, "Button");
    btn->tooltip("Button");
  }
  pack.end();
  win.end();
  win.show();
  win.redraw();
  return Fl::run();
}

@wyhinton
Copy link
Author

wyhinton commented Jul 18, 2021

Good to know. I guess we should move this to a C FLTK issue then.

@MoAlyousef
Copy link
Collaborator

I was looking at the fltk source code and it seems to be related to this line:
https://github.com/fltk/fltk/blob/41b1f1f91197b40b243b6a0b38cc36ff3bc824fe/src/Fl_Tooltip.cxx#L304

@Albrecht-S
Copy link

Should be fixed upstream, see fltk/fltk#261 (comment)

@MoAlyousef
Copy link
Collaborator

Hi
I pulled latest master and can confirm it's fixed.

This was referenced Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants