Commit Graph

16 Commits

Author SHA1 Message Date
Orestis Floros 3c522d9f2f
Sort includes in *.c files
Not enabling in .clang-format because it breaks headers files.

Used:
    IncludeCategories:
      - Regex:           '^<config'
        Priority:        0
      - Regex:           '^".*"'
        Priority:        1
      - Regex:           '^<(xcb|xkb|yajl|X11)'
        Priority:        3
      - Regex:           '.*'
        Priority:        2
2020-04-19 09:58:25 +02:00
Orestis Floros 052e96d323
Use lround instead of (long)round 2018-10-13 21:10:10 +03:00
Orestis Floros 50880db2c5
Reduce some code around frees 2018-10-13 21:10:09 +03:00
Pawel S. Veselov d2b35388b4 Fixes #3072, Xft.dpi can be floating point 2017-12-09 15:12:25 +01:00
Theo Buehler d29d908003 Avoid use of uninitialized in init_dpi_end
If conn == NULL or display == NULL, init_dpi() jumps to init_dpi_end
before (declaring and) initializing resource. In init_dpi_end, there
is a free(resource) call conditionally on resource != NULL, so this
may lead to a bogus free. Found by clang -Wsometimes-uninitialized.
2017-08-23 15:48:58 +02:00
Ingo Bürk 25d27c5b2e Free allocated X resource value. (#2620)
This fixes a little memory leak.
2017-01-02 15:56:28 +01:00
mihaicmn ad7dec31d5 Use the DPI setting within the i3bar (#2556) 2016-11-12 06:34:54 -08:00
Michael Stapelberg f354f53435 Ensure all *.[ch] files include config.h
Including config.h is necessary to get e.g. the _GNU_SOURCE define and
any other definitions that autoconf declares. Hence, config.h needs to
be included as the first header in each file.

This is done either via:
1. Including "common.h" (i3bar)
2. Including "libi3.h"
3. Including "all.h" (i3)
4. Including <config.h> directly

Also remove now-unused I3__FILE__, add copyright/license statement
where missing and switch include/all.h to #pragma once.
2016-10-23 21:09:24 +02:00
Ingo Bürk cb1fcfed6a Use Xft.dpi for DPI if available.
fixes #2465
2016-09-26 20:29:53 +02:00
Alex Auvolat 19fd6817af Refactor extern definition of conn and root_screen 2015-12-29 12:47:12 +01:00
Deiz 884214f14f Update copyright notices and get rid of ranges
The script used to make these changes can be found at:

   https://gist.github.com/Deiz/32322020f76d23e2bf8f
2015-04-20 17:50:21 -04:00
Tony Crisci 6fb7fc9bc6 Bugfix: validation segfault
When `new_window` is given in the config, config validation with `i3 -C`
would segfault.

Add a NULL check in logical_px() to check for the case when the config
is being validated without an X server to prevent this.
2015-03-22 05:46:52 -04:00
Michael Stapelberg 33d1d5d3c6 Treat everything up to 120 dpi as 96 dpi (Thanks jefvel)
See the comment in the source for rationale.
2014-08-23 16:02:30 +02:00
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 3760a48abe truncate DPI to an integer before multiplying (Thanks eeemsi)
This fixes i3bar workspace button rendering on non-DPI screens
(oldschool!)
2014-04-26 22:50:31 +02:00
Michael Stapelberg c79c49f69d libi3: add logical_px() for Retina display support 2014-04-26 17:17:37 +02:00