Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 393689 - [ GTK+ 3] style in GTK+ 3 should use CSS
Summary: [ GTK+ 3] style in GTK+ 3 should use CSS
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M7   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-11-06 11:30 EST by Anatoly Spektor CLA
Modified: 2013-05-24 09:25 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anatoly Spektor CLA 2012-11-06 11:30:55 EST
In GTK 3 if you set SWT.Border or alignment such as SWT.Center they are not shown in the widget.

As an example  you can try execute this line:

Label label = new Label (shell, SWT.CENTER|SWT.BORDER);

 I think it is because GTK 3 uses CSSProvider to set style.
Comment 1 Anatoly Spektor CLA 2012-11-09 09:47:42 EST
(In reply to comment #0)
> In GTK 3 if you set SWT.Border or alignment such as SWT.Center they are not
> shown in the widget.
> 
> As an example  you can try execute this line:
> 
> Label label = new Label (shell, SWT.CENTER|SWT.BORDER);
> 
>  I think it is because GTK 3 uses CSSProvider to set style.

Regarding SWT.BORDER - I found out that SWT.BORDER is theme dependant and in adwaita (default theme) border is not drawn, whereas it is drawn in some other  themes. Also I found som more information about moving to different styling of frames from here: http://developer.gnome.org/hig-book/3.5/controls-frames.html.en

Silenio question to you: should we spend time on possibly creating our own CSS and putting border in it, or we leave this issue as theme specific  ?
Comment 2 Silenio Quarti CLA 2013-03-21 14:12:39 EDT
Sorry, I missed your question probably because I was not in the CC list.

I think if a given theme has no borders we should just respect that.  We should not force the label to have borders otherwise our labels will look different.  It seems Fedora 18 added borders back anyways.

I have not been able to reproduce the alignment problem in the latest. Can you still reproduce it?
Comment 3 Anatoly Spektor CLA 2013-04-09 09:08:13 EDT
(In reply to comment #2)
> Sorry, I missed your question probably because I was not in the CC list.
> 
> I think if a given theme has no borders we should just respect that.  We
> should not force the label to have borders otherwise our labels will look
> different.  It seems Fedora 18 added borders back anyways.
> 
> I have not been able to reproduce the alignment problem in the latest. Can
> you still reproduce it?

I totally agree about forcing part.

And in regards to  the alignment, this issue was lately fixed. So bug can be closed.

To see that issue is fixed, you can run:

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class FirstSWTClass {

  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("First SWT Application");
    shell.setSize(250, 250);
    Label label = new Label(shell, SWT.CENTER);
    label.setText("Greetings from SWT");
    label.setBounds(shell.getClientArea());
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }
}
Comment 4 Anatoly Spektor CLA 2013-04-09 09:09:16 EDT
Alignment and border issues are fixed.