Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1188,9 +1188,7 @@ public void setEnabled (boolean enabled) {
* </ul>
*/
public void setLocation (int x, int y) {
checkWidget ();
int zoom = getZoom();
setLocationInPixels(DPIUtil.scaleUp(x, zoom), DPIUtil.scaleUp(y, zoom));
setLocation(new Point(x, y));
}

void setLocationInPixels (int x, int y) {
Expand Down Expand Up @@ -1227,7 +1225,7 @@ void setLocationInPixels (int x, int y) {
public void setLocation (Point location) {
checkWidget ();
if (location == null) error (SWT.ERROR_NULL_ARGUMENT);
location = DPIUtil.scaleUp(location, getZoom());
location = getDisplay().translateLocationInPixelsInDisplayCoordinateSystem(location.x, location.y);
setLocationInPixels(location.x, location.y);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1651,8 +1651,8 @@ boolean showMenu (int x, int y) {

boolean showMenu (int x, int y, int detail) {
Event event = new Event ();
int zoom = getZoom();
event.setLocation(DPIUtil.scaleDown(x, zoom), DPIUtil.scaleDown(y, zoom));
Point mappedLocation = getDisplay().translateLocationInPointInDisplayCoordinateSystem(x, y);
event.setLocation(mappedLocation.x, mappedLocation.y);
event.detail = detail;
if (event.detail == SWT.MENU_KEYBOARD) {
updateMenuLocation (event);
Expand All @@ -1663,7 +1663,7 @@ boolean showMenu (int x, int y, int detail) {
if (!event.doit) return true;
Menu menu = getMenu ();
if (menu != null && !menu.isDisposed ()) {
Point locInPixels = DPIUtil.scaleUp(event.getLocation(), zoom); // In Pixels
Point locInPixels = DPIUtil.scaleUp(event.getLocation(), getZoom()); // In Pixels
if (x != locInPixels.x || y != locInPixels.y) {
menu.setLocation (event.getLocation());
}
Expand Down
Loading