Skip to content

Commit b7861da

Browse files
author
jossonsmith
committed
Only set "ltr" direction when necessary.
Only update monitor size when the monitor is document.body element
1 parent 259a8cd commit b7861da

5 files changed

Lines changed: 41 additions & 9 deletions

File tree

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
import org.eclipse.swt.SWT;
1515
import org.eclipse.swt.SWTException;
16-
import org.eclipse.swt.events.SelectionAdapter;
17-
import org.eclipse.swt.events.SelectionEvent;
1816
import org.eclipse.swt.graphics.Color;
1917
import org.eclipse.swt.graphics.Image;
2018
import org.eclipse.swt.graphics.Point;
@@ -30,8 +28,6 @@
3028
import org.eclipse.swt.internal.xhtml.HTMLEvent;
3129
import org.eclipse.swt.internal.xhtml.document;
3230
import org.eclipse.swt.internal.xhtml.window;
33-
import org.eclipse.swt.layout.GridData;
34-
import org.eclipse.swt.layout.GridLayout;
3531

3632
/**
3733
* Instances of this class provide the appearance and
@@ -2250,12 +2246,34 @@ boolean traverseDecorations (boolean next) {
22502246
*/
22512247
public void _updateMonitorSize() {
22522248
Monitor monitor = getMonitor();
2249+
Element el = monitor.handle;
2250+
if (el == document.body) {
2251+
monitor.clientWidth = document.body.clientWidth;
2252+
monitor.clientHeight = document.body.clientHeight;
2253+
monitor.x = 0;
2254+
monitor.y = 0;
2255+
monitor.width = window.screen.availWidth;
2256+
monitor.height = window.screen.availHeight;
2257+
} else {
2258+
/*
2259+
* Ignore non document.body's bounds change events
2260+
Point pt = OS.getElementPositionInShell(el, document.body);
2261+
//el.style.position = "absolute";
2262+
monitor.x = pt.x;
2263+
monitor.y = pt.y;
2264+
monitor.width = monitor.clientWidth = OS.getContainerWidth(el);
2265+
monitor.height = monitor.clientHeight = OS.getContainerHeight(el);
2266+
*/
2267+
}
2268+
2269+
/*
22532270
monitor.clientWidth = document.body.clientWidth;
22542271
monitor.width = window.screen.availWidth;
22552272
monitor.clientHeight = document.body.clientHeight;
22562273
monitor.height = window.screen.availHeight;
22572274
monitor.clientX = monitor.x = 0;
22582275
monitor.clientY = monitor.y = 0;
2276+
*/
22592277
}
22602278

22612279
/*

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,15 @@ public void setText (String string) {
503503
groupText = string;
504504
}
505505
protected void _updateOrientation(){
506-
this.handle.style.direction = "ltr";
506+
/*
507+
* Force left to right
508+
*/
509+
if((style & SWT.RIGHT_TO_LEFT) != 0){
510+
handle.style.direction = "ltr";
511+
} else if (parent != null
512+
&& (parent.style & SWT.RIGHT_TO_LEFT) != 0) {
513+
handle.style.direction = "ltr";
514+
}
507515
}
508516
/*
509517
int widgetStyle () {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ public void setRegion (Region region) {
12771277
*/
12781278
}
12791279

1280-
void setToolTipText (Element hwnd, String text) {
1280+
void setToolTipText (Object hwnd, String text) {
12811281
/*
12821282
if (OS.IsWinCE) return;
12831283
if (toolTipHandle == 0) {

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,15 @@ void setSelection (int index, boolean notify) {
10331033
}
10341034
}
10351035
protected void _updateOrientation(){
1036-
handle.style.direction = "ltr";
1036+
/*
1037+
* Force left to right
1038+
*/
1039+
if((style & SWT.RIGHT_TO_LEFT) != 0){
1040+
handle.style.direction = "ltr";
1041+
} else if (parent != null
1042+
&& (parent.style & SWT.RIGHT_TO_LEFT) != 0) {
1043+
handle.style.direction = "ltr";
1044+
}
10371045
}
10381046

10391047
void updateSelection(int index) {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,6 @@ void checkOrientation (Widget parent) {
418418
protected void _updateOrientation(){
419419
if((style & SWT.RIGHT_TO_LEFT) != 0){
420420
handle.style.direction = "rtl";
421-
}else{
422-
handle.style.direction = "ltr";
423421
}
424422
}
425423
void checkOpened () {

0 commit comments

Comments
 (0)