Ingo Bürk [Wed, 6 Jan 2016 14:19:42 +0000 (09:19 -0500)]
Use correct fallback color for decoration_border.
The newly introduced decoration_border color incorrectly uses the default value
for "background" as a fallback when not specified. Instead, it should use the
user-specified "background" as a fallback.
Ingo Bürk [Sun, 3 Jan 2016 00:11:55 +0000 (19:11 -0500)]
Fix segfault when calling "i3 -C".
Commit 287a0b4 introduced a segfault when validating the i3 config
as the root_screen will not be set in this case, causing a null
pointer dereference.
Ingo Bürk [Tue, 29 Dec 2015 17:01:51 +0000 (12:01 -0500)]
Move title_format from window to container.
This patch moves the title_format information from windows to containers.
Furthermore, it allows correctly setting it on window-less containers and
displays the title accordingly for split containers.
We now also dump and read title_format in GET_TREE / during restarts.
Alex Auvolat [Mon, 28 Dec 2015 11:58:32 +0000 (12:58 +0100)]
get_colorpixel support for non-true color displays
Re-introduce fully-fledged get_colorpixel function, which enables arbitrary
color depths for the display. The previous code is kept as an optimization for
the case of a true color display, where a X11 roundtrip is unnecessary.
Alex Auvolat [Mon, 28 Dec 2015 11:43:53 +0000 (12:43 +0100)]
Correct color management for pango fonts
Corrects the cases where the colorpixel is not 0xRRGGBB : we have to
use the full color_t struct to describe font colors, as Pango expects
RGB values and not an XCB colorpixel value.
Franz Thoma [Mon, 28 Dec 2015 18:38:17 +0000 (19:38 +0100)]
Comply with documentation: 'workspace' token in 'assign' command
According to the User's Guide [1], an `assign` command allows a
`workspace` token after the selector, as an alternative or in addition
to the unicode arrow `→`. In reality, however, the `workspace` token is
not recognized.
Example:
assign [class="Firefox"] workspace "1: Browser"
should assign Firefox windows to workspace `1: Browser`, but the the
browser window appears on a new workspace called
`workspace "1: Browser"` instead.
With this fix, both `→` and `workspace` are recognized (and ignored)
after the selector.
Ingo Bürk [Mon, 28 Dec 2015 03:11:51 +0000 (22:11 -0500)]
Validate matched containers for "kill" command correctly.
We now execute the validations when "kill" is executed even if match
criteria are used. This prevents users from killing workspace containers,
which instead kills all clients (as before when not using criteria).
Ingo Bürk [Mon, 28 Dec 2015 01:58:35 +0000 (20:58 -0500)]
Rename tree_close() to tree_close_internal().
It should be clear for callers of this function that this is an internal
function that skips certain validations which might be important. Therefore
we make it clear that this is an internal function by renaming it.
i3bar: explicitly set cursor using libxcursor if available
Even if the X11 root window cursor is not set up correctly for some
reason, with this fix, users should at least see the correct cursor when
the pointer is over i3bar.
This fixes race conditions, for example when i3bar gets reconfigured
after the available outputs change. In that specific case, i3bar sends a
ConfigureWindow request (see
https://github.com/i3/i3/blob/b5693d6fb33ad29337e4187a2db4a2618ea8fb4c/i3bar/src/xcb.c#L376)
which normally is turned into a ConfigureRequest that i3 largely
ignores, only the dock client’s height is considered (see
https://github.com/i3/i3/blob/b5693d6fb33ad29337e4187a2db4a2618ea8fb4c/src/handlers.c#L390).
Turning ConfigureWindow into ConfigureRequest is only done when the
SubstructureRedirect event mask is set, and because we temporarily
removed _all_ events from our mask, the ConfigureWindow request went
through unmodified.
This in turn lead to the i3bar client window (not its decoration frame)
being positioned at e.g. y=1304, whereas dock client windows should
always end up at x=0 y=0 within their decoration frame. The result of
the i3bar client window being out of the visible space was either a
black i3bar or graphics corruption.
This also fixes issue #1904, I think. I couldn’t reproduce issue #1904
specifically, but when i3bar is in the misconfigured state, it will
receive a VisibilityNotify event, telling i3bar that it is obscured.
This would explain why i3bar sent a SIGSTOP in issue #1904.
Ingo Bürk [Tue, 15 Dec 2015 12:38:56 +0000 (07:38 -0500)]
Match on all criteria even if con_id or con_mark are given.
Previously, if a match specification contained the con_id or con_mark criterion,
all other criteria were ignored. However, a user may want to specify one of
those two unique identifiers and still specify others as well, for example to
match the currently focused window, but only if it has a certain WM_CLASS:
Florian Merkel [Mon, 7 Dec 2015 11:34:24 +0000 (12:34 +0100)]
Support matching _NET_WM_WINDOW_TYPE_NOTIFICATION
This commit fixes #1969 by adding support for matching a window's type
against _NET_WM_WINDOW_TYPE_NOTIFICATION. The userguide and tests were
updated to reflect this change.
Ingo Bürk [Sat, 12 Dec 2015 20:45:59 +0000 (15:45 -0500)]
Allow mouse bindings to run on the root window.
Previously, mouse bindings could only be run when a window was present,
by using --whole-window. Such bindings would not work on empty
workspaces. However, this is a valid usecase for bindings like
bindsym $mod+button4 workspace prev
bindsym $mod+button5 workspace next
Hence, we need to grab the root window as well and run bindings on it.
Ingo Bürk [Wed, 9 Dec 2015 12:39:08 +0000 (13:39 +0100)]
Reject invalid match criteria with an error.
Previously, using a command like
[con_id=foo] kill
would kill the currently focused window because while an error for
not being able to parse the con_id was logged, no further action
was taken, which caused the criterion to be ignored. In this case,
the fallback behavior of using the focused window took over.
For con_id, id and window_type we now reject incorrect values with
an error and abort the command.
Ingo Bürk [Thu, 3 Dec 2015 17:59:35 +0000 (18:59 +0100)]
Fail gracefully when the gc cannot be created
We now only log an error but do not exit when creating the graphics
context fails. While, if this happens, rendering will likely be wrong,
this is still better than terminating the user's session entirely due
to a rendering problem, potentially causing data loss.
Ingo Bürk [Thu, 3 Dec 2015 17:57:02 +0000 (18:57 +0100)]
Cast unsigned to signed before comparison
The values of a Rect are unsigned, but can contain signed values.
Using MAX when the value is negative causes incorrect behavior and
makes the result stay negative, which is what we wanted to avoid here
in the first place.
Fix by properly casting the value for the comparison.
Ingo Bürk [Wed, 18 Nov 2015 14:32:45 +0000 (15:32 +0100)]
Make freeing surfaces idempotent
If a window with border is set to "border none" and then closed, we would
call cairo_destroy / cairo_surface_destroy twice, causing an assertion
failure in cairo as the objects already had zero references the second
time. We fix this by explicitly setting these objects to NULL.
Ingo Bürk [Tue, 17 Nov 2015 11:50:06 +0000 (12:50 +0100)]
Use 32-bit visual by default if available.
With this patch, we use 32-bit visuals per default whenever it is
available. Otherwise, we fall back to the actual root window's
depth, which will typically be 24-bit.
Before this patch, we already used 32-bit depth for containers with
a window that uses 32-bit. However, this means that we didn't use
32-bit for split parent containers on which decoration is drawn.
For 32-bit windows using transparency, this caused a graphical glitch
because the decoration pixmap behind it would show through. This
behavior is fixed with this change.
Ingo Bürk [Mon, 16 Nov 2015 22:40:41 +0000 (23:40 +0100)]
Don't create a pixmap for CT_ROOT and CT_OUTPUT containers.
Such containers never require a pixmap anyway. In particular for the __i3
output (used for the scratchpad workspace), this would cause an allocation
error anyway because it can be very big -- so big, in fact, that X cannot
allocate the pixmap for it.
Until now, this error was silently ignored due to the fact that we did not
create the pixmap checked (and asserted its success), but with cairo this
would cause a crash because we'd try to create a surface for a pixmap
which doesn't exist.
Ingo Bürk [Mon, 16 Nov 2015 22:03:39 +0000 (23:03 +0100)]
Parse colors as color_t instead of colorpixel.
With this patch we remove the temporary draw_util_colorpixel_to_color
function we introduced previously by parsing the colors as color_t to
begin with.
Ingo Bürk [Mon, 16 Nov 2015 20:28:33 +0000 (21:28 +0100)]
Skip drawing for uninitialized surfaces.
We return early from drawing functions if the surface to draw to is not
initialized properly. There is no immediate need to do so, at least no
crashes have been observed, but it mirrors the previous behavior a bit
more closely. Furthermore, i3 should not crash due to not being able to
make some rendering call, so this provides some stability.
Ingo Bürk [Mon, 16 Nov 2015 20:26:06 +0000 (21:26 +0100)]
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.
Ingo Bürk [Sun, 15 Nov 2015 16:25:12 +0000 (17:25 +0100)]
Fix draw_util_copy_surface.
This patch fixes a bug when copying one surface to another.
Since it only exposes itself when used with non-trivial source
coordinates, it didn't surface before when only used for i3bar.
Ingo Bürk [Wed, 11 Nov 2015 22:39:15 +0000 (23:39 +0100)]
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.
Tony Crisci [Sun, 22 Nov 2015 18:32:21 +0000 (13:32 -0500)]
Bug: parse con_id base 16
Mouse bindings that target the window that was clicked send the command
to the parser with `con_id` of the clicked window serialized base 16
for compatability with FreeBSD. See 7c2842e for explaination.
Set base to 0 for strtol to handle base 16 numbers for that reason.
This allows mouse bindings that target specific windows to work
correctly. Without this change, the focused window is always targetted
rather than the window that was actually clicked.
Ingo Bürk [Fri, 20 Nov 2015 23:19:49 +0000 (00:19 +0100)]
Support _NET_WM_USER_TIME.
With this patch, we support the special value "0" for _NET_WM_USER_TIME
on a window upon managing it, which indicates that the window shall not
be focused.
That commit accidentally defaulted to group mask 1, but the default
should be to match any group mask, so that having multiple layouts
loaded at the same time works.
Ingo Bürk [Wed, 11 Nov 2015 19:40:25 +0000 (20:40 +0100)]
Only grab scrollwheel buttons if necessary.
With this patch, we only grab the scrollwheel buttons (4 and 5) when
managing a window if a whole window key binding exists for these buttons.
This allows both of these usecases:
- Bindings to scrollwheel buttons using --whole-window (see #1701).
- Scrolling in a window without focusing it if no such binding
exists (see #2049).
Furthermore, we drop all button grabs and regrab them after a config
reload in order to reevaluate the new bindings correctly.
Ingo Bürk [Wed, 11 Nov 2015 19:21:26 +0000 (20:21 +0100)]
Extract function to grab buttons when managing a window.
We refactor the button grabbing into a function to allow the next patch
both to
- conditionally grab different sets of buttons
- grab the buttons again when reloading the config.
Ingo Bürk [Mon, 2 Nov 2015 14:11:21 +0000 (09:11 -0500)]
Raise dependency to cairo 1.14.4.
With the recent cairo bugfix, we can now switch to using cairo for
rendering i3bar per default by raising the minimum version of cairo
to 1.14.4, if this cairo version is available.
Ingo Bürk [Mon, 2 Nov 2015 14:21:43 +0000 (09:21 -0500)]
Remove autostart commands after they have been executed.
As there is no need to keep autostart commands in memory, we can safely
remove them as soon as they have been executed. As we previously didn't
clear them at all during config reloads, this also fixes a memory leak.
Note that neither autostarts nor autostarts_always is executed during
config reloads, so removing them from memory is fine as an i3 restart
will cause them to be parsed again.
hwangcc23 [Mon, 2 Nov 2015 14:12:44 +0000 (22:12 +0800)]
Fix config validation fail when no new line from end of file
1. i3 config validation failed when the new line is missing from the end of file.
The error was: "ERROR: Your line continuation is too long, it exceeds 4096 bytes".
It is wrong to assume that there is always a '\n' at the end of each line in the config file.
(Not for the last line.)
Fix it via adding a end-of-file check.
2. See the issue #2051. (https://github.com/i3/i3/issues/2051)
Ingo Bürk [Fri, 16 Oct 2015 09:34:19 +0000 (11:34 +0200)]
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.