Commit Graph

67 Commits

Author SHA1 Message Date
Michael Stapelberg
9200094203 format **/*.c with clang-format-3.5
This has multiple effects:

1) The i3 codebase is now consistently formatted. clang-format uncovered
   plenty of places where inconsistent code made it into our code base.

2) When writing code, you don’t need to think or worry about our coding
   style. Write it in yours, then run clang-format-3.5

3) When submitting patches, we don’t need to argue about coding style.

The basic idea is that we don’t want to care about _how_ we write the
code, but _what_ it does :). The coding style that we use is defined in
the .clang-format config file and is based on the google style, but
adapted in such a way that the number of modifications to the i3 code
base is minimal.
2014-06-15 19:07:02 +02:00
Michael Stapelberg
e2f47ef466 i3-input: fix (irrelevant) memory leak
Given that the code was exit(0)ing directly after using that memory,
it’s not like this has any effect. However, less false positives on the
clang-analyze report pages is a good thing.
2014-05-15 23:50:09 +02:00
Alexander Kedrik
e2ebe3e2ae Use #pragma once
#pragma once is safer and simpler. According to Wikipedia it's supported by all major compilers.
2014-01-01 15:06:57 +01:00
Michael Stapelberg
0883dfbe14 only LOG() the DPI when it changes, DLOG() it otherwise (Thanks lkraav)
This avoids flooding stdout every time some text (e.g. a window
decoration) is drawn, yet leaves the message in place when it’s actually
relevant (upon DPI changes).

fixes #1115
2013-12-24 10:35:56 +01:00
Michael Stapelberg
d3beff2339 make i3bar use libi3’s root_atom_contents()
This removes code duplication, which will be useful for a subsequent
commit.

Furthermore, we now don’t open X11 connections unnecessarily in some
corner cases.
2013-11-22 15:48:45 +01:00
Michael Stapelberg
28933f8de3 i3-input: set focus before sending the command (Thanks emias)
This avoids problems with sending 'focus left' or other commands which
manipulate focus.
2013-01-24 13:57:08 +01:00
Michael Stapelberg
5779f573e7 i3-input: restore input focus on exit() (Thanks f8l)
fixes #641
2012-12-19 18:22:03 +01:00
Michael Stapelberg
a01bac13fe don’t use reserved identifiers for include guards (left-overs)
fixes #804
2012-09-22 13:31:08 +02:00
Oliver Kiddle
f7d825062a remove superfluous ev.h include statements 2012-09-20 11:15:17 +02:00
Michael Stapelberg
4636eb840d fix compilation with older xcb-util with -DXCB_COMPAT (Thanks okraits) 2012-09-03 14:55:27 +02:00
Quentin Glidic
a007283773 i3-input: Fix text drawing offset 2012-08-28 12:06:03 +02:00
Quentin Glidic
af15087b99 i3-input: Do not use a non-loaded font
We must call load_font before any font-related calls like
predict_text_width
2012-08-28 10:58:18 +02:00
Michael Stapelberg
2896ae8057 logging: make libi3 use verboselog()/errorlog(), provide it in each caller
While this is a bit ugly, it makes the log messages end up where they
are supposed to: in the shmlog/stdout in case of i3 and on stdout in
case of utilities such as i3-input
2012-08-13 13:27:16 +02:00
Fernando Tarlá Cardoso Lemos
6ff3f7abad libi3: Implement Pango rendering 2012-08-13 11:39:30 +02:00
Quentin Glidic
210fc6dfed libi3: Rework predict_text_width
predict_text_width now takes an i3String as argument
2012-08-13 11:37:23 +02:00
Quentin Glidic
53365fa887 libi3: Rework draw_text
We now have two versions of draw_text
draw_text: Now takes an i3String
draw_text_ascii: Designed for static strings in plain ASCII
2012-08-13 11:37:21 +02:00
Quentin Glidic
284294e9c2 i3-input: Store and use xcb_char2b_t directly 2012-08-13 11:30:08 +02:00
Quentin Glidic
d89cb04c98 i3-input: Port prompt to i3String 2012-08-13 11:30:08 +02:00
Quentin Glidic
b01545b131 Makefile: Always link libi3 first 2012-08-13 02:00:01 +02:00
Michael Stapelberg
8a1c8115ca fix a few warnings/places where the clang static analyzer complains 2012-08-05 16:34:38 +02:00
Quentin Glidic
0b4ee7a1da common.mk: Split XCB common flags 2012-07-23 00:12:55 +02:00
Quentin Glidic
5e0cd52f10 common.mk: Split XCB keyboard flags 2012-07-23 00:06:37 +02:00
Quentin Glidic
c7029a5e21 common.mk: Introduce I3_*FLAGS
CPPFLGES, CFLAGS and LDFLAGS should be user variables
We now provide default flags but use I3_*FLAGS flags for our own needed
flags

Also reoder lib flags a bit
2012-07-22 23:53:49 +02:00
Quentin Glidic
3b1b72ecbb *.mk: Support passing specific CFLAGS/LIBS 2012-07-22 23:53:13 +02:00
Quentin Glidic
e452acb30e Add stub Makefiles to allow subdir make calls 2012-07-22 19:57:48 +02:00
Quentin Glidic
eb08d33692 Move i3-input to the new Makefile layout 2012-07-22 19:57:21 +02:00
Michael Stapelberg
dee7c07ad2 shmlog: store meta information in the buffer itself, store path as X11 atom
This makes i3-dump-log completely independent of a running i3 instance.
2012-01-06 23:40:07 +00:00
Michael Stapelberg
561cf3719f little style fixes 2011-11-21 21:48:24 +00:00
Fernando Tarlá Cardoso Lemos
344c04af12 Implement set_font_colors.
This paves the way for other font rendering backends. Fonts and
colors shouldn't be specified manually from now on.
2011-11-21 20:52:32 +00:00
Fernando Tarlá Cardoso Lemos
eafc7af606 Make all programs use draw_text. 2011-11-21 20:52:29 +00:00
Fernando Tarlá Cardoso Lemos
fb11cc2d14 Consolidate all convert_* functions into libi3.
Some minor fixes along the way as well. Very minor stuff, unlikely
to ever be visible to the user.
2011-11-16 20:54:30 +00:00
Fernando Tarlá Cardoso Lemos
d5613905c8 Plug minor leaks in string conversion routines. 2011-11-07 19:57:11 +00:00
Michael Stapelberg
726f2a1e5a normalize file headers across **/*.{h,c} 2011-10-25 21:19:38 +01:00
Michael Stapelberg
f4469eee0b get rid of xcb.c in all i3-* tools
open_input_window was slightly different for each of them, so it made no sense
to generalize it (then we would end up with a thin and useless wrapper).
2011-10-23 23:20:57 +01:00
Michael Stapelberg
a58018cf66 Add libi3/load_font, use it everywhere
…except for i3bar, which needs slightly more information about the font
2011-10-23 22:37:11 +01:00
Michael Stapelberg
c2d04116d4 i3-input: Remove unused get_mod_mask from xcb.c 2011-10-23 19:37:28 +01:00
Michael Stapelberg
05d097bb36 i3-input: fix handling of Mode_switch (makes special characters work again)
This seems to have only worked before in certain settings, where the modifiers
were configured in a way that it matched by chance…
2011-10-23 19:34:48 +01:00
Michael Stapelberg
7c04e23ab7 i3-input: Bugfix: font must be dynamically allocated, we FREE it later 2011-10-23 19:34:21 +01:00
Michael Stapelberg
6dc6ba11fc Eliminate xcb_change_gc_single everywhere with C99 2011-10-23 18:06:25 +01:00
Michael Stapelberg
cb9bbcfccf Move get_colorpixel to libi3, use it everywhere else 2011-10-23 17:38:21 +01:00
Michael Stapelberg
0086bcb2b4 i3-input: eliminate xcb_change_gc_single usage with C99 2011-10-23 17:26:06 +01:00
Michael Stapelberg
4f57d49318 add libi3/ipc_connect, use it in i3-config-wizard, i3-input, i3bar 2011-10-23 17:18:14 +01:00
Michael Stapelberg
9d15a00ba8 introduce sasprintf() in libi3, use it everywhere 2011-10-23 13:16:56 +01:00
Michael Stapelberg
d87b0f13a0 i3-input: use IPC functions from libi3 2011-10-23 13:15:20 +01:00
Michael Stapelberg
4f6e58e250 Makefiles: prefix compilation messages (for parallel builds) 2011-10-02 16:04:18 +01:00
Michael Stapelberg
1737a78fcd i3-input: implement -F (format) option, deprecate -p (prefix)
This introduces the '-F format' parameter, which takes a format and replaces %s
in it with the user input. An example: The user should enter the target
workspace name. The appropriate i3-input invocation looks like this:

    i3-input -F 'workspace "%s"' -P 'Switch to workspace: '
2011-09-18 13:51:11 +01:00
Michael Stapelberg
fddee471e8 i3-input: add missing \n in --help 2011-09-18 13:21:45 +01:00
Michael Stapelberg
46ab86b88d i3-input: reformat main.c 2011-09-18 13:20:59 +01:00
Michael Stapelberg
6a07e08320 makefiles: build subdirs (Thanks Kacper) 2011-07-25 00:31:35 +02:00
Michael Stapelberg
fdd098b010 secure strscpy by replacing with strncpy 2011-07-23 22:22:36 +02:00