File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -47,9 +47,12 @@ public class MenuItem extends Item {
4747 /* Image margin. */
4848 final static int MARGIN_WIDTH = 1 ;
4949 final static int MARGIN_HEIGHT = 1 ;
50- final static int LEFT_TEXT_MARGIN = 5 ;
51- final static int IMAGE_TEXT_GAP = 3 ;
52- final static int WINDOWS_OVERHEAD = 5 ;
50+ private final static int LEFT_TEXT_MARGIN = 7 ;
51+ private final static int IMAGE_TEXT_GAP = 3 ;
52+ // There is a weird behavior in the Windows API with menus in OWENERDRAW mode that the returned
53+ // value in wmMeasureChild is increased by a fixed value (in points) when wmDrawChild is called
54+ // This static is used to mitigate this increase
55+ private final static int WINDOWS_OVERHEAD = 6 ;
5356 static {
5457 DPIZoomChangeRegistry .registerHandler (MenuItem ::handleDPIChange , MenuItem .class );
5558 }
@@ -1186,7 +1189,7 @@ LRESULT wmDrawChild(long wParam, long lParam) {
11861189 gc .fillRectangle (menuItemArea );
11871190
11881191 int xPositionText = LEFT_TEXT_MARGIN + DPIUtil .scaleDown (x , zoom ) + (this .image != null ? this .image .getBounds ().width + IMAGE_TEXT_GAP : 0 );
1189- int yPositionText = DPIUtil .scaleDown (struct .top , zoom );
1192+ int yPositionText = DPIUtil .scaleDown (struct .top , zoom ) + MARGIN_HEIGHT ;
11901193 gc .drawText (drawnText , xPositionText , yPositionText , flags );
11911194 }
11921195 if (image != null ) {
You can’t perform that action at this time.
0 commit comments