Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "SWT/Devel/Gtk"

< SWT‎ | Devel
(SWT Gtk Development Articles)
(Unsorted)
Line 19: Line 19:
 
* [[SWT/Devel/Gtk/GtkPackageFedora | Determining what version of Gtk shipped with Fedora]]
 
* [[SWT/Devel/Gtk/GtkPackageFedora | Determining what version of Gtk shipped with Fedora]]
 
* [https://developer.gnome.org/gtk3/stable/ch25s02.html GNOME documentation on changes from Gtk2 to Gtk3]
 
* [https://developer.gnome.org/gtk3/stable/ch25s02.html GNOME documentation on changes from Gtk2 to Gtk3]
 +
* [[SWT/Devel/Gtk/JUnitNoDefError | SWT JUnit tests fail to launch]]
  
  

Revision as of 11:18, 31 August 2015

SWT Gtk Development Articles

Here are links to sections that are too big for this page:

Compilation

Compilation Issues

Coding

Unsorted

These are to be categorized when enough accumulate:




Launching Eclipse with SWT source code

To test SWT snippets, it's useful to launch a child Eclipse with your patch to see how it looks and feels. To do so, under run-configurations, right click on "Eclipse Application" and select "new".

Eclipse Application

Common troubleshooting

Often Eclipse won't launch with various errors. Below are common steps to troubleshoot.

  • API Baseline: Make sure API Base line is set. If you updated Eclipse (e.g Luna to Mars), you may need to re-create the baseline.
  • Enable Execution Environments: Make sure that relevant Execution Environments are enabled. (1.5, 1.6 etc..)
Eclipse Execution Environments
  • Target Platform: Make sure to have an Target Platform set. Try re-creating it with Default for running platform.
  • Validate Plugins: In the run-time configuration for a Child Eclipse, under the 'Plug-ins' tab, instead of launching all plugins, try to select only SWT and it's binaries. Try to Validate the setup to see if there are missing dependencies.
  • re-create new run-time configuration: Often after updating Eclipse version, I have to create new "Eclipse Application" run time configurations for the child Eclipse to launch propertly

Tips

  • Choice of child Eclipse Workspace: Instead of using a blank workspace, copy your exiting workspace, append '-runtime' and use that for your child Eclipse.




Patch Submission guidelines

When submitting patches, you should consider the following:

General checklist

Your patches must:

Also keep in mind

  • Avoid refactoring code in the same patch as a bug-fix. Instead split it up into two commits. [1]
  • Please avoid removing white spaces in the same commit as a bugfix. [2]
  • Your code should follow SWT code style. See the code in other widgets for guidance. [3]
  • Avoid introducing methods that are only called once. But if you see the same code many times, it makes sense to add a method for it.
  • When removing code that calls internal functions, check that those functions are actually still called else where. Avoid leaving dead methods in the code.

General etiquette

  • Description : It's recommended to mention how you tested your patch at the end of the description. [4]
  • When you submit new patch sets, in the comment please describe what you improved on (unless it's a trivial thing). Often when reviewing multiple patch sets it's easy to loose track what was done in each patch set.


Foot Notes

  1. This makes it easier to rollback broken commits and avoids merge conflicts.
  2. Reviewing patches that consist of a lot of white space removal and a few actual code changes is tedious and causes merge conflicts. Instead submit white space removal in a separate patch.
  3. E.g use '!=' instead of '>' for bit checks. (TODO, add wiki page on SWT code style)
  4. E.g "Tested on Gtk2.24, Gtk3.14, Gtk3.16 on Snippet123. Also tested with child Eclipse on Luna and Mars"


Wayland Development

Wayland (wiki) is a rendering engine, intended to be a replacement for X Window System (wiki).

Launching wayland

In fedora 21+, you can run things on Wayland. There are several ways:

Log into Gnome Wayland

Log out and then on the logon screen, click on the gear icon and select "Gnome Wayland". See example screenshot. At the time of writing (2015.07.21) things like drag and drop and copy and paste did not work. So using Gnome-Wayland full time is difficult.

Launch Gnome Wayland in other Virtual Console

Alternatively, you can press Ctl+Alt+F3 etc.. to launch a virtual console. You login with your own user. Then run Gnome Wayland via:

   gnome-session --session gnome-wayland

Kill unresponsive Wayland session

You may find sometimes that Wayland with GNOME becomes unresponsive. In this case, switch back to your original virtual terminal (using Ctlr + Alt + F[1,2,3,4...]).

Running the following command will give you the PID of the process that needs to be killed in order to end the GNOME Wayland session:

  ps aux | grep <TTY_NUMBER> | grep "gnome-session --session gnome-wayland" | grep -v dbus | awk '{print $2}'                # where <TTY_NUMBER> is the tty Wayland is running on (i.e. tty[1,2,3,4...])

You can then kill it using:

 sudo kill PID               # where PID is the PID of process found from the step above

To make this a bit easier I have written a script that does this all in one step.

 export PID="$(ps aux | grep $1 | grep "gnome-session --session gnome-wayland" | grep -v dbus | awk '{print $2}')"
 kill $PID

Simply run the script using:

 kill_gnome_wayland <TTY_NUMBER>            # where <TTY_NUMBER> is the tty Wayland is running on (i.e. tty[1,2,3,4...])

Note: to kill the process you may/may not need to use sudo.

How to identify if your app runs on Wayland as backend

Wayland has a notion of XWayland. This is so that you can run Gtk2 apps on Wayland. Since Wayland and X applications look almost the same, it's tricky to tell them appart.

There are several ways to tell.

  • Launch Gtk Inspector. Under "General" tab, look under "Gdk Backend".
  • Launch looking glass "lg", top left click on "Windows" Tab, then click on one of the appliactions in the list, inspect 'Gtype'. E.g
           Gtype:MetaWindowX11          # X11
           Gtype:MetaWindowWayland      # Wayland



See also Eclipse Wiki Pages

These are pages mostly for special interest.

See Also External

Back to the top