Skip to content

Commit 46fcb32

Browse files
author
soheil_h_y
committed
1.preserving the left(x) of a control whenever it is Right to Left.
1 parent a0fb613 commit 46fcb32

File tree

1 file changed

+8
-0
lines changed
  • sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets

1 file changed

+8
-0
lines changed

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Control.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,9 +2075,12 @@ void setBounds (int x, int y, int width, int height, int flags, boolean defer) {
20752075
/**
20762076
* A patch to send bounds to support mirroring features like what Windows have.
20772077
*/
2078+
int tempX = x;
20782079
if(parent != null){
20792080
if((parent.style & SWT.RIGHT_TO_LEFT) != 0){
2081+
System.out.println(this.toString() + " the x " + x + " y " + y + " w " + width + " height " + height);
20802082
x = Math.max(0, parent.getClientArea().width - x - width);
2083+
System.err.println("the x after " + x + " cw " + parent.getClientArea().width);
20812084
}
20822085
}
20832086
Element topHandle = topHandle ();
@@ -2135,6 +2138,11 @@ void setBounds (int x, int y, int width, int height, int flags, boolean defer) {
21352138
this.height = height;
21362139
SetWindowPos (topHandle, null, x, y, width, height, flags);
21372140
}
2141+
/*
2142+
* The x coordination should be preserved, because the right to left emulation is just
2143+
* for the view, not the data!
2144+
*/
2145+
this.left = tempX;
21382146
}
21392147

21402148
/**

0 commit comments

Comments
 (0)