Bug 482059 - SWT Label on Linux GTK with "SWT.WRAP | SWT.RIGHT_TO_LEFT" style doesn't align RTL
Summary: SWT Label on Linux GTK with "SWT.WRAP | SWT.RIGHT_TO_LEFT" style doesn't alig...
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.2.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Lina Kemmel CLA
QA Contact: Lina Kemmel CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-11-12 18:11 EST by Peter Parapounsky CLA
Modified: 2018-11-30 14:56 EST (History)
5 users (show)

See Also:


Attachments
Screenshot - not repro in 4.3 (61.16 KB, image/jpeg)
2016-01-13 09:40 EST, Lina Kemmel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Parapounsky CLA 2015-11-12 18:11:14 EST
This can be reproduced on a Linux GTK platform with Eclipse 4.2.2. When a Label SWT control has the SWT.WRAP style, the SWT.RIGHT_TO_LEFT does not have an effect. If you run the following code in eclipse 4.2.2(Juno) you should see that the Text control has the correct RTL orientation, while the Label control, even though it has the SWT.RIGHT_TO_LEFT style applied, still shows LTR:

public static void main(String[] args) {
   Display display = new Display();
   Shell shell = new Shell(display, SWT.DIALOG_TRIM | SWT.RIGHT_TO_LEFT);
		shell.setSize(500, 500);

   Label l = new Label(shell, SWT.BORDER | SWT.WRAP | SWT.RIGHT_TO_LEFT);
   l.setText("\u05d4\u05d2\u05d9\u05e8\u05d4 \u05e9\u05dc \u05e0\u05ea\u05d5\u05e0\u05d9\u05dd");
   l.setBounds(10,10,300,30);
		
   Text t = new Text(shell, SWT.BORDER | SWT.WRAP);
   t.setText("\u05d4\u05d2\u05d9\u05e8\u05d4 \u05e9\u05dc \u05e0\u05ea\u05d5\u05e0\u05d9\u05dd"); 
   t.setBounds(10,50,300,30);
		
   shell.open();
   while (!shell.isDisposed()) {
       if (!display.readAndDispatch())
       display.sleep();
   }
   display.dispose();
}
Comment 1 Tomer Mahlin CLA 2016-01-07 01:22:43 EST
Hi Lina, looks like Linux specific issue, but still a very ugly one :-)). I wonder if it is reproducible on Windows ?
Comment 2 Sravan Kumar Lakkimsetti CLA 2016-01-08 00:28:34 EST
I am able to reproduce this in Neon also
Comment 3 Lina Kemmel CLA 2016-01-12 11:25:12 EST
(In reply to Tomer Mahlin from comment #1)
> Hi Lina, looks like Linux specific issue, but still a very ugly one :-)). I
> wonder if it is reproducible on Windows ?

Hi Tomer, this is not reproducible on Windows.

BTW, based on the content the testcase uses ("\u05d4\u05d2\u05d9\u05e8\u05d4 \u05e9\u05dc \u05e0\u05ea\u05d5\u05e0\u05d9\u05dd") it's impossible to say whether the problem base direction, alignment, or both.

Taking this bug for investigation.
Comment 4 Lina Kemmel CLA 2016-01-13 09:40:31 EST
Created attachment 259162 [details]
Screenshot - not repro in 4.3

I tried this on my old RedHat machine having Eclipse Kepler (4.3), and the problem is not reproducible. So this looks like a regression.
Comment 5 Lina Kemmel CLA 2016-01-13 09:48:22 EST
Of course, this can be coming from GTK; that machine has GTK2.

Peter: could you please let me know your GTK level. Thank you.
Comment 6 Lina Kemmel CLA 2016-01-14 08:25:36 EST
Hi Sravan, which GTK+ version are you running on? Thank you.
Comment 7 Lina Kemmel CLA 2016-01-14 10:08:33 EST
Here is a slightly modified example:

	public static void main(String[] args) {
		   Display display = new Display();
		   Shell shell = new Shell(display, SWT.DIALOG_TRIM | SWT.RIGHT_TO_LEFT);
				shell.setSize(500, 500);

		   Label l = new Label(shell, SWT.BORDER | SWT.WRAP | SWT.RIGHT_TO_LEFT);
		   l.setText("abc \u05d4\u05d2\u05d9\u05e8\u05d4 \u05e9\u05dc \u05e0\u05ea\u05d5\u05e0\u05d9\u05dd...");
		   l.setBounds(10,10,300,30);
		   l.setAlignment(SWT.LEFT);
				
		   l = new Label(shell, SWT.BORDER | SWT.WRAP | SWT.RIGHT_TO_LEFT);
		   l.setText("abc \u05d4\u05d2\u05d9\u05e8\u05d4 \u05e9\u05dc \u05e0\u05ea\u05d5\u05e0\u05d9\u05dd...");
		   l.setBounds(10,50,300,30);
		   l.setAlignment(SWT.RIGHT);
				
		   Text t = new Text(shell, SWT.BORDER | SWT.WRAP);
		   t.setText("abc \u05d4\u05d2\u05d9\u05e8\u05d4 \u05e9\u05dc \u05e0\u05ea\u05d5\u05e0\u05d9\u05dd..."); 
		   t.setBounds(10,90,300,30);
				
		   shell.open();
		   while (!shell.isDisposed()) {
		       if (!display.readAndDispatch())
		       display.sleep();
		   }
		   display.dispose();
		}
It has a few diifs with that in Comment 0:

(1) text content is different to have a clear indication what base direction a control applies.
  - If it is LTR, the text will be displayed as "abc HEBREW..."
  - If it is RTL, the text will be displayed as "...HEBREW abc"

(2) There is an additional Label control

(3) We set an explicit alignment on each Label - SWT#LEFT and SWT#RIGHT respectively.

Could someone try this on GTK3 and share the screen cap please? (It looks like my system cannot upgrade its GTK to level 3, and setting up a new machine may take a while.)
Comment 8 Lina Kemmel CLA 2016-01-20 12:49:40 EST
Ping!

We cannot reproduce this on GTK+ 3 either.
Comment 9 Lina Kemmel CLA 2016-01-20 12:57:03 EST
What is the machine / application locale this is reproducible on?
Comment 10 Peter Parapounsky CLA 2016-01-22 18:59:14 EST
Hi Lina, as described in the description, this is reproducible with Eclipse 4.2.2. I cannot reproduce with say Eclipse 4.5.1. I need to know when was this issue fixed so the fix could be potentially back-ported, is there a bugzilla that fixes this? In what version of Eclipse was the fix delivered? Thanks!
Comment 11 Lina Kemmel CLA 2016-01-24 08:31:17 EST
(In reply to Peter Parapounsky from comment #10)
> Hi Lina, as described in the description, this is reproducible with Eclipse
> 4.2.2. I cannot reproduce with say Eclipse 4.5.1. I need to know when was
> this issue fixed so the fix could be potentially back-ported, is there a
> bugzilla that fixes this? In what version of Eclipse was the fix delivered?
> Thanks!

Hi Peter, as stated in Comment 4, the problem is not reproducible with Eclipse 4.3 (but Comment 2 says it is reproducible with 4.6). 
I'll try to figure out what the problem in 4.2.2 (and 4.6?) is.

It would be still very helpful if you could indicate your Linux distro, GTK version, machine/app locale please. Thank you!
Comment 12 Peter Parapounsky CLA 2016-01-25 12:24:52 EST
Hi Lina, I can reproduce on Redhat 7 and Ubuntu 14.04 and 15.04.
Comment 13 Lina Kemmel CLA 2016-02-09 11:27:05 EST
Well, I can't reproduce this with 4.2.2 either.

Peter, could you please run the example given in Comment 7 and share your screen shot? - I hope that would help us track down the problem. Thank you.
Comment 14 Eric Williams CLA 2018-11-30 14:56:40 EST
I cannot reproduce the issue on SWT from master as of today, GTK3.24, and Fedora 29.