Commit Graph

6000 Commits

Author SHA1 Message Date
Uli Schlachter 9d232c085c Print LuaJIT version in --version (#996)
When called with "--version", awesome prints the Lua version that it was
compiled against and the one that it is running against. This commit makes the
code detect LuaJIT and makes it print the LuaJIT version instead of an
unspecific "Lua 5.1".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-12 19:36:08 +02:00
Uli Schlachter a93dc75cd6 Remove useless information from awesome -v
Most of this information isn't interesting. If you are getting awesome from a
distro, then the time, hostname and username of the build are likely 'random
stuff' and if you are building awesome yourself, then the hostname and username
are obviously yours and the time can still be interfered based on the awesome's
binary ctime.

The GCC version shouldn't make any difference at all.

Closes https://github.com/awesomeWM/awesome/pull/566.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-12 19:36:01 +02:00
Uli Schlachter f29eb2fee3 Fix wallpaper setting after RandR monitor changes
A co-worker of mine has a laptop with a small display and two larger displays.
When enabling the larger displays (and disabling the built-in display), the
wallpaper was set incorrectly. Only the size of the old, smaller screen actually
contained the wallpaper and the left was black.

The reason for this is that the code directly draws the new wallpaper to the
pixmap containing the old wallpaper. However, because the old display was
smaller, this pixmap isn't as large as the screen and so couldn't contain all of
the new wallpaper.

Fix this by explicitly creating a surface of the needed size and copying the old
wallpaper into it (because we might be setting only the wallpaper of some
screen, not all of them).

Special-thanks-to: vsp
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-28 17:31:39 +02:00
Uli Schlachter 4628b15235 change codename
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-06 15:05:54 +01:00
Uli Schlachter e54d911a94 Make client key bindings for e.g. xeyes work again
Instead of focusing the root window, we now create a "focus window" inside of
our frame window. This window is placed so that it is not visible, but we can
grab key bindings on it to simulate the window having the input focus.

Fixes: https://github.com/awesomeWM/awesome/issues/699
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-29 21:47:22 +01:00
Uli Schlachter 89a29b5404 Fix arguments to luaL_checkstack()
The argument to luaL_checkstack() is the amount of new stack to make available,
not the new size of the stack. Thus, remove the addition of lua_gettop(L) here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-29 21:35:17 +01:00
Uli Schlachter 333cfaf0a5 Balance the stack in luaA_loadrc()
In various conditions, luaA_loadrc() left luaA_dofunction_on_error and an error
message on the Lua stack. Also, it used LUA_MULTRET without looking at the
return values. Fix all of this and reorder the code a bit to make it easier to
follow.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-29 21:35:05 +01:00
Uli Schlachter a181bee465 Fix unbalance Lua stack usage in event_handle_leavenotify()
Commit 42e0081958 removed a call to lua_pop(L,1) that was still necessary.
This commit adds that call again.

Fixes: https://github.com/awesomeWM/awesome/issues/703
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-29 21:35:01 +01:00
Uli Schlachter bf73f78eea Check that the Lua stack is empty in the main loop
The Lua stack is a finite resource and everything that pushes something there
should also clean up. This is not a problem for functions that are called by
Lua, because their "stack frame" is freed when they return. However, in global
context, Lua does not and cannot automatically clean up for us. Thus, it makes
sense to print a warning in this case.

(Additionally, this cleans up the stack if something is left)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-29 21:34:28 +01:00
Uli Schlachter 9d34f2dc03 Fix awful.ewmh to handle window gravities
Since commit b2aaefd095, we correctly handle window gravities when
the border width of a client changes. Since most windows out there have a
NorthWest gravity, this means that most windows do not have this problem.
However, e.g. mplayer uses gravity "Static" and this causes this issue (any
gravity other than NorthWest will do).

This affects the fullscreen handling in awful.ewmh. The code has to set the
border width before it changes a client's geometry so that the move when the
border width changes doesn't matter.

No new integration test for this since I didn't find anything usable with a
non-NorthWest gravity. A test would be easy to write, just test if `c.fullscreen
= true ; c.fullscreen = false` restores the previous window geometry.

Fixes: https://github.com/awesomeWM/awesome/issues/697
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-17 18:16:00 +01:00
Uli Schlachter 64748671cd Don't modify WM_HINTS in client_set_urgent()
To quote from ICCCM (§4.1.2): "The window manager will not change properties
written by the client."

We tried to do this anyway to update WM_HINTS so that the current urgency state
is reflected. Apparently, Chrome does a similar read-modify-set cycle and the
resulting race condition meant that the "accepts input" hint on Chromium's
window was permanently disabled.

This helps with https://github.com/awesomeWM/awesome/issues/670, but I still
think that Chrome shouldn't try to implement "please don't focus me when I do
the following" by temporarily claiming "please don't ever focus me".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-16 19:34:34 +01:00
Uli Schlachter dfe44a1571 Always send ConfigureNotifies
ICCCM specifies when the WM has to send a ConfigureNotify. Java does not care
and wants one all the time. Meh.

Fixes: #248
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-16 19:29:02 +01:00
Uli Schlachter 6208d46635 change codename
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-30 14:55:18 +01:00
Roy Crihfield dd40e7a021 menubar: handle nil Name in .desktop files 2016-01-29 18:30:25 +01:00
Uli Schlachter f128b31313 Fix window key grabbing
Commit ff799a0f5d is incomplete. It changed the window on which we grab
keys, but only in some places. When the keyboard layout changes, we have to
re-grab these keys, but the code does so on the wrong window.

This patch fixes that oversight.

Fixes: https://github.com/awesomeWM/awesome/issues/639
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-23 13:14:30 +01:00
Uli Schlachter 1098bee582 change codename
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 16:51:19 +01:00
Kimball Thurston 1c27a69131 Fix focus handling with multiple awesome instances
When there are multiple X11 screens (i.e. :0.0 and :0.1) for zaphod mode
style X setups, this triggers a refresh of focus when the instance
running on a particular root receives the mouse

Fixes https://github.com/awesomeWM/awesome/issues/599.
2016-01-11 19:57:52 +01:00
Daniel Hahler 91743f01b8 Add .travis.yml from master, ignoring functional tests
Closes https://github.com/awesomeWM/awesome/pull/554.
2015-11-19 22:42:34 +01:00
Uli Schlachter 4bc44ee141 objects: Add .valid property (Fixes #110)
This property is especially useful for client objects which are unusable after
unmanage. "Unusuable" here means that pretty much everything you do with the
client object results in a lua error.

Syntax is c.valid.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:44:52 +01:00
Uli Schlachter 0bf4771e51 Spawn: Improve handling of startup notification
The ID for startup notification is transmitted to the spawned process via the
DESKTOP_STARTUP_ID environment variable. Before this commit, we set this
variable in the main process. This meant that if we started something "without"
a startup id, then it might get the ID that was used by the last spawn and which
was still saved in our env. Fix this by setting the environment variable only
after fork().

Small anecdote: The above wasn't enough to make Daniel's test case succeed and
at first I couldn't figure out why.

Turns out that rxvt-unicode doesn't unset the DESKTOP_STARTUP_ID environment
variable (I think it should, according to some spec), even though it supports
startup notification. So awesome was already started with DESKTOP_STARTUP_ID set
and thus all spawned processes used this ID.

Fix this by explicitly unsetting DESKTOP_STARTUP_ID if we don't set any new
value (even though this breaks encapsulation; we shouldn't have to care about
this "implementation detail" of libstartup-notification).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:44:15 +01:00
Uli Schlachter ff799a0f5d Grab client keys on the client window (#496)
Before this, we grabbed the keys on the frame window. That meant we only got key
events for things that nothing else grabbed directly on the key window.

After this, we grab directly on the client window itself and so we "fight" with
everything else which wants to grab keys. I don't actually know how the winner
is decided... First come, first serve, the rest gets an error?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:42:49 +01:00
Uli Schlachter facf51b8cb Apply window gravity for border width changes
Together with the previous changes, this also fixes the initial positions for
metacity's test-gravity.c.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:41:45 +01:00
Uli Schlachter 9c7cc12e5f Apply window gravity for titlebar resizes
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:39:13 +01:00
Uli Schlachter cd5cd52c20 Refactor code a little
The previous commit added some variables and this commit makes the surrounding
code use these new variables as well.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:38:19 +01:00
Uli Schlachter bbf88211b4 Apply window gravity when a window moves itself
This just makes us do what ICCCM requires us to do. Tested via metacity's
test-gravity.c.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:37:27 +01:00
Uli Schlachter 4313d93c6c Fix obvious typo in xwindow_translate_for_gravity()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:37:19 +01:00
Uli Schlachter 821e3e7e2c Make awesome.quit() during startup work
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:34:55 +01:00
Uli Schlachter e7fbbf47e5 Fix client_apply_size_hints()
The bit that indicates that the base size is set is
XCB_ICCCM_SIZE_HINT_BASE_SIZE. However, instead this code checked
XCB_ICCCM_SIZE_HINT_P_SIZE which is set to indicate how the initial window
position is chosen. So we were checking the complete wrong bit. Whoops...

Fixes: https://github.com/awesomeWM/awesome/issues/456

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:34:34 +01:00
Uli Schlachter 9b5ab994b0 Never explicitly focus the root window
Whenever client.focus == nil, we set the input focus to the root window to
express "nothing has the input focus". However, thanks to the way X11 input
works, this means that whatever is under the mouse cursor gets keyboard input
events. This can easily be reproduced with urxvt and some small addition to the
config to unfocus things.

This commit changes things. Instead of focusing the root window, we create a
special "no focus" window that gets focused if we want nothing to have the
focus.

Closes https://github.com/awesomeWM/awesome/pull/470.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:33:54 +01:00
Kazunobu Kuriyama abf7d1546c Fix the definition of A_STRNEQ_CASE
Replace A_STRCASEEQ whose definition is not given anywhere with A_STREQ_CASE.

Closes https://github.com/awesomeWM/awesome/pull/488.
2015-11-06 21:32:49 +01:00
Uli Schlachter de8fd4ffd4 Handle enter/leave events with detail=Inferior correctly
There is a client window C. Around this window, awesome adds a frame window F.
When the pointer is inside of C and then moves inside of F, we get a LeaveNotify
with detail=Inferior, but from our point of view, the pointer is still inside of
C, because F is contained in C.

Similarly, if the pointer is in F and moves to C, we get an EnterNotify with
detail=Inferior that we should ignore. However, for an EnterNotify the pointer
can now be inside of a titlebar, so this case has to be handled now.

The above explains the enter/leave behavior for clients. Let's now think about
titlebars: When the pointer moves from C to F, it cannot be in any titlebar any
more, so we must generate a leave event on that titlebar. Similar when the
pointer moves from F to C, but in this case we also have to figure out which
titlebar now contains the pointer.

This patch makes the code handle these events with detail=Inferior correctly.

Closes https://github.com/awesomeWM/awesome/pull/461.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:30:52 +01:00
Uli Schlachter a638310e89 Fix compilation
This fixes a bad cherry-pick from commit db087fdda7.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:29:27 +01:00
Uli Schlachter ac72f8e5a0 Fix enter/leave events on titlebars
This adds a global variable that tracks the drawable that is currently under the
mouse cursor. This new variable is then used so that we get consistent behavior
for enter/leave signals. Such signals are now also generated when a MotionNotify
event tells us that the pointer is now in a different titlebar.

Before this, it was possible that we did not generate a leave event on a
titlebar since the LeaveNotify contains the cursor position after the leave and
we did not manage to figure out which titlebar was left.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-06 21:28:47 +01:00
Uli Schlachter f320cc74d0 Force systray redraw on BG color change
This commit makes awesome track the current background color of the systray
window. When Lua applies another color, a redraw of all icons is forced.

Fixes: https://github.com/awesomeWM/awesome/issues/359
Closes: https://github.com/awesomeWM/awesome/pull/402

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-29 18:26:34 +02:00
Daniel Hahler d37cc7e9df awesome_atexit: keep client order always
This is not only useful for soft restarts, but also when TERMinating
awesome during development/testing.

The drawback appears to be that it would leak a property on the root
window in case it is really meant to be quit.

Closes https://github.com/awesomeWM/awesome/pull/374.
2015-08-29 18:20:28 +02:00
Uli Schlachter db087fdda7 Keep client order across restarts
This saves the order of clients in a property called AWESOME_CLIENT_ORDER on the
root window during shutdown. During startup, after managing all existing
windows, we force the client list into the order described by this property
(overwriting any changes that Lua possibly did).

This code should safely handle cases where the property doesn't contain all
existing clients or contains a client which doesn't exist anymore.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-29 18:18:34 +02:00
Uli Schlachter 0412acfdc0 Keep stacking order across restarts
ReparentWindow puts the window at the top of the stacking order. Thus, we have
to reparent clients back to the root window in the stacking order.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-29 18:18:21 +02:00
Daniel Hahler 581ccc80ad cmake: s/ESCAPE_QUOTE/ESCAPE_QUOTES
This appears to be the correct name for 2.8.12 [1] already, but CMake
3.2.3 complains loud(er) now.

1: http://www.cmake.org/cmake/help/v2.8.12/cmake.html#command:configure_file
2015-08-29 18:08:28 +02:00
Daniel Hahler 925e6ecc17 Make stdout/stderr line buffered
This improves the behaviour with print()ing for debugging, when the
output is redirected to a file.

I was using `setbuf(…, 0)` initially, but it makes sense to buffer it
per line.  This uses `setvbuf` instead of `setlinebuf`, which might not
be available everywhere.

Closes https://github.com/awesomeWM/awesome/pull/267
2015-08-29 18:07:10 +02:00
Uli Schlachter 4c517cf9d3 Screen __index: Don't turn argument into a string
Calling lua_tostring() on a number/integer, turns that stack slot into a string.
This patch changes the code to only call lua_tostring() if the function argument
really is a string.

This partly also caused https://github.com/awesomeWM/awesome/issues/238.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-08-29 18:05:57 +02:00
▟ ▖▟ ▖ 84f09d9c69 awful.menu: update t new layout api
Apparently the style to get the direction of a wibox.layout.* changed
from calling get_dir to just accessing the attribute dir.
2015-08-29 18:01:00 +02:00
Heiko Becker 00d466204f awesomeConfig.cmake: Allow setting AWESOME_DATA_DIR
The motivation behind this patch is my distro moving to a multiarch
layout. While binaries, libraries, etc. are are installed into
/usr/{host}/{bin,lib,...} architecture-independent data should still
go to /usr/share.
2015-08-29 17:59:28 +02:00
Daniel Hahler 2efc09d103 tag.lua: add "property::icon_only" signal
Thanks @NormalRa for the patch.

Fixes #138.
2015-08-29 17:59:05 +02:00
Uli Schlachter c03ee8ab36 Ignore more events while minimizing a client
When minimizing a client, we temporarily ignore events for the client window (so
that we don't get the UnmapNotify event that we are causing for the unmap) and
for the root window (I don't actually know why, no "harmful" events should be
caused...).

However, we weren't ignoring events on the frame window itself. This commit
fixes that oversight.

The problem here is that the pointer could be inside the window that is being
minimized. When we then unmap said window, the pointer will now be inside of the
frame window and the X11 server will thus generate an EnterNotify. When we
handle this event later on, we emit mouse::enter on the client and e.g. the
default config then focuses this client, which undoes the minimization.

This fixes a regression introduced in commit 3aeac3870c and fixes #92.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-02-28 22:58:57 +01:00
Uli Schlachter 89fd49f48c a_dbus_message_iter: Handle DBUS_TYPE_DOUBLE
Fixes #78 on GitHub.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-17 19:44:59 +01:00
Uli Schlachter 635223b5fe Remove titlebars from clients during shutdown (FS#1159)
This reparents all clients back to their proper position during shutdown, so
that their top-left corner is now where their titlebar's top-left corner was.
Hopefully, this fixes floating clients moving around across a restart.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-11 10:44:18 +01:00
Uli Schlachter 3113fee2ee change codename
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-10 20:36:35 +01:00
Uli Schlachter 53b0f946d8 awful.mouse.finder: Remove rounded_corners call
Let's just quote a mail I received from Rastislav Barlik:

I tried to make use of awful.mouse.finder but I found out that it's not working
as supporting functions rounded_corners were removed with commit
03e0ee53d2.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-10 20:29:57 +01:00
findkiko 87230862d5 Vim style menu navigation in addition to arrow keys
Is there a reason it shouldn't be on by default? I'm not familiar enough with the code-base to tell if it will clash with anything.
2015-01-10 12:57:09 +01:00
Uli Schlachter 02be8943db Unmap minimized clients
Because ICCCM pretty much mandates that minimized (aka "iconic") clients are
unmapped. In detail: To go back to normal state, the client should map its
window and for this to work, the window needs to be unmapped.

Thanks to Oleg Shparber for reporting some issue he had with a self-written Qt
program and for providing a simple and short test case.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-10 01:01:05 +01:00