Fix "Wrong tooltip position on Wayland with secondary monitor" (#894)

This commit is contained in:
ManoloFLTK 2024-01-23 10:40:25 +01:00
parent 5cc5a60e09
commit da8d6c8d77
1 changed files with 12 additions and 10 deletions

View File

@ -96,17 +96,19 @@ void Fl_TooltipBox::layout() {
for (Fl_Widget* p = Fl_Tooltip::current(); p; p = p->window()) {
oy += p->y();
}
int scr_x, scr_y, scr_w, scr_h;
Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h);
if (ox+ww > scr_x+scr_w) ox = scr_x+scr_w - ww;
if (ox < scr_x) ox = scr_x;
if (currentTooltipH > 30) {
oy = Fl::event_y_root()+13;
if (oy+hh > scr_y+scr_h) oy -= 23+hh;
} else {
if (oy+hh > scr_y+scr_h) oy -= (4+hh+currentTooltipH);
if (!Fl_Window_Driver::driver(this)->popup_window()) {
int scr_x, scr_y, scr_w, scr_h;
Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h);
if (ox+ww > scr_x+scr_w) ox = scr_x+scr_w - ww;
if (ox < scr_x) ox = scr_x;
if (currentTooltipH > 30) {
oy = Fl::event_y_root()+13;
if (oy+hh > scr_y+scr_h) oy -= 23+hh;
} else {
if (oy+hh > scr_y+scr_h) oy -= (4+hh+currentTooltipH);
}
if (oy < scr_y) oy = scr_y;
}
if (oy < scr_y) oy = scr_y;
resize(ox, oy, ww, hh);
}