Commit Graph

2044 Commits

Author SHA1 Message Date
Michael Stapelberg bff72d653d Initialize default window border width retina-correctly 2014-04-26 17:18:21 +02:00
Tony Crisci 02ff10aadb Move check_for_duplicate_bindings to bindings.[ch]
Additionally add a check for the same input_type (mouse or keyboard).
Bindings with different input types cannot be duplicates.
2014-04-26 12:10:33 +02:00
Tony Crisci ea551e4d99 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.

fixes #1220
2014-04-26 12:10:05 +02:00
Petr Písař 2cc51841a5 Reset SIGIPE handler before executing a command
This commit:

commit fb6d117c42
Author: Axel Wagner <mail@merovius.de>
Date:   Thu Dec 30 21:09:32 2010 +0100

    Port sighandler to tree-branch

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:

$ perl -e 'print $SIG{PIPE}, qq{\n}'
IGNORE

fixes #1237
2014-04-26 12:09:45 +02:00
Michael Stapelberg 254e4d6f05 Fix i3.mk to not rebuild test.* all the time
This problem was introduced in 5181055a
2014-04-23 19:34:45 +02:00
Julian Ospald 5181055aad fix parallel make
fixes #1232
2014-04-23 17:55:15 +02:00
Julian Ospald a2cbca7ae1 respect CFLAGS in linking command
fixes #1233
2014-04-23 17:55:15 +02:00
Michael Stapelberg 110b8d9557 Don’t overwrite existing windows with placeholder windows
This could happen when you appended a layout on a workspace where there
are already other windows.
2014-04-18 20:36:56 +02:00
Michael Stapelberg 524f20b8a0 layout restoring: append at the nearest split container (or workspace) (Thanks chris)
Before this commit, leaf containers (such as terminal emulators) would
get children appended, which is not intended.

fixes #1223
2014-04-18 20:30:27 +02:00
Tony Crisci 702906d0cf Move switch_mode to bindings.[ch] 2014-04-15 17:46:59 +02:00
Tony Crisci 05f0585817 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.

fixes #1167
2014-04-15 17:46:08 +02:00
Tony Crisci 819bc09375 Maintain the _NET_CLIENT_LIST property
Add and update the _NET_CLIENT_LIST property on the root window to
better comply with ewmh standards.

Information on this property can be found here:
http://standards.freedesktop.org/wm-spec/latest/ar01s03.html

> These arrays contain all X Windows managed by the Window Manager.
> _NET_CLIENT_LIST has initial mapping order, starting with the oldest window.

fixes #1099
2014-04-15 17:44:25 +02:00
Michael Stapelberg 77abb2ef19 Bugfix: clear wm_size_hints if they are not set
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.
2014-04-09 22:14:50 +02:00
Tony Crisci 4ded44d18a 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.
2014-03-31 23:28:33 +02:00
Tony Crisci 0c3735fc23 Free owindow when no con_id match or window
This memory leak is related to matching on con_id or matching when the
container has a null window. In that case, windows that do not match
would leak the owindow struct.
2014-03-21 19:26:13 +01:00
Tony Crisci 587273505c Free match after criteria initialization
This memory leak is associated with matching by a criteria that uses a
regular expression. Without freeing a regex before calling match_init,
it will definitely be lost.
2014-03-21 19:23:05 +01:00
Michael Stapelberg c23db20cb5 Merge branch 'master' into next 2014-03-15 18:05:45 +01:00
Tony Crisci a6a6c9b6d9 Bugfix: don't try to resize docks by command
cmd_resize does not implement a method to resize dock clients.

A command like `[instance=".*"] resize grow width 160 px or 16 ppt`
when a dock client matched would crash i3.

fixes #1201
2014-03-15 18:05:42 +01:00
Tony Crisci c5df093f5d Move translate_keysyms to bindings.[ch]
Additionally add a check so the function only handles bindings of type
B_KEYBOARD to prepare for the new bindmouse feature.
2014-03-15 17:59:57 +01:00
Tony Crisci 192b67df18 Free window ran_assignments on tree_close 2014-03-10 17:37:35 +01:00
Tony Crisci 81271887e2 Set con window to NULL on tree_close
Prevents invalid reads on the freed window struct.
2014-03-10 08:39:56 +01:00
Kernc 8ed95ae58c Improved detection of windows that want floating
Windows that match the following criteria are floated by default:
- dialog, utility, toolbar, or splash windows,
- modal windows, or
- windows that have specified equal minimum and maximum size.

closes #1182
2014-03-08 21:00:44 +01:00
Michael Stapelberg b28ddca96d Merge branch 'master' into next 2014-03-08 20:59:18 +01:00
Tony Crisci a16dfdb15e Bugfix: ipc_receive_message reply leak
The function ipc_recv_message in libi3 allocates memory to the location
of the `message` reply in src/ipc_receive_message.c with malloc and must
be freed.

This memory leak was found using valgrind.
2014-03-08 20:58:56 +01:00
Tony Crisci 3d6d0c134c Move keyboard binding accessor to bindings.[ch]
Rename `get_binding` to `get_keyboard_binding` and ensure that this
function only accesses bindings of type B_KEYBOARD. Other types of
bindings (e.g. mouse bindings) will be accessed by a different function.
2014-02-26 22:26:05 +01:00
Marco Hunsicker 00ee86de79 Send IPC window events for focus and title changes
This patch fixes ticket #1168 to extend the window IPC event mechanism
to send IPC events for window focus and title changes. The newly added
window events use the same format as the already established "new"
event.

Specifically this patch:

* Moves the ipc_send_window_event() function from src/manage.c into
  src/ipc.c and adds an argument for the change property of the event
* Updates src/manage.c to use the new function signature. To ensure
  that the "new" event does not send the same event data as the
  "focus" event, setting focus now happens after the "new" event
  has been sent
* Adds IPC focus event notification to src/x.c. To workaround a problem
  during window close when accessing the window name, a function has been
  added to query whether a window is actually attached to its parent. To
  avoid obsolete focus notification, a new field has been added to keep
  track of the focus without any interference by the click handling
* Adds IPC title event notification to src/handlers.c. To avoid
  obsolete title notification, a function has been added to determine
  whether a window title has actually changed
* Updates the IPC documentation to include the new events
* Updates testcases/t/205-ipc-windows.t to include the "focus" event
  in order to ensure the correct event sequence
* Adds two new unit tests, b/testcases/t/219-ipc-window-focus.t and
  b/testcases/t/220-ipc-window-title.t to ensure proper "focus" and
 "title" events
2014-02-26 22:24:19 +01:00
Tony Crisci 48ec79ca02 Move grab_all_keys to bindings.[ch]
Also add checks for binding input_type to filter bindings that are not
keyboard bindings.
2014-02-15 12:55:38 +01:00
Tony Crisci 759c26fc02 Improve drag_pointer error handling
Log errors generated by failed pointer grabs and ungrab the pointer
after failed keyboard grabs.
2014-02-13 21:06:32 +01:00
Michael Stapelberg 491274d8b3 handle ButtonPress events with child != XCB_NONE (Thanks xeen)
The X11 protocol description states:

  The window the event is reported with respect to is called the event
  window. The event window is found by starting with the source window
  and looking up the hierarchy for the first window on which any client
  has selected interest in the event.

For the case of urxvt with URxvt.internalBorder > 0, urxvt sets up a
subwindow for its actual contents that is placed “in the middle” of the
urxvt window. In terms of the X11 protocol, the source window is urxvt’s
window, but urxvt does not select ButtonPress events for that.
Therefore, X11 will go up in the hierarchy and deliver the event to i3
for i3’s window decoration, even though this was not actually a click on
the decoration, but into the managed window.

Therefore, we check whether child != XCB_NONE for clicks on window
decorations and then handle them as a click inside the window.

fixes #1176
2014-02-09 14:00:43 +01:00
Michael Stapelberg 22be7bc986 fix warnings: unsigned check for >= 0 is always true 2014-02-08 21:03:26 +01:00
Tony Crisci 6ae4ecb1de Bugfix: `tree_split` should not split floating cons
Use the more robust test of `con_is_floating` for testing a container
for being floating.

fixes #1177
2014-02-08 20:59:23 +01:00
Steve Jones 0e27ff3cd0 Set EWMH desktop properties on startup.
Calls ewmh_update_current_desktop on startup to set the
_NET_CURRENT_DESKTOP property. Without this change the property only
gets set after the workspaces have been manipulated. Also exclude
hidden workspaces (i.e. those starting with "__" from the workspace
index.

Adds tests for startup and workspace switching.
2014-02-08 20:38:16 +01:00
Jonas Maaskola 905440d6d1 Resize floating windows by right-clicking decoration 2014-02-05 22:41:26 +01:00
Tony Crisci d6b32971df Really do not create con pixmap when not needed
The pixmap of a borderless leaf container will not be used except
for the titlebar in a stack or tabs.

Make sure these containers do not (really) have a pixmap because it can
only get in the way.

fixes #1013
2014-02-05 22:21:47 +01:00
Michael Stapelberg d51d2acc95 Revert "Do not create container pixmap when not needed"
This reverts commit 6578976b61.

fixes #1170
2014-01-30 22:55:26 +01:00
Tony Crisci d24d8baeb5 Abstract binding configuration to bindings.[ch]
Create files bindings.[ch] to contain functions for configuring,
finding, and running bindings.

Use the new function `configure_binding` for binding configuration. This
function adds a binding from config parameters.

Export the function `modifiers_from_str` from config_directives.h.

This change is made in preparation for the new bindmouse functionality.
2014-01-28 08:21:21 +01:00
Marco Hunsicker 92868cf6d3 update year in copyright notices to 2014
This patch updates the copyright year information the i3 and
i3bar binaries show to the user.
2014-01-26 16:10:57 +01:00
Michael Stapelberg cacc199a68 Merge branch 'master' into next 2014-01-23 22:20:16 +01:00
David Coppa 88300f0f30 OpenBSD lacks posix_fallocate() 2014-01-23 22:20:14 +01:00
Michael Stapelberg 61b53603e2 Merge branch 'master' into next 2014-01-23 22:19:49 +01:00
David Coppa 39bf343618 Fix install target of i3-with-shmlog.desktop 2014-01-23 22:19:45 +01:00
Tony Crisci 6578976b61 Do not create container pixmap when not needed
The pixmap of a borderless container will not be used (except for the
titlebar in a stack or tabs). Make sure these containers do not have a
pixmap because it can only get in the way.

fixes #1013
2014-01-19 23:11:25 +01:00
Tony Crisci dee6264d57 Respect Motif hint for window decorations
When the _MOTIF_WM_HINTS property of a window specifies it should have
no title bar, or no decorations at all, respond by setting the border
style of that container to BS_PIXEL or BS_NONE respectively.

This comes from the old Motif window manager. It was originally intended
to specify exactly what sort of decorations a window should have, and
exactly what sort of user input it should respond to. The EWMH spec
intended to replace Motif hints with _NET_WM_WINDOW_TYPE, but it is
still in use by popular widget toolkits such as GTK+ and Java AWT.

i3's implementation simply mirrors Gnome's Metacity. Official
documentation of this hint is nowhere to be found.

For more information see:
https://people.gnome.org/~tthurman/docs/metacity/xprops_8h-source.html
http://stackoverflow.com/questions/13787553/detect-if-a-x11-window-has-decorations

fixes #832
2014-01-18 16:25:37 +01:00
Michael Stapelberg 10d7c1a993 Merge branch 'master' into next 2014-01-13 23:36:47 +01:00
Tony Crisci 7639337716 Bugfix: `move <direction>` sends workspace focus
Make sure the command `move <direction>` properly sends the workspace
focus ipc event required for i3bar to be properly updated and redrawn.

Make `ipc_send_workspace_focus_event publicly available from ipc.h for
more flexible event sending.
2014-01-13 23:36:31 +01:00
Tony Crisci aa11c03d4c Movement into a branch considers movement direction
Change the behavior of movement into a branch with respect to the
position the moving con will be placed within the branch when the
movement is complete.

The correct position is determined by the direction of movement or the
position of the focused-inactive container within the branch.

If the direction of movement is the same as the orientation of the
branch container, append or prepend the container to the branch in the
obvious way.  If the movement is to the right or downward, insert the
moving container in the first position (i.e., the leftmost or top
position resp.) If the movement is to the left or upward, insert the
moving container in the last position (i.e., the rightmost or bottom
position resp.)

If the direction of movement is different from the orientation of the
branch container, insert the container into the branch after the
focused-inactive container.

fixes #1060
2014-01-06 22:26:23 +01:00
Alexander Kedrik de3901bb29 use designated initializers for yajl_callbacks struct 2014-01-06 22:12:14 +01:00
Michael Stapelberg 0fd9a96118 ipc: dump new "swallows" properties 2014-01-05 20:30:03 +01:00
Michael Stapelberg 93cfdcd488 sanity check: drop swallows for split containers (Thanks xeen)
fixes #1149
2014-01-05 20:25:47 +01:00
Michael Stapelberg 2fea5ef82b Revert "use designated initializers for yajl_callbacks struct"
This reverts commit 705b43294a.

This commit broke i3bar for some users.
2014-01-05 13:05:31 +01:00