Commit Graph

179 Commits

Author SHA1 Message Date
Ingo Bürk 1c4100ce5d Use 32-bit visuals for i3bar when possible and allow RGBA colors.
This patch creates all necessary windows for i3bar with 32-bit visuals if available.
It also introduces the possibility to define RGBA colors (next to RGB colors), which
allows the user to set the opacity of any color. This requires running a compositor.

With this patch we also start supporting _NET_SYSTEM_TRAY_VISUAL, which is necessary
for the tray icons so they create the tray window with the correct depth and visual.
2015-10-06 23:01:57 +02:00
Ingo Bürk 2d4f8ce90b Set a proper WM_CLASS on frame windows. 2015-09-22 08:57:05 +02:00
Ingo Bürk 034815b8fd Set and unset individual atoms in _NET_WM_STATE instead of overwriting the entire list everytime. This allows independent management of multiple states.
fixes #1873
2015-09-17 09:13:12 +02:00
Ingo Bürk 5dbfb05c85 Use the EWMH support window rather than the root window as an input focus fallback.
If no other window is available on the active workspace, we now select the EWMH support window (used to indicate that an EWMH-compliant window manager is preent) as the focus window rather than the root window. The NET_WM_ACTIVE window will still be set to XCB_WINDOW_NONE to pretend that no window is actually focused.
This fixes the issue that when using the root window, a fallback mechanism in X11 takes effect which routes keyboard input to the window under the cursor, independent of whether that window has the input focus. Using the EWMH window instead, we can avoid this behavior. We cannot simply set it to XCB_WINDOW_NONE as this would discard all keyboard events, breaking keybindings.

fixes #1378
2015-09-13 20:29:02 +02:00
Ingo Bürk f44c87685b Support _NET_WM_VISIBLE_NAME. As per specification this is necessary since we can display custom titles with title_format.
fixes #1872
2015-08-30 22:42:14 +02:00
Ingo Bürk 2938fc0ab1 Added '%class' and '%instance' as placeholders for the title_format directive.
relates to #1861
2015-08-25 19:22:05 +02:00
shdown bc52fae15c libi3: change scalloc() signature to match calloc() 2015-08-03 12:50:13 +03:00
Ingo Bürk 5a8d66a1d5 Parse the title_format and display the customized window title if a format was set.
The format string set with "title_format" can contain the placeholder "%title" which will be replaced with the actual window title.

By not overwriting window->name itself, we make sure that assignment matching still works as expected.

fixes #1723
2015-06-29 09:13:31 +02:00
Ingo Bürk ffe25d9e43 Set the _NET_WM_STATE_HIDDEN atom on windows that are currently not visible due to being in the non-focused tab of a stacked or tabbed container.
fixes #1648
2015-04-21 09:14:22 +02:00
Deiz 884214f14f Update copyright notices and get rid of ranges
The script used to make these changes can be found at:

   https://gist.github.com/Deiz/32322020f76d23e2bf8f
2015-04-20 17:50:21 -04:00
Ingo Bürk 245a29e233 Make show_marks configurable
Introduce a config directive "show_marks [yes|no]" to en- or disable drawing marks on window decorations.
To not change the look & feel of existing configurations, the default is "no".
2015-03-30 23:11:50 +02:00
Ingo Bürk 2af1a80028 Introduce a cached boolean for changes to the mark of a window.
This is necessary to correctly redraw window decorations when the mark of
a window is added or removed.
2015-03-30 23:08:25 +02:00
Ingo Bürk 1e89a301d5 Draw marks in window decoration
If a window has a mark set, e.g., "example", it will be printed on the right side of the window decorations.
The format is "[example]" and the name of the window is truncated if necessary.

Marks starting with an underscore ("_") will be ignored.
2015-03-30 23:08:25 +02:00
Michael Stapelberg 091f1db39a run clang-format (3.5.0)
Not quite sure why there are so many differences. Perhaps we’ve gotten
out of the habit of running clang-format after every change.

I guess it’d be best to have a travis hook that runs clang-format for us
and reports any problems on pull requests.
2015-03-01 17:16:03 +01:00
Michael Stapelberg 105db325dc Revert "Bugfix: Set input focus with last timestamp"
This reverts commit 9cee8dac5e.

fixes #1383
2014-11-23 00:36:09 +01:00
Mats 7fe55090ec Don't draw borders wider than actual width
Rectangles passed to function xcb_poly_fill_rectangle are of type
xcb_rectangle_t and defined as:

    struct xcb_rectangle_t {
        int16_t  x;
        int16_t  y;
        uint16_t width;
        uint16_t height;
    }

The rectangles for the right and lower border had a width and height,
respectively, greater than the actual border width.

Furthermore, offset the bottom border to not overlap with the right one
and, for the top border, use r->width instead of con->rect.width as with
the other borders.
2014-10-01 22:29:43 +02:00
Tony Crisci 8870edc2ca Do not resend focus on click
Do not set focused_id to XCB_NONE in route click to force resend focus,
in some cases to an already focused window.

Sending focus again on click is not necessary and may cause problems
with certain wine or mono apps. Resending focus makes combo boxes not
work in Office 2010.

This effectively reverts commit 250577da, so in case this commit causes
any problems with Eclipse to resurface, we’ll revert this commit in
favor of 250577da (the Eclipse-related bug fix).
2014-09-21 02:55:11 +02:00
Mats 5762456d89 Align lower line of bar decoration to border width
In normal border style, two horizontal lines are drawn to outline the
bar decoration. The lower line leaves a gap to the left and right to
align with the border. This gap was hardcoded to 2 pixels. Now it
matches the current border width, if any.

In stacked layout, only the bottommost bar is aligned. In tabbed layout,
no gaps are left in order to close the outline and make the notion of a
tab more clear.
2014-08-11 09:49:49 +02:00
Michael Stapelberg 67e00b3ab8 Merge branch 'master' into next 2014-07-23 09:48:26 +02:00
Tony Crisci 56c284af8e Bugfix: missed case for decoration rerender
Rerender the decoration when the container requires a pixmap and does
not have one.

fixes #1292
2014-07-23 09:48:20 +02:00
Michael Stapelberg 0279401528 Merge branch 'master' into next 2014-06-28 13:05:40 +02:00
Michael Stapelberg 1f9057bc4b Revert "Disable render-time pointer warps if asked"
This reverts commit b109b1b20d.

Turns out the change in behavior was unexpected by a number of users, so
let’s revert it and make those users that want this behavior configure
it explicitly.

Sorry for the back-and-forth here.
2014-06-28 13:04:52 +02:00
Michael Stapelberg 4c06e7a573 clang-format-3.5 **/*.h **/*.c
This should be the last commit that formats a big bunch of files. From
here on, whenever I merge patches, I’ll run clang-format like described
in the title.
2014-06-19 11:20:32 +02:00
Michael Stapelberg 9200094203 format **/*.c with clang-format-3.5
This has multiple effects:

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.
2014-06-15 19:07:02 +02:00
Tony Crisci 9cee8dac5e Bugfix: Set input focus with last timestamp
Setting input focus with the last event timestamp prevents race
conditions when setting focus.

fixes #1127
2014-06-12 09:33:35 +02:00
Tony Crisci b4507da713 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.
2014-06-01 11:45:59 +02:00
Atte Peltomaki 62ea60ba42 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.
2014-05-31 14:55:29 +02:00
Tony Crisci 4126c87daf Dont include dock clients in ewmh lists
http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368149456

The _NET_CLIENT_LIST property of the root window:

> These arrays contain all X Windows managed by the Window Manager.

Dock clients are not managed windows, so they should not be included in
_NET_CLIENT_LIST or _NET_CLIENT_LIST_STACKING.
2014-05-03 15:08:31 +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
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
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 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 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 b109b1b20d Disable render-time pointer warps if asked
When `focus_follows_mouse` configuration option is disabled, do not warp
the pointer when focus changes outputs after rendering.

Rationale: this option is meant to be disabled by users who have a setup
where the mouse is usually in the way. These users tend to move the
mouse to a corner or use a utility to hide the pointer when it is not
active. When this user switches focus between outputs, the mouse is
placed in the center of the screen.

This is clearly against the spirit of disabling `focus_follows_mouse`.
Disabling this option now implies disabling "mouse follows focus".
2014-01-04 20:52:12 +01:00
Michael Stapelberg 28a993e656 replace never-true condition with a working one
state->initial is set to false before calling x_push_node() since we
began pushing the window stack before pushing changes. Therefore, the
condition could never be true.
2013-12-22 21:52:49 +01:00
Michael Stapelberg 103ab83131 Revert "raise fullscreen windows on top of all other X11 windows"
This reverts commit 0659a0d98c.

It was a fix for dzen2 setups, but broke several other use cases.
Because dzen2 is not really important since most people use i3bar
nowadays, let’s revert this.

fixes #1062
fixes #1068
fixes #1070
2013-08-27 20:21:11 +02:00
Alexander Berntsen f9d93d75b3 Implement shmlog command
Add shmlog command that takes <size>|toggle|on|off. Separate logbuffer
management into open_logbuffer() and close_logbuffer(). Make
t/187-commands-parser.t expect 'shmlog'. Add update_shmlog_atom() to
update the SHMLOG_PATH. Document the shmlog command in userguide.
2013-06-23 21:48:02 +02:00
Diego Ongaro 609496d13f Draw indicator border only for split layouts
In order to distinguish split layouts from tabbed/stacking layouts when
only one window is shown, do not draw the indicator border for tabbed or
stacking layouts.
2013-05-22 19:35:33 +02:00
Michael Stapelberg 0659a0d98c raise fullscreen windows on top of all other X11 windows
Note that this is ineffective for dunst’s notifications because dunst
re-raises them as soon as they get obscured. It does work for dzen2
however, which was the original use-case.

fixes #569
2013-04-07 15:38:00 +02:00
Michael Stapelberg d8e27dd5aa ignore MotionNotify events generated while warping the pointer 2012-12-27 17:04:13 +01:00
Michael Stapelberg 9edbcc4790 debug message for window focus: include window ID 2012-12-27 16:58:46 +01:00
Joep van Delft 79bd2aede5 Draw 1px tab separators left/right instead of 2px on the right only
fixes #894
2012-12-22 16:15:11 +01:00
Michael Stapelberg ae605bdd39 Also draw right tab border for split containers (Thanks alex)
fixes #696
2012-12-19 21:12:38 +01:00
Michael Stapelberg 71ccb4bef2 Merge branch 'master' into next 2012-10-29 16:42:11 +01:00
Michael Stapelberg e7a4580c5f Bugfix: force rendering when the parent’s orientation changed
Otherwise, the split indicator might not be refreshed even though it
should be.

fixes #858
2012-10-29 16:41:16 +01:00
Michael Stapelberg 72c66a2091 Merge branch 'master' into next 2012-09-29 00:03:42 +02:00
Michael Stapelberg 31e8d7f2f8 Bugfix: Correctly move floating windows to invisible workspaces cross-output (Thanks swh) 2012-09-29 00:02:41 +02:00
Michael Stapelberg 2252b4f5b9 Merge branch 'master' into next 2012-09-28 19:47:16 +02:00