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.
handle windows whose WM_TRANSIENT_FOR points to themselve
I consider this behavior broken and not respecting the standard, but it
happens in real life, and it’s better for i3 to not busy-loop in such a
situation :).
Tony Crisci [Sat, 7 Jun 2014 02:11:44 +0000 (22:11 -0400)]
Don't ELOG ipc EOF
Receiving EOF from a client is not an error, but rather a standard way a
client may disconnect from the IPC. This should rather be logged from
a consumer of the libi3 ipc_recv_message() function as a normal client
disconnect event.
Tony Crisci [Sat, 31 May 2014 15:00:02 +0000 (11:00 -0400)]
Add abstraction for running a binding
Add run_binding function to bindings.h.
> Runs the given binding and handles parse errors. Returns a
> CommandResult for running the binding's command. Caller should render
> tree if needs_tree_render is true. Free with command_result_free().
Tony Crisci [Sat, 31 May 2014 16:06:39 +0000 (12:06 -0400)]
Set EWMH active window to None when none has focus
_NET_ACTIVE_WINDOW:
> The window ID of the currently active window or None if no window has
> the focus.
This fixes a bug that would not update _NET_ACTIVE_WINDOW when focus
changed to an i3 container without a window such as a branch or
workspace content container.
Tony Crisci [Wed, 28 May 2014 06:01:50 +0000 (02:01 -0400)]
Refactor parse_command
parse_command returns a struct that contains useful information about
the result of a command as a whole (instead of the intermediate
representation used during parsing).
parse_command now requires the caller to allocate the yajl_gen used for
generating a json reply. This is passed as the second parameter to
parse_command. If NULL is passed, no json reply will be generated.
Atte Peltomaki [Mon, 24 Mar 2014 17:03:05 +0000 (19:03 +0200)]
Add configuration option for disabling mouse warping
This patch adds a new configuration option "mouse_warping [output|none]".
When mouse warping is disabled, mouse cursor does not jump to middle of current
screen when changing workspaces between multiple outputs. This introduces a
"special" cursor state, where focus is in one window and cursor on another.
Useful for eg. scrolling a web page with mouse wheel while typing into another
window on keyboard.
Tony Crisci [Sun, 18 May 2014 04:44:19 +0000 (00:44 -0400)]
Change the names of parser result structs
Change the name of structs CommandResult and ConfigResult to
CommandResultIR and ConfigResultIR to show they are an intermediate
representation used during parsing.
Floating windows already had their own border style, but the width was
the same for all windows.
The configuration directives 'new_window' and 'new_float' can now be
used simultaneously to have different border widths for floating and
tiled windows.
Tony Crisci [Mon, 5 May 2014 17:56:47 +0000 (13:56 -0400)]
i3bar: implement custom workspace numbers config
Implement the configuration option within the bar config directive for
custom workspace numbers with the directive `strip_workspace_numbers
yes`.
This directive strips the workspace name of the number prefix and
delimiter. When the workspace name consists only of the number, it will
default to show the number.
For example:
* "2:5" -> "5"
* "4:$" -> "$"
* "8" -> "8"
This allows customization of i3bar for alternate ordering of workspaces
which has a legitimate use for alternate keyboard layouts such as
Dvorak.
Given that the code was exit(0)ing directly after using that memory,
it’s not like this has any effect. However, less false positives on the
clang-analyze report pages is a good thing.
Tony Crisci [Fri, 2 May 2014 20:27:26 +0000 (16:27 -0400)]
Feature: improve active window request handling
Allow client requests of type _NET_ACTIVE_WINDOW to switch workspaces if
they indicate they are a pager. Otherwise, set the urgency hint on that
con to indicate that something happened.
This allows task switchers like skippy-xd to work properly.
Tony Crisci [Fri, 2 May 2014 14:22:40 +0000 (10:22 -0400)]
Refactor binding accessor
Change the primary binding accessor to `get_binding_from_xcb_event`.
This function gets a binding from a generic xcb event of type KeyPress,
KeyRelease, ButtonPress, or ButtonRelease by determining the input type
(keyboard or mouse), the modifiers pressed from the filtered event
`state`, managing the proper fall back in case mode switch is enabled,
and finally querying the bindings for a binding that matches the event.
The logic of querying keyboard bindings is not intended to be altered by
this change.
The general accessor has been slightly modified to work with mouse
bindings and made private because it is only used in bindings.c
Workspaces won't work properly if they start with "__", so reserve that
namespace altogether. Disallow renaming workspaces to reserved namespace
and using reserved namespace in configuration.
Tony Crisci [Mon, 28 Apr 2014 22:38:06 +0000 (18:38 -0400)]
Implement the window::fullscreen_mode event
The fullscreen_mode event is a window with the "change" property set to
"fullscreen_mode". This event should be emitted whenever a window enters
or exits fullscreen mode.
This event can be used to turn off dpms off when a window is fullscreen
or display the fullscreen container name in the status line for
instance.
Tony Crisci [Wed, 30 Apr 2014 01:29:17 +0000 (21:29 -0400)]
Delegate click handling to dock clients
Do not handle click events on dock clients because they are not managed
windows. Dock clients are responsible for sending the message to i3 to
focus a workspace if that is appropriate. i3bar now sends the message to
focus the correct workspace when that is appropriate.
Otherwise, it could interfere with the dock clients own click handling,
which could be an action to focus a different workspace than i3 had
assumed, such as would be the case with a workspace widget.
Tony Crisci [Sun, 27 Apr 2014 05:48:28 +0000 (01:48 -0400)]
Implement bindsym mouse configuration
If a `bindsym` config directive specifies a symbol beginning with
"button", the binding will be given the type B_MOUSE for the indicated
button number.
Example:
bindsym $mod+button2 exec echo 'button two'
This will be interpreted as having input code (now `keycode`) 2 and type
B_MOUSE.
The mechanism to find and run mouse bindings on mouse events is not
implemented.
i3-dmenu-desktop: also quote the %c field code (Thanks bo)
The spec says:
“Implementations must take care not to expand field codes into multiple
arguments unless explicitly instructed by this specification. This means
that name fields, filenames and other replacements that can contain
spaces must be passed as a single argument to the executable program
after expansion.”
Tony Crisci [Fri, 18 Apr 2014 18:14:22 +0000 (14:14 -0400)]
Bugfix: resize window check should check for null
When checking the window type for a resize command, first check to see
if the window property is null before checking whether or not it is a
dock window. The window may be null in the case it is a branch
container.
blocks SIGPIPE. Unfortunatelly blocked signal set is preserved accross
execve()s, so any program executed by i3 inherited blocked SIGPIPE signal.
This leads to courious effects when pipe writer does not terminate after
exiting pipe reader.
Simple reproducer is to spawn a new xterm by a key shortcut and then run this
command there:
Tony Crisci [Thu, 10 Apr 2014 17:28:14 +0000 (13:28 -0400)]
Dont set input focus and send WM_TAKE_FOCUS
If input focus is set by the window manager, it is not necessary to send
WM_TAKE_FOCUS because it has already taken focus.
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7
> The goal is to support window managers that want to assign the input
> focus to a top-level window in such a way that the top-level window
> either can assign it to one of its subwindows or can decline the offer
> of the focus. For example, a clock or a text editor with no currently
> open frames might not want to take focus even though the window
> manager generally believes that clients should take the input focus
> after being deiconified or raised.
Both setting input focus and sending WM_TAKE_FOCUS is effectively
setting focus on the window twice which is certainly against the spirit
of the spec, if not the letter.
Otherwise, we read random garbage. Found by the testsuite due to
t/185-scratchpad.t failing because a window was incorrectly recognized
as a floating window.
Tony Crisci [Sat, 29 Mar 2014 04:25:52 +0000 (00:25 -0400)]
Send last event timestamp with WM_TAKE_FOCUS msg
According to 4.1.7 of the iccm spec
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7
> Windows with the atom WM_TAKE_FOCUS in their WM_PROTOCOLS property may
> receive a ClientMessage event from the window manager (as described in
> section 4.2.8) with WM_TAKE_FOCUS in its data[0] field and a valid
> timestamp (i.e. not CurrentTime ) in its data[1] field.
Adds the timestamp parameter to send_take_focus to avoid the dangerous
use of a global variable.