Commit Graph

185 Commits (1eabe1b2b1b6b232048204b75cf040667967bb32)

Author SHA1 Message Date
Michael Stapelberg b91cd347e4 Merge branch 'master' into next 2014-06-24 09:57:05 +02:00
Michael Stapelberg 5c30c6ca80 add log messages for the detected DPI
Currently, the DPI is only logged when pango fonts are used, which is
often not the case when people report problems with the DPI detection.
2014-06-24 09:56:31 +02:00
Tony Crisci a9c094b731 Implement EWMH desktop names
Maintain the _NET_DESKTOP_NAMES property on the root window.

http://standards.freedesktop.org/wm-spec/latest/ar01s03.html#idm140251368131760

> _NET_DESKTOP_NAMES
>
> _NET_DESKTOP_NAMES, UTF8_STRING[]
>
> The names of all virtual desktops. This is a list of NULL-terminated
> strings in UTF-8 encoding [UTF8]. This property MAY be changed by a
> Pager or the Window Manager at any time.
2014-06-24 09:04:05 +02:00
Tony Crisci 4205973135 feature: implement ewmh desktop viewport property
Set and update the _NET_DESKTOP_VIEWPORT property

http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#idm140146176862048

> _NET_DESKTOP_VIEWPORT x, y, CARDINAL[][2]/32
> Array of pairs of cardinals that define the top left corner of each
> desktop's viewport.
2014-06-23 21:29:57 +02:00
Michael Stapelberg 3f5a0f0024 Switch to xcb-xkb and libxkbcommon
This removes our last dependency on Xlib! :)

(Okay, an Xlib dependency still comes in through other libraries that we
 link against, but it’s not us. Our code is simpler by this change and
 uses one less connection to X11.)
2014-06-21 19:10:37 +02:00
Tony Crisci b47f480728 Implement EWMH number of desktops property
_NET_NUMBER_OF_DESKTOPS:

> This property SHOULD be set and updated by the Window Manager to
> indicate the number of virtual desktops.

We interpret this property as the number of noninternal workspaces.
2014-06-19 11:21:03 +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
Michael Stapelberg 94574db6f6 cleanup temporary directory when restarting and not using XDG_RUNTIME_DIR
fixes #1253
2014-06-11 09:17:43 +02:00
Michael Stapelberg 26460c091a delete ipc socket when exiting, cleanup tmpdir
fixes #1253
2014-06-08 22:13:43 +02: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
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 a32b6da712 Merge branch 'master' into next 2014-01-04 12:20:12 +01:00
Michael Stapelberg 2326ebfd63 enable shmlog when invoked as i3-with-shmlog, install symlink + .desktop file 2014-01-04 12:18:45 +01:00
Michael Stapelberg e567cf436c dragging: instead of using a custom event loop, use libev
This is done by installing a new check watcher that replaces the main
X11 event handler and calling ev_run with EVRUN_ONCE until the dragging
loop left state DRAGGING.

With this commit, other handlers, most notably the redraw handler for
placeholder windows, get a chance to run when dragging (placeholder!)
windows around.
2013-12-22 21:52:49 +01:00
Michael Stapelberg 3a4ad9b330 layout restore: create and render placeholder windows
This is not entirely done yet, but TODO entries are placed in the code
where appropriate.
2013-12-22 21:52:49 +01:00
Lancelot SIX f22995393a Remove references to PATH_MAX macro
Since the macro PATH_MAX is not defined on every system (GNU/Hurd being
one of those who do not define it), we remove all references to this
macro. Instead, we use a buffer of arbitraty size and grow it when
needed to contain paths.
2013-11-24 13:50:29 +01:00
Michael Stapelberg 4f5e0e794f persist root window’s background contents to a pixmap
The commit title is fairly technical, so I’ll try to explain.

Recently, users of GDM3 (I’m sure) and LightDM (I think) have reported
that when switching to a new workspace, the contents of the previous
workspace are still visible. i3bar updates, though, so it is the X11
root window which is not being updated here.

When using GDM3, X11 will be started with -background none, and no
background pixmap or pixel is set. Then, apparently,
gnome-settings-daemon will display a fade animation from whatever is
currently on the window to the destination contents. I think this is to
avoid flickering when logging in, which would occur when just setting a
specific background pixmap or pixel.

So, this commit will, when i3 starts first (not on restarts), copy the
contents of the X11 root window (typicall a grey background, at least on
my machine with GDM3) into a pixmap and set that pixmap as background
pixmap. That way, the content will be preserved and one has a
background, instead of what is perceived as a bug :).

This commit has some chance of breakage, so I’m prepared to revert it
unless we can figure out the issues and roll forward.
2013-11-24 13:44:30 +01:00
Michael Stapelberg d3beff2339 make i3bar use libi3’s root_atom_contents()
This removes code duplication, which will be useful for a subsequent
commit.

Furthermore, we now don’t open X11 connections unnecessarily in some
corner cases.
2013-11-22 15:48:45 +01:00
Michael Stapelberg eec80838ab actively delete _NET_WORKAREA on startup
fixes #1038
2013-07-13 12:24:15 +02:00
Alexander Berntsen 49bc20c934 Fix incorrect comment 2013-06-23 22:34:04 +02:00
Alexander Berntsen 684a77442e Make default shmlog_size a const int 2013-06-12 23:24:07 +02:00
Michael Stapelberg 271189444d bump copyright years to 2013 2013-03-17 01:01:04 +01:00
David Edmondson 3365b52384 Allow servers which do not support the XKB extension.
If we can open the X display but the XKB extension is not available,
continue without it.
2013-01-23 20:27:27 +01:00
Michael Stapelberg dcb8ac84f8 ipc_recv_message: store message_type, don’t compare. add distinct EOF retval
Also use ELOG, which requires i3-msg to provide logging functions.
2013-01-23 18:51:39 +01:00
Michael Stapelberg d8e27dd5aa ignore MotionNotify events generated while warping the pointer 2012-12-27 17:04:13 +01:00
Michael Stapelberg b304e6ad34 remove old cfgparse.{l,y} 2012-12-24 15:46:57 +01:00
Michael Stapelberg 625401d162 Bugfix: handle MapRequests sent between i3 registering as a wm and handling events
This fixes the problem where i3-nagbar does not come up because its
MapRequest is ignored.

fixes #892
2012-12-24 14:49:19 +01:00
Michael Stapelberg 20c0fa7cfb use the new parser by default
you can force the old parser with the command line flag
--force-old-config-parser-v4.4-only (which will be present in v4.4 only,
as the name suggests)
2012-10-08 13:26:42 +02:00
Michael Stapelberg 1cbf665581 remove async-unsafe functions from signal handler 2012-09-27 12:37:27 +02:00
Michael Stapelberg 9c01bdeef7 Revert "Use ev_signal to avoid async-unsafe functions (Thanks Markus)"
This makes our signal handler useless and leads to infinite SIGSEGV
loops because the ev callback handler gets called only from within the
event loop, and control doesn’t necessary get to the event loop…

This reverts commit 514265b529.
2012-09-27 12:34:09 +02:00
Deiz e582e19ffd Clicking the root window should try to focus the relevant workspace. 2012-09-23 16:39:35 +02:00
Michael Stapelberg 514265b529 Use ev_signal to avoid async-unsafe functions (Thanks Markus)
Functions such as fprintf() might be unsafe to use in a signal handler,
see http://stackoverflow.com/questions/3941271/#answer-3941563

By using ev_signal, libev will use a tiny signal handler which just
passes on the information and then calls (outside of the signal handler)
our callback function which can use fprintf() and other unsafe
functions.

fixes #803
2012-09-21 16:35:25 +02:00
Michael Stapelberg 99e91c8049 --help: note that nVidia’s driver supports RandR from 302.17 on 2012-09-19 17:52:56 +02:00
Michael Stapelberg 73d5dcbbaf x: grab server and process pending events before managing existing windows
fixes #782
2012-09-04 18:02:37 +02:00
Michael Stapelberg 4eff386439 remove obsolete branch reference "(tree)" from starting line 2012-08-13 01:57:23 +02:00
Michael Stapelberg 1e49f1b08a Implement i3 --moreversion
From the code:

    Connects to i3 to find out the currently running version. Useful since it
    might be different from the version compiled into this binary (maybe the
    user didn’t correctly install i3 or forgot te restart it).

Here is an example output:

    $ ./i3 --moreversion
    Binary i3 version:  4.2-202-gb8e782c (2012-08-12, branch "next") © 2009-2012 Michael Stapelberg and contributors
    Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

    The i3 binary you just called: /home/michael/i3/i3
    RUNNING BINARY DIFFERENT FROM BINARY ON DISK!
    The i3 binary you are running: /home/michael/i3/i3

    $ i3 restart
    2012-08-12 15:05:28 - Additional arguments passed. Sending them as a command to i3.
    IPC: received EOF instead of reply

    $ ./i3 --moreversion
    Binary i3 version:  4.2-202-gb8e782c (2012-08-12, branch "next") © 2009-2012 Michael Stapelberg and contributors
    Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

    The i3 binary you just called: /home/michael/i3/i3
    The i3 binary you are running: /home/michael/i3/i3
2012-08-12 15:10:13 +02:00
Michael Stapelberg 884627ef20 use I3__FILE__ for DLOG, leave __FILE__ as is
See also commit 0e752070ac, which broke
source code listings in gdb unless you cd into i3/src. This should give
us best of both :-).
2012-08-12 12:19:47 +02:00
Julius Plenz 70ec3867fe clean up zero-byte logfile on immediate exit
Otherwise, a zero-byte log file stays behind after every call to `i3
--get-socketpath`. Also, replace "return" calls with more explicit "exit"
calls.

Before:

$ ls -ld /tmp/i3* | wc -l; \
  repeat 10 i3 --get-socketpath >/dev/null; \
  ls -ld /tmp/i3* | wc -l
1
11

Now:

$ ls -ld /tmp/i3* | wc -l; \
  repeat 10 i3 --get-socketpath >/dev/null; \
  ls -ld /tmp/i3* | wc -l
1
1

Signed-off-by: Julius Plenz <julius@plenz.com>
2012-08-11 02:23:03 +02:00
Michael Stapelberg 6ba0944430 scratchpad: fix moving scratchpad window
From the source:

    When starting i3 initially (and after each change to the connected
    outputs), this function fixes the resolution of the __i3
    pseudo-output. When that resolution is not set to a function which
    shares a common divisor with every active output’s resolution,
    floating point calculation errors will lead to the scratchpad window
    moving when shown repeatedly.

fixes #632
2012-08-08 18:45:40 +02:00
Michael Stapelberg 0e752070ac explicitly set filenames to $(basename __FILE__)
This makes the debug log a bit more readable, especially since commit
48f1e383ca
2012-08-07 09:55:52 +02:00
Michael Stapelberg 1b2d222449 Properly report errors in 'focus parent' (Thanks eeemsi)
Also, make X11 errors debug log level only. They are harmless usually.

fixes #762
2012-08-05 20:57:20 +02:00
Michael Stapelberg 8a1c8115ca fix a few warnings/places where the clang static analyzer complains 2012-08-05 16:34:38 +02:00
Quentin Glidic bdc078914b i3: Replace loglevels by a global debug logging
File-limited were not used nor really useful
Besides, they are painful to maintain in Makefile rules compared to the
benefit
2012-07-22 18:41:12 +02:00
Michael Stapelberg 6146f39b8a when using i3 -C, don’t send remaining arguments via IPC (Thanks Somelauw) 2012-06-25 21:43:41 +02:00
Michael Stapelberg 62d3329906 remove dead code
This was a left-over of commit 9d68d780e2
2012-05-09 20:00:46 +02:00
Michael Stapelberg eeb6ff9237 Move is_debug_build() to libi3/ 2012-05-09 19:12:20 +02:00
Michael Stapelberg cc9f0ab353 bump copyright in --version (Thanks joepd) 2012-04-22 13:04:24 +02:00
Michael Stapelberg 0f10ccdf12 Implement fake-outputs option (cmdline, cfg) for multi-monitor testing
This kills the dependency on xdmx and makes the testsuite simpler
and more flexible (in the output sizes / configurations).
2012-04-09 14:28:36 +02:00
Michael Stapelberg 206b96202c Use (void) instead of () for functions without args (Thanks fernandotcl)
See also:
http://article.gmane.org/gmane.linux.kernel/1268792

The C compiler will handle (void) as "no arguments" and () as "variadic
function" (equivalent to (...)) which might lead to subtle errors, such
as the one which was fixed with commit 0ea64ae4.
2012-03-31 10:53:04 +02:00
darkraven 9d68d780e2 Use 32bit visual only when needed. Thus we could drop the --enable-32bit-visual option. 2012-03-26 16:50:44 +02:00
Michael Stapelberg 4172e43c9c debugging trick: keep a symbol pointing to I3_VERSION around
This way, gdb will include the i3 version in backtraces.
2012-03-21 20:48:00 +01:00
Michael Stapelberg 58ecd14900 Implement support for chosing a 32 bit visual (necessary for pseudo-transparency) (Thanks darkraven)
You need to specify the --enable-32bit-visual flag when starting i3. This is
done because everything feels sluggish on my system when using a 32 bit visual
instead of a 24 bit visual. Fast > fancy.
2012-02-15 18:56:07 +00:00
Michael Stapelberg 318d4fdeef make in-place restarts use socket activation, too (for faster/less flaky tests) 2012-01-21 23:03:09 +00:00
Michael Stapelberg 759ed0b6e3 Merge branch 'master' into next 2012-01-20 18:10:52 +00:00
Michael Stapelberg 4f26d6f2a1 Bugfix: Setup the _NET_SUPPORTING_WM_CHECK atom in a standards-compliant way
This makes chrome (and probably other apps, too) receive changes of the
_NET_ACTIVE_WINDOW and thus show its bookmark dialog properly.

Fixes: #544
2012-01-20 18:09:53 +00:00
Michael Stapelberg dee7c07ad2 shmlog: store meta information in the buffer itself, store path as X11 atom
This makes i3-dump-log completely independent of a running i3 instance.
2012-01-06 23:40:07 +00:00
Michael Stapelberg f7a73f4a68 fix the SHM log size 2011-12-10 11:15:57 +00:00
Michael Stapelberg aa82adb5c0 Introduce --shmlog-size flag, unlink SHM log when exiting 2011-12-10 10:51:55 +00:00
Jan-Erik Rediger f23d675de9 Implement new "i3bar_command" option for bar.
This allows you to specify an alternate path to the i3bar binary.
The userguide docu is included.
2011-11-27 21:40:57 +00:00
Michael Stapelberg b6e859787e clarify comments about socket activation (Thanks mxf) 2011-11-16 23:14:57 +00:00
Michael Stapelberg 6bdd12a584 Bugfix: Correctly fill the buffer with zeros 2011-11-09 22:23:33 +00:00
Michael Stapelberg 332dbfe9c1 Enable (unlimited) core dumps when running i3 development versions
Also prints out useful stuff:

    CORE DUMPS: You are running a development version of i3, so coredumps were
    automatically enabled (ulimit -c unlimited).
    CORE DUMPS: Your current working directory is "/home/michael/i3".
    CORE DUMPS: Your core_pattern is: /tmp/%e.core.%p
    i3 (tree) version 4.0.2-479-g26ab2ac (2011-11-08, branch "next") starting

This does not affect child processes of i3.

The intention of this change is to make debugging easier – it’s one less thing
users of the development version have to worry about when trying to help with
debugging.
2011-11-08 22:49:25 +00:00
Michael Stapelberg bbfbd28dfa Add a --no-startup-id flag for exec (command), exec (config), exec_always (config) 2011-10-25 22:18:17 +01:00
Michael Stapelberg 91134f75c0 Move get_mod_mask to libi3, use it in i3 and i3-config-wizard
Also, the API changed a bit. There are two functions now, both assume you
already got the keysyms (which is the case for i3 and i3-config-wizard),
one gets the modifier mapping for you (aio_get_mod_mask_for) while the other
assumes you also got that. No roundtrips are required for the latter.
2011-10-23 21:26:15 +01:00
Michael Stapelberg a512b99a51 Introduce --get_socketpath and --force_xinerama as synonyms for --get-socketpath and --force-xinerama 2011-10-23 19:41:40 +01:00
Michael Stapelberg 9d15a00ba8 introduce sasprintf() in libi3, use it everywhere 2011-10-23 13:16:56 +01:00
Michael Stapelberg 42d355f2b7 normalize modelines/headers across src/*.c 2011-10-22 23:40:02 +01:00
Michael Stapelberg 12d866e4f6 Don’t start i3-nagbar when using -C to validate the config 2011-10-20 22:25:59 +01:00
Michael Stapelberg 230b238870 Actually start i3bar instances for each configured bar 2011-10-20 19:03:40 +01:00
Michael Stapelberg 15bface10d Create different IDs for each bar (+test) 2011-10-19 19:57:39 +01:00
Michael Stapelberg 32b97745ec Don’t call ev_destroy_loop with ev < 4 in atexit (Thanks xeen) 2011-10-15 16:56:32 +01:00
Michael Stapelberg 5f52c78aa0 Change the root window cursor to 'watch' during startups 2011-10-10 15:54:18 +01:00
Michael Stapelberg b9db72dc8a Implement support for startup notifications
This only sets up startup notifications for the 'exec' commands and directives.

Monitoring startups follows later.
2011-10-10 15:54:17 +01:00
Michael Stapelberg 2a29d9c2c1 Make conn_screen available outside of main()
Will be used in other parts of the code for startup notification
2011-10-10 15:54:17 +01:00
Michael Stapelberg b755397687 Make i3 send arguments as command to a running i3 instance (like i3-msg)
From i3 --help:

If you pass plain text arguments, i3 will interpret them as a command
to send to a currently running i3 (like i3-msg). This allows you to
use nice and logical commands, such as:

	i3 border none
	i3 floating toggle
	i3 kill window
2011-10-02 19:20:43 +01:00
Michael Stapelberg 4243a4053e Cleanup i3 --help 2011-10-02 18:55:15 +01:00
Michael Stapelberg 23796ea900 Implement i3 --get-socketpath, useful for IPC scripts
In order to not depend on X11 just for getting the socket paths, scripts or
other programs can now use i3 --get-socketpath. Since i3 must be present on the
computer anyways, this saves one dependency :).
2011-10-02 16:12:10 +01:00
Michael Stapelberg 679bceccc4 remove obsolete comment 2011-10-02 13:18:12 +01:00
Michael Walle 5aa43d61f8 Add force_xinerama configuration option
The configuration option does the same as the commandline parameter, except
it can be easily set by the user (e.g. you are using KDM and can't start a
session through ~/.xsession).

Signed-off-by: Michael Walle <michael@walle.cc>
2011-09-19 23:10:38 +01:00
Michael Stapelberg d03dffe012 Kill left-over i3-nagbar processes on 'exit' 2011-09-11 21:49:35 +01:00
Michael Stapelberg 2cd8231fce Merge branch 'master' into next 2011-08-20 17:48:49 +02:00
Michael Stapelberg f15559eb1f Don’t die, but ELOG and fallback when the pointer cannot be queried (Thanks Niklas) 2011-08-20 17:48:07 +02:00
Michael Stapelberg 4cf2cab626 Merge branch 'master' into next 2011-08-17 13:37:33 +02:00
Michael Stapelberg 09ad9808f6 Bugfix: Set focus to where the mouse pointer is when starting (Thanks nutron)
Fixes #477
2011-08-17 13:37:08 +02:00
Michael Stapelberg 2abe23d6ff Merge branch 'master' into next 2011-08-17 01:52:45 +02:00
Michael Stapelberg 7951445849 xcb: use predefined XCB_ATOM_ atoms, don’t request them 2011-08-17 01:41:19 +02:00
Michael Stapelberg 10f871b57b implement "socket activation": passing IPC sockets to i3 2011-08-10 15:55:27 +02:00
Michael Stapelberg c883e7050a Include <limits.h> in all.h 2011-08-04 00:10:04 +02:00
Michael Stapelberg 192dbdabd6 Bugfix: Correctly set the _NET_CLIENT_LIST_STACKING hint (fixes chromium tabbar)
Fixes #287
2011-08-03 20:07:03 +02:00
Michael Stapelberg ffbcfa2c97 Bugfix: also free() X11 errors in the main loop 2011-07-31 19:41:57 +02:00
Michael Stapelberg 3721c598bd Bugfix: Set the cursor via the Xlib connection if XCursor is supported
This fixes a race where we created cursors on the Xlib connection, flushed,
then used the cursor on the XCB connection. Even though we flushed, the X
server did not process the requests yet and therefore returned a BadCursor
error.

This bugfix uses the Xlib connection for setting the root window cursor which
will ensure that the requests are properly serialized.

An easy test for this (on my machine) is the following ~/.xsession:
    xsetroot -cursor_name cross
    exec i3
If you see a cross cursor instead of the pointer, the race happens. You’ll see
a error_code=6 error in your ~/.xsession-errors.
2011-07-29 13:13:51 +02:00
Michael Stapelberg bc7dec6a4c X11 errors: also log the error_code (see X Protocol, Appendix B, Errors) 2011-07-29 13:11:02 +02:00
Fernando Tarlá Cardoso Lemos 7a18dcc89e Set the root window cursor. Fixes #442. 2011-07-29 12:38:24 +02:00
Michael Stapelberg f84264ae41 remove _NET_WM_WORKAREA from _NET_SUPPORTED for now
See ticket #301, this is a problem with Qt apps on your second monitor.

We should implement better EWMH support, but not before the release :).
2011-07-27 12:51:38 +02:00
Michael Stapelberg a05a9f8dae Set some more atoms for _NET_SUPPORTED (Thanks lexszero) 2011-07-23 22:40:47 +02:00
Michael Stapelberg ffe297f5e5 Bugfix: use the global root variable, don’t get the first one (Thanks quaec) 2011-07-23 22:29:01 +02:00
Claudio Marforio cc24a96e96 patch to allow exec_always in configure file
fixed indentation, updated docs
2011-07-12 18:23:14 +02:00
Michael Stapelberg 05e39c1c48 Ignore X11 errors caused by ReparentWindow / ChangeProperty on already destroyed windows
These errors can happen because a DestroyWindow request by a client will
trigger an UnmapNotify, then a DestroyNotify. We cannot distinguish this
UnmapNotify from an UnmapNotify not followed by a DestroyNotify, so we just try
to send the ReparentWindow / ChangeProperty and ignore the errors, if any.
2011-07-10 23:44:13 +02:00
Michael Stapelberg c55abca115 add i3-nagbar. tells you about config file errors (for example) 2011-07-10 14:33:19 +02:00