Skip to content

Commit

Permalink
Fix: ToolTipHelper doesn't work properly on Linux
Browse files Browse the repository at this point in the history
The pop-up helper reuses the shell that is used to display the tooltip.
When a new tooltip is shown, the (currently invisible) shell is moved
from its old location and then made visible. This doesn't work in GTK
and the shell remains at its old location.

Instead, the shell is disposed when hiding the pop-up and (if necessary)
a new shell is created when it is shown again.

Resolves #531
  • Loading branch information
ptziegler committed Aug 24, 2024
1 parent b1f6f28 commit 6a3c749
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion org.eclipse.draw2d/src/org/eclipse/draw2d/ToolTipHelper.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2011 IBM Corporation and others.
* Copyright (c) 2000, 2024 IBM Corporation and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -120,6 +120,11 @@ public void displayToolTipNear(IFigure hoverSource, IFigure tip, int eventX, int
.getExpanded(getShellTrimSize());
setShellBounds(displayPoint.x, displayPoint.y, shellSize.width, shellSize.height);
show();
// Moving an invisible shell might not be supported by the operating system. Try
// again once it has become visible...
if (!getShell().getLocation().equals(displayPoint)) {
setShellBounds(displayPoint.x, displayPoint.y, shellSize.width, shellSize.height);
}
currentTipSource = hoverSource;
timer = new Timer(true);
timer.schedule(new TimerTask() {
Expand Down

0 comments on commit 6a3c749

Please sign in to comment.