Commit Graph

3047 Commits (10646eb0021403c1f1448339603b24c50da0e604)

Author SHA1 Message Date
Orestis Floros a84b30f8a9
randr.c: Fix regression with focusing NULL container
This was introduced in db3b9e4187 which
removed the NULL check for next.

Fixes #3523.
2018-11-15 13:49:26 +02:00
Orestis Floros d2d6d6e0a8
Re-render floating cons alone when possible 2018-11-12 19:05:51 +02:00
Orestis Floros 100d05a2a6
render_con: Get rid of render_fullscreen argument
Only true for the fullscreen container and doesn't affect any of its
children. Thus, we can get the same result by checking
->fullscreen_mode.
2018-11-12 19:05:50 +02:00
Orestis Floros 29f2510fa9
Fix aspect ratio bugs
- ICCCM says: > If a base size is not provided, the minimum size is to
be used in its place and vice versa.
i3 didn't obey the "vice versa" part. Min size and base size are both
saved without replacements in window_update_normal_hints,
floating_check_size makes the needed replacements if either was not
provided.
- Aspect ratio is now saved correctly in manage_window because
window_update_normal_hints is called.
- i3 didn't save the aspect ratio if the window conformed the given
aspect ratio range when handle_normal_hints was called. If the window
was resized to a size outside of the given bounds, i3 didn't correct it.
- Aspect ratio now affects only tiling windows, like the rest of the
normal size hints
- The aspect ratio calculation is now done without a loop

A real life example of how these changes affect the workflow:
An mpv window, when playing a video, sets its min == max aspect ratio
during mapping. i3 ignored these hints. When resized, the window's
aspect ratio was not preserved. With this commit, resizing floating mpv
windows will always preserve the aspect ratio.
2018-11-12 18:45:00 +02:00
Orestis Floros f397698d43
floating_resize: Use uint32_t 2018-11-12 18:45:00 +02:00
Orestis Floros 01960f956f
floating_check_size: Use window variable 2018-11-12 18:44:45 +02:00
Ingo Bürk 90c39a4bf6
Merge pull request #3484 from xzfc/3476-export-i3sock
Export I3SOCK
2018-11-10 22:12:01 +01:00
Ingo Bürk 56bb806b52
Merge pull request #3397 from orestisf1993/randr-enable-disable
Fix bugs in enabling & disabling randr outputs
2018-11-10 21:56:34 +01:00
Orestis Floros 11bc25b70b
Truncate wm_name utf8 strings to first zero byte
Fixes #3515
2018-11-09 19:42:32 +02:00
aksel bbfa140c0f For resizing, convert pixel diff to percentage, based on parent.
Previously, it first calculated one of the containers' next percentage, and then subtracted the previous percentage to find the actual change.

Now it directly calculates the change, and subtracts and adds the change to the two affected containers.

Added util function con_rect_size_in_orientation.

Removed px_resize_to_percent; inlined, using con_rect_size_in_orientation.

Also, prematurely return when pixel diff is 0, as no action is necessary.

This is related to [this issue on i3-gaps](https://github.com/Airblader/i3/issues/247).
2018-11-08 23:15:23 +01:00
Ingo Bürk 44e8fddc28
Merge pull request #2954 from orestisf1993/swap-for-floating
Rewrite con_swap to work only with queue operations
2018-11-07 13:13:41 +00:00
Orestis Floros eb53ec83b9
load_layout: Correctly mark non-leaf containers
Example problematic layout:
    {
        "layout": "splith",
        "marks": ["H1"],
        "nodes": [
            {
                "swallows": [
                    {
                        "class": "^a$"
                    }
                ]
            }
        ]
    }

Since the marks were added to the json_node during end_map, the
container that ended up getting the "H1" mark was the child instead of
the parent.
2018-11-07 02:32:12 +02:00
Albert Safin 7926c817a2 Draw outer header borders for all layouts 2018-11-05 20:17:01 +07:00
Orestis dc16df439e Update ewmh focused only when new focus is different (#3496)
Fixes #3495.
2018-11-03 13:39:49 +01:00
Michael Stapelberg eedb257655 switch to clang-format-4.0
clang-format-3.8 is old enough to have vanished from Debian testing, which we
use for our CI.
2018-11-03 09:16:16 +01:00
Orestis Floros 64c493ef1f
Fix regression with moving floating windows
This fixes a regression introduced in 6d983b5. Consider 2 outputs:
fake-0: workspace '1'
fake-1: workspaces '2','3'
Workspace 1 focused, workspace 2 visible.
Open a floating window in 1 and move it to 3. Now, the floating window
appears in workspace 2 and disappears once focus is switched to
that workspace.

Instead of focusing 'old_focus' which might refer to a container in a
different output, we should restore focus by focusing the previously
focused workspace of the output.
2018-10-29 15:46:28 +02:00
Albert Safin aa20358620 Export I3SOCK (#3476) 2018-10-26 15:40:59 +07:00
Ingo Bürk 64e7646c7e
Merge pull request #3452 from orestisf1993/title_align
Add title_align config directive
2018-10-23 16:41:54 +02:00
Ingo Bürk 0ed29f5678
Merge pull request #3448 from orestisf1993/sticky
Fix sticky focus when switching to workspace on different output
2018-10-23 15:31:57 +02:00
Ingo Bürk 74a7bf31a5
Merge pull request #3444 from orestisf1993/move
Some move.c fixes
2018-10-23 15:29:48 +02:00
Orestis Floros 07dfb8450b
Fix typo: childs -> children 2018-10-13 21:10:11 +03:00
Orestis Floros 204eefc679
floating_reposition: avoid extra tree_render 2018-10-13 21:10:11 +03:00
Orestis Floros 8c17e4e38d
manage_window: cleaner variable declarations 2018-10-13 21:10:10 +03:00
Orestis Floros 966915cfb2
borders_to_hide doesn't need to be initialized 2018-10-13 21:10:10 +03:00
Orestis Floros 4219eb213b
root is externally declared 2018-10-13 21:10:10 +03:00
Orestis Floros e4d2b38552
Make comment style more consistent 2018-10-13 21:10:10 +03:00
Orestis Floros a65914f338
Fix missing prototypes
i3 will now compile with no warnings when -Wmissing-prototypes is used.
2018-10-13 21:10:10 +03:00
Orestis Floros 2a9522dda4
Enforce strict prototypes
i3 will now compile with no warnings when -Wstrict-prototypes is used.
2018-10-13 21:10:09 +03:00
Orestis Floros a15fff2370
Use path_exists 2018-10-13 21:10:09 +03:00
Orestis Floros 50880db2c5
Reduce some code around frees 2018-10-13 21:10:09 +03:00
Aestek 6d82753d53
Add title_align config directive
Controls the window titles alignment in title bars. Possible values are:
- left
- center
- right

Co-authored-by: Orestis Floros <orestisf1993@gmail.com>
- Made title_align a config directive instead of a command. Helps with
some tree_render() issues we had.
- Made title_max_width the same for all 3 cases.
- Modified title offset calculations and added explanations for each
case.
- Append title_padding to mark_width if a mark exists.

Fixes #1750
2018-10-12 19:58:48 +03:00
Orestis Floros b09090fa7d
Fix sticky focus when switching to workspace on different output
See the testcase for the exact steps to reproduce the problem.
2018-10-11 12:27:57 +03:00
Orestis Floros 6728696ec8
output_push_sticky_windows: Make a bit easier to understand 2018-10-11 12:27:56 +03:00
Orestis Floros 8e1687a317
Rewrite con_swap to work only with queue operations
Benefits are that we don't open a fake container and don't call many
complicated functions that can lead to redraws (x_push_changes calls) as
discussed in #2954.

Fixes #2810:
Windows exchange floating mode & window rects.
Swap will still not work with CT_FLOATING_CONs but this doesn't make
much sense.

Fixes #3280:
The behaviour is not very user friendly but swap behaves exactly as it
should. The rest is a tree_flatten issue. Attached pictures in #2954.
2018-10-10 17:09:26 +03:00
Orestis Floros 11dd2dbc66
tree_move: Don't change focus order when swapping containers
The call to ewmh_update_wm_desktop is removed since the change happens
under the same parent.
2018-10-09 22:39:38 +03:00
Orestis Floros 9380a75186
move.c: Fix move_to_output_directed problems
- Use workspace_show that correctly updates _NET_CURRENT_DESKTOP, warps
mouse.
- Use TAILQ_INSERT_TAIL only for focus_head. Focus order is not related
to direction.
- Call con_focus only if con was focused before. See testcase for
directional move with command criteria.
- Correct first call of move_to_output_directed in tree_move which
didn't call ipc_send_window_event("move", con) and
ewmh_update_wm_desktop().
- Don't produce events when the move doesn't happen. Correct
276-ipc-window-move.t as well.
2018-10-09 22:35:04 +03:00
Orestis 18dbfe699a userguide: Mention know issues for assign (#3434)
Fixes #3222
Fixes #3293
Related to #2060
2018-10-07 20:24:09 +02:00
Thomas Fischer 0ede8b9365 Correctly calculate max_aspect 2018-09-28 17:34:18 -07:00
Ingo Bürk ebf40889a1
Merge pull request #3424 from orestisf1993/con_num_windows
con_num_windows: Count floating windows
2018-09-28 09:27:58 +02:00
Orestis Floros 5e1d327e43
con_num_windows: Count floating windows
Fixes #3423.
2018-09-26 20:04:17 +03:00
Dan Elkouby 6877205ac1 Reject requests for WM_STATE_ICONIC
For compatiblity reasons, Wine will request iconic state and cannot
ensure that the WM has agreed on it; immediately revert to normal to
avoid being stuck in a paused state.
2018-09-25 15:04:55 +03:00
Orestis 7c21b5995d
Merge pull request #3400 from Synray/next
Respect max size from WM_NORMAL_HINTS
2018-09-20 11:36:22 +03:00
Thomas Fischer 690e6d1f0e
Respect max size in WM_NORMAL_HINTS 2018-09-20 11:31:19 +03:00
Orestis Floros 515dd45f59
match_matches_window: Check if focused->window exists
Fixes #3406.
2018-09-16 14:55:27 +03:00
Orestis Floros d407393d0d
_con_move_to_con: Move upwards only on CT_FLOATING_CON
If target is inside a floating container but not its direct child, the
move can be completed as is.

Fixes #3402.
2018-09-14 16:13:41 +03:00
Ingo Bürk ede954128a
Merge pull request #3342 from orestisf1993/tree_close_internal
Simplify tree_close_internal
2018-09-14 12:24:54 +02:00
Orestis Floros f6bb1e22bb
init_ws_for_output: Remove content argument 2018-09-12 16:53:20 +03:00
Orestis Floros 5976381012
output_init_con: Restore focus if possible
Before this, i3 would focus newly created workspaces on output init
2018-09-12 16:47:18 +03:00
Orestis Floros db3b9e4187
randr_disable_output: Always restore focus
con_detach and con_attach modify the focus stack.

This will make sure that the currently focused workspace will remain
focused after disabling an output.
2018-09-12 16:46:47 +03:00
Orestis Floros 4d21f4cfc2
init_ws_for_output: use workspace_move_to_output
This fixes a crash produced with the following config:
    # i3 config file (v4)
    workspace 1 output $screen1
    workspace 2 output $screen2

    exec --no-startup-id "i3-msg workspace 1, open && i3-msg workspace 2 && xrandr --output $screen2 --off && xrandr --output $screen1 --auto --output $screen2 --auto --right-of $screen1 "

Which results in:
ERROR: AddressSanitizer: heap-use-after-free on address …
READ of size 8 at 0x614000001f48 thread T0
    #0 0x5563df6e73a8 in init_ws_for_output i3/src/randr.c:468
    #1 0x5563df6ef3b4 in randr_query_outputs i3/src/randr.c:940
    #2 0x5563df68dbe1 in handle_screen_change i3/src/handlers.c:450

… is located 264 bytes inside of 448-byte region …
freed by thread T0 here:
    #1 0x5563df634b0a in con_free i3/src/con.c:96
    #2 0x5563df7151e6 in tree_close_internal i3/src/tree.c:344
    #3 0x5563df7280fe in workspace_show i3/src/workspace.c:499
    #4 0x5563df6e7315 in init_ws_for_output i3/src/randr.c:457
    #5 0x5563df6ef3b4 in randr_query_outputs i3/src/randr.c:940
    #6 0x5563df68dbe1 in handle_screen_change i3/src/handlers.c:450

Which is similar to #3228, #3248.
2018-09-12 16:46:47 +03:00
Orestis Floros e67be1ccd3
commands.c: Improve error replies
- Improve / add various error messages.
- Replace all `LOG(…); ysuccess(false);` with `yerror(…);`.
- switch_mode: Remove redundant "ERROR:" ELOG string.
- cmd_move_con_to_workspace*: Make sure that we don't try to move an
empty workspace to another workspace. This can be problematic when we
match a workspace using command criteria (eg marks) and the target is a
non-existing workspace. We create the new workspace but since nothing is
moved there, we are left with an empty workspace. See added testcase.
2018-09-11 08:35:58 +03:00
Orestis Floros 6a1f653508
libi3: validate UTF8 strings
Will validate container / window titles.

Fixes #3156.
2018-09-10 02:00:32 +03:00
Orestis Floros a3dcee35f3
tree_restore: Check croot
Related to #2414, #3156.
2018-09-09 16:11:48 +03:00
Orestis Floros be6faa3161
tree_append_json: Allow strings that are not valid UTF8
Fixes #3156.

I couldn't reproduce the problem in a "natural" way so I cheated:
1. Start i3 with gdb
2. Set breakpoing on tree_restore
3. Run, open window, i3-msg restart
5. Open the file in *path with a hex editor
6. Edit the "name" field of the window and insert bytes that are not
valid UTF8
7. Continue

After parsing fails, all nodes including croot are incomplete, meaning
they have to be deleted. We can't recover in any reasonable way so we
have to allow non-UTF8 characters to avoid this situation altogether.
2018-09-06 14:58:31 +03:00
Orestis Floros e8d2b9b7b5
tree_append_json: don't focus freed container 2018-09-06 14:48:21 +03:00
Ingo Bürk cb6da7169a
Merge pull request #3389 from orestisf1993/resize-ensure-1px
Ensure containers have a size of at least 1px after resize
2018-09-06 08:41:00 +02:00
Ingo Bürk 9edb7c7a3b
Merge pull request #3390 from orestisf1993/resize-tile
resize set for tiling: default to px when not specified
2018-09-06 08:38:53 +02:00
Orestis Floros 64142eeef2
resize set for tiling: default to px when not specified 2018-09-06 05:58:51 +03:00
Orestis Floros 23c1c13d34
Ensure containers have a size of at least 1px after resize
Fixes #2226.
Fixes #2776.
Fixes #3241.
Related to #3194.
2018-09-06 04:56:31 +03:00
Orestis Floros 6846ac98c0
cmd_rename_workspace: correct order of events
1. Rename happens
2. Workspace is moved because of assignments
3. Workspace closes because it is empty (#3248)

Fixes #3248.
2018-09-06 03:42:07 +03:00
Ingo Bürk 9595263142
Merge pull request #3376 from orestisf1993/floating-disable-scratchpad
Don't disable floating in internal workspaces
2018-08-28 13:30:57 +02:00
Orestis Floros 9718e38a7a
Don't disable floating in internal workspaces 2018-08-28 11:26:20 +03:00
Orestis Floros 37b879f4ad
ipc_client_timeout: Fix build when not on linux
Also moved the 'end' label because it is unused otherwise.

Reported here: https://github.com/Airblader/i3/issues/233
2018-08-27 22:21:59 +03:00
Ingo Bürk 4cba9fcbda
Merge pull request #3368 from orestisf1993/render_root
(floating) global fullscreen bugs & others
2018-08-24 09:49:41 +02:00
Orestis Floros 096cff0aad
Make resize set ppt more accurate
See the testcase for the usecase.
2018-08-24 04:13:25 +03:00
Orestis Floros 51d230ad4c
Make resize set px work with tiling containers 2018-08-24 04:13:25 +03:00
Orestis Floros 423e20b960
cmd_resize* statics: remove useless 'way' argument 2018-08-24 04:13:25 +03:00
Orestis Floros 26bbaf6237
Make cmd_resize_tiling_width_height work with pixels 2018-08-24 04:13:25 +03:00
Orestis Floros 2ead7745d6
Make cmd_resize_tiling_direction work with pixels
Introduces resize_neighboring_cons in resize.c which is also used by
resize_graphical_handler.

Co-authored-by: Andrew Laucius <andrewla@gmail.com>
Authored original code and tests in #3240. I rewrote most of the
resizing code and fixed the failing tests.
2018-08-24 04:13:03 +03:00
Orestis Floros ea43507bed
precalculate_sizes: don't malloc needlessly 2018-08-24 04:12:24 +03:00
Orestis Floros 7b9318a541
precalculate_sizes: round sizes instead of flooring them
This will lead to more accurate and consistent container sizes.

Needed to fix the failing test of #3240.
2018-08-24 04:12:14 +03:00
Orestis Floros db294f4505
Improve resize_graphical_handler code style
- int return type is not useful
- Consistent comment style
2018-08-23 22:04:22 +03:00
Orestis Floros 9522b46f1b
Introduce parse_direction
Also fixes the following bug: in the fix for #1011 in
cmd_resize_floating direction "width" is not considered.

Influenced by #3240.
2018-08-23 15:45:24 +03:00
Orestis Floros 6e1b79e057
Introduce orientation_from_direction 2018-08-23 15:36:23 +03:00
Orestis Floros e6202d43f5
Apply compatible changes from clang-format 6.0.1
These are the changes that clang-format 6.0.1 makes to the codebase that
clang-format-3.8 doesn't change back.

Useful for those that use a more recent version of clang-format in their
local machines.
2018-08-22 14:51:17 +03:00
Orestis Floros e1a83d057f
handle_configure_request: check for scratchpad once 2018-08-22 14:23:01 +03:00
Orestis Floros 9190a9ab70
handle_configure_request: use 'goto out' 2018-08-22 14:11:26 +03:00
Orestis Floros 9ae84593ba
handle_configure_request: reuse 'workspace' variable 2018-08-22 14:10:42 +03:00
Orestis Floros 0ac75bea5a
con_border_style: check con->fullscreen_mode directly 2018-08-22 14:09:05 +03:00
Orestis Floros efc78de4ee
Introduce con_get_fullscreen_covering_ws
This commit will also fix the following bugs:
1. click.c: Users could drag global fullscreen floating containers.
2. render.c: Floating containers would get rendered with a global fullscreen container in another
workspace.
2018-08-22 14:05:50 +03:00
Orestis Floros b3e69ed12a
render_root: fix popup_during_fullscreen logic
The first issue is that there seems to be a typo: fullscreen->window
should have been child->window. The corrected check is redundant since
the while loop checks if the transient_con has a window.

The second issue is that popup_during_fullscreen is never checked even
though the behaviour should be exclusive to the "smart" option.
2018-08-22 03:45:35 +03:00
Ingo Bürk 2f3c8b6484
Merge pull request #3365 from orestisf1993/DRAG_REVERT
floating_drag_window: return on DRAG_REVERT
2018-08-21 20:39:26 +02:00
Ingo Bürk e906cdad66
Merge pull request #3366 from orestisf1993/NUM_HANDLERS
property_notify: use NUM_HANDLERS
2018-08-21 20:38:31 +02:00
Orestis Floros 2c78f2458c
Call dragloop callback on DRAG_SUCCESS
A race condition is possible. For example, if we first receive a
XCB_MOTION_NOTIFY event and then, while drain_drag_events is still
running, a XCB_BUTTON_RELEASE event the first event is never handled
because we return.

This fixes the flakiness of the tests in #3085.
2018-08-21 21:19:57 +03:00
Orestis Floros 5d89bd344f
floating_drag_window: return on DRAG_REVERT
Right now tree_render() is called twice on DRAG_REVERT since
floating_reposition calls it.
Also, on DRAG_REVERT the scratchpad state shouldn't change since the
user canceled the action.
2018-08-21 21:06:00 +03:00
Orestis Floros b1aa2fb1c4
property_notify: use NUM_HANDLERS 2018-08-21 21:04:46 +03:00
Ingo Bürk e8dee4308a
Merge pull request #3364 from orestisf1993/warp-randr_query
randr_query_outputs: con_activate -> workspace_show
2018-08-17 11:55:15 +02:00
Orestis Floros 789a09a6e7
Use con_focus instead of con_activate for workspace 2018-08-17 12:49:34 +03:00
Orestis Floros ba29290123
Typo: output -> content 2018-08-17 12:49:34 +03:00
Orestis Floros 7010644964
randr_query_outputs: con_activate -> workspace_show
workspace_show will call x_set_warp_to if needed.

Fixes #3333
2018-08-17 12:49:15 +03:00
Orestis Floros cac28b69d4
Call con_activate after moving scratchpad window to current ws
Fixes #3361
2018-08-17 12:34:20 +03:00
Orestis Floros 01e971b51e
Free ws_assignments on reload
This fixes an unreported bug where deleting a workspace assignment and
reloading the config file would keep the assignment.
2018-08-09 17:28:05 +03:00
Orestis Floros 37d0105c83
Kill misbehaving subscribed clients instead of hanging
This change only affects clients that are subscribed to events, which
should be the main cause of our problems.

In the common case (no buffered data) the behaviour doesn't change at
all: the message is sent directly, no ev_io / ev_timeout callback is
enabled. Once a write to a client's socket is not completed fully
(returns with EAGAIN error), we put the message in the tail of a queue
and init an ev_io callback and a corresponding timer. If the timer is
triggered first, the socket is closed and the client connection is
removed. If the socket becomes writeable before the timeout we either
reset the timer if we couldn't push all the buffered data or completely
remove it if everything was pushed.

We could also replace ipc_send_message() for all client connections in
i3, not just those subscribed to events.

Furthermore, we could limit the amount of messages stored and increase
the timeout (or use multiple timeouts): eg it's ok if a client is not
reading for 10 seconds and we are only holding 5KB of messages for them
but it is not ok if they are inactive for 5 seconds and we have 30MB of
messages held.

Closes #2999
Closes #2539
2018-08-08 19:14:56 +03:00
Orestis Floros b0bbe53d04
Introduce free_ipc_client 2018-07-31 14:39:07 +03:00
Orestis Floros f908403376
Simplify tree_close_internal
This commit makes multiple changes in tree_close_internal. I didn't
split them because they are not completely independent.

- Remove force_set_focus parameter
This parameter was always set to `false` throughout the code base except
for one case where it was set to `(con == focused)`, when killing a
floating con's parent (the one with type CT_FLOATING_CON). But this case
is not needed anymore since the special handling of CT_FLOATING_CONs in
con_next_focused was removed in #2941.
- Assume that con_next_focused does not returned a container of type
CT_DOCKAREA. This is reasonable since con_next_focused uses the
focus_head stack and has special handling of CT_DOCKAREA containers.
- Remove is_mapped
This variable was only used in the if block towards the end of
tree_close_internal. Ignoring the, now removed, dockarea code and the
use of force_set_focus this block performed only one useful action:
focus the `next` container when `con == focused`. `con == focused` was a
necessary and sufficient condition for the con_activate call:
if `con != focused` we could reach the inner if blocks because of the
other conditions but would never focus another container. If `con ==
focused` then all other conditions would be irrelevant.
- Remove special handling of floating containers
Since the `next` focused container is calculated through the parent for
floating containers, I moved this code to con_next_focused.
Also, because of the removal of force_set_focus, it appears that we can
call con_on_remove_child for floating containers as well.
2018-07-30 19:41:24 +03:00
Ingo Bürk a1351138d1
Merge pull request #3254 from orestisf1993/issue-555
Multiple assignments of workspaces to outputs (#555)
2018-07-12 16:18:13 +02:00
Orestis Floros bce088679a
Allow multiple assignments of workspaces to outputs
Also makes get_assigned_output work with the primary output:
    workspace X output primary
will now work.

Fixes #555.
2018-07-12 17:07:01 +03:00
Orestis Floros d1652ca7cd
cmd_rename_workspace: always call con_focus
This was introduced in 252db3b8c (#3245). That commit moved the
con_activate line inside the loop, meaning it wouldn't always be called.

When the mouse moved after a rename with focus_follows_mouse enabled,
check_crossing_screen_boundary (src/handlers.c:111) called
con_descend_focused that used the wrong focus order.

I also change con_activate to con_focus since we don't really want to
raise floating containers there.

Fixes #3325
2018-07-12 03:42:38 +03:00
Orestis Floros fd70ea6b31
Correct XDG paths precedence for config files
Fixes #3323
2018-07-10 05:04:34 +03:00
Orestis Floros d525eb80ae
Use get_assigned_output for numbers
This prohibits the usage of workspaces assigned to other outputs in
create_workspace_on_output.

Eg, with config:
    workspace 1 output fake-0
    workspace 2 output fake-0
and 2 screens workspace 2 would be used for the second screen even
though it is assigned to the first one.

Also introduces a test for workspace assignments that includes the case
described above and some tests that don't fail in the next branch.
2018-06-27 14:56:50 +03:00
Orestis Floros bc439de755
Introduce get_assigned_output
This also replaces code in create_workspace_on_output() that is
theoretically more efficient but:
1. It isn't a huge difference since it depends on the number of outputs,
that shouldn't be high.
2. get_assigned_output will be modified and used for #555, then its
logic should be followed in create_workspace_on_output() too.

Another note for create_workspace_on_output: if assigned is not NULL the
condition (assigned != output->con) should never be false, ie if there
is an assigned output to this name, it isn't the current one. This
happens because the current callers check for assignments before calling
create_workspace_on_output().
2018-06-27 14:56:31 +03:00
Ingo Bürk 6339427f01
Merge pull request #3179 from orestisf1993/issue-2733
Correctly handle bindings for the same key with and without --release
2018-06-22 14:39:02 +02:00
Łukasz Adamczak 606050a700 Consider rect changed when its position changes 2018-06-22 12:34:11 +02:00
Orestis Floros b87bc70cd6
Enable detectable autorepeat
https://www.x.org/releases/current/doc/kbproto/xkbproto.html#Detectable_Autorepeat

Detectable autorepeat should only affect --release bindings. Currently,
when a user keeps a key pressed, we get multiple KeyPress and KeyRelease
events. With this change, we still get multiple KeyPress events, which
means that you can still keep a key pressed to repeatedly execute a
normal binding, but only one KeyRelease event when the key is physically
released.

Unfortunately, this change is not currently testable because detectable
autorepeat doesn't seem to work under Xephyr. AwesomeWM experienced the
same problem:
6f2424e901

Fixes #3306
2018-06-15 13:56:31 +03:00
Orestis Floros 5ab8c766c4
Fix link
Equivalent from the same version:
https://cgit.freedesktop.org/xorg/xserver/tree/xkb/xkbEvents.c?h=xorg-server-1.17.2#n927
2018-06-07 23:07:16 +03:00
Dan Elkouby 7ac37d8ae4 Reframe swallowed windows if depth doesn't match
X will not allow a window with ParentRelative background to be created
or reparented under a window with mismatching color depth.
Deal with this by destroying the container frame and creating a new one
with the right depth upon swallowing.
Defer destruction of the frame window until after the updated tree has
been rendered to avoid some distracting flickering.

Fixes #3297
2018-06-02 14:32:47 +03:00
Dan Elkouby 94bc401680 Activate the focused child when scrolling over tab/stack decorations
fbce834b introduced a bug where scrolling over the decoration while
another container is focused would not focus the tabbed/stacked
container itself, but would instead move focus through the currently
focused container.
2018-05-05 13:30:48 +03:00
Ingo Bürk d302af2312
Merge pull request #3272 from orestisf1993/fake-outputs
Fix: ConfigureNotify can crash i3 with fake-outputs
2018-05-04 21:58:01 +02:00
Orestis Floros c50bf50f09
resize set: accept 'width' and 'height' keywords
Fixes #3275
2018-05-02 19:02:38 +03:00
Orestis Floros b901fc9464
resize set for floating: interpret 0 as 'no change'
Fixes #3276
2018-05-02 19:02:38 +03:00
Oliver Graff 252db3b8cf Don't refocus a workspace cleaned up by `workspace_show` during rename
When moving a workspace to the current output by way of a rename, if the
current workspace is empty, it will be removed by `workspace_show`.
Attempting to restore focus to this removed workspace causes a crash.
Follow the pattern in workspace.c:996 to only restore the original focus if the
original workspace still exists.

Add a test to ensure that the renamed workspace moves to its appropriate
output and that a crash does not occur.

Fixes #3228
2018-05-01 11:25:13 +03:00
Ingo Bürk e8057b2fbc
Merge pull request #3270 from orestisf1993/ADD_TRANSLATED_KEY
Define ADD_TRANSLATED_KEY once
2018-04-30 10:02:34 +02:00
Orestis Floros 1f74f8d2c1
Fix: ConfigureNotify can crash i3 with fake-outputs
handle_screen_change() and handle_configure_notify() call
randr_query_outputs() where root_output is not initialized because
randr_init() is never called when config.fake_outputs is not NULL.
2018-04-30 03:54:38 +03:00
Orestis 6f11b6fa4a send_tick: set "first" field (#3271)
According to the docs, the tick event should return:
    {
     "first": false,
     "payload": "arbitrary string"
    }
2018-04-28 14:47:28 +02:00
Orestis Floros 1681ab4496
Define ADD_TRANSLATED_KEY once 2018-04-28 12:21:39 +03:00
Ingo Bürk 5813525c62
Merge pull request #3268 from orestisf1993/janitorial
Janitorial
2018-04-27 11:14:45 +02:00
Orestis Floros 16f8fe28d9
main.c: remove redundant 'focused' declaration
Previously declared in tree.h:17.
2018-04-27 01:16:42 +03:00
Orestis Floros 0b5a2092a0
Fix redundant casts to the same type
Found using clang-tidy's google-readability-casting.
2018-04-27 00:09:42 +03:00
Orestis Floros aca7790217
Fix redundant return statements
… at the end of a function with a void return type.

Found using clang-tidy's readability-redundant-control-flow.
2018-04-27 00:09:42 +03:00
Orestis Floros 2f2053284e
cmd_shmlog: use parse_long() 2018-04-26 23:47:45 +03:00
Orestis Floros b5f887287a
Don't call con_fullscreen_permits_focusing with ignore_focus
When we don't modify the focus we aren't risking giving focus to a
container behind the current fullscreen one.

_con_move_to_con can with ignore_focus is called through the swap
command or through con_move_to_workspace for floating containers. This
change shouldn't break the expectations of the callers there.

Fixes issue #3259.
2018-04-22 16:56:36 +03:00
Orestis Floros 799e3951a2
con_swap: exit when first _con_move_to_con fails
This is enough to fix the crash discussed in #3259 even though the next
commit can fix it independently. This commit is useful because it
generally makes sense to abort the command when the first call to
_con_move_to_con fails.
2018-04-22 03:48:50 +03:00
Ingo Bürk 5a0f02b7ff
Merge pull request #3230 from hwangcc23/fix-3227
Make "scratchpad show" return correct info
2018-04-21 17:57:54 +02:00
Ingo Bürk 53648511b3
Merge pull request #3256 from orestisf1993/REQUIRED_OPTION
Remove obsolete macro REQUIRED_OPTION
2018-04-21 17:56:06 +02:00
Orestis Floros bd7a5ee48a
cmd_border: improve width selection
- 'border toggle' now accepts an optional pixel argument which will be
ignored when switching to BS_NONE.
- 'border pixel' now defaults to 1 pixel instead of 2.
- Calling 'border normal' or 'border pixel' will use the configured
default_border_width if one exists. Also applies to floating windows.
2018-04-21 16:50:57 +03:00
hwangcc23 4869becfee Make "scratchpad show" return correct info
Fix the issue #3227(https://github.com/i3/i3/issues/3227).

1).Make cmd_scratchpad_show() use the information coming from scratchpad_show().
2).Add a test case 298-scratchpad-show.t.
2018-04-20 22:30:41 +08:00
Orestis Floros 8fba543719
Remove obsolete macro REQUIRED_OPTION
Was used for the removed option 'terminal' and for 'font'. 'font' is no
longer this aggressive and doesn't use the macro.

Killing i3 when an option is missing would be super backwards
incompatible so I doubt we are going to use this ever again.
2018-04-20 13:05:23 +03:00
Orestis Floros fe6b3b7474
i3bar: make modifier behave like floating_modifier
Pressed modifiers are determined like in click.c:handle_button_press.

Fixes #3234.
2018-04-17 02:00:03 +03:00
hwangcc23 e26fd91cf8 Add an i3bar flag: --verbose
Fix the issue #3220. (https://github.com/i3/i3/issues/3220)
2018-04-13 23:09:44 +08:00
Orestis Floros 626af81232
Fix crash when moving container to marked workspace
Was a small typo.

This also has the (positive) side-effect of allowing to move all the
content of a marked workspace next to the target container, see added
tests.
2018-04-07 21:58:55 +03:00
Ingo Bürk a92acadfc0
Merge pull request #3223 from orestisf1993/minor
Minor changes
2018-04-05 10:59:34 +02:00
Oliver Graff e4a184e77e
Workspace renaming: Interpret outputs as nondirectional
Currently when renaming outputs, an output assignment of "left" will
cause the workspace to move left. Treat this assignment as a proper name
instead (even though it is unlikely an output will be named "left").

Move logic for determining output to move to out of
`workspace_move_to_output`

Add test for ignoring direcionality during rename.

Fixes #3208.
2018-04-04 13:37:59 -04:00
Orestis Floros 0aa636b207
Prefer compiler warnings to assertions for unhandled switch cases
Using 'default:' cases can hide logical errors which would lead to i3
crashes for users. With this change the compiler will print a warning
when a case is not handled. For example, if I add a new value in the
Font.type enum:
../../i3/libi3/font.c: In function ‘draw_text’:
../../i3/libi3/font.c:378:5: warning: enumeration value ‘NEWFONT’ not handled in switch [-Wswitch]
     switch (savedFont->type) {
     ^~~~~~
2018-04-04 19:20:55 +03:00
Orestis Floros 393412a204
A__NET_REQUEST_FRAME_EXTENTS: use render_font_height() 2018-04-04 18:09:34 +03:00
Orestis Floros 96ee336a0b
Use con_orientation instead of ternary operator 2018-04-01 12:18:27 +03:00
Orestis Floros fbce834b20
Window decoration scrolling: don't focus sibling
The current behaviour is buggy in the following layout:
T [ A* V [ B C ] ], where the focus stack in V is B > C.
When the user scrolls down, focus correctly moves to B but if the user
scrolls down again the whole vertical container is focused.

This happens because 'bool scroll_next_possible' is false but
con_activate is called on the tabbed container's sibling - the vertical
container.
2018-04-01 12:18:27 +03:00
Ingo Bürk 666aa9e0dd
Merge pull request #2941 from orestisf1993/issue-2938
Fix focus order in floating_disable & floating_enable for unfocused windows
2018-03-31 20:34:17 +02:00
Michael Stapelberg eca8fae2de introduce the sync IPC command
Sending the sync command via IPC ensures pending IPC messages are handled by i3
before the sync response is read. This is rarely useful for direct IPC
connections to i3, but becomes useful when synchronizing with i3bar, which might
have pending IPC messages in response to button clicks.
2018-03-30 21:09:52 +02:00
Michael Stapelberg 725ee3ce62 move i3 sync code into sync_respond (for following commits) 2018-03-30 21:05:32 +02:00
Orestis Floros 791e407fd3
Remove special handling of floating containers in con_next_focused
Explanation for the changed test:
After $third is switched to floating, the test moves focus to $second.
So, the parent of $second (the stacked container) is above $third in the
focus stack and it's children ($first, $second) should get focused
before $second. When $second is switched to floating the correct focus
order for the workspace should be $second->parent (floating con is the
parent) > $first->parent (stacked con) > $third.

Fixes #1975
2018-03-30 18:29:33 +03:00
Orestis Floros 3a89f88fb6
Fix focus order in floating_enable for unfocused windows
Partially fixes issue #2938
2018-03-30 18:29:32 +03:00
Orestis Floros 10a3c1e827
Fix focus order in floating_disable for unfocused windows
Partially fixes issue #2938
2018-03-30 18:20:40 +03:00
Orestis Floros 60875c7bcb
Use con_detach instead of TAILQ_REMOVE in floating 2018-03-30 18:20:40 +03:00
Orestis Floros 4143f3abfc
Fix memory leak when _XKB_RULES_NAMES can't be found
Steps to reproduce:

1. Force the branch to be taken:

diff --git a/src/bindings.c b/src/bindings.c
index fe77bc8f..caa5848c 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -941,7 +941,7 @@ bool load_keymap(void) {

     struct xkb_keymap *new_keymap = NULL;
     int32_t device_id;
-    if (xkb_supported && (device_id = xkb_x11_get_core_keyboard_device_id(conn)) > -1) {
+    if (0) {
         if ((new_keymap = xkb_x11_keymap_new_from_device(xkb_context, conn, device_id, 0)) == NULL) {
             ELOG("xkb_x11_keymap_new_from_device failed\n");
             return false;

2. Run `python2 ./xproperty.py _XKB_RULES_NAMES ''` (from
https://github.com/siemer/xproperty) in the xinitrc
3. Memory sanitizers detect memory leaks.

Note: We don't (and didn't) pass NULL in xkb_keymap_new_from_names() but
an xkb_rule_names structures with NULL fields (fill_rmlvo_from_root only
fills its argument when there are no errors) should be equivalent:
767fa86d42/NEWS (L349-L351)
> The function xkb_keymap_new_from_names() now accepts a NULL value for
the 'names' parameter, instead of failing. This is equivalent to passing
a 'struct xkb_rule_names' with all fields set to NULL.

Fixes #2535.
2018-03-29 17:46:41 +03:00
Ingo Bürk 77bfa595df
Merge pull request #3200 from orestisf1993/_con_move_to_con
_con_move_to_con: don't change focus when moving to active workspace
2018-03-29 12:06:29 +02:00
Ingo Bürk 145a93d5b4
Merge pull request #3207 from orestisf1993/get_workspace_by_
Introduce get_workspace_by_* functions
2018-03-29 12:06:05 +02:00
Orestis 6dfa348960
Merge pull request #3192 from Exagone313/next
translate_keysyms: fix potential memory leak
2018-03-29 12:16:12 +03:00
Orestis Floros 0b5799412a
Introduce get_existing_workspace_by_num 2018-03-28 15:18:43 +03:00
Orestis Floros 6a2728ba79
Introduce get_existing_workspace_by_name 2018-03-28 15:18:43 +03:00
Orestis Floros 6d983b5ee0
_con_move_to_con: don't change focus when moving to active workspace
Seems to be the intention, indicated by this comment (con.c:1307-1309):
    /* For split containers, we use the currently focused container within it.
     * This allows setting marks on, e.g., tabbed containers which will move
     * con to a new tab behind the focused tab. */

Related to #3085.
2018-03-28 15:10:11 +03:00
Elouan Martinet e6bd2006bc Fix potential memory leak
xkb_state_new uses calloc and may fail in a rare case, which would cause a memory leak.
Note that xkb_state_unref checks if the parameter given is not null (!state) before freeing.
Calls to xkb_state_new have been grouped to remove code duplication.

Signed-off-by: Elouan Martinet <exa@elou.world>
2018-03-27 10:23:16 +00:00
Orestis Floros e424a31307
cmd_append_layout: resolve_tilde already allocates memory
Fixes a small memory leak with all append_layout commands.
2018-03-27 03:37:57 +03:00
Ingo Bürk 6f4b0e1fdd
Merge pull request #3204 from orestisf1993/focus_next
_con_move_to_con: focus_next isn't always con_next_focused(con)
2018-03-26 21:35:12 +02:00
Orestis a0309cbd52 xcb_drag_prepare_cb: drain events (#3193)
As discussed in PR #3085, X11 events can appear while
dragloop->callback() is running.

Co-authored-by: Michael Stapelberg <michael@stapelberg.de>
2018-03-26 17:59:34 +02:00
Orestis Floros c7dde08673
_con_move_to_con: focus_next isn't always con_next_focused(con)
con_next_focused uses con's parent. But since con can be inside an
unfocused container this means that one of it's siblings could become
focused in the current workspace.
2018-03-26 00:09:26 +03:00
Ingo Bürk f560519f5c
Merge pull request #3203 from orestisf1993/free
memory leaks
2018-03-25 20:12:16 +02:00
Orestis Floros b0997234ab
con_toggle_layout: free(tm_dup) outside loop 2018-03-25 20:48:20 +03:00
Orestis Floros e19a120961
Free A_TO_WORKSPACE_NUMBER assignments 2018-03-25 20:35:53 +03:00
Orestis Floros a5014dc7f8
cfg_workspace: memleak on duplicate workspace assignment
assignment->output is set but lost since TAILQ_INSERT_TAIL is never
called when duplicate is set.
This essentially happens on every reload.
2018-03-25 20:27:07 +03:00
Orestis Floros ee1f551195
startup.c: free timer
Small memleak. The timer is not called used again since ev_timer_init is
called with repeat = 0.
2018-03-25 20:04:31 +03:00
Orestis Floros 37106aa84b
Prefer fullscreen floating containers when on directional focus
Fixes #3201
2018-03-25 14:47:45 +03:00
Ingo Bürk b849fe3e44
Merge pull request #3196 from orestisf1993/_con_move_to_con
_con_move_to_con cleanup
2018-03-24 18:49:26 +01:00
Orestis Floros 9e3b48dd22 con_activate -> con_focus when it is used as a building block 2018-03-24 15:21:11 +02:00
Orestis Floros 9a1fcff4e0 _con_move_to_con: remove outdated comment 2018-03-24 15:21:11 +02:00
Orestis Floros 037b1c3710 _con_move_to_con: showing target_ws is useless
The current_ws is shown latter anyway:
    if (!ignore_focus) {
        workspace_show(current_ws);
        ...

This also causes the following bug:
- Open a window in an empty workspace
- Switch to another workspace
- seturgent to the first window
- Move another window to the first workspace
- Urgent flag is now reset
2018-03-24 15:19:49 +02:00
Orestis Floros f46bb0396e workspace_show: remove redundant if 2018-03-24 15:15:02 +02:00
Orestis Floros 4097769105 _workspace_show -> workspace_show
a9b57a44a9 removed the extra parameter of
workspace_show.
2018-03-24 14:26:11 +02:00
Ingo Bürk 83ac1c0e72
Merge pull request #3184 from orestisf1993/issue-1341
floating_enable & floating_maybe_reassign_ws changes
2018-03-23 19:17:12 +01:00
Orestis Floros 8e9b26fc90 floating_maybe_reassign_ws: use get_output_from_rect
This significantly reduces the number of ELOGs while dragging floating
containers. The behaviour is improved since floating containers in the
edge of the screen will still get reassigned to their closest workspace.

For example, consider this setup:
fake-outputs 500x500+0+0,500x500+500+0

Now, open a window in the right output and run:
i3-msg floating enable, move position 0 px 450 px
The window is on the bottom edge of the left workspace but if you run:
i3-msg focus mode_toggle
focus will go to the right workspace since floating_maybe_reassign_ws
didn't change the assigned workspace of the floating container.
2018-03-23 17:42:39 +02:00
Orestis Floros 128122e766 floating_enable: change reassign logic
This allows the floating container's top left corner to be mapped
outside any output as long as they are contained partially by one. This,
for example, will allow:
mpv --geometry +1+1 video.mp4

For windows mapped to (0, 0) see comment in floating.c:270-273:
/* Some clients (like GIMP’s color picker window) get mapped
 * to (0, 0), so we push them to a reasonable position
 * (centered over their leader) */

 The floating_reassign_ws call is removed since we try to place the new
 floating container in the current output:
 /* Sanity check: Are the coordinates on the appropriate output? If not, we
  * need to change them */

Fixes #1341
2018-03-23 17:42:39 +02:00
Orestis Floros 8a3ef3a81b Introduce get_output_from_rect 2018-03-23 17:42:39 +02:00
Orestis Floros e09861f73f contained_by_output: return output and rename to output_containing_rect 2018-03-23 17:40:03 +02:00
Ingo Bürk 8e198a2105
Merge pull request #3195 from orestisf1993/issue-2993
Improve directional moving of fullscreen containers
2018-03-23 14:52:48 +01:00
Ingo Bürk 9f273f3356
Merge pull request #3178 from orestisf1993/pr-2314
Support _NET_WM_STATE_FOCUSED
2018-03-23 14:50:46 +01:00
Orestis Floros 3ccaf11eab Improve directional moving of fullscreen containers
Fixes #2993.
2018-03-23 15:46:40 +02:00
Tony Crisci c42de09b1b Support _NET_WM_STATE_FOCUSED
_NET_WM_STATE_FOCUSED is set on _NET_WM_STATE to indicate that the
window is focused. It must be set when the window is newly focused and
removed once the window no longer has focus.

> _NET_WM_STATE_FOCUSED indicates whether the window's decorations are
> drawn in an active state. Clients MUST regard it as a read-only hint.
> It cannot be set at map time or changed via a _NET_WM_STATE client
> message.

For example, this is used by GTK applications to show the decoration in
an active or inactive state. This change can be tested by opening a GTK
application (like evince), focusing the window and unfocusing the
window, and observing a change in the window decorations.

Fixes #2273
2018-03-23 14:30:57 +02:00
Orestis Floros 5e8a3f3f0c cmd_move_window_to_position: improve error message 2018-03-20 16:59:06 +02:00
Orestis Floros 174dc389ff Remove 'method' from cmd_move_window_to_position
For command:
move window to [absolute] position X px Y px
if the optional keyword 'absolute' is provided the end result is the
same even though it is implemented differently. Only difference is that
with absolute the floating window can move completely outside of any
output.

This commit removes the 'method' argument and only keeps the sane
implementation.
2018-03-20 16:59:06 +02:00
Orestis Floros dc0337d2e5 Reset B_UPON_KEYRELEASE_IGNORE_MODS bindings when switching modes
With example config:
    mode "a_mode" {
        bindcode 27 --release mode "default"
    }
    bindsym $mod+r mode "a_mode"

The first time $mod+r is pressed "a_mode" is activated like normal. When
r (bindcode 27) is pressed to exit the mode:
- On the KeyPress event the corresponding bind->release is correctly
marked as B_UPON_KEYRELEASE_IGNORE_MODS.
- On the KeyRelease event the command 'mode "default"' is executed but
bind->release is still B_UPON_KEYRELEASE_IGNORE_MODS since they are only
reset on KeyPress events.
The second time $mod+r is pressed and "a_mode" is activated and when the
r key is released the 'mode "default"' is executed even though the mods
are not matching since bind->release == B_UPON_KEYRELEASE_IGNORE_MODS.

This still doesn't catch 2 cases:
1. When the order is: press $mod -> press r -> release $mod -> release
    r. Since 'r' is released without any modifiers the binding matches.
2. With:
        mode "resize" {
            bindsym --release r mode "default"
        }
        bindsym r mode "resize"
    This is arguably correct: on the KeyPress event we switch to the mode and
    on the KeyRelease we switch back.
2018-03-20 04:09:34 +02:00
Orestis Floros ff579ef22f Correctly handle bindings for the same mod key with and without --release
Before this commit, get_binding() exited on the first match without
marking the rest --release bindings with B_UPON_KEYRELEASE_IGNORE_MODS.

Similarly, once it found a --release binding during a KeyPress event it
would stop searching for a matching key press binding.

Example config, placing the --release line first will trigger the second
problem:

# i3 config file (v4)
bindsym Super_L exec notify-send "press"
# or
# bindcode 133 exec notify-send "press"
bindsym --release Super_L exec notify-send "release"
# or
# bindcode --release 133 exec notify-send "release"

Fixes #2733
2018-03-20 04:09:25 +02:00
Orestis Floros 130b3ce3a9 Check for B_UPON_KEYRELEASE_IGNORE_MODS with bindsyms
From 548d74015c50d7fae14bfb8bb1989acde5fc22ae:
> 1. press $mod, press x, release x, release $mod
> 2. press $mod, press x, release $mod, release x

case (2.) didn't work, now it should be fixed.
2018-03-20 04:00:47 +02:00
Ingo Bürk 670dfa0bba
Merge pull request #3189 from orestisf1993/run_assignments
run_assignments: check for A_COMMAND early
2018-03-19 14:32:54 +01:00
Ingo Bürk b4e24a6d5f
Merge pull request #3188 from orestisf1993/free_ran_assignments
Free ran_assignments
2018-03-19 07:04:45 +01:00
Orestis Floros 6306acdb65 run_assignments: check for A_COMMAND early 2018-03-19 03:17:32 +02:00
Orestis Floros 98df2e21fa Free ran_assignments
When we run 'reload' all the assignments are freed:
e3e09119bf/src/config.c (L99-L109)

Assignments are saved to each window after they are executed:
e3e09119bf/src/assignments.c (L41-L46)

This means that the pointers stored in window->ran_assignments are
invalid (shouldn't be dangerous currently but could lead to a segfault
if the code is modified) after a 'reload'.
2018-03-19 03:00:35 +02:00
Orestis Floros 1fe4e635b5 Fix memleak: FREE(assign->dest.output) 2018-03-19 02:02:59 +02:00
Orestis Floros 9d22d2efce Reduce repetition in get_binding() 2018-03-16 03:08:47 +02:00
Orestis Floros d66fa51f33 Don't call con_focus in tree_move
Fixes:
- Issue where moving an urgent (unfocused) window resets it's urgency
hint.
- Moving an unfocused container to a new parent should not move it to
the top of the focus stack.
2018-03-15 19:57:30 +02:00
Orestis Floros 6222ab1084 Correct insert_con_into's focus handling
Change from always putting con on the head of the new parent. Important
for moving unfocused containers.
2018-03-15 19:49:17 +02:00
Ingo Bürk dfc330fcb8
Merge pull request #3167 from hwangcc23/fix-3163
Add strip_workspace_name
2018-03-11 16:33:10 +01:00
hwangcc23 2269b2e795 Add strip_workspace_name
See the issue #3163 (https://github.com/i3/i3/issues/3163).

Add strip_workspace_name to strip off the workspace name.
2018-03-11 12:17:42 +08:00
Ingo Bürk 69eec7e5b2 Refocus focused window for FOCUS_IN events on the root window. (#3097)
This deals with (admittedly somewhat misbehaving) clients which
use XSetInputFocus to take focus, but then don't properly restore
focus. This has been observed with TK apps, but also, e.g., Steam.

fixes #2722
fixes #3096
2018-03-10 19:18:44 +01:00
Ingo Bürk 4b4fba0e74
Merge pull request #3087 from orestisf1993/focus_order
Fix focus order issues when encapsulating workspaces
2018-02-27 07:59:37 +01:00
Orestis Floros cb73fd5e31 Fix focus order issues when encapsulating workspaces
See new tests for an explanation of the problem.
2018-02-26 23:08:57 +02:00
Orestis Floros dc2363a665 Introduce *focus_order functions 2018-02-26 23:06:04 +02:00
Orestis Floros 60200b1d3c Don't raise floating windows when workspace is shown
From comment:
https://github.com/i3/i3/issues/2990#issuecomment-368345169

To easily reproduce:
1. Open 2 floating windows
2. Focus (with `focus_follows_mouse`) the one behind
3. Move the mouse to the other workspace
4. Move the mouse inside the previous workspace (without it even
touching a window)
2018-02-26 03:26:05 +02:00
Ingo Bürk 2cffb978f0
Merge pull request #3138 from clawoflight/default-border
[WIP] Add default_{,floating_}border
2018-02-19 07:03:03 +01:00
Bennett Piater f8d6c10d7c
Add default_{,floating_}border to config
userguide: document default_{,floating_}border

201-config-parser.t: add new tokens to $expected_all_tokens

201-config-parser-t: fix whitespace

closes i3/i3#2702
2018-02-15 16:25:56 +01:00
Alex Lu 147d3c354a Update EWMH atoms when closing a workspace container
fix #3126
2018-02-13 12:00:56 +08:00
Ingo Bürk 9610dc29b8
Merge pull request #3080 from orestisf1993/cmd_move_con_to_workspace
Reduce repetition in cmd_move_con_to_workspace*
2018-01-17 21:26:09 +01:00