about summary refs log tree commit diff stats
path: root/wm.h
diff options
context:
space:
mode:
Diffstat (limited to 'wm.h')
-rw-r--r--wm.h40
1 files changed, 24 insertions, 16 deletions
diff --git a/wm.h b/wm.h
index 6bf0d5e..038078f 100644
--- a/wm.h
+++ b/wm.h
@@ -9,16 +9,14 @@
 
 #include <X11/Xutil.h>
 
-/* WM atoms */
+/* atoms */
 enum { WMState, WMProtocols, WMDelete, WMLast };
-
-/* NET atoms */
 enum { NetSupported, NetWMName, NetLast };
 
-/* Cursor */
+/* cursor */
 enum { CurNormal, CurResize, CurMove, CurInput, CurLast };
 
-/* Rects */
+/* rects */
 enum { RFloat, RGrid, RLast };
 
 typedef struct Client Client;
@@ -28,35 +26,45 @@ struct Client {
 	Tag *tag;
 	char name[256];
 	int proto;
+	unsigned int border;
+	Bool fixedsize;
 	Window win;
 	Window trans;
 	Window title;
-	GC gc;
 	XSizeHints size;
 	XRectangle r[RLast];
 	Client *next;
-	Client *tnext;
-	Client *tprev;
+	Client *snext;
 };
 
 struct Tag {
 	char name[256];
-	Client *clients;
-	Client *sel;
+	Client *stack;
 	XRectangle r;
+	Tag *next;
+	Tag *cnext;
 };
 
 extern Display *dpy;
-extern Window root;
-extern XRectangle rect;
-extern Atom wm_atom[WMLast];
-extern Atom net_atom[NetLast];
+extern Window root, barwin;
+extern Atom wm_atom[WMLast], net_atom[NetLast];
 extern Cursor cursor[CurLast];
-extern Pixmap pmap;
+extern XRectangle rect, barrect;
+extern Bool running;
+extern void (*handler[LASTEvent]) (XEvent *);
 
 extern int screen, sel_screen;
-extern unsigned int kmask, numlock_mask;
+extern unsigned int lock_mask, numlock_mask;
+extern char *bartext, *shell;
 
 extern Brush brush;
 
+/* bar.c */
+extern void draw_bar();
+
+/* client.c */
+extern Client *create_client(Window w, XWindowAttributes *wa);
+extern void manage(Client *c);
+
 /* wm.c */
+extern int win_proto(Window w);
<rymg19@gmail.com> 2015-07-29 11:47:21 -0500 Fix contributing guide rST' href='/ahoang/Nim/commit/contributing.rst?h=devel&id=3fe39798e6a124d8318c8a6aa1b0ede08bee1cf8'>3fe39798e ^
57964a0ef ^






3fe39798e ^
2552a0f4b ^
57964a0ef ^



























a7c6279b1 ^






39dd16b5e ^
13dd7922a ^
a7c6279b1 ^



c4fb1246d ^
a7c6279b1 ^





39dd16b5e ^

a7c6279b1 ^







c4fb1246d ^
a7c6279b1 ^

c4fb1246d ^
a7c6279b1 ^

c4fb1246d ^














39dd16b5e ^
c4fb1246d ^
57964a0ef ^


























57964a0ef ^
39dd16b5e ^
c03502943 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226

































                                                                       




                                                                      




























                                                        
 





                                                                  
 






                                                                              
 












                                                                       
 






                                                          
 






                                                                       
 
                                         



























                                                                              






                                                                             
                                                                              
                              



                            
                         





                                                                            

                                                                                     







                                                                               
                             

                          
                  

                














                                                                           
 
                       


























                                                                               
                                                  
 
                         
Writing tests
=============

Not all the tests follow this scheme, feel free to change the ones
that don't. Always leave the code cleaner than you found it.

Stdlib
------

If you change the stdlib (anything under ``lib/``), put a test in the
file you changed. Add the tests under an ``when isMainModule:``
condition so they only get executed when the tester is building the
file. Each test should be in a separate ``block:`` statement, such that
each has its own scope. Use boolean conditions and ``doAssert`` for the
testing by itself, don't rely on echo statements or similar.

Sample test:

.. code-block:: nim

  when isMainModule:
    block: # newSeqWith tests
      var seq2D = newSeqWith(4, newSeq[bool](2))
      seq2D[0][0] = true
      seq2D[1][0] = true
      seq2D[0][1] = true
      doAssert seq2D == @[@[true, true], @[true, false],
                          @[false, false], @[false, false]]

Compiler
--------

The tests for the compiler work differently, they are all located in
``tests/``. Each test has its own file, which is different from the
stdlib tests. All test files are prefixed with ``t``. If you want to
create a file for import into another test only, use the prefix ``m``.

At the beginning of every test is the expected side of the test.
Possible keys are:

- output: The expected output, most likely via ``echo``
- exitcode: Exit code of the test (via ``exit(number)``)
- errormsg: The expected error message
- file: The file the errormsg
- line: The line the errormsg was produced at

An example for a test:

.. code-block:: nim

  discard """
    errormsg: "type mismatch: got (PTest)"
  """

  type
    PTest = ref object

  proc test(x: PTest, y: int) = nil

  var buf: PTest
  buf.test()

Running tests
=============

You can run the tests with

::

  ./koch tests

which will run a good subset of tests. Some tests may fail. If you
only want to see the output of failing tests, go for

::

  ./koch tests --failing all

You can also run only a single category of tests. A category is a subdirectory
in the ``tests`` directory. There are a couple of special categories; for a
list of these, see ``tests/testament/categories.nim``, at the bottom.

::

  ./koch tests c lib

Comparing tests
===============

Because some tests fail in the current ``devel`` branch, not every fail
after your change is necessarily caused by your changes.

The tester can compare two test runs. First, you need to create the
reference test. You'll also need to the commit id, because that's what
the tester needs to know in order to compare the two.

::

  git checkout devel
  DEVEL_COMMIT=$(git rev-parse HEAD)
  ./koch tests

Then switch over to your changes and run the tester again.

::

  git checkout your-changes
  ./koch tests

Then you can ask the tester to create a ``testresults.html`` which will
tell you if any new tests passed/failed.

::

  ./koch tests --print html $DEVEL_COMMIT


Deprecation
===========

Backward compatibility is important, so if you are renaming a proc or
a type, you can use


.. code-block:: nim

  {.deprecated: [oldName: new_name].}

Or you can simply use

.. code-block:: nim

  proc oldProc() {.deprecated.}

to mark a symbol as deprecated. Works for procs/types/vars/consts,
etc. Note that currently the ``deprecated`` statement does not work well with
overloading so for routines the latter variant is better.


`Deprecated <http://nim-lang.org/docs/manual.html#pragmas-deprecated-pragma>`_
pragma in the manual.


Documentation
=============

When contributing new procedures, be sure to add documentation, especially if
the procedure is exported from the module. Documentation begins on the line
following the ``proc`` definition, and is prefixed by ``##`` on each line.

Code examples are also encouraged. The RestructuredText Nim uses has a special
syntax for including examples.

.. code-block:: nim

  proc someproc*(): string =
    ## Return "something"
    ##
    ## .. code-block:: nim
    ##
    ##  echo someproc() # "something"
    result = "something" # single-hash comments do not produce documentation

The ``.. code-block:: nim`` followed by a newline and an indentation instructs the
``nim doc`` and ``nim doc2`` commands to produce syntax-highlighted example code with
the documentation.

When forward declaration is used, the documentation should be included with the
first appearance of the proc.

.. code-block:: nim

  proc hello*(): string
    ## Put documentation here
  proc nothing() = discard
  proc hello*(): string =
    ## Ignore this
    echo "hello"

The preferred documentation style is to begin with a capital letter and use
the imperative (command) form. That is, between:

.. code-block:: nim

  proc hello*(): string =
    # Return "hello"
    result = "hello"
or

.. code-block:: nim

  proc hello*(): string =
    # says hello
    result = "hello"

the first is preferred.

The Git stuff
=============

General commit rules
--------------------

1. All changes introduced by the commit (diff lines) must be related to the
   subject of the commit.

   If you change some other unrelated to the subject parts of the file, because
   your editor reformatted automatically the code or whatever different reason,
   this should be excluded from the commit.

   *Tip:* Never commit everything as is using ``git commit -a``, but review
   carefully your changes with ``git add -p``.

2. Changes should not introduce any trailing whitespace.

   Always check your changes for whitespace errors using ``git diff --check``
   or add following ``pre-commit`` hook:

   .. code-block:: sh

      #!/bin/sh
      git diff --check --cached || exit $?

3. Describe your commit and use your common sense.

.. include:: docstyle.rst