Commit Graph

2470 Commits (f904511b7ec51fc6e8adcf97fef2a7d39049a965)

Author SHA1 Message Date
Michael Stapelberg f904511b7e con_get_tree_representation: fix memory leak 2016-01-09 17:06:58 +01:00
Michael Stapelberg feef3ea78a window.c: fix memory leak 2016-01-09 17:06:58 +01:00
Michael Stapelberg e7f1476180 reload: fix memory leak 2016-01-09 17:06:54 +01:00
Michael Stapelberg 79594398e2 commands.c: fix memory leak 2016-01-09 13:39:00 +01:00
Michael Stapelberg ada71471c1 x.c: fix memory leak 2016-01-09 13:13:57 +01:00
Michael Stapelberg 71476b03e3 log.c: fix memory leak 2016-01-09 13:11:03 +01:00
Michael Stapelberg 6f53dc01ef tree_restore(): fix memory leak 2016-01-09 12:50:38 +01:00
Michael Stapelberg 9eba061ed3 fix memory leak: free(pointerreply); 2016-01-09 12:07:47 +01:00
Michael Stapelberg de035cab6d ipc: fix memory leak when clients with subscriptions disconnect 2016-01-08 21:24:21 +01:00
Michael Stapelberg 287ebcc206 ipc: fix cosmetic memory leak when shutting down 2016-01-08 21:24:12 +01:00
Michael Stapelberg 08976f7a2a con_mark: fix heap-use-after-free 2016-01-08 20:41:09 +01:00
Michael Stapelberg 0d1aad0af4 rename workspace: fix heap-use-after-free 2016-01-08 20:21:54 +01:00
Ingo Bürk bcee585e17 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.

fixes #2149
2016-01-06 09:19:42 -05:00
Michael Stapelberg 3853d1866b Merge pull request #2143 from Airblader/feature-2120
Allow title_format for all containers
2016-01-05 22:32:15 +01:00
Ingo Bürk 1f660a4cc4 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.

fixes #2120
2016-01-05 12:22:27 -05:00
Lauri Tirkkonen 034a12acad add decoration_border color for the actual client borders
see https://github.com/i3/i3/pull/2136
2016-01-05 12:17:48 +02:00
Ingo Bürk 6fefe836d4 Fix memory leaks in title_format.
This fixes three memory leaks that were found during the implementation of #2120
so that they can be fixed in a bugfix release.

relates to #2143
2016-01-04 18:48:01 -05:00
Johannes Lange 8bfd06c3dd added "toggle" option to "split" command
as requested in #1814
2016-01-04 17:31:47 +01:00
Alex Auvolat c6a4e4519f 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.
2015-12-29 14:26:21 +01:00
Alex Auvolat 19fd6817af Refactor extern definition of conn and root_screen 2015-12-29 12:47:12 +01:00
Michael Stapelberg bc126aaeaf Merge pull request #2134 from Airblader/bug-1761
Properly validate containers when killing via criteria
2015-12-29 11:50:58 +01:00
Ingo Bürk 19c273a2ad 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).

fixes #1761
2015-12-28 02:35:25 -05:00
Ingo Bürk 0dd71674de 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.

relates to #1761
2015-12-27 20:58:35 -05:00
Ingo Bürk 61a8bc81ec Move urgent flag before killing the parent.
We need to move the urgent flag when moving a container across
workspaces before calling on_remove_child on the parent in order
to avoid a crash.

fixes #2128
2015-12-27 18:08:30 -05:00
Michael Stapelberg dc463077d6 Merge pull request #2113 from Airblader/bug-2111
Match on all criteria even if con_id or con_mark are given.
2015-12-25 17:14:29 +01:00
Michael Stapelberg 0ebb4b2005 make: should be XCB_CURSOR, not XCURSOR
After all, we’re not using libXcursor, but libxcb-cursor :).
2015-12-25 16:37:44 +01:00
Michael Stapelberg 019ae6d06c Bugfix: don’t remove SubstructureRedirect event mask temporarily
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
b5693d6fb3/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
b5693d6fb3/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.

fixes #1904
2015-12-22 22:33:37 +01:00
Ingo Bürk 68e3cb8ab7 Don't force base 10 for parsing id. 2015-12-17 09:43:34 -05:00
Ingo Bürk bba18453af 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:

    [con_id=__focused__ class=special] kill

We now check all specified criteria.

fixes #2111
2015-12-17 08:56:05 -05:00
Michael Stapelberg af49a8cd0d Merge pull request #2102 from ccryx/next
Add support for _NET_WM_WINDOW_TYPE_NOTIFICATION
2015-12-16 08:58:59 +01:00
Florian Merkel 33f017daa9 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.
2015-12-15 21:55:33 +01:00
Ingo Bürk 905bca3531 Avoid rendering the tree twice in a row
The callee already renders the tree if necessary, so despite the documentation
of the function, doing it again on the caller side is unnecessary.
2015-12-15 13:59:50 -05:00
Ingo Bürk 6f12f029f4 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.

fixes #2097
2015-12-14 16:26:36 -05:00
Michael Stapelberg 8e081d7fff Merge pull request #2105 from Airblader/bug-2099
Reject empty swallow definitions
2015-12-14 20:48:49 +01:00
Ingo Bürk e3a5c004d3 Reject empty swallow definitions
Empty swallow definitions don't make sense and can lead to crashes,
for that reason we reject them.

fixes #2099
2015-12-11 20:28:13 +01:00
Ingo Bürk 8d36f78b8e 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.

fixes #2091
2015-12-09 14:00:53 +01:00
Michael Stapelberg 04be42f7cd Merge pull request #2095 from Airblader/bug-2090
Allow "move position center" to operate on matched windows
2015-12-04 09:02:51 +01:00
Ingo Bürk 256007442f 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.

fixes #2094
2015-12-03 18:57:02 +01:00
Ingo Bürk caeb193a6c Allow "move position center" to operate on matched windows
Moving windows to the center previously did not consider command criteria.
We now operate on matched windows as for other commands.

fixes #2090
2015-12-03 13:24:39 +01:00
Ingo Bürk 780cb8d15d 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.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk d2126027ce 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.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk a4afd1b642 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.

relates to #1278
2015-11-23 22:18:02 +01:00
Ingo Bürk fdeb4e0c36 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.

relates to #1278
2015-11-23 22:18:02 +01:00
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
Tony Crisci 8f90b8448b 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.

Regression introduced in b744c5e.
2015-11-22 13:32:21 -05:00
Ingo Bürk 00881bb156 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.

fixes #2064
2015-11-21 22:48:48 +01:00
Michael Stapelberg b255d140be Merge pull request #2061 from Airblader/bug-2049
Only grab scrollwheel buttons if necessary
2015-11-16 00:49:27 -08:00
Michael Stapelberg e48c4cd257 Revert "Bugfix: set group mask 1 by default, correctly compare modifiers"
This reverts commit 9692c1498b.

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.

fixes #2062
2015-11-16 09:00:27 +01:00
Ingo Bürk 029d78c0bf 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.

fixes #2049
2015-11-15 22:08:47 +01:00
Ingo Bürk 66882bf445 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.

relates to #2049
2015-11-11 20:21:26 +01:00