[swt/gtk development] Why you should type the odd /*int*/ comment after long

You might have noticed that a lot of code in SWT/GTK has that odd /*int*/ comment after a long declaration.

long /*int*/ list 

I turns out the comment is needed for backwards 32 bit support.

So in general you should put it in parameter declarations and in variable declarations:

//Parameter declaration:
Control [] _getChildren (long /*int*/ parentHandle)

//Variable declaration:
long /*int*/ list = OS.gtk_container_get_children (parentHandle);

This is especially important in OS.java which is used to generate C code.

SWT Bug Triage

If you are a GTK/SWT developer and want to be involved in SWT Triage,
Then you should read:
https://www.eclipse.org/swt/triage.php

It is also useful to subscribe to the swt-platform email in bugzilla.
This way you’ll get emails for new SWT bugs and comment update on un-assigned bugs.
To do this, go to bugzilla, -> Preferences -> Email preferences
-> “Add users to my watch list” , add: platform-swt-inbox@eclipse.org
The only trouble is that you’ll get emails for all platforms (Windows/Mac/Linux) and you’ll have to create some filters for sorting things out. But in general I found that it’s good to be ‘aware’ of the issues that happen on windows/mac, as those sometimes occur on Linux also, or a bug labeled as ‘windows’ often impacts linux swt also.

 

 

How to tell if you are running Eclipse on Gtk2 or on Gtk3

When troubleshooting Eclipse bugs, I sometimes ask if you are running eclipse on gtk2 or gtk3.

Usually I can tell visually if Eclipse is running on Gtk2 or Gtk3, but this changes depending on your system theme.

In the about section

As Alexander Kurtakov pointed out and described in Lar’s article ,

Help -> About -> Installation Details -> Configuration Tab.

Look for something like:
org.eclipse.swt.internal.gtk.version=3.14.12

It’s usually somewhere near line 84 ish. But you can copy the text and search for it in your text editor.

Note, if this line is missing altogether, you’re (very most likely) running Eclipse on Gtk2.

See what version is on your system

You can find out which version of gtk is installed on your system by running pkg-config (you might need to install it first). This gives you an indication of which version of gtk eclipse might be using.

pkg-config --modversion gtk+-3.0

Force Eclipse to use either gtk2 / gtk3

You can force Eclipse to use a certain version of gtk:

#Gtk3 forced:
export SWT_GTK3=1
eclipse

#Gtk2 forced:
export SWT_GTK3=0
eclipse

Under gtk3, the entry in the about section should be present like: org.eclipse.swt.internal.gtk.version=3.14.12

 

[edit 2016-09Sep-08Thu]
This is actually by far the most visited blog entry on my blog (20k+ views)
I reference this page quite often, I made a short/memorable url for it: http://bit.ly/gtk2orgtk3

Correct SWT code style for widget development and using Eclipse’s regex to fix your code style.

When doing SWT Development, if you submit code with the wrong style, you might get some code-comments from other contributors advising you to fix your style.

Luckily there is an Eclipse-SWT-formatted profile that one can use or one can fix them with some Regex.

Note: I will update this article as I find out more about SWT style.
Continue reading