diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java index adef5ce49fe..e5810362727 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java @@ -1092,7 +1092,7 @@ public Point getCaretLocation () { PangoRectangle pos = new PangoRectangle (); OS.pango_layout_index_to_pos (layout, index, pos); Point thickness = getThickness (entryHandle); - int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidthInPixels () - thickness.x; + int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidth() - thickness.x; int y = offset_y [0] + OS.PANGO_PIXELS (pos.y) - thickness.y; return new Point (x, y); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java index 2dea4fbc0e3..4abfd8d5db4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DateTime.java @@ -1745,7 +1745,7 @@ public void setBounds(int x, int y, int width, int height) { * Usually called when control is resized or first initialized. */ private void setDropDownButtonSize() { - Rectangle rect = getClientAreaInPixels(); + Rectangle rect = getClientArea(); int parentWidth = rect.width; int parentHeight = rect.height; Point buttonSize = down.computeSize(SWT.DEFAULT, parentHeight); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java index 08e611ebee6..00cdf140bbf 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java @@ -232,15 +232,8 @@ public boolean getExpanded() { */ public int getHeaderHeight () { checkWidget (); - return DPIUtil.autoScaleDown (getHeaderHeightInPixels ()); -} - -int getHeaderHeightInPixels() { - checkWidget(); - GtkAllocation allocation = new GtkAllocation(); GTK.gtk_widget_get_allocation(GTK.gtk_expander_get_label_widget(handle), allocation); - return allocation.height; } @@ -256,7 +249,7 @@ int getHeaderHeightInPixels() { */ public int getHeight() { checkWidget(); - return DPIUtil.autoScaleDown(height); + return height; } /** @@ -506,11 +499,6 @@ void setForegroundRGBA (GdkRGBA rgba) { * */ public void setHeight (int height) { - checkWidget (); - setHeightInPixels(DPIUtil.autoScaleUp(height)); -} - -void setHeightInPixels (int height) { checkWidget (); if (height < 0) return; this.height = height; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java index 7e20a4986a0..9d8ac5f8f59 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java @@ -110,14 +110,14 @@ long clientHandle () { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { - Point size = super.computeSizeInPixels(wHint, hHint, changed); +public Point computeSize(int wHint, int hHint, boolean changed) { + Point size = super.computeSize(wHint, hHint, changed); int width = computeNativeSize (handle, SWT.DEFAULT, SWT.DEFAULT, false).x; size.x = Math.max (size.x, width); return size; } @Override -Rectangle computeTrimInPixels (int x, int y, int width, int height) { +public Rectangle computeTrim(int x, int y, int width, int height) { checkWidget(); forceResize (); GtkAllocation allocation = new GtkAllocation(); @@ -132,8 +132,8 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) { } @Override -Rectangle getClientAreaInPixels () { - Rectangle clientRectangle = super.getClientAreaInPixels (); +public Rectangle getClientArea() { + Rectangle clientRectangle = super.getClientArea(); /* * Bug 453827 Child position fix. * SWT's calls to gtk_widget_size_allocate and gtk_widget_set_allocation diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java index ed2eb59080f..7588d96f0e0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java @@ -139,7 +139,7 @@ Point computeNativeSize (long h, int wHint, int hHint, boolean changed) { } } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -369,7 +369,7 @@ public int getAlignment () { } @Override -int getBorderWidthInPixels () { +public int getBorderWidth() { checkWidget(); if (frameHandle != 0) { return getThickness (frameHandle).x; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java index 099764719a6..700cd57692b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java @@ -18,7 +18,6 @@ import org.eclipse.swt.accessibility.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.internal.gtk3.*; import org.eclipse.swt.internal.gtk4.*; @@ -121,7 +120,7 @@ public void addSelectionListener (SelectionListener listener) { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -130,19 +129,19 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { //TEMPORARY CODE if (wHint == 0) { layout.setWidth (1); - Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); + Rectangle rect = layout.getBounds (); width = 0; height = rect.height; } else { - layout.setWidth (DPIUtil.autoScaleDown(wHint)); - Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds ()); + layout.setWidth(wHint); + Rectangle rect = layout.getBounds (); width = rect.width; height = rect.height; } layout.setWidth (layoutWidth); if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; - int border = getBorderWidthInPixels (); + int border = getBorderWidth(); width += border * 2; height += border * 2; return new Point (width, height); @@ -191,9 +190,9 @@ void drawWidget(GC gc) { if ((state & DISABLED) != 0) gc.setForeground (disabledColor); layout.draw (gc, 0, 0, selStart, selEnd, null, null); if (hasFocus () && focusIndex != -1) { - Rectangle [] rects = getRectanglesInPixels (focusIndex); + Rectangle [] rects = getRectangles(focusIndex); for (int i = 0; i < rects.length; i++) { - Rectangle rect = DPIUtil.autoScaleDown(rects [i]); + Rectangle rect = rects [i]; gc.drawFocus (rect.x, rect.y, rect.width, rect.height); } } @@ -292,7 +291,7 @@ String getNameText () { return getText (); } -Rectangle [] getRectanglesInPixels (int linkIndex) { +Rectangle [] getRectangles(int linkIndex) { int lineCount = layout.getLineCount (); Rectangle [] rects = new Rectangle [lineCount]; int [] lineOffsets = layout.getLineOffsets (); @@ -303,13 +302,13 @@ String getNameText () { while (point.y > lineOffsets [lineEnd]) lineEnd++; int index = 0; if (lineStart == lineEnd) { - rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (point.x, point.y)); + rects [index++] = layout.getBounds (point.x, point.y); } else { - rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (point.x, lineOffsets [lineStart]-1)); - rects [index++] = DPIUtil.autoScaleUp (layout.getBounds (lineOffsets [lineEnd-1], point.y)); + rects [index++] = layout.getBounds (point.x, lineOffsets [lineStart]-1); + rects [index++] = layout.getBounds (lineOffsets [lineEnd-1], point.y); if (lineEnd - lineStart > 1) { for (int i = lineStart; i < lineEnd - 1; i++) { - rects [index++] = DPIUtil.autoScaleUp (layout.getLineBounds (i)); + rects [index++] = layout.getLineBounds (i); } } } @@ -365,7 +364,7 @@ long gtk_button_press_event (long widget, long event) { int x = (int) eventX[0]; int y = (int) eventY[0]; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; - int offset = DPIUtil.autoScaleUp(layout.getOffset (x, y, null)); + int offset = layout.getOffset (x, y, null); int oldSelectionX = selection.x; int oldSelectionY = selection.y; selection.x = offset; @@ -376,11 +375,11 @@ long gtk_button_press_event (long widget, long event) { oldSelectionX = oldSelectionY; oldSelectionY = temp; } - Rectangle rect = DPIUtil.autoScaleUp(layout.getBounds (oldSelectionX, oldSelectionY)); - redrawInPixels (rect.x, rect.y, rect.width, rect.height, false); + Rectangle rect = layout.getBounds (oldSelectionX, oldSelectionY); + redraw(rect.x, rect.y, rect.width, rect.height, false); } for (int j = 0; j < offsets.length; j++) { - Rectangle [] rects = getRectanglesInPixels (j); + Rectangle [] rects = getRectangles(j); for (int i = 0; i < rects.length; i++) { Rectangle rect = rects [i]; if (rect.contains (x, y)) { @@ -419,7 +418,7 @@ long gtk_button_release_event (long widget, long event) { int x = (int) eventX[0]; int y = (int) eventY[0]; if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; - Rectangle [] rects = getRectanglesInPixels (focusIndex); + Rectangle [] rects = getRectangles(focusIndex); for (int i = 0; i < rects.length; i++) { Rectangle rect = rects [i]; if (rect.contains (x, y)) { @@ -544,7 +543,7 @@ long gtk_motion_notify_event (long widget, long event) { if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x; if ((state[0] & GDK.GDK_BUTTON1_MASK) != 0) { int oldSelection = selection.y; - selection.y = DPIUtil.autoScaleUp(layout.getOffset (x, y, null)); + selection.y = layout.getOffset (x, y, null); if (selection.y != oldSelection) { int newSelection = selection.y; if (oldSelection > newSelection) { @@ -553,11 +552,11 @@ long gtk_motion_notify_event (long widget, long event) { newSelection = temp; } Rectangle rect = layout.getBounds (oldSelection, newSelection); - redrawInPixels (rect.x, rect.y, rect.width, rect.height, false); + redraw(rect.x, rect.y, rect.width, rect.height, false); } } else { for (int j = 0; j < offsets.length; j++) { - Rectangle [] rects = getRectanglesInPixels (j); + Rectangle [] rects = getRectangles(j); for (int i = 0; i < rects.length; i++) { Rectangle rect = rects [i]; if (rect.contains (x, y)) { @@ -810,7 +809,7 @@ int parseMnemonics (char[] buffer, int start, int end, StringBuilder result) { int setBounds(int x, int y, int width, int height, boolean move, boolean resize) { int result = super.setBounds (x, y, width,height, move, resize); if ((result & RESIZED) != 0) { - layout.setWidth (DPIUtil.autoScaleDown((width > 0 ? width : -1))); + layout.setWidth(width > 0 ? width : -1); redraw (); } return result; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java index bb1bcf8cb1f..3dea647947a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java @@ -269,7 +269,7 @@ int applyThemeBackground () { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -282,7 +282,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { * based on the number of items in the table */ if (size.y == 0 && hHint == SWT.DEFAULT) { - size.y = getItemCount() * getItemHeightInPixels(); + size.y = getItemCount() * getItemHeight(); } /* @@ -291,7 +291,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { * so need to assign default height */ if (size.y == 0 && hHint == SWT.DEFAULT) size.y = DEFAULT_HEIGHT; - Rectangle trim = computeTrimInPixels (0, 0, size.x, size.y); + Rectangle trim = computeTrim(0, 0, size.x, size.y); size.x = trim.width; size.y = trim.height; return size; @@ -543,12 +543,6 @@ public int getItemCount () { */ public int getItemHeight () { checkWidget(); - return DPIUtil.autoScaleDown(getItemHeightInPixels()); -} - -int getItemHeightInPixels() { - checkWidget(); - final int BASE_ITEM_PADDING = 1; int[] h = new int [1]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java index 22bb51cdb4c..ccc4737a67d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java @@ -1198,11 +1198,6 @@ public void setEnabled(boolean enabled) { */ public void setLocation (int x, int y) { checkWidget (); - setLocation (new Point (x, y)); -} - -void setLocationInPixels (int x, int y) { - checkWidget(); if ((style & (SWT.BAR | SWT.DROP_DOWN)) != 0) return; this.x = x; this.y = y; @@ -1235,13 +1230,8 @@ void setLocationInPixels (int x, int y) { */ public void setLocation (Point location) { checkWidget (); - setLocationInPixels (DPIUtil.autoScaleUp (location)); -} - -void setLocationInPixels (Point location) { - checkWidget(); if (location == null) error (SWT.ERROR_NULL_ARGUMENT); - setLocationInPixels (location.x, location.y); + setLocation(location.x, location.y); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java index 0b131624385..ce057341e56 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java @@ -17,7 +17,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.internal.gtk3.*; import org.eclipse.swt.internal.gtk4.*; @@ -122,13 +121,13 @@ static int checkStyle(int style) { } @Override -Point computeSizeInPixels(int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; - int border = getBorderWidthInPixels(); + int border = getBorderWidth(); int width = border * 2, height = border * 2; if ((style & SWT.HORIZONTAL) != 0) { width += DEFAULT_WIDTH; @@ -191,11 +190,11 @@ void gtk_gesture_press_event(long gesture, int n_press, double x, double y, long Event jEvent = new Event(); jEvent.time = GDK.gdk_event_get_time(event); Rectangle eventRect = new Rectangle(lastX, lastY, width, height); - jEvent.setBounds(DPIUtil.autoScaleDown(eventRect)); + jEvent.setBounds(eventRect); if ((style & SWT.SMOOTH) == 0) { jEvent.detail = SWT.DRAG; } - if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x; + if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x; sendSelectionEvent(SWT.Selection, jEvent, true); if (isDisposed()) return; @@ -241,15 +240,15 @@ void gtk4_motion_event(long controller, double x, double y, long event) { Event jEvent = new Event(); jEvent.time = GDK.gdk_event_get_time(event); Rectangle eventRect = new Rectangle(newX, newY, width, height); - jEvent.setBounds(DPIUtil.autoScaleDown(eventRect)); + jEvent.setBounds(eventRect); if ((style & SWT.SMOOTH) == 0) { jEvent.detail = SWT.DRAG; } - if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x; + if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x; sendSelectionEvent(SWT.Selection, jEvent, true); if (isDisposed()) return; - Rectangle rect = DPIUtil.autoScaleUp(jEvent.getBounds()); + Rectangle rect = jEvent.getBounds(); if (jEvent.doit) { lastX = rect.x; lastY = rect.y; @@ -261,7 +260,7 @@ void gtk4_motion_event(long controller, double x, double y, long event) { * Use lastX instead of rect.x, as lastX takes into account * the event.doit flag. See bug 522140. */ - setBoundsInPixels(lastX, lastY, width, height); + setBounds(lastX, lastY, width, height); } } @@ -307,18 +306,18 @@ boolean gtk4_key_press_event(long controller, int keyval, int keycode, int state Event jEvent = new Event(); jEvent.time = GDK.gdk_event_get_time(event); Rectangle eventRect = new Rectangle(newX, newY, width, height); - jEvent.setBounds(DPIUtil.autoScaleDown(eventRect)); - if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x; + jEvent.setBounds(eventRect); + if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x; sendSelectionEvent(SWT.Selection, jEvent, true); if (isDisposed()) break; if (jEvent.doit) { - Rectangle rect = DPIUtil.autoScaleUp(jEvent.getBounds()); + Rectangle rect = jEvent.getBounds(); lastX = rect.x; lastY = rect.y; if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth() - width - lastX; if ((style & SWT.SMOOTH) != 0) { - setBoundsInPixels(rect.x, rect.y, width, height); + setBounds(rect.x, rect.y, width, height); if (isDisposed()) break; } } @@ -360,22 +359,22 @@ long gtk_button_press_event(long widget, long event) { Event jEvent = new Event(); jEvent.time = GDK.gdk_event_get_time(event); Rectangle eventRect = new Rectangle(lastX, lastY, width, height); - jEvent.setBounds(DPIUtil.autoScaleDown(eventRect)); + jEvent.setBounds(eventRect); if ((style & SWT.SMOOTH) == 0) { jEvent.detail = SWT.DRAG; } - if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x; + if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x; sendSelectionEvent(SWT.Selection, jEvent, true); if (isDisposed()) return 0; if (jEvent.doit) { dragging = true; - Rectangle rect = DPIUtil.autoScaleUp(jEvent.getBounds()); + Rectangle rect = jEvent.getBounds(); lastX = rect.x; lastY = rect.y; if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth() - width - lastX; parent.update(true, (style & SWT.SMOOTH) == 0); if ((style & SWT.SMOOTH) != 0) { - setBoundsInPixels(rect.x, rect.y, width, height); + setBounds(rect.x, rect.y, width, height); // widget could be disposed at this point } } @@ -402,14 +401,14 @@ long gtk_button_release_event(long widget, long event) { Event jEvent = new Event(); jEvent.time = GDK.gdk_event_get_time(event); Rectangle eventRect = new Rectangle(lastX, lastY, width, height); - jEvent.setBounds(DPIUtil.autoScaleDown(eventRect)); - if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - jEvent.x; + jEvent.setBounds(eventRect); + if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = parent.getClientWidth() - width - jEvent.x; sendSelectionEvent(SWT.Selection, jEvent, true); if (isDisposed()) return result; if (jEvent.doit) { if ((style & SWT.SMOOTH) != 0) { - Rectangle rect = DPIUtil.autoScaleUp(jEvent.getBounds()); - setBoundsInPixels(rect.x, rect.y, width, height); + Rectangle rect = jEvent.getBounds(); + setBounds(rect.x, rect.y, width, height); // widget could be disposed at this point } } @@ -497,19 +496,19 @@ long gtk_key_press_event(long widget, long eventPtr) { Event event = new Event(); event.time = GDK.gdk_event_get_time(eventPtr); Rectangle eventRect = new Rectangle(newX, newY, width, height); - event.setBounds(DPIUtil.autoScaleDown(eventRect)); - if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - event.x; + event.setBounds(eventRect); + if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth() - width - event.x; sendSelectionEvent(SWT.Selection, event, true); if (ptrGrabResult == GDK.GDK_GRAB_SUCCESS) gdk_pointer_ungrab(gdkResource, GDK.GDK_CURRENT_TIME); if (isDisposed()) break; if (event.doit) { - Rectangle rect = DPIUtil.autoScaleUp(event.getBounds()); + Rectangle rect = event.getBounds(); lastX = rect.x; lastY = rect.y; if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth() - width - lastX; if ((style & SWT.SMOOTH) != 0) { - setBoundsInPixels(rect.x, rect.y, width, height); + setBounds(rect.x, rect.y, width, height); if (isDisposed()) break; } @@ -519,7 +518,7 @@ long gtk_key_press_event(long widget, long eventPtr) { } else { cursorX += width / 2; } - display.setCursorLocation(parent.toDisplayInPixels(cursorX, cursorY)); + display.setCursorLocation(parent.toDisplay(cursorX, cursorY)); } break; } @@ -586,15 +585,15 @@ long gtk_motion_notify_event(long widget, long eventPtr) { Event event = new Event(); event.time = GDK.gdk_event_get_time(eventPtr); Rectangle eventRect = new Rectangle(newX, newY, width, height); - event.setBounds(DPIUtil.autoScaleDown(eventRect)); + event.setBounds(eventRect); if ((style & SWT.SMOOTH) == 0) { event.detail = SWT.DRAG; } - if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown(parent.getClientWidth() - width) - event.x; + if ((parent.style & SWT.MIRRORED) != 0) event.x = parent.getClientWidth() - width - event.x; sendSelectionEvent(SWT.Selection, event, true); if (isDisposed()) return 0; - Rectangle rect = DPIUtil.autoScaleUp(event.getBounds()); + Rectangle rect = event.getBounds(); if (event.doit) { lastX = rect.x; lastY = rect.y; @@ -606,7 +605,7 @@ long gtk_motion_notify_event(long widget, long eventPtr) { * Use lastX instead of rect.x, as lastX takes into account * the event.doit flag. See bug 522140. */ - setBoundsInPixels(lastX, lastY, width, height); + setBounds(lastX, lastY, width, height); } return result; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java index c65bfd7367e..83df2687181 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scale.java @@ -109,7 +109,7 @@ static int checkStyle (int style) { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java index 1b6747bf801..4a94d9f610c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java @@ -17,7 +17,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.internal.gtk3.*; import org.eclipse.swt.internal.gtk4.*; @@ -289,11 +288,6 @@ public int getSelection () { * */ public Point getSize () { - checkWidget (); - return DPIUtil.autoScaleDown (getSizeInPixels ()); -} - -Point getSizeInPixels () { checkWidget (); if (handle == 0) return new Point (0,0); GtkRequisition requisition = new GtkRequisition (); @@ -333,12 +327,6 @@ public int getThumb () { */ public Rectangle getThumbBounds() { checkWidget(); - return DPIUtil.autoScaleDown(getThumbBoundsInPixels()); -} - -Rectangle getThumbBoundsInPixels() { - checkWidget(); - int[] slider_start = new int[1], slider_end = new int[1]; long rangeHandle = GTK.GTK4 ? GTK4.gtk_widget_get_first_child(handle) : handle; GTK.gtk_range_get_slider_range(rangeHandle, slider_start, slider_end); @@ -402,11 +390,6 @@ Rectangle getThumbBoundsInPixels() { */ public Rectangle getThumbTrackBounds () { checkWidget (); - return DPIUtil.autoScaleDown(getThumbTrackBoundsInPixels()); -} - -Rectangle getThumbTrackBoundsInPixels () { - checkWidget(); int x = 0, y = 0, width, height; /* diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java index 71bc811137c..177359dfc30 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java @@ -16,7 +16,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; -import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.internal.gtk3.*; import org.eclipse.swt.internal.gtk4.*; @@ -115,12 +114,6 @@ long clientHandle () { * @see #getClientArea */ public Rectangle computeTrim (int x, int y, int width, int height) { - checkWidget(); - Rectangle rect = DPIUtil.autoScaleUp(new Rectangle (x, y, width, height)); - return DPIUtil.autoScaleDown(computeTrimInPixels(rect.x, rect.y, rect.width, rect.height)); -} - -Rectangle computeTrimInPixels (int x, int y, int width, int height) { checkWidget(); int border = 0; if (fixedHandle != 0) border += gtk_container_get_border_width_or_margin (fixedHandle); @@ -211,7 +204,7 @@ void destroyScrollBar (ScrollBar bar) { } @Override -int getBorderWidthInPixels () { +public int getBorderWidth() { checkWidget(); int border = 0; if (fixedHandle != 0) border += gtk_container_get_border_width_or_margin (fixedHandle); @@ -245,11 +238,6 @@ int getBorderWidthInPixels () { * @see #computeTrim */ public Rectangle getClientArea () { - checkWidget (); - return DPIUtil.autoScaleDown(getClientAreaInPixels()); -} - -Rectangle getClientAreaInPixels () { checkWidget (); if(RESIZE_ON_GETCLIENTAREA) { forceResize (); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java index b561a37c853..aa7f6635e43 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java @@ -552,7 +552,7 @@ void adjustTrim (int widthHint, int heightHint) { } else { trimStyle = Display.TRIM_NONE; } - Rectangle bounds = getBoundsInPixels(); + Rectangle bounds = getBounds(); int widthAdjustment = display.trimWidths[trimStyle] - trimWidth; int heightAdjustment = display.trimHeights[trimStyle] - trimHeight; if (widthAdjustment == 0 && heightAdjustment == 0) return; @@ -659,11 +659,11 @@ void bringToTop (boolean force) { void center () { if (parent == null) return; - Rectangle rect = getBoundsInPixels (); - Rectangle parentRect = display.mapInPixels (parent, null, parent.getClientAreaInPixels()); + Rectangle rect = getBounds(); + Rectangle parentRect = display.map(parent, null, parent.getClientArea()); int x = Math.max (parentRect.x, parentRect.x + (parentRect.width - rect.width) / 2); int y = Math.max (parentRect.y, parentRect.y + (parentRect.height - rect.height) / 2); - Rectangle monitorRect = DPIUtil.autoScaleUp(parent.getMonitor ().getClientArea()); + Rectangle monitorRect = parent.getMonitor ().getClientArea(); if (x + rect.width > monitorRect.x + monitorRect.width) { x = Math.max (monitorRect.x, monitorRect.x + monitorRect.width - rect.width); } else { @@ -674,7 +674,7 @@ void center () { } else { y = Math.max (y, monitorRect.y); } - setLocationInPixels (x, y); + setLocation(x, y); } @Override @@ -713,9 +713,9 @@ void closeWidget () { } @Override -Rectangle computeTrimInPixels (int x, int y, int width, int height) { +public Rectangle computeTrim(int x, int y, int width, int height) { checkWidget(); - Rectangle trim = super.computeTrimInPixels (x, y, width, height); + Rectangle trim = super.computeTrim(x, y, width, height); int border = 0; if ((style & (SWT.NO_TRIM | SWT.BORDER | SWT.SHELL_TRIM)) == 0 || isCustomResize()) { border = gtk_container_get_border_width_or_margin (shellHandle); @@ -1257,12 +1257,12 @@ public boolean getFullScreen () { } @Override -Point getLocationInPixels () { +public Point getLocation() { checkWidget (); // Bug in GTK: when shell is moved and then hidden, its location does not get updated. // Move it before getting its location. if (!getVisible() && moved) { - setLocationInPixels(oldX, oldY); + setLocation(oldX, oldY); } int [] x = new int [1], y = new int [1]; if (GTK.GTK4) { @@ -1295,11 +1295,6 @@ public boolean getMaximized () { * @since 3.1 */ public Point getMinimumSize () { - checkWidget (); - return DPIUtil.autoScaleDown (getMinimumSizeInPixels ()); -} - -Point getMinimumSizeInPixels () { checkWidget (); int width = Math.max (1, geometry.getMinWidth() + trimWidth ()); int height = Math.max (1, geometry.getMinHeight() + trimHeight ()); @@ -1323,12 +1318,6 @@ Point getMinimumSizeInPixels () { */ public Point getMaximumSize () { checkWidget (); - return DPIUtil.autoScaleDown (getMaximumSizeInPixels ()); -} - -Point getMaximumSizeInPixels () { - checkWidget (); - int width = Math.min (Integer.MAX_VALUE, geometry.getMaxWidth() + trimWidth ()); int height = Math.min (Integer.MAX_VALUE, geometry.getMaxHeight() + trimHeight ()); return new Point (width, height); @@ -1380,7 +1369,7 @@ public boolean getModified () { } @Override -Point getSizeInPixels () { +public Point getSize() { checkWidget (); GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation (vboxHandle, allocation); @@ -2319,7 +2308,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize * anything different from the current bounds. */ if (getMaximized ()) { - Rectangle rect = getBoundsInPixels (); + Rectangle rect = getBounds(); boolean sameOrigin = !move || (rect.x == x && rect.y == y); boolean sameExtent = !resize || (rect.width == width && rect.height == height); if (sameOrigin && sameExtent) return 0; @@ -2434,7 +2423,7 @@ public void setEnabled (boolean enabled) { long parentHandle = shellHandle; GTK.gtk_widget_realize (parentHandle); long window = gtk_widget_get_window (parentHandle); - Rectangle rect = getBoundsInPixels (); + Rectangle rect = getBounds(); GdkWindowAttr attributes = new GdkWindowAttr (); attributes.width = rect.width; attributes.height = rect.height; @@ -2659,11 +2648,6 @@ public void setMinimized (boolean minimized) { * @since 3.1 */ public void setMinimumSize (int width, int height) { - checkWidget (); - setMinimumSize (new Point (width, height)); -} - -void setMinimumSizeInPixels (int width, int height) { checkWidget (); geometry.setMinWidth(Math.max (width, trimWidth ()) - trimWidth ()); geometry.setMinHeight(Math.max (height, trimHeight ()) - trimHeight ()); @@ -2698,14 +2682,9 @@ void setMinimumSizeInPixels (int width, int height) { * @since 3.1 */ public void setMinimumSize (Point size) { - checkWidget (); - setMinimumSizeInPixels (DPIUtil.autoScaleUp (size)); -} - -void setMinimumSizeInPixels (Point size) { checkWidget (); if (size == null) error (SWT.ERROR_NULL_ARGUMENT); - setMinimumSizeInPixels (size.x, size.y); + setMinimumSize(size.x, size.y); } /** @@ -2728,9 +2707,15 @@ void setMinimumSizeInPixels (Point size) { * * @since 3.116 */ -public void setMaximumSize (int width, int height) { +public void setMaximumSize(int width, int height) { checkWidget (); - setMaximumSize (new Point (width, height)); + geometry.setMaxWidth(Math.max (width, trimWidth ()) - trimWidth ()); + geometry.setMaxHeight(Math.max (height, trimHeight ()) - trimHeight ()); + int hint = GDK.GDK_HINT_MAX_SIZE; + if (geometry.getMinWidth() > 0 || geometry.getMinHeight() > 0) { + hint = hint | GDK.GDK_HINT_MIN_SIZE; + } + GTK3.gtk_window_set_geometry_hints (shellHandle, 0, (GdkGeometry) geometry, hint); } /** @@ -2756,25 +2741,9 @@ public void setMaximumSize (int width, int height) { * @since 3.116 */ public void setMaximumSize (Point size) { - checkWidget (); - setMaximumSizeInPixels (DPIUtil.autoScaleUp (size)); -} - -void setMaximumSizeInPixels (Point size) { checkWidget (); if (size == null) error (SWT.ERROR_NULL_ARGUMENT); - setMaximumSizeInPixels (size.x, size.y); -} - -void setMaximumSizeInPixels (int width, int height) { - checkWidget (); - geometry.setMaxWidth(Math.max (width, trimWidth ()) - trimWidth ()); - geometry.setMaxHeight(Math.max (height, trimHeight ()) - trimHeight ()); - int hint = GDK.GDK_HINT_MAX_SIZE; - if (geometry.getMinWidth() > 0 || geometry.getMinHeight() > 0) { - hint = hint | GDK.GDK_HINT_MIN_SIZE; - } - GTK3.gtk_window_set_geometry_hints (shellHandle, 0, (GdkGeometry) geometry, hint); + setMaximumSize(size.x, size.y); } /** @@ -2858,7 +2827,7 @@ static Region mirrorRegion (Region region) { int [] nRects = new int [1]; long [] rects = new long [1]; gdk_region_get_rectangles (rgn, rects, nRects); - Rectangle bounds = DPIUtil.autoScaleUp(region.getBounds ()); + Rectangle bounds = region.getBounds (); cairo_rectangle_int_t rect = new cairo_rectangle_int_t(); for (int i = 0; i < nRects [0]; i++) { Cairo.memmove (rect, rects[0] + (i * GdkRectangle.sizeof), GdkRectangle.sizeof); @@ -2900,7 +2869,7 @@ public void setVisible (boolean visible) { checkWidget(); if (moved) { //fix shell location if it was moved. - setLocationInPixels(oldX, oldY); + setLocation(oldX, oldY); } int mask = SWT.PRIMARY_MODAL | SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL; if ((style & mask) != 0) { @@ -3013,7 +2982,7 @@ public void setVisible (boolean visible) { opened = true; if (!moved) { moved = true; - Point location = getLocationInPixels(); + Point location = getLocation(); oldX = location.x; oldY = location.y; sendEvent (SWT.Move); @@ -3021,7 +2990,7 @@ public void setVisible (boolean visible) { } if (!resized) { resized = true; - Point size = getSizeInPixels (); + Point size = getSize(); oldWidth = size.x - trimWidth (); oldHeight = size.y - trimHeight (); sendEvent (SWT.Resize); @@ -3379,7 +3348,7 @@ public void forceActive () { } @Override -Rectangle getBoundsInPixels () { +public Rectangle getBounds() { checkWidget (); int [] x = new int [1], y = new int [1]; if ((state & Widget.DISPOSE_SENT) == 0) { @@ -3464,7 +3433,7 @@ Point getWindowOrigin () { * window trims etc. from the window manager. That's why getLocation () * is not safe to use for coordinate mappings after the shell has been made visible. */ - return getLocationInPixels (); + return getLocation(); } return super.getWindowOrigin( ); } @@ -3472,7 +3441,7 @@ Point getWindowOrigin () { @Override Point getSurfaceOrigin () { if (!mapped) { - return getLocationInPixels (); + return getLocation(); } return super.getSurfaceOrigin( ); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java index 869f1656c76..b09d20cde0a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java @@ -291,7 +291,7 @@ void deregister() { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget(); GTK.gtk_widget_realize(handle); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java index 0bea1a4c29f..f1a10283fdb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java @@ -200,7 +200,7 @@ protected void checkSubclass () { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -211,7 +211,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { GTK.gtk_widget_get_preferred_size(handle, requisition, null); int width = wHint == SWT.DEFAULT ? requisition.width : Math.max(wHint, requisition.width); int height = hHint == SWT.DEFAULT ? requisition.height : hHint; - Rectangle trim = computeTrimInPixels(0, 0, width, height); + Rectangle trim = computeTrim(0, 0, width, height); return new Point(trim.width, trim.height); } else { GTK.gtk_widget_realize (handle); @@ -247,16 +247,16 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { width = wHint == SWT.DEFAULT ? requisition.width : Math.max(wHint, requisition.width); height = hHint == SWT.DEFAULT ? requisition.height : hHint; OS.pango_layout_set_text (layout, buffer2, buffer2.length); - Rectangle trim = computeTrimInPixels (0, 0, width, height); + Rectangle trim = computeTrim(0, 0, width, height); return new Point (trim.width, trim.height); } } @Override -Rectangle computeTrimInPixels (int x, int y, int width, int height) { +public Rectangle computeTrim(int x, int y, int width, int height) { checkWidget (); int xborder = 0, yborder = 0; - Rectangle trim = super.computeTrimInPixels (x, y, width, height); + Rectangle trim = super.computeTrim(x, y, width, height); GtkBorder tmp = new GtkBorder(); long context = GTK.gtk_widget_get_style_context (handle); int state_flag = GTK.gtk_widget_get_state_flags(handle); @@ -429,7 +429,7 @@ void fixIM () { } @Override -int getBorderWidthInPixels () { +public int getBorderWidth() { checkWidget(); if ((this.style & SWT.BORDER) != 0) { return getThickness (handle).x; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java index e3f7631a40c..24775f6749f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabFolder.java @@ -171,9 +171,9 @@ long clientHandle () { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); - Point size = super.computeSizeInPixels (wHint, hHint, changed); + Point size = super.computeSize(wHint, hHint, changed); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; boolean scrollable = GTK.gtk_notebook_get_scrollable (handle); @@ -188,7 +188,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { } @Override -Rectangle computeTrimInPixels (int x, int y, int width, int height) { +public Rectangle computeTrim(int x, int y, int width, int height) { checkWidget(); forceResize (); long clientHandle = clientHandle (); @@ -211,8 +211,8 @@ Rectangle computeTrimInPixels (int x, int y, int width, int height) { } @Override -Rectangle getClientAreaInPixels () { - Rectangle clientRectangle = super.getClientAreaInPixels (); +public Rectangle getClientArea() { + Rectangle clientRectangle = super.getClientArea(); /* * Bug 454936 (see also other 454936 references) @@ -356,7 +356,7 @@ void destroyItem (TabItem item) { if (newIndex != -1) { Control control = items [newIndex].getControl (); if (control != null && !control.isDisposed ()) { - control.setBoundsInPixels (getClientAreaInPixels()); + control.setBounds(getClientArea()); control.setVisible (true); } Event event = new Event (); @@ -589,7 +589,7 @@ long gtk_switch_page(long notebook, long page, int page_num) { if (GTK.GTK4) { Control control = item.getControl(); - control.setBoundsInPixels(getClientAreaInPixels()); + control.setBounds(getClientArea()); } else { int index = GTK.gtk_notebook_get_current_page(handle); if (index != -1) { @@ -603,7 +603,7 @@ long gtk_switch_page(long notebook, long page, int page_num) { Control control = item.getControl(); if (control != null && !control.isDisposed()) { - control.setBoundsInPixels(getClientAreaInPixels()); + control.setBounds(getClientArea()); control.setVisible(true); } } @@ -666,7 +666,7 @@ Point minimumSize (int wHint, int hHint, boolean flushCache) { index++; } if (index == count) { - Rectangle rect = DPIUtil.autoScaleUp(child.getBounds ()); + Rectangle rect = child.getBounds (); width = Math.max (width, rect.x + rect.width); height = Math.max (height, rect.y + rect.height); } else { @@ -674,7 +674,7 @@ Point minimumSize (int wHint, int hHint, boolean flushCache) { * Since computeSize can be overridden by subclasses, we cannot * call computeSizeInPixels directly. */ - Point size = DPIUtil.autoScaleUp(child.computeSize (DPIUtil.autoScaleDown(wHint), DPIUtil.autoScaleDown(hHint), flushCache)); + Point size = child.computeSize(wHint, hHint, flushCache); width = Math.max (width, size.x); height = Math.max (height, size.y); } @@ -793,7 +793,7 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize TabItem item = items [index]; Control control = item.control; if (control != null && !control.isDisposed ()) { - control.setBoundsInPixels (getClientAreaInPixels ()); + control.setBounds(getClientArea()); } } } @@ -870,7 +870,7 @@ void setSelection (int index, boolean notify) { TabItem item = items [newIndex]; Control control = item.control; if (control != null && !control.isDisposed ()) { - control.setBoundsInPixels (getClientAreaInPixels ()); + control.setBounds(getClientArea()); control.setVisible (true); } if (notify) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java index 64479c09e02..dc0be9a15b1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java @@ -160,11 +160,6 @@ void destroyWidget () { */ public Rectangle getBounds () { checkWidget (); - return DPIUtil.autoScaleDown (getBoundsInPixels ()); -} - -Rectangle getBoundsInPixels () { - checkWidget(); GtkAllocation allocation = new GtkAllocation (); GTK.gtk_widget_get_allocation (handle, allocation); int x = allocation.x; @@ -339,7 +334,7 @@ public void setControl(Control control) { } } if (newControl != null) { - newControl.setBoundsInPixels (parent.getClientAreaInPixels ()); + newControl.setBounds(parent.getClientArea()); newControl.setVisible (true); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java index d2d99021f65..2cac637c079 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java @@ -488,7 +488,7 @@ public void clearAll () { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -521,7 +521,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { if (wHint == SWT.DEFAULT && size.x == 0 && columnCount == 0) { size.x = maxWidth; } - Rectangle trim = computeTrimInPixels (0, 0, size.x, size.y); + Rectangle trim = computeTrim(0, 0, size.x, size.y); size.x = trim.width; /* * Feature in GTK: sometimes GtkScrolledWindow's with no scrollbars @@ -1157,7 +1157,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean long [] path = new long [1]; if (GTK.gtk_gesture_drag_get_start_point(dragGesture, startX, startY)) { if (getHeaderVisible()) { - startY[0]-= getHeaderHeightInPixels(); + startY[0]-= getHeaderHeight(); } if (GTK.gtk_tree_view_get_path_at_pos (handle, (int) startX[0], (int) startY[0], path, null, null, null)) { if (path [0] != 0) { @@ -1185,7 +1185,7 @@ long eventSurface () { } @Override -Rectangle getClientAreaInPixels() { +public Rectangle getClientArea() { checkWidget(); if(RESIZE_ON_GETCLIENTAREA) { forceResize(); @@ -1434,11 +1434,6 @@ TableItem getFocusItem () { */ public int getGridLineWidth () { checkWidget (); - return DPIUtil.autoScaleDown (getGridLineWidthInPixels ()); -} - -int getGridLineWidthInPixels () { - checkWidget(); return 0; } @@ -1488,11 +1483,6 @@ public Color getHeaderForeground () { */ public int getHeaderHeight () { checkWidget (); - return DPIUtil.autoScaleDown (getHeaderHeightInPixels ()); -} - -int getHeaderHeightInPixels () { - checkWidget(); if (!GTK.gtk_tree_view_get_headers_visible(handle)) return 0; int height = 0; @@ -1598,11 +1588,6 @@ public TableItem getItem (int index) { * */ public TableItem getItem (Point point) { - checkWidget(); - return getItemInPixels(DPIUtil.autoScaleUp(point)); -} - -TableItem getItemInPixels (Point point) { checkWidget(); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); long [] path = new long [1]; @@ -1657,11 +1642,6 @@ public int getItemCount () { */ public int getItemHeight () { checkWidget (); - return DPIUtil.autoScaleDown (getItemHeightInPixels ()); -} - -int getItemHeightInPixels () { - checkWidget(); int height = 0; if (itemCount == 0) { @@ -2879,11 +2859,7 @@ void sendMeasureEvent (long cell, long width, long height) { int imageWidth = 0; if (image != null) { Rectangle bounds; - if (DPIUtil.useCairoAutoScale()) { - bounds = image.getBounds (); - } else { - bounds = image.getBoundsInPixels(); - } + bounds = image.getBounds(); imageWidth = bounds.width; } contentWidth [0] += imageWidth; @@ -2894,11 +2870,11 @@ void sendMeasureEvent (long cell, long width, long height) { event.index = columnIndex; event.gc = gc; Rectangle eventRect = new Rectangle (0, 0, contentWidth [0], contentHeight [0]); - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); if (isSelected) event.detail = SWT.SELECTED; sendEvent (SWT.MeasureItem, event); gc.dispose (); - Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); + Rectangle rect = event.getBounds(); contentWidth [0] = rect.width - imageWidth; if (contentHeight [0] < rect.height) contentHeight [0] = rect.height; if (width != 0) C.memmove (width, contentWidth, 4); @@ -3048,13 +3024,11 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr if (cr != 0) { GdkRectangle r = new GdkRectangle(); GDK.gdk_cairo_get_clip_rectangle(cr, r); - Rectangle rect2 = DPIUtil.autoScaleDown(rect); // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 - gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + gc.setClipping(rect.x, r.y, r.width, r.height); } else { - Rectangle rect2 = DPIUtil.autoScaleDown(rect); // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 - gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + gc.setClipping(rect.x, rect.y, rect.width, rect.height); } @@ -3072,7 +3046,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr event.index = columnIndex; event.gc = gc; event.detail = drawState; - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); sendEvent (SWT.EraseItem, event); } finally { Cairo.cairo_translate (cr, 0, y_offset); @@ -3106,7 +3080,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr if ((drawState & SWT.BACKGROUND) != 0 && (drawState & SWT.SELECTED) == 0) { GC gc = getGC(cr); gc.setBackground (item.getBackground (columnIndex)); - gc.fillRectangle (DPIUtil.autoScaleDown (rendererRect.toRectangle ())); + gc.fillRectangle(rendererRect.toRectangle()); gc.dispose (); } if ((drawState & SWT.FOREGROUND) != 0 || GTK.GTK_IS_CELL_RENDERER_TOGGLE (cell)) { @@ -3142,11 +3116,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr int imageWidth = 0; if (image != null) { Rectangle bounds; - if (DPIUtil.useCairoAutoScale()) { - bounds = image.getBounds (); - } else { - bounds = image.getBoundsInPixels (); - } + bounds = image.getBounds(); imageWidth = bounds.width; } contentX [0] -= imageWidth; @@ -3176,9 +3146,8 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr gc.setFont (item.getFont (columnIndex)); if ((style & SWT.MIRRORED) != 0) rect.x = getClientWidth () - rect.width - rect.x; - Rectangle rect2 = DPIUtil.autoScaleDown(rect); // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 - gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + gc.setClipping(rect.x, rect.y, rect.width, rect.height); // SWT.PaintItem/SWT.EraseItem often expect that event.y matches // what 'event.item.getBounds()' returns. The workaround is to @@ -3194,7 +3163,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr event.index = columnIndex; event.gc = gc; event.detail = drawState; - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); sendEvent (SWT.PaintItem, event); } finally { Cairo.cairo_translate (cr, 0, y_offset); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java index d44c0037a3b..5a73a58fddc 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java @@ -319,11 +319,6 @@ public String getToolTipText () { */ public int getWidth () { checkWidget (); - return DPIUtil.autoScaleDown(getWidthInPixels()); -} - -int getWidthInPixels () { - checkWidget(); if (!GTK.gtk_tree_view_column_get_visible (handle)) { return 0; } @@ -507,7 +502,7 @@ public void pack () { } OS.g_free (iter); } - setWidthInPixels(width); + setWidth(width); } @Override @@ -760,11 +755,6 @@ public void setToolTipText(String string) { */ public void setWidth (int width) { checkWidget (); - setWidthInPixels (DPIUtil.autoScaleUp (width)); -} - -void setWidthInPixels (int width) { - checkWidget(); if (width < 0) return; if (width == lastWidth) return; if (width > 0) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java index 92af154acff..be72fb30440 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableItem.java @@ -288,26 +288,6 @@ public Color getBackground () { * @since 3.2 */ public Rectangle getBounds () { - return DPIUtil.autoScaleDown (getBoundsinPixels ()); -} - -/** - * Returns a rectangle describing the size and location of the receiver's - * text relative to its parent. - * - * @return the bounding rectangle of the receiver's text - * - * @exception SWTException - * - * @since 3.105 - */ -Rectangle getBoundsinPixels () { - // TODO fully test on early and later versions of GTK - // shifted a bit too far right on later versions of GTK - however, old Tree also had this problem - checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); long parentHandle = parent.handle; long column = GTK.gtk_tree_view_get_column (parentHandle, 0); @@ -394,11 +374,6 @@ public Color getBackground (int index) { */ public Rectangle getBounds (int index) { checkWidget (); - return DPIUtil.autoScaleDown (getBoundsInPixels (index)); -} - -Rectangle getBoundsInPixels (int index) { - checkWidget(); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); long parentHandle = parent.handle; long column = 0; @@ -601,11 +576,6 @@ public Image getImage (int index) { * */ public Rectangle getImageBounds (int index) { - checkWidget (); - return DPIUtil.autoScaleDown (getImageBoundsInPixels (index)); -} - -Rectangle getImageBoundsInPixels (int index) { checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); long parentHandle = parent.handle; @@ -742,11 +712,6 @@ public String getText (int index) { * @since 3.3 */ public Rectangle getTextBounds (int index) { - checkWidget (); - return DPIUtil.autoScaleDown (getTextBoundsInPixels (index)); -} - -Rectangle getTextBoundsInPixels (int index) { checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); @@ -807,12 +772,7 @@ Rectangle getTextBoundsInPixels (int index) { Image image = _getImage(index); int imageWidth = 0; if (image != null) { - if (DPIUtil.useCairoAutoScale()) { - imageWidth = image.getBounds ().width; - } else { - imageWidth = image.getBoundsInPixels ().width; - } - + imageWidth = image.getBounds().width; } if (x [0] < imageWidth) { rect.x += imageWidth; @@ -1212,13 +1172,8 @@ public void setImage(int index, Image image) { if (!parent.pixbufSizeSet) { if (image != null) { int iWidth, iHeight; - if (DPIUtil.useCairoAutoScale()) { - iWidth = image.getBounds ().width; - iHeight = image.getBounds ().height; - } else { - iWidth = image.getBoundsInPixels ().width; - iHeight = image.getBoundsInPixels ().height; - } + iWidth = image.getBounds().width; + iHeight = image.getBounds().height; if (iWidth > currentWidth [0] || iHeight > currentHeight [0]) { GTK.gtk_cell_renderer_set_fixed_size (pixbufRenderer, iWidth, iHeight); parent.pixbufHeight = iHeight; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java index a5470f9e08d..a9674a487c2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java @@ -622,7 +622,7 @@ public void clearSelection () { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -669,14 +669,14 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { if (height == 0) height = DEFAULT_HEIGHT; width = wHint == SWT.DEFAULT ? width : wHint; height = hHint == SWT.DEFAULT ? height : hHint; - Rectangle trim = computeTrimInPixels (0, 0, width, height); + Rectangle trim = computeTrim(0, 0, width, height); return new Point (trim.width, trim.height); } @Override -Rectangle computeTrimInPixels (int x, int y, int width, int height) { +public Rectangle computeTrim(int x, int y, int width, int height) { checkWidget (); - Rectangle trim = super.computeTrimInPixels (x, y, width, height); + Rectangle trim = super.computeTrim(x, y, width, height); int xborder = 0, yborder = 0; if ((style & SWT.SINGLE) != 0) { GtkBorder tmp = new GtkBorder(); @@ -905,9 +905,9 @@ void fixIM () { } @Override -int getBorderWidthInPixels () { +public int getBorderWidth() { checkWidget(); - if ((style & SWT.MULTI) != 0) return super.getBorderWidthInPixels (); + if ((style & SWT.MULTI) != 0) return super.getBorderWidth(); if ((this.style & SWT.BORDER) != 0) { return getThickness (handle).x; } @@ -948,11 +948,6 @@ public int getCaretLineNumber () { * */ public Point getCaretLocation () { - checkWidget (); - return DPIUtil.autoScaleDown(getCaretLocationInPixels()); -} - -Point getCaretLocationInPixels () { checkWidget (); if ((style & SWT.SINGLE) != 0) { int index = GTK.gtk_editable_get_position (handle); @@ -962,7 +957,7 @@ Point getCaretLocationInPixels () { long layout = GTK3.gtk_entry_get_layout (handle); PangoRectangle pos = new PangoRectangle (); OS.pango_layout_index_to_pos (layout, index, pos); - int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidthInPixels (); + int x = offset_x [0] + OS.PANGO_PIXELS (pos.x) - getBorderWidth(); int y = offset_y [0] + OS.PANGO_PIXELS (pos.y); return new Point (x, y); } else { @@ -1532,11 +1527,6 @@ public int getTopIndex () { * */ public int getTopPixel () { - checkWidget (); - return DPIUtil.autoScaleDown(getTopPixelInPixels()); -} - -int getTopPixelInPixels () { checkWidget (); if ((style & SWT.SINGLE) != 0) return 0; byte [] position = new byte [ITER_SIZEOF]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java index be019ea0d78..2515754e8e7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java @@ -172,7 +172,7 @@ int applyThemeBackground () { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -302,15 +302,10 @@ public ToolItem getItem (int index) { */ public ToolItem getItem (Point point) { checkWidget(); - return getItemInPixels(DPIUtil.autoScaleUp(point)); -} - - -ToolItem getItemInPixels (Point point) { if (point == null) error (SWT.ERROR_NULL_ARGUMENT); ToolItem[] items = getItems(); for (int i=0; i */ public void setLocation (int x, int y) { - checkWidget (); - setLocation (new Point (x, y)); -} - -void setLocationInPixels (int x, int y) { checkWidget (); this.x = x; this.y = y; @@ -745,14 +740,9 @@ void setLocationInPixels (int x, int y) { * */ public void setLocation (Point location) { - checkWidget (); - setLocationInPixels(DPIUtil.autoScaleUp(location)); -} - -void setLocationInPixels (Point location) { checkWidget (); if (location == null) error (SWT.ERROR_NULL_ARGUMENT); - setLocationInPixels (location.x, location.y); + setLocation(location.x, location.y); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java index 42723c9f4c7..da673edf244 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java @@ -200,7 +200,7 @@ Point adjustMoveCursor () { int newX = bounds.x + bounds.width / 2; int newY = bounds.y; - Point point = display.mapInPixels(parent, null, newX, newY); + Point point = display.map(parent, null, newX, newY); display.setCursorLocation(point); int[] actualX = new int[1], actualY = new int[1], state = new int[1]; @@ -237,7 +237,7 @@ Point adjustResizeCursor () { newY = bounds.y + bounds.height / 2; } - Point point = display.mapInPixels (parent, null, newX, newY); + Point point = display.map(parent, null, newX, newY); display.setCursorLocation (point); /* @@ -368,7 +368,7 @@ void drawRectangles (Rectangle [] rects) { // Ensure we have absolute screen coordinates. (btw, there are no absolute coordinates on Wayland, so Tracker(Display) is probably broken). if (parent != null) { // if Tracker(Display) has absolute coords. Tracker(Composite) has relative. For relative, we need to find absolute. - cachedUnion = display.mapInPixels(parent, null, cachedUnion) ; + cachedUnion = display.map(parent, null, cachedUnion) ; } if (!cachedCombinedDisplayResolution.intersects(cachedUnion)) { @@ -382,7 +382,7 @@ void drawRectangles (Rectangle [] rects) { // Combine Rects into a region. (region is not necessarily a rectangle, E.g it can be 'L' shaped etc..). for (int i = 0; i < rects.length; i++) { // Turn filled rectangles into just the outer lines by drawing one line at a time. - Rectangle r = parent != null ? display.mapInPixels(parent, null, rects[i]) : rects[i]; + Rectangle r = parent != null ? display.map(parent, null, rects[i]) : rects[i]; rect.x = r.x; rect.y = r.y; rect.width = r.width + 1; @@ -436,16 +436,6 @@ void drawRectangles (Rectangle [] rects) { * */ public Rectangle [] getRectangles () { - checkWidget(); - Rectangle [] result = new Rectangle [rectangles.length]; - for (int i = 0; i < rectangles.length; i++) { - Rectangle current = rectangles [i]; - result [i] = DPIUtil.autoScaleDown (new Rectangle (current.x, current.y, current.width, current.height)); - } - return result; -} - -Rectangle [] getRectanglesInPixels () { checkWidget(); Rectangle [] result = new Rectangle [rectangles.length]; for (int i = 0; i < rectangles.length; i++) { @@ -529,9 +519,9 @@ long gtk_key_press_event (long widget, long eventPtr) { } Event event = new Event (); Rectangle eventRect = new Rectangle (oldX + xChange, oldY + yChange, 0, 0); - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); if (parent != null && (parent.style & SWT.MIRRORED) != 0) { - event.x = DPIUtil.autoScaleDown (parent.getClientWidth ()) - event.width - event.x; + event.x = parent.getClientWidth () - event.width - event.x; } if ((style & SWT.RESIZE) != 0) { resizeRectangles (xChange, yChange); @@ -659,11 +649,11 @@ long gtk_mouse (int eventType, long widget, long eventPtr) { Event event = new Event (); if (parent == null) { Rectangle eventRect = new Rectangle (newX [0], newY [0], 0, 0); - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); } else { - Point screenCoord = display.mapInPixels (parent, null, newX [0], newY [0]); + Point screenCoord = display.map(parent, null, newX [0], newY [0]); Rectangle eventRect = new Rectangle (screenCoord.x, screenCoord.y, 0, 0); - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); } if ((style & SWT.RESIZE) != 0) { resizeRectangles (newX [0] - oldX, newY [0] - oldY); @@ -846,7 +836,7 @@ public boolean open () { GDK.gdk_window_set_override_redirect (overlayWindow, true); } setTrackerBackground(true); - Rectangle bounds = display.getBoundsInPixels(); + Rectangle bounds = display.getBounds(); GTK3.gtk_window_move (overlay, bounds.x, bounds.y); GTK3.gtk_window_resize (overlay, bounds.width, bounds.height); GTK.gtk_widget_show (overlay); @@ -1154,16 +1144,6 @@ public void setCursor (Cursor newCursor) { * */ public void setRectangles (Rectangle [] rectangles) { - checkWidget(); - if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT); - int length = rectangles.length; - for (int i = 0; i < length; i++) { - rectangles [i] = DPIUtil.autoScaleUp (rectangles [i]); - } - setRectanglesInPixels (rectangles); -} - -void setRectanglesInPixels (Rectangle [] rectangles) { checkWidget(); if (rectangles == null) error (SWT.ERROR_NULL_ARGUMENT); int length = rectangles.length; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java index 808623da98d..2957265fa80 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java @@ -618,7 +618,7 @@ void clearAll (boolean all, long parentIter) { } @Override -Point computeSizeInPixels (int wHint, int hHint, boolean changed) { +public Point computeSize(int wHint, int hHint, boolean changed) { checkWidget (); if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0; if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0; @@ -645,7 +645,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { * the number of items at the root of the tree. */ if (hHint == SWT.DEFAULT && size.y == getHeaderHeight()) { - int itemHeight = getItemHeightInPixels(); + int itemHeight = getItemHeight(); // Initialize to height of root items & header size.y = getItemCount() * itemHeight + getHeaderHeight(); @@ -657,7 +657,7 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) { } } - Rectangle trim = computeTrimInPixels (0, 0, size.x, size.y); + Rectangle trim = computeTrim(0, 0, size.x, size.y); size.x = trim.width; /* * Feature in GTK: sometimes GtkScrolledWindow's with no scrollbars @@ -1320,7 +1320,7 @@ boolean dragDetect (int x, int y, boolean filter, boolean dragOnTimeout, boolean long [] path = new long [1]; if (GTK.gtk_gesture_drag_get_start_point(dragGesture, startX, startY)) { if (getHeaderVisible()) { - startY[0]-= getHeaderHeightInPixels(); + startY[0]-= getHeaderHeight(); } if (GTK.gtk_tree_view_get_path_at_pos (handle, (int) startX[0], (int) startY[0], path, null, null, null)) { if (path [0] != 0) { @@ -1343,7 +1343,7 @@ long eventWindow () { } @Override -Rectangle getClientAreaInPixels () { +public Rectangle getClientArea() { checkWidget(); if(RESIZE_ON_GETCLIENTAREA) { forceResize(); @@ -1602,11 +1602,6 @@ TreeItem getFocusItem () { */ public int getGridLineWidth () { checkWidget (); - return DPIUtil.autoScaleDown (getGridLineWidthInPixels ()); -} - -int getGridLineWidthInPixels () { - checkWidget(); return 0; } @@ -1656,11 +1651,6 @@ public Color getHeaderForeground () { */ public int getHeaderHeight () { checkWidget (); - return DPIUtil.autoScaleDown (getHeaderHeightInPixels ()); -} - -int getHeaderHeightInPixels () { - checkWidget(); if (!GTK.gtk_tree_view_get_headers_visible(handle)) return 0; int height = 0; @@ -1771,11 +1761,6 @@ public TreeItem getItem (int index) { */ public TreeItem getItem (Point point) { checkWidget(); - return getItemInPixels(DPIUtil.autoScaleUp(point)); -} - -TreeItem getItemInPixels (Point point) { - checkWidget (); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); long [] path = new long [1]; GTK.gtk_widget_realize (handle); @@ -1846,11 +1831,6 @@ public int getItemCount () { */ public int getItemHeight () { checkWidget (); - return DPIUtil.autoScaleDown (getItemHeightInPixels ()); -} - -int getItemHeightInPixels () { - checkWidget(); int height = 0; int itemCount = GTK.gtk_tree_model_iter_n_children(modelHandle, 0); @@ -3078,11 +3058,6 @@ void sendMeasureEvent (long cell, long width, long height) { int imageWidth = 0; if (image != null && !image.isDisposed()) { Rectangle bounds; - if (DPIUtil.useCairoAutoScale()) { - bounds = image.getBounds (); - } else { - bounds = image.getBoundsInPixels (); - } bounds = image.getBounds (); imageWidth = bounds.width; } @@ -3094,7 +3069,7 @@ void sendMeasureEvent (long cell, long width, long height) { event.index = columnIndex; event.gc = gc; Rectangle eventRect = new Rectangle (0, 0, contentWidth [0], contentHeight [0]); - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); long path = GTK.gtk_tree_model_get_path (modelHandle, iter); long selection = GTK.gtk_tree_view_get_selection (handle); if (GTK.gtk_tree_selection_path_is_selected (selection, path)) { @@ -3103,7 +3078,7 @@ void sendMeasureEvent (long cell, long width, long height) { GTK.gtk_tree_path_free (path); sendEvent (SWT.MeasureItem, event); gc.dispose (); - Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ()); + Rectangle rect = event.getBounds(); contentWidth [0] = rect.width - imageWidth; if (contentHeight [0] < rect.height) contentHeight [0] = rect.height; if (width != 0) C.memmove (width, contentWidth, 4); @@ -3253,12 +3228,10 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr if (cr != 0) { // Use the original rectangle, not the Cairo clipping for the y, width, and height values. // See bug 535124. - Rectangle rect2 = DPIUtil.autoScaleDown(rect); - gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + gc.setClipping(rect.x, rect.y, rect.width, rect.height); } else { - Rectangle rect2 = DPIUtil.autoScaleDown(rect); // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 - gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + gc.setClipping(rect.x, rect.y, rect.width, rect.height); } // SWT.PaintItem/SWT.EraseItem often expect that event.y matches @@ -3275,7 +3248,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr event.index = columnIndex; event.gc = gc; event.detail = drawState; - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); sendEvent (SWT.EraseItem, event); } finally { Cairo.cairo_translate (cr, 0, y_offset); @@ -3300,7 +3273,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr if ((drawState & SWT.BACKGROUND) != 0 && (drawState & SWT.SELECTED) == 0) { GC gc = getGC(cr); gc.setBackground (item.getBackground (columnIndex)); - gc.fillRectangle (DPIUtil.autoScaleDown (rendererRect.toRectangle ())); + gc.fillRectangle(rendererRect.toRectangle()); gc.dispose (); } if ((drawState & SWT.FOREGROUND) != 0 || GTK.GTK_IS_CELL_RENDERER_TOGGLE (cell)) { @@ -3336,11 +3309,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr int imageWidth = 0; if (image != null) { Rectangle bounds; - if(DPIUtil.useCairoAutoScale()) { - bounds = image.getBounds (); - } else { - bounds = image.getBoundsInPixels (); - } + bounds = image.getBounds(); imageWidth = bounds.width; } // Account for the image width on GTK3, see bug 535124. @@ -3378,10 +3347,8 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr if ((style & SWT.MIRRORED) != 0) { rect.x = getClientWidth () - rect.width - rect.x; } - - Rectangle rect2 = DPIUtil.autoScaleDown(rect); // Caveat: rect2 is necessary because GC#setClipping(Rectangle) got broken by bug 446075 - gc.setClipping(rect2.x, rect2.y, rect2.width, rect2.height); + gc.setClipping(rect.x, rect.y, rect.width, rect.height); // SWT.PaintItem/SWT.EraseItem often expect that event.y matches // what 'event.item.getBounds()' returns. The workaround is to @@ -3397,7 +3364,7 @@ void rendererRender (long cell, long cr, long snapshot, long widget, long backgr event.index = columnIndex; event.gc = gc; event.detail = drawState; - event.setBounds (DPIUtil.autoScaleDown (eventRect)); + event.setBounds(eventRect); sendEvent (SWT.PaintItem, event); } finally { Cairo.cairo_translate (cr, 0, y_offset); @@ -3478,7 +3445,7 @@ public void setInsertMark (TreeItem item, boolean before) { } if (item.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); if (item.parent != this) return; - Rectangle rect = item.getBoundsInPixels(); + Rectangle rect = item.getBounds(); long [] path = new long [1]; GTK.gtk_widget_realize (handle); if (!GTK.gtk_tree_view_get_path_at_pos(handle, rect.x, rect.y, path, null, null, null)) return; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java index 8c9cab8bb73..022b9b2674c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java @@ -321,11 +321,6 @@ public String getToolTipText () { */ public int getWidth () { checkWidget (); - return DPIUtil.autoScaleDown (getWidthInPixels ()); -} - -int getWidthInPixels () { - checkWidget(); if (!GTK.gtk_tree_view_column_get_visible (handle)) { return 0; } @@ -485,7 +480,7 @@ public void pack () { } OS.g_free (iter); } - setWidthInPixels(width); + setWidth(width); } @Override @@ -734,11 +729,6 @@ public void setToolTipText(String string) { * */ public void setWidth(int width) { - checkWidget(); - setWidthInPixels(DPIUtil.autoScaleUp(width)); -} - -void setWidthInPixels(int width) { checkWidget(); if (width < 0) return; if (width == lastWidth) return; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java index 15ca6fd4ec3..a323af2601d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeItem.java @@ -407,12 +407,6 @@ public Color getBackground (int index) { */ public Rectangle getBounds (int index) { checkWidget (); - return DPIUtil.autoScaleDown (getBoundsInPixels (index)); -} - -Rectangle getBoundsInPixels (int index) { - // TODO fully test on early and later versions of GTK - checkWidget(); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); long parentHandle = parent.handle; long column = 0; @@ -453,11 +447,6 @@ Rectangle getBoundsInPixels (int index) { * */ public Rectangle getBounds () { - checkWidget (); - return DPIUtil.autoScaleDown (getBoundsInPixels ()); -} - -Rectangle getBoundsInPixels () { // TODO fully test on early and later versions of GTK // shifted a bit too far right on later versions of GTK - however, old Tree also had this problem checkWidget (); @@ -693,11 +682,6 @@ public Image getImage (int index) { * @since 3.1 */ public Rectangle getImageBounds (int index) { - checkWidget (); - return DPIUtil.autoScaleDown(getImageBoundsInPixels(index)); -} - -Rectangle getImageBoundsInPixels (int index) { // TODO fully test on early and later versions of GTK checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); @@ -927,11 +911,6 @@ public String getText (int index) { * @since 3.3 */ public Rectangle getTextBounds (int index) { - checkWidget (); - return DPIUtil.autoScaleDown(getTextBoundsInPixels(index)); -} - -Rectangle getTextBoundsInPixels (int index) { checkWidget (); if (!parent.checkData (this)) error (SWT.ERROR_WIDGET_DISPOSED); int count = Math.max (1, parent.getColumnCount ()); @@ -991,11 +970,7 @@ Rectangle getTextBoundsInPixels (int index) { Image image = _getImage(index); int imageWidth = 0; if (image != null) { - if (DPIUtil.useCairoAutoScale()) { - imageWidth = image.getBounds ().width; - } else { - imageWidth = image.getBoundsInPixels ().width; - } + imageWidth = image.getBounds().width; } if (x [0] < imageWidth) { rect.x += imageWidth; @@ -1529,13 +1504,9 @@ public void setImage(int index, Image image) { if (!parent.pixbufSizeSet) { if (image != null) { int iWidth, iHeight; - if (DPIUtil.useCairoAutoScale()) { - iWidth = image.getBounds ().width; - iHeight = image.getBounds ().height; - } else { - iWidth = image.getBoundsInPixels ().width; - iHeight = image.getBoundsInPixels ().height; - } + iWidth = image.getBounds().width; + iHeight = image.getBounds().height; + if (iWidth > currentWidth [0] || iHeight > currentHeight [0]) { GTK.gtk_cell_renderer_set_fixed_size (pixbufRenderer, iWidth, iHeight); parent.pixbufSizeSet = true; diff --git a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF index 0d1e38a2f97..b56e48fbad5 100644 --- a/bundles/org.eclipse.swt/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.swt/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-SymbolicName: org.eclipse.swt; singleton:=true -Bundle-Version: 3.127.0.qualifier +Bundle-Version: 3.128.0.qualifier Bundle-ManifestVersion: 2 Bundle-Localization: plugin DynamicImport-Package: org.eclipse.swt.accessibility2 diff --git a/bundles/org.eclipse.swt/pom.xml b/bundles/org.eclipse.swt/pom.xml index 7575e1f32a3..7ccf4bcc272 100644 --- a/bundles/org.eclipse.swt/pom.xml +++ b/bundles/org.eclipse.swt/pom.xml @@ -21,7 +21,7 @@ org.eclipse.swt org.eclipse.swt - 3.127.0-SNAPSHOT + 3.128.0-SNAPSHOT eclipse-plugin