Merge lp:~gala-dev/gala/HACKING into lp:gala

Proposed by Tom Beckmann
Status: Merged
Approved by: Rico Tzschichholz
Approved revision: 360
Merged at revision: 361
Proposed branch: lp:~gala-dev/gala/HACKING
Merge into: lp:gala
Diff against target: 307 lines (+303/-0)
1 file modified
HACKING (+303/-0)
To merge this branch: bzr merge lp:~gala-dev/gala/HACKING
Reviewer Review Type Date Requested Status
David Gomes (community) Approve
Review via email: mp+183158@code.launchpad.net

Description of the change

Adds a HACKING file based on pantheon-terminal's.

To post a comment you must log in.
lp:~gala-dev/gala/HACKING updated
359. By Tom Beckmann

Copy code style rules from plank's HACKING file

Revision history for this message
David Gomes (davidgomes) :
review: Approve
Revision history for this message
David Gomes (davidgomes) wrote :

>Help getting Pantheon Terminal translated in your language!
Oops.

>Run Pantheon Terminal:
Oops.

review: Needs Fixing
lp:~gala-dev/gala/HACKING updated
360. By Rico Tzschichholz

Fix left Pantheon Terminal references

Revision history for this message
David Gomes (davidgomes) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'HACKING'
2--- HACKING 1970-01-01 00:00:00 +0000
3+++ HACKING 2013-09-28 21:56:52 +0000
4@@ -0,0 +1,303 @@
5+====== Gala Contribute ======
6+
7+====== Testing the latest build ======
8+
9+Get daily builds on Launchpad for Ubuntu 12.04 and later.
10+
11+ https://launchpad.net/~elementary-os/+archive/daily
12+
13+====== Join IRC chat rooms ======
14+
15+Join #elementary-dev on Freenode (irc.freenode.net).
16+
17+====== Contribute without touching code ======
18+
19+Go through problem reports and check unconfirmed bugs or those lacking
20+information and mark any duplicates you spot.
21+
22+ http://bugs.launchpad.net/gala
23+
24+Help getting Gala translated in your language!
25+
26+ https://translations.launchpad.net/gala
27+
28+Answer questions.
29+
30+ https://answers.launchpad.net/gala
31+
32+====== Check out the sources ======
33+
34+ bzr branch lp:gala
35+
36+The development trunk (master, tip) is the latest iteration of the next
37+release. Browse it online and look for other branches at:
38+
39+ http://code.launchpad.net/gala
40+
41+====== Build the code ======
42+
43+Prepare the source and compile:
44+ mkdir build
45+ cd build/
46+ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
47+ make
48+
49+Run Gala:
50+ ./gala --replace # from build/
51+
52+===== Debugging Code ======
53+
54+Debugging a window manager is not as easy as debugging any window application.
55+When the window manager processes crashes, it is stopped by gdb, so all your
56+windows will get stuck. Instead, run gdb from a different tty by pressing
57+Ctrl+Alt+F6 for example and executing
58+
59+ gdb gala
60+ # once inside gdb
61+ run -d :0 --replace
62+
63+Now, you can switch back to your X session, which will probably be on tty7,
64+which would be Ctrl+Alt+F7. You can then get program to crash as you usually
65+would and switch back to tty6 as above and you have full access to all gdb
66+features like "bt" for getting a backtrace. See the end of the
67+"If something goes wrong" section if you have troubles starting gala a second
68+time from gdb.
69+
70+===== If something goes wrong =====
71+
72+If gala crashes, you'll usually find yourself in a pretty bad position, as you
73+can't give focus to a window anymore by clicking on it, so you can't enter text
74+either. To get things back running, switch to tty6 by pressing ctrl+alt+f6 and
75+execute
76+
77+ gala -d :0 --replace
78+
79+which will start gala on display :0, which typically is the display you'll be
80+running. The "--replace" is most probably not required when gala crashed.
81+You might experience some weirdnesses if you you try to restart gala again from
82+a tty. The first launch will usually be somehow ignored. If that's the case,
83+just hit ctrl+c, and start it again. Now it should be running just fine.
84+
85+===== Gala is a mutter plugin? =====
86+
87+Mutter works with plugins, although they are not implemented in the way you
88+would maybe expect. In fact, you should better only load a single plugin at a
89+time. This plugin will then be queried by mutter for animating windows or
90+workspaces and defining a few other things. The plugin also has the oppurtinity
91+to add arbitrary ClutterActors to the stage or registring handlers for shortcuts.
92+
93+===== Adding a new shell component ====
94+
95+Shell components are typically placed in the src/Widgets/ folder. They usually derive
96+from ClutterActor, so they can be added to the stage the wm runs in directly. Once
97+you defined your actor, you can go to src/Plugins.vala and add a new instance of it
98+to the stage in the Plugin's start() method. You can register shortcuts for invoking
99+your view in that function as well. To get input events on your actor, you'll have to
100+call plugin.begin_modal(), which puts the stage in a mode where only the custom actors
101+receive events and the windows are unaccessible. When your view is closed, call
102+plugin.end_modal() to make the windows accessible again. A last option to have elements
103+like a panel receive clicks, even when not being in modal mode, is to have a look at the
104+Utils.set_input_region() method. Currently, you'll have to hack your area into it
105+manually, it is planned to have automatic areas for actors that request it as well later
106+on as we need it.
107+
108+====== Important: Keep fixes for different bugs in different branches ======
109+
110+Branches that contain patches to fix more than one bug will be rejected, and
111+you will be asked to supply a separate branch for every bug fix. However,
112+this doesn't apply to patches that are indivisible by nature, and that
113+fix multiple bugs.
114+
115+The reasons to work in this way are the following:
116+
117+If one of the bugs targeted by your branch is correctly fixed, but one of the
118+other bugs is incorrectly fixed or needs corrections, the branch won't be
119+accepted until everything looks ok for all bugs. This causes an unnecessary
120+delay for the bugs that where fixed correctly.
121+
122+Suppose your branch was accepted for merging in the main one. Later, it is
123+discovered that your branch introduces faulty behavior. The standard course of
124+action for these situations is to revert the merge that introduced that faulty
125+behavior. This will cause that all of your fixes are reverted (even the ones
126+that didn't cause problems) because there was no way of discriminating between
127+them. If a separate branch for each bug fixed existed, only the offending one
128+would have been reverted, and not all of them.
129+
130+Be sure to understand this, and avoid a headache later!
131+
132+====== Coding style ======
133+
134+Gala's source code in general follows the K&R "One True Brace Style" (1TBS),
135+with a caveat: spaces are inserted before opening parenthesis.
136+
137+For indenting the source code only tabs are used!
138+Tabs should be 4 spaces wide for code to look good.
139+
140+Consider the following snippet as an example:
141+
142+ int test_check ()
143+ {
144+ if (x < 0) {
145+ message ("Negative");
146+ negative (x);
147+ } else {
148+ message ("Non-negative");
149+ nonnegative (x);
150+ }
151+
152+ return 0;
153+ }
154+
155+Of course the best example is the current source code itself.
156+
157+You can also have a look at this doc for some parts:
158+
159+ http://elementaryos.org/docs/code/code-style
160+
161+Keep in mind that neither the indentation rules or curly
162+bracket positions mentioned there apply for Gala.
163+
164+====== Committing code ======
165+
166+Make a branch which will contain your changes for fixing bug 123456:
167+
168+ bzr branch lp:gala fix-123456
169+
170+Tell Bazaar your name if you haven't yet:
171+
172+ bzr whoami "Real Name <email@address>"
173+
174+See what you did so far:
175+
176+ bzr diff
177+ bzr diff | less
178+
179+Get an overview of changed and new files:
180+
181+ bzr status
182+
183+Add new files, move/ rename or delete:
184+
185+ bzr add FILENAME
186+ bzr mv OLDFILENAME NEWFILENAME
187+ bzr rm FILENAME
188+
189+Note: 'bzr add' should be used only when new source or data files are added
190+to Gala's source directory.
191+
192+After making your changes, you need to commit your work as a new revision.
193+
194+ bzr commit
195+
196+Bazaar will open the default text editor (in most systems, nano) where you
197+will write the commit message, save the document, and close it. Bazaar will
198+use the commit message as commentary for the new revision, so it should be
199+a concise summary of what you did.
200+
201+To change Bazaar's text editor, add the following line to Bazaar's
202+configuration file (usually located at ~/.bazaar/bazaar.conf):
203+
204+ editor = your_text_editor_here
205+
206+For example:
207+
208+ editor = gedit
209+
210+Commit your changes in small increments. It is better to keep different
211+changes in different commits.
212+
213+If a commit fixes a reported bug in Launchpad, it is useful to make a
214+reference to that bug report when committing:
215+
216+ bzr commit --fixes lp:123456
217+
218+Did you make changes to more than one file, but don't want to commit the
219+changes of all of them? You can specify which files you want to commit:
220+
221+ bzr commit file1 file2
222+
223+To see the last 5 revisions in the current branch:
224+
225+ bzr log -l5
226+ bzr log -l5 -p | less
227+
228+In the case you committed something wrong or want to ammend it:
229+
230+ bzr uncommit
231+
232+If you want to revert all the changes made after the last revision:
233+
234+ bzr revert
235+
236+Remember to keep your branch updated:
237+
238+ bzr pull
239+
240+As a general rule of thumb, 'bzr help COMMAND' gives you an explanation of any
241+command and 'bzr help commands' lists all available commands.
242+
243+====== Push proposed changes ======
244+
245+If you haven't yet, https://launchpad.net/~/+editsshkeys check that Launchpad
246+has your SSH key - you can create an SSH key with Passwords and Keys aka
247+Seahorse or 'ssh-keygen -t rsa' - and use 'bzr launchpad-login' to make
248+youself known to bzr locally.
249+
250+If you checked out trunk, and commited your patch(es), just push it under your
251+username in Launchpad and you can propose it for merging into trunk. This will
252+automatically request a review from other developers who can then comment on
253+it and provide feedback.
254+
255+ bzr push lp:~USERNAME/gala/fix-123456
256+ bzr lp-open
257+
258+The last command will open a summary of the current branch in your web
259+browser. There, you will be able to propose it for merging into trunk.
260+Your branch will be reviewed by another developer. At this stage, you may be
261+notified that changes need to be made to your branch, so keep an eye on your
262+email inbox!
263+After the branch is approved by the reviewer, it will get merged into the main
264+project's source code.
265+
266+
267+What happens to all the branches?
268+
269+Leave the branches alone, approved branches are cleared automatically by
270+Launchpad.
271+
272+For larger feature branches, use the team in Launchpad to allow other
273+developers to work on the code with you.
274+
275+What if I want to help out on an existing merge request that I can't push to?
276+
277+ bzr branch lp:~OTHERPERSON/gala/fix-123456
278+ cd fix-123456
279+ # make commits
280+ bzr push lp:~USERNAME/gala/fix-123456
281+ bzr lp-open
282+
283+And in the Launchpad web overview of your branch, propose your branch for
284+merging into lp:~OTHERPERSON/gala/fix-123456
285+
286+Updating a branch that may be out of sync with trunk:
287+
288+ bzr pull
289+ bzr: ERROR: These branches have diverged
290+ bzr merge lp:gala
291+ # Hand-edit conflicting changes
292+ bzr resolve FILENAME
293+ # If any conflicts remain continue fixing
294+ bzr commit -m 'Merge changes from lp:gala'
295+
296+Save a little bandwidth, branch from an existing local copy that you keep
297+around:
298+
299+ bzr branch lp:gala gala
300+ bzr branch gala/ gala-fix-123456
301+ cd gala-fix-123456
302+ bzr pull lp:gala
303+
304+====== License ======
305+
306+This document and the Gala project are licensed under the
307+GPL Version 3.

Subscribers

People subscribed via source and target branches