Commit Graph

445 Commits

Author SHA1 Message Date
Ingo Bürk b665049883 Migrate i3 rendering to cairo.
This patch migrates all decoration rendering of i3 to cairo. Using the
compile switch CAIRO_SUPPORT, rendering can be switched back to the
previous XCB behavior, just like with the previous migration to cairo
in i3bar.

This patch also fixes a bug in draw_util.c where copying one surface
to another would use incorrect coordinates if the source coordinates
are not 0, 0.

Furthermore, this patch implicitly fixes some minor issues in the
decoration rendering which would be ignored previously due to the fact
that errors would only show up in the event queue, but not cause the
rendering code path to crash. One example is zero-height pixmaps which
are not allowed. Using cairo, these would cause i3 to instantly segfault,
so this patch avoids this.

Lastly, this patch annotates other issues found but not fixed in this patch
using TODO comments, e.g., the zero-height check not working correctly
and the comment that it should probably work the same way for zero-width
pixmaps.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk 90d94298fa Move draw_util.c to libi3.
In order to prepare for using cairo for rendering i3 decorations,
we need to make the draw_util.c from i3bar available via libi3 such
that both i3bar and i3 can use it.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk 38fcaf3fa8 Rename I3BAR_CAIRO to CAIRO_SUPPORT. 2015-11-07 14:28:45 -05:00
Ingo Bürk bc250b26a0 Allow multiple tray_output directives.
This patch introduces the possibility to specify the tray_output directive
multiple times. All values will be used by i3bar, in the order they are
given.

This way, a single bar configuration can be used for several machines with
internal output names "eDP1" and "LVDS-0" by specifying tray_output for both.
Any external output (e.g., "DP-0") will still not receive the tray. The same
effect can be achieved by using "primary", but forces the user to couple the
tray display to the primary output which may not be desirable behavior.

relates to #555
2015-11-01 16:35:17 -05:00
David Simon dc05d905c1 Optionally change i3bar color on focused output, implements #2020 2015-10-27 09:12:57 -04:00
David Simon 071f11f9b9 Use separate buffers for i3bar statusline for each workspace, track short and long renders separately, fixes #1824 2015-10-26 16:15:01 -04:00
Ingo Bürk a0add1ba73 Added background and border keys to the i3bar protocol.
This patch adds two new status block keys, background and border, which
define the respective colors for the status block. If not specified, the
current behavior is kept, e.g., no background / border will be drawn.

If the status block is marked urgent, the urgent color is prioritized.

fixes #2022
2015-10-22 16:11:08 +02:00
Ingo Bürk 0750b450b2 Use sasprintf() instead of alloc'ing and strncpy() in i3bar.
resolves #1995
2015-10-17 22:14:48 +02:00
Ingo Bürk 19a16f3ce7 Log X11 errors in i3bar.
This commit introduces X11 error logging similar to the way we already do in i3.

fixes #1998
2015-10-16 21:18:23 +02:00
Michael Stapelberg d622df70ad Merge pull request #1990 from Airblader/bug-1989
Flush cairo surface after drawing text.
2015-10-14 13:32:31 -07:00
Ingo Bürk 02468296c4 Introduce switch for the drawing backend
This commit restores the old XCB drawing code paths while keeping the
cairo drawing available via a compile-time switch (I3BAR_CAIRO). This
is necessary as cairo currently has a bug that breaks i3bar for users
without the RENDER extension, which might be the case, e.g., for VNC
users.

For more context, see #1989 and the discussions about its fix. Once the
cairo fix is available in a stable release, i3 can depend on that version
and remove the XCB drawing code paths.

fixes #1989
2015-10-14 21:12:33 +02:00
Ingo Bürk 46bcc55f6f Extract cairo_clear_surface.
This commit refactors the i3bar drawing code to also define an abstraction
function for clearing a surface. This is needed to fully abstract i3bar/xcb.c's
drawing code so that we can introduce a switch to easily exchange the
underlying drawing mechanism.
2015-10-14 19:03:05 +02:00
Ingo Bürk 8178910f16 Introduce a macro to flush a cairo surface twice.
Flushing the surface twice is necessary due to a cairo bug. For context,
refer to #1989 and https://bugs.freedesktop.org/show_bug.cgi?id=92455.
2015-10-14 18:57:16 +02:00
Ingo Bürk 54dbbe2f06 Flush cairo surface after drawing text.
This is necessary to avoid a bug where a cairo assertion fails because no snapshot is available.

fixes #1989
2015-10-13 11:08:10 +02:00
Ingo Bürk fec61791e1 Rename is_markup to pango_markup. 2015-10-13 09:59:26 +02:00
Ingo Bürk 82dc747396 Make pango markup in mode names optional with a flag.
This introduces the flag "--pango" on the mode config directive to
explicitly enable pango markup for mode names. Not setting this will
cause the mode name to be rendered as is.
This fixes a regression in 4.11 where mode names containing characters
such as '<' would break user's configs as they didn't escape these
characters.

fixes #1992
2015-10-13 09:23:30 +02:00
Ingo Bürk 21c0c20843 Remove support for 32-bit visuals and RGBA colors.
fixes #1984
2015-10-11 00:33:14 +02:00
Ingo Bürk d300a07660 Refactor cairo drawing of rectangles into utility functions. 2015-10-08 12:31:56 +02:00
Ingo Bürk ff0aeddede When drawing text, mark the surface as dirty.
Since libi3 currently creates its own cairo surface for drawing text, we
need to mark our own surface as dirty to force cairo to invalidate its
cache. Otherwise, this will result in graphical glitches such as the text
not showing up at all.

This wrapper can be removed in the future when libi3 is adapted to reuse
the same cairo surface as we do for all other drawing operations.
2015-10-08 12:16:25 +02:00
Ingo Bürk 1c4100ce5d Use 32-bit visuals for i3bar when possible and allow RGBA colors.
This patch creates all necessary windows for i3bar with 32-bit visuals if available.
It also introduces the possibility to define RGBA colors (next to RGB colors), which
allows the user to set the opacity of any color. This requires running a compositor.

With this patch we also start supporting _NET_SYSTEM_TRAY_VISUAL, which is necessary
for the tray icons so they create the tray window with the correct depth and visual.
2015-10-06 23:01:57 +02:00
Ingo Bürk 410c5da7cf Use cairo for all drawing operations in i3bar.
fixes #1878
2015-10-05 09:29:17 +02:00
shdown c85d16faa4 Use safe wrappers wherever possible 2015-08-03 12:50:50 +03:00
shdown bc52fae15c libi3: change scalloc() signature to match calloc() 2015-08-03 12:50:13 +03:00
Ingo Bürk b9bacdf464 Send custom-defined command upon click on the non-statusline part of i3bar even if workspace_buttons is set to 'no'.
fixes #1777
2015-07-01 14:48:06 +02:00
Michael Hofmann bad4203755 Configurable tray padding. 2015-06-28 00:14:37 +02:00
Michael Stapelberg 696d844ffa Merge pull request #1697 from Airblader/feature-1695
Extend mouse commands on i3bar
2015-06-18 20:50:56 +02:00
Ingo Bürk 9eb255d5fa Ensure format of dumped bindings for i3bar is compatible with i3 bindings.
fixes #1695
2015-06-18 19:28:24 +02:00
Ingo Bürk 715fbf2d80 Read 'bindsym' rather than the old 'wheel_up_cmd' and 'wheel_down_cmd' directives in i3bar and call the command if specified.
The old directives are still read for transitional support which can be removed in a future version.
2015-06-18 19:28:20 +02:00
Michael Stapelberg 560d9a25d8 Merge pull request #1731 from Airblader/feature-indicator-pango
Allow pango markup for the binding indicator.
2015-06-07 20:46:16 +02:00
shdown fe006f0f6a i3bar: fix freeing static strings
name and color fields of blocks are freed in clear_statusline, so they
need to be strdup'ed.
2015-06-02 23:29:24 +03:00
Ingo Bürk 0a0f59038a Use the introduced binding_mode_* colors to draw the binding mode.
fixes #1732
2015-06-01 16:57:17 +02:00
Ingo Bürk 9b691bcca2 Introduce a config directive 'binding_mode' in the 'bar' config, pass it through the IPC and parse it in i3bar. 2015-05-31 16:49:09 +02:00
Ingo Bürk 36f5a37777 Allow pango markup for the binding indicator. 2015-05-31 12:35:47 +02:00
Michael Stapelberg 79e7e69939 Merge pull request #1700 from mh21/tray-icon-size-cleanup
Tray icon size cleanup.
2015-05-12 22:44:08 +02:00
Michael Hofmann 0319bda1d4 Introduce sstrndup wrapper. 2015-05-06 16:33:15 +02:00
Michael Hofmann 27c060b279 Tray icon size cleanup.
- icon_size instead of font.height
- consistent spacing with tray_spacing_px
2015-04-30 11:45:38 +02:00
Michael Stapelberg 5dda3bc2ae Merge pull request #1657 from Georgiy-Tugai/fix-flickering-shortened
i3bar: fix flickering shortened status bar on other output(s)
2015-04-26 23:38:27 +02:00
Ingo Bürk bbc66e45f7 Only detect clicks within the statusline width.
If the user clicks on the very top of i3bar above a tray icon, i3bar might
mistakenly trigger the click event for the last status block. This is due to
the fact that the click detection considers the separator width of the block
even though on the last block this is ignored, incorrectly spanning the block's
width partially (or entirely) across the tray area.
2015-04-26 00:32:18 +02:00
Georgiy Tugai de866c2fea
i3bar: fix flickering shortened status bar on other output(s) 2015-04-21 12:28:43 +09:30
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
Thomas Anderson 196e1d0971 Respect EXEC_PREFIX and a users' choice of PKG_CONFIG.
The Makefiles should put binaries in $(EXEC_PREFIX) and
architecture-independent files in $(PREFIX). Also a user may have a
prefixed- pkg-config, as in the case of cross compiling on Exherbo
Linux, so respect the well-accepted $(PKG_CONFIG) variable for this
purpose.
2015-04-12 17:59:30 -07:00
Ingo Bürk a952ae74f4 Use a reasonable default sep_block_width if a separator_symbol is given 2015-04-03 22:54:59 +02:00
Michael Stapelberg 6b04f28b48 fix remaining warnings 2015-03-29 17:12:20 +02:00
Michael Stapelberg 93adcf8bdc Merge pull request #1575 from hwangcc23/next
Fix warnings
2015-03-29 16:53:14 +02:00
hwangcc 42515308e7 Add a safe wrapper for write and fix some warnings
1. Add a function writeall and make swrite wrap that function. Use either writeall or swrite, depending on whether we want to exit on errors or not.
2. Fix warnings when compiling with a higher optimisation level.
(CFLAGS ?= -pipe -O3 -march=native -mtune=native -freorder-blocks-and-partition)

Signed-off-by: hwangcc <hwangcc@csie.nctu.edu.tw>
2015-03-29 10:22:34 +08:00
Michael Stapelberg af71d3a2f1 Merge pull request #1590 from acrisci/bug/i3bar-no-markup-default
i3bar: don't parse markup on statusline by default
2015-03-28 10:08:41 +01:00
Tony Crisci beaf904943 i3bar: don't parse markup on statusline by default
fixes #1565
2015-03-27 19:00:32 -04:00
Michael Stapelberg 856e1f9772 Merge pull request #1591 from Airblader/feature-child-cleanup
Return in child parsing as soon as the match was made.
2015-03-27 09:51:00 +01:00
Michael Stapelberg fb0573e183 Merge pull request #1582 from shdown/allow-escaping-backslashes
Allow escaping backslashes
2015-03-27 09:40:09 +01:00
Ingo Bürk 6adc7e8bfb Return in child parsing as soon as the match was made.
As soon as we found the current key for which the value should be handled we can return
from the function to save some string comparisons.
2015-03-27 09:26:29 +01:00