18
18
import org .eclipse .swt .accessibility .*;
19
19
import org .eclipse .swt .events .*;
20
20
import org .eclipse .swt .graphics .*;
21
- import org .eclipse .swt .internal .*;
22
21
import org .eclipse .swt .internal .gtk .*;
23
22
import org .eclipse .swt .internal .gtk3 .*;
24
23
import org .eclipse .swt .internal .gtk4 .*;
@@ -121,7 +120,7 @@ public void addSelectionListener (SelectionListener listener) {
121
120
}
122
121
123
122
@ Override
124
- Point computeSizeInPixels (int wHint , int hHint , boolean changed ) {
123
+ public Point computeSize (int wHint , int hHint , boolean changed ) {
125
124
checkWidget ();
126
125
if (wHint != SWT .DEFAULT && wHint < 0 ) wHint = 0 ;
127
126
if (hHint != SWT .DEFAULT && hHint < 0 ) hHint = 0 ;
@@ -130,19 +129,19 @@ Point computeSizeInPixels (int wHint, int hHint, boolean changed) {
130
129
//TEMPORARY CODE
131
130
if (wHint == 0 ) {
132
131
layout .setWidth (1 );
133
- Rectangle rect = DPIUtil . autoScaleUp ( layout .getBounds () );
132
+ Rectangle rect = layout .getBounds ();
134
133
width = 0 ;
135
134
height = rect .height ;
136
135
} else {
137
- layout .setWidth ( DPIUtil . autoScaleDown ( wHint ) );
138
- Rectangle rect = DPIUtil . autoScaleUp ( layout .getBounds () );
136
+ layout .setWidth ( wHint );
137
+ Rectangle rect = layout .getBounds ();
139
138
width = rect .width ;
140
139
height = rect .height ;
141
140
}
142
141
layout .setWidth (layoutWidth );
143
142
if (wHint != SWT .DEFAULT ) width = wHint ;
144
143
if (hHint != SWT .DEFAULT ) height = hHint ;
145
- int border = getBorderWidthInPixels ();
144
+ int border = getBorderWidth ();
146
145
width += border * 2 ;
147
146
height += border * 2 ;
148
147
return new Point (width , height );
@@ -191,9 +190,9 @@ void drawWidget(GC gc) {
191
190
if ((state & DISABLED ) != 0 ) gc .setForeground (disabledColor );
192
191
layout .draw (gc , 0 , 0 , selStart , selEnd , null , null );
193
192
if (hasFocus () && focusIndex != -1 ) {
194
- Rectangle [] rects = getRectanglesInPixels (focusIndex );
193
+ Rectangle [] rects = getRectangles (focusIndex );
195
194
for (int i = 0 ; i < rects .length ; i ++) {
196
- Rectangle rect = DPIUtil . autoScaleDown ( rects [i ]) ;
195
+ Rectangle rect = rects [i ];
197
196
gc .drawFocus (rect .x , rect .y , rect .width , rect .height );
198
197
}
199
198
}
@@ -292,7 +291,7 @@ String getNameText () {
292
291
return getText ();
293
292
}
294
293
295
- Rectangle [] getRectanglesInPixels (int linkIndex ) {
294
+ Rectangle [] getRectangles (int linkIndex ) {
296
295
int lineCount = layout .getLineCount ();
297
296
Rectangle [] rects = new Rectangle [lineCount ];
298
297
int [] lineOffsets = layout .getLineOffsets ();
@@ -303,13 +302,13 @@ String getNameText () {
303
302
while (point .y > lineOffsets [lineEnd ]) lineEnd ++;
304
303
int index = 0 ;
305
304
if (lineStart == lineEnd ) {
306
- rects [index ++] = DPIUtil . autoScaleUp ( layout .getBounds (point .x , point .y ) );
305
+ rects [index ++] = layout .getBounds (point .x , point .y );
307
306
} 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 );
310
309
if (lineEnd - lineStart > 1 ) {
311
310
for (int i = lineStart ; i < lineEnd - 1 ; i ++) {
312
- rects [index ++] = DPIUtil . autoScaleUp ( layout .getLineBounds (i ) );
311
+ rects [index ++] = layout .getLineBounds (i );
313
312
}
314
313
}
315
314
}
@@ -365,7 +364,7 @@ long gtk_button_press_event (long widget, long event) {
365
364
int x = (int ) eventX [0 ];
366
365
int y = (int ) eventY [0 ];
367
366
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 );
369
368
int oldSelectionX = selection .x ;
370
369
int oldSelectionY = selection .y ;
371
370
selection .x = offset ;
@@ -376,11 +375,11 @@ long gtk_button_press_event (long widget, long event) {
376
375
oldSelectionX = oldSelectionY ;
377
376
oldSelectionY = temp ;
378
377
}
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 );
381
380
}
382
381
for (int j = 0 ; j < offsets .length ; j ++) {
383
- Rectangle [] rects = getRectanglesInPixels (j );
382
+ Rectangle [] rects = getRectangles (j );
384
383
for (int i = 0 ; i < rects .length ; i ++) {
385
384
Rectangle rect = rects [i ];
386
385
if (rect .contains (x , y )) {
@@ -419,7 +418,7 @@ long gtk_button_release_event (long widget, long event) {
419
418
int x = (int ) eventX [0 ];
420
419
int y = (int ) eventY [0 ];
421
420
if ((style & SWT .MIRRORED ) != 0 ) x = getClientWidth () - x ;
422
- Rectangle [] rects = getRectanglesInPixels (focusIndex );
421
+ Rectangle [] rects = getRectangles (focusIndex );
423
422
for (int i = 0 ; i < rects .length ; i ++) {
424
423
Rectangle rect = rects [i ];
425
424
if (rect .contains (x , y )) {
@@ -544,7 +543,7 @@ long gtk_motion_notify_event (long widget, long event) {
544
543
if ((style & SWT .MIRRORED ) != 0 ) x = getClientWidth () - x ;
545
544
if ((state [0 ] & GDK .GDK_BUTTON1_MASK ) != 0 ) {
546
545
int oldSelection = selection .y ;
547
- selection .y = DPIUtil . autoScaleUp ( layout .getOffset (x , y , null ) );
546
+ selection .y = layout .getOffset (x , y , null );
548
547
if (selection .y != oldSelection ) {
549
548
int newSelection = selection .y ;
550
549
if (oldSelection > newSelection ) {
@@ -553,11 +552,11 @@ long gtk_motion_notify_event (long widget, long event) {
553
552
newSelection = temp ;
554
553
}
555
554
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 );
557
556
}
558
557
} else {
559
558
for (int j = 0 ; j < offsets .length ; j ++) {
560
- Rectangle [] rects = getRectanglesInPixels (j );
559
+ Rectangle [] rects = getRectangles (j );
561
560
for (int i = 0 ; i < rects .length ; i ++) {
562
561
Rectangle rect = rects [i ];
563
562
if (rect .contains (x , y )) {
@@ -810,7 +809,7 @@ int parseMnemonics (char[] buffer, int start, int end, StringBuilder result) {
810
809
int setBounds (int x , int y , int width , int height , boolean move , boolean resize ) {
811
810
int result = super .setBounds (x , y , width ,height , move , resize );
812
811
if ((result & RESIZED ) != 0 ) {
813
- layout .setWidth ( DPIUtil . autoScaleDown (( width > 0 ? width : -1 )) );
812
+ layout .setWidth ( width > 0 ? width : -1 );
814
813
redraw ();
815
814
}
816
815
return result ;
0 commit comments