1818import org .eclipse .swt .accessibility .*;
1919import org .eclipse .swt .events .*;
2020import org .eclipse .swt .graphics .*;
21- import org .eclipse .swt .internal .*;
2221import org .eclipse .swt .internal .gtk .*;
2322import org .eclipse .swt .internal .gtk3 .*;
2423import org .eclipse .swt .internal .gtk4 .*;
@@ -121,7 +120,7 @@ public void addSelectionListener (SelectionListener listener) {
121120}
122121
123122@ Override
124- Point computeSizeInPixels (int wHint , int hHint , boolean changed ) {
123+ public Point computeSize (int wHint , int hHint , boolean changed ) {
125124 checkWidget ();
126125 if (wHint != SWT .DEFAULT && wHint < 0 ) wHint = 0 ;
127126 if (hHint != SWT .DEFAULT && hHint < 0 ) hHint = 0 ;
@@ -130,19 +129,19 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
130129 //TEMPORARY CODE
131130 if (wHint == 0 ) {
132131 layout .setWidth (1 );
133- Rectangle rect = DPIUtil . autoScaleUp ( layout .getBounds () );
132+ Rectangle rect = layout .getBounds ();
134133 width = 0 ;
135134 height = rect .height ;
136135 } else {
137- layout .setWidth ( DPIUtil . autoScaleDown ( wHint ) );
138- Rectangle rect = DPIUtil . autoScaleUp ( layout .getBounds () );
136+ layout .setWidth ( wHint );
137+ Rectangle rect = layout .getBounds ();
139138 width = rect .width ;
140139 height = rect .height ;
141140 }
142141 layout .setWidth (layoutWidth );
143142 if (wHint != SWT .DEFAULT ) width = wHint ;
144143 if (hHint != SWT .DEFAULT ) height = hHint ;
145- int border = getBorderWidthInPixels ();
144+ int border = getBorderWidth ();
146145 width += border * 2 ;
147146 height += border * 2 ;
148147 return new Point (width , height );
@@ -191,9 +190,9 @@ void drawWidget(GC gc) {
191190 if ((state & DISABLED ) != 0 ) gc .setForeground (disabledColor );
192191 layout .draw (gc , 0 , 0 , selStart , selEnd , null , null );
193192 if (hasFocus () && focusIndex != -1 ) {
194- Rectangle [] rects = getRectanglesInPixels (focusIndex );
193+ Rectangle [] rects = getRectangles (focusIndex );
195194 for (int i = 0 ; i < rects .length ; i ++) {
196- Rectangle rect = DPIUtil . autoScaleDown ( rects [i ]) ;
195+ Rectangle rect = rects [i ];
197196 gc .drawFocus (rect .x , rect .y , rect .width , rect .height );
198197 }
199198 }
@@ -292,7 +291,7 @@ String getNameText () {
292291 return getText ();
293292}
294293
295- Rectangle [] getRectanglesInPixels (int linkIndex ) {
294+ Rectangle [] getRectangles (int linkIndex ) {
296295 int lineCount = layout .getLineCount ();
297296 Rectangle [] rects = new Rectangle [lineCount ];
298297 int [] lineOffsets = layout .getLineOffsets ();
@@ -303,13 +302,13 @@ String getNameText () {
303302 while (point .y > lineOffsets [lineEnd ]) lineEnd ++;
304303 int index = 0 ;
305304 if (lineStart == lineEnd ) {
306- rects [index ++] = DPIUtil . autoScaleUp ( layout .getBounds (point .x , point .y ) );
305+ rects [index ++] = layout .getBounds (point .x , point .y );
307306 } else {
308- rects [index ++] = DPIUtil . autoScaleUp ( layout .getBounds (point .x , lineOffsets [lineStart ]-1 ) );
309- rects [index ++] = DPIUtil . autoScaleUp ( layout .getBounds (lineOffsets [lineEnd -1 ], point .y ) );
307+ rects [index ++] = layout .getBounds (point .x , lineOffsets [lineStart ]-1 );
308+ rects [index ++] = layout .getBounds (lineOffsets [lineEnd -1 ], point .y );
310309 if (lineEnd - lineStart > 1 ) {
311310 for (int i = lineStart ; i < lineEnd - 1 ; i ++) {
312- rects [index ++] = DPIUtil . autoScaleUp ( layout .getLineBounds (i ) );
311+ rects [index ++] = layout .getLineBounds (i );
313312 }
314313 }
315314 }
@@ -365,7 +364,7 @@ long gtk_button_press_event (long widget, long event) {
365364 int x = (int ) eventX [0 ];
366365 int y = (int ) eventY [0 ];
367366 if ((style & SWT .MIRRORED ) != 0 ) x = getClientWidth () - x ;
368- int offset = DPIUtil . autoScaleUp ( layout .getOffset (x , y , null ) );
367+ int offset = layout .getOffset (x , y , null );
369368 int oldSelectionX = selection .x ;
370369 int oldSelectionY = selection .y ;
371370 selection .x = offset ;
@@ -376,11 +375,11 @@ long gtk_button_press_event (long widget, long event) {
376375 oldSelectionX = oldSelectionY ;
377376 oldSelectionY = temp ;
378377 }
379- Rectangle rect = DPIUtil . autoScaleUp ( layout .getBounds (oldSelectionX , oldSelectionY ) );
380- redrawInPixels (rect .x , rect .y , rect .width , rect .height , false );
378+ Rectangle rect = layout .getBounds (oldSelectionX , oldSelectionY );
379+ redraw (rect .x , rect .y , rect .width , rect .height , false );
381380 }
382381 for (int j = 0 ; j < offsets .length ; j ++) {
383- Rectangle [] rects = getRectanglesInPixels (j );
382+ Rectangle [] rects = getRectangles (j );
384383 for (int i = 0 ; i < rects .length ; i ++) {
385384 Rectangle rect = rects [i ];
386385 if (rect .contains (x , y )) {
@@ -419,7 +418,7 @@ long gtk_button_release_event (long widget, long event) {
419418 int x = (int ) eventX [0 ];
420419 int y = (int ) eventY [0 ];
421420 if ((style & SWT .MIRRORED ) != 0 ) x = getClientWidth () - x ;
422- Rectangle [] rects = getRectanglesInPixels (focusIndex );
421+ Rectangle [] rects = getRectangles (focusIndex );
423422 for (int i = 0 ; i < rects .length ; i ++) {
424423 Rectangle rect = rects [i ];
425424 if (rect .contains (x , y )) {
@@ -544,7 +543,7 @@ long gtk_motion_notify_event (long widget, long event) {
544543 if ((style & SWT .MIRRORED ) != 0 ) x = getClientWidth () - x ;
545544 if ((state [0 ] & GDK .GDK_BUTTON1_MASK ) != 0 ) {
546545 int oldSelection = selection .y ;
547- selection .y = DPIUtil . autoScaleUp ( layout .getOffset (x , y , null ) );
546+ selection .y = layout .getOffset (x , y , null );
548547 if (selection .y != oldSelection ) {
549548 int newSelection = selection .y ;
550549 if (oldSelection > newSelection ) {
@@ -553,11 +552,11 @@ long gtk_motion_notify_event (long widget, long event) {
553552 newSelection = temp ;
554553 }
555554 Rectangle rect = layout .getBounds (oldSelection , newSelection );
556- redrawInPixels (rect .x , rect .y , rect .width , rect .height , false );
555+ redraw (rect .x , rect .y , rect .width , rect .height , false );
557556 }
558557 } else {
559558 for (int j = 0 ; j < offsets .length ; j ++) {
560- Rectangle [] rects = getRectanglesInPixels (j );
559+ Rectangle [] rects = getRectangles (j );
561560 for (int i = 0 ; i < rects .length ; i ++) {
562561 Rectangle rect = rects [i ];
563562 if (rect .contains (x , y )) {
@@ -810,7 +809,7 @@ int parseMnemonics (char[] buffer, int start, int end, StringBuilder result) {
810809int setBounds (int x , int y , int width , int height , boolean move , boolean resize ) {
811810 int result = super .setBounds (x , y , width ,height , move , resize );
812811 if ((result & RESIZED ) != 0 ) {
813- layout .setWidth ( DPIUtil . autoScaleDown (( width > 0 ? width : -1 )) );
812+ layout .setWidth ( width > 0 ? width : -1 );
814813 redraw ();
815814 }
816815 return result ;
0 commit comments