~ubuntu-branches/ubuntu/precise/kdocker/precise

« back to all changes in this revision

Viewing changes to HACKING

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo Villani
  • Date: 2006-07-24 16:58:25 UTC
  • Revision ID: james.westby@ubuntu.com-20060724165825-tcir4glqacf9eno0
Tags: upstream-1.3
ImportĀ upstreamĀ versionĀ 1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Words of wisdom
 
2
 
 
3
1. Make sure all changed work on both KDE and Gnome
 
4
 
 
5
2. The System tray protocol specification can be found at
 
6
        http://freedesktop.org/Standards/systemtray-spec/systemtray-spec-0.1.html
 
7
 
 
8
3. The KDE System tray Docking Protocol can be found at
 
9
        http://developer.kde.org/documentation/library/kdeqt/kde3arch/protocols-docking.html
 
10
 
 
11
4. The site i use for Xlib reference
 
12
        http://tronche.com/gui/x/xlib/function-index.html
 
13
 
 
14
5. Qt Documentation at http://doc.trolltech.com
 
15
 
 
16
6. There's do or no do. There's no try.
 
17
 
 
18
KDocker Window Docking Strategy and a little bit of history
 
19
-----------------------------------------------------------
 
20
Couple of things that will help you if you are looking through the code.
 
21
I wanted a single instance of KDocker to be running all the time. So,
 
22
whenever a new instance of KDocker was created it would ask the previous
 
23
instance take over.
 
24
 
 
25
Two things to know about
 
26
1. Mapping from the PID (process id) to WID (window id)
 
27
2. How to let the previous instance know about app_to_launch
 
28
 
 
29
Lets deal with them one by one.
 
30
1. PID to WID mapping is easy if people followed rules. Just read _NET_WM_PID
 
31
for a window. If it matches the one app's PID we just created, that window is
 
32
the one we want to dock. Its not as simple as that. Programs have "splash"
 
33
screens. A nice thing is that these "splash" screen have the _WM_TRANSIENT_FOR
 
34
property set. So, we can skip those windows. There are these bunch of programs
 
35
(like gaim, xmms) that create windows and dont put this property on them. Arrgh.
 
36
What we do to counter these applications is to look for interesting windows
 
37
possibly created by the process until the process dies. Have a look at the code
 
38
for a better understanding.
 
39
 
 
40
2. Sending ClientMessages to previous instances with the program name and
 
41
arguments is painful and makes the code more complex. Before 1.0, I used to dump
 
42
all the program arguments in ~/kdocker.<pid> and send the pid in a 
 
43
ClientMessage. The file is then deleted after processing. As of 1.0, I set a
 
44
property _KDOCKER_<pid> on the KDocker initial instance's window which holds
 
45
the program arguments. (The correct way to transfer information is using
 
46
XSelections)
 
47
 
 
48
TRACING
 
49
-------
 
50
Add the following line in kdocker.pro (in fact just uncomment it)
 
51
DEFINES += ENABLE_TRACING
 
52
 
 
53
Now do a "make clean" and "then make".
 
54
 
 
55
Launch KDocker. Try recreating the problem.
 
56
- Right Click on the tray icon.
 
57
- Choose "About KDocker"
 
58
- You should see a button called "Show Trace". Please note that this button
 
59
  will appear only when compiled with tracing
 
60
- Try debugging yourself or send it to me
 
61
- If you send SIGUSR1 to the KDocker process, it will dump all the trace to
 
62
  ~/kdocker.trace
 
63