Commit Graph

323 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallée 587cc530c7 Merge pull request #1067 from BlueUsername/tiling-to-floating-window-fix
Fix a bug moving between a tiled and a floating screen.
2016-09-07 16:20:20 -04:00
Emmanuel Lepage Vallee e29a2d3ac9 client: Add property::tags
It is useful for rules debugging.
2016-09-04 02:52:16 -04:00
blueusername 9ca57a8364 Fix a bug moving between a tiled and a floating screen.
Check if any of the window is on the screen it is moved to, not just
the topmost leftmost edge.

Signed-off-by: blueusername <blueusername@github>
2016-09-02 20:15:00 +01:00
Emmanuel Lepage Vallée 08e4c304cd client: Fix a potential crash due to a race condition. (#1055)
If raise was called from the awful.rule `manage` callback at
startup with a client already present it crashed due to a
buffer underflow.
2016-08-30 12:59:45 +02:00
Daniel Hahler 63c8a310d0 doc: fix missing parenthesis with client examples (#1046) 2016-08-20 18:59:01 +02:00
Uli Schlachter 231436d9e3 C: Remove unneeded calls to signal_add()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-04 17:57:08 +02:00
Uli Schlachter e5f9ec4723 C code: Move docs for signals away from signal_add()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-04 17:39:14 +02:00
Uli Schlachter 270baeb153 "Fix" client properties which can be absent (#932)
A client c could have no c.machine or no c.pid because the corresponding
properties are not set on its window. Previously, the C code would return an
empty string or 0 for these values. This commit makes the C code give Lua no
value instead (not even a nil).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-04 00:51:23 +02:00
Uli Schlachter 0b64c8987d Remove unused argument to systray_request_handle()
It always had the value NULL.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-29 14:33:23 +02:00
Emmanuel Lepage Vallee 43ef623dc6 client: Add x, y, width and height properties 2016-05-15 17:15:55 -04:00
Uli Schlachter 08845c7a4b Cache a screen's workarea
Instead of computing the workarea whenever some Lua code asks for it, it is now
remembered explicitly as a property on a screen. This allows us to only emit
property::workarea if the workarea actually changed.

Fixes: https://github.com/awesomeWM/awesome/issues/756
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 16:30:37 +02:00
Uli Schlachter 697a88958e client_manage: Check for _NET_STARTUP_ID on WM_CLIENT_LEADER
Apparently the spec allows to set the _NET_STARTUP_ID value on the property that
WM_CLIENT_LEADER points to instead of the window itself. Thus, if we don't find
a _NET_STARTUP_ID on the window itself, check again on the client leader window.

Apparently GTK even does this (for whatever reason...)...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-05 18:29:35 +02:00
Emmanuel Lepage Vallee e54387904b client: Add request::geometry
Remove request::fullscreen and request::maximized_* and use
a single request for them. The other client resizing features
will soon also start to use this.
2016-04-20 00:11:04 -04:00
Emmanuel Lepage Vallee 9991f9ccc8 geometry: Use the relevant rounding functions instead of integers
In the case where one want to put the cursor at the middle of the
workarea, it is logic to do:

   x=screen.workarea.x+screen.workasrea.width/2

However, this can cause floating points. This commit move the
burden back to the C-API so the Lua placement code doesn't have
to add a large number of rounding methods. Given 1 type of rounding
cover a vast majority of use cases for each types of coordinates,
the C-API can take care of it in peace. For the other corner cases,
it is still possible for the Lua code to do the rounding there, but
no longer necessary. The convenstions are:

 'x' and 'y': use round (move to the closest point)

 'width' and 'height': use ceil (to avoid involontary truncating)
2016-04-18 04:20:22 -04:00
Uli Schlachter d46e11f5e1 Add range-checking to lots of arguments in the C code
This change catches things like c:geometry { width = -42 }.

Helps-a-bit-with: https://github.com/awesomeWM/awesome/pull/820 (fixes X errors)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-18 04:20:22 -04:00
Emmanuel Lepage Vallee bfccd1c467 luaobject: Make the miss_handlers documentation private
As the code is now reliant on a single implementation, it cannot
be replaced by the users anymore without breaking Awesome.
2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee eb133175ba awful.screen: Add some client getter properties 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 5655521ec3 client: Use the new @property and @beautiful tags.
Also improve the documentation.
2016-04-11 23:46:10 -04:00
Emmanuel Lepage Vallee 8a09ef707a Fix an ldoc mistake 2016-04-02 04:08:24 -04:00
Uli Schlachter 611cd7c2d8 Remove luaA_pushscreen
It's just an alias for luaA_object_push().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-26 18:13:55 +01:00
Uli Schlachter 93e50b2e23 Merge branch 'lua-index-handlers' of https://github.com/psychon/awesome 2016-03-06 14:19:00 +01:00
Daniel Hahler 4ba8386f7b Merge pull request #715 from psychon/lazy_border_update
Lazily apply changes to border_width and border_color
2016-02-28 22:16:32 +01:00
Daniel Hahler 87a3233be8 Merge pull request #713 from psychon/no_focus_window
Make client key bindings for e.g. xeyes work again
2016-02-28 22:16:22 +01:00
Daniel Hahler 43f485b6cf Merge pull request #707 from psychon/bullet_proof_transient_for
Bullet proof transient_for
2016-02-28 22:09:04 +01:00
Uli Schlachter ee7a41370f Lazily apply changes to border_width and border_color
Fixes: https://github.com/awesomeWM/awesome/issues/592
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-28 16:24:30 +01:00
Uli Schlachter aae960e99e 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-28 13:29:25 +01:00
Uli Schlachter a2301ae8f3 Add and use luaA_pushscreen()
Even when a screen is just an integer, the code becomes a bit more
self-documenting. Even better, if we start to handle screen objects to Lua
instead of screen indicies, there will only be one place that needs to be
changed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 10:57:07 +01:00
Uli Schlachter d598a4115a Update transient_for when a new window appears
When we manage the transient before the main window, the client object's
.transient_for property would stay nil. This happens because the property points
to a window which we don't know (yet) and thus is ignored.

Fix this by remembering the value of WM_TRANSIENT_FOR and checking in
client_manage() if the new client is the "missing window we did not find
before".

Fixes: https://github.com/awesomeWM/awesome/issues/181
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-22 21:09:25 +01:00
Uli Schlachter 9907f804b2 Refactor setting of c->transient_for
This creates a new helper function for setting the transient_for property of a
client. This is a preparation for a following commit. No behaviour changes
intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-22 21:02:47 +01:00
Uli Schlachter 976b03f8a7 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:31:20 +01:00
Uli Schlachter cd63cabadd 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-04 18:21:25 +01:00
Uli Schlachter ad4c62e639 Fix warnings from ldoc
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-30 10:43:41 +01:00
Emmanuel Lepage Vallee 55190646c4 client: Add swapped, raised and lowered signals
This allow layout "arrange" to be called less often and react on
the cause of the change itself rather than it's consequences
(usually, the "focus" signal).

Previously, the layout were re-arranged everytime the focus changed.
Now, with "raised" and "lowered", it require less "arrange".

"swapped" allow smarted layouts. Currently, swapped cause a full
re-arrange. It re-read the "index" list from scratch and create
a "new" layout. With "swapped", incremental layout changes are
possible.

Fixes https://github.com/awesomeWM/awesome/issues/616
2016-01-18 01:29:31 -05:00
Uli Schlachter 430f4fab15 Leave titlebars early
When a client is unmanaged, we know emit mouse::leave on its titlebar before the
client object is invalidated, so that Lua can still work with it. Before, this
event was emitted only when we got a LeaveNotify from the X11 server.

Fixes: #620
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-10 19:27:55 +01:00
Daniel Hahler 83ed65212d Merge pull request #531 from psychon/property_geometry
Property geometry

Closes https://github.com/awesomeWM/awesome/pull/531.
2015-11-05 23:08:02 +01:00
Uli Schlachter 532ec0cd90 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-10-16 17:30:46 +02:00
Uli Schlachter 085bc00a24 Emit property::geometry only if something changed
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-14 19:40:18 +02:00
Daniel Hahler 555ccc15a8 doc: typos/grammar 2015-10-14 16:24:52 +02:00
Daniel Hahler 2932322775 doc: params for request::activate 2015-10-14 16:24:51 +02:00
Daniel Hahler e7663e1ebd Some doc fixes 2015-10-14 13:57:38 +02:00
Daniel Hahler 208db47b2d Merge pull request #505 from psychon/fix_window_gravities
Fix window gravities
2015-10-13 11:34:37 +02:00
Uli Schlachter 79fa6ad017 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-10-10 21:13:40 +02:00
Uli Schlachter 22305f3abf Merge branch 'client_resize_do-prefer-current' of https://github.com/blueyed/awesome 2015-10-10 19:57:45 +02:00
Uli Schlachter b2aaefd095 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-10-10 17:45:24 +02:00
Uli Schlachter 3b97d1c1a7 Apply window gravity for titlebar resizes
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 17:44:11 +02:00
Uli Schlachter 2f78ec5b30 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-09-28 23:36:23 +02:00
Uli Schlachter a5a106f97f Make it possible for Lua to emulate arbitrary properties
This makes it possible to add something similar to a __index / __newindex
metamethod to all our C objects. Based on this, Lua can then easily implement
arbitrary properties on our capi objects.
2015-09-27 17:43:41 +02:00
Daniel Hahler 5431b18f33 Rename client_maybevisible to client_on_selected_tags
This makes it more clear what it is about, and also fixes its
documentation.
2015-09-25 00:43:52 +02:00
Daniel Hahler 62622f7935 Do not unset max/fullscreen when setting the other
From http://standards.freedesktop.org/wm-spec/latest/ar01s05.html:

> _NET_WM_STATE_FULLSCREEN indicates that the window should fill the
> entire screen and have no window decorations. Additionally the Window
> Manager is responsible for restoring the original geometry after a
> switch from fullscreen back to normal window. For example, a
> presentation program would use this hint.

awesome prefers fullscreen internally already.  With this patch, the
previous maximized state will be restored after leaving fullscreen mode.

Fixes https://github.com/awesomeWM/awesome/issues/245.
Closes https://github.com/awesomeWM/awesome/pull/418.
2015-09-02 22:10:56 +02:00
Daniel Hahler baeb8fd2b5 client_resize_do: remove honor_hints argument
This was only used by client_resize before, which now handles this
itself.

Ref: https://github.com/awesomeWM/awesome/pull/383#commitcomment-12483405.
2015-08-04 20:50:49 +02:00
Daniel Hahler 56d9e3b9de client_resize: apply size hints before calling client_resize_do
This will skip calling `client_resize_do` in case of honored size hints.

This could be also done in `client_resize_do`, but it appears to be
meant to force the resize.

Closes https://github.com/awesomeWM/awesome/pull/383.
2015-08-04 20:50:41 +02:00
Daniel Hahler 1118ec4439 Do not call `xcb_ungrab_key` twice (before `xwindow_grabkeys`)
It gets called in `xwindow_grabkeys` always:

    xwindow_grabkeys(xcb_window_t win, key_array_t *keys)
    {
        /* Ungrab everything first */
        xcb_ungrab_key(globalconf.connection, XCB_GRAB_ANY, win, XCB_BUTTON_MASK_ANY);

Closes https://github.com/awesomeWM/awesome/pull/366.
2015-08-01 14:16:06 +02:00
Daniel Hahler 6d323e7c04 doc: distinguish between client.object and client.class
Instead of `client.client`, the client object is now referred to as
`client.object` and the client class as `client.class`.

This moves the documentation of `client.focus` to the class.

Closes https://github.com/awesomeWM/awesome/pull/349.
2015-07-26 00:45:38 +02:00
Daniel Hahler 0c55b2edec client.get: add `stacked` argument
Fixes https://github.com/awesomeWM/awesome/issues/178.
2015-07-25 18:55:36 +02:00
Daniel Hahler 50982fc082 client_resize_do: prefer client's current screen
In case of an overlapping screen configuration, prefer the client's
current screen.

Without this, clients would be moved to the first matching screen.
2015-07-21 15:16:37 +02:00
Daniel Hahler d5cf6e0272 Add client.first_tag, as a shortcut for `c:tags()[1]`
This is meant to be a faster alternative in case only the first tag is
relevant/used.

Closes https://github.com/awesomeWM/awesome/pull/294.
2015-07-14 01:20:39 +02:00
Daniel Hahler 63b19efef8 doc: signals: minor improvements, mainly for "tagged" 2015-07-07 17:19:41 +02:00
Julian Wollrath 26f15a13f3 Document C API directly in the C source code
v2: Add available signals to the docs.

Signed-off-by: Julian Wollrath <jwollrath@web.de>
2015-06-19 23:13:31 +02:00
Uli Schlachter 9555c2d4a6 Emit property::focusable where needed
Before this, doing c.focusable = nil didn't emit this signal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-12 11:00:19 +02:00
Emmanuel Lepage Vallee e8fb93d2b6 lua: Use pushinteger for int type
Attempt to fix #238
2015-05-26 01:09:12 -04:00
Daniel Hahler fd6ffb1458 Make client.focusable writable from Lua
It uses an extra boolean to track if `c.focusable` has been set.

It's possible to unset the overriding by setting it to `nil`, i.e.
`client.focus.focusable = nil`.

Fixes https://github.com/awesomeWM/awesome/issues/237.
Closes https://github.com/awesomeWM/awesome/pull/239.
2015-05-25 15:35:49 +02:00
Uli Schlachter df173f7ddd Make client.focus = nil work (Closes #164)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-03-14 09:06:12 +01:00
Uli Schlachter 20ca989333 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-25 21:52:03 +01:00
Daniel Hahler 8531fef0d3 Merge pull request #119 from psychon/apply_size_hints
Add c:apply_size_hints() to client objects
2015-02-15 01:47:25 +01:00
Daniel Hahler f2aa8d39ed Merge branch 'ewmh_urgent_v1'
- Fix / revert changing of file modes for: lib/awful/tag.lua.in,
   lib/awful/widget/taglist.lua.in, objects/client.c and property.h.
 - Fix typo / punctuation in doc.
 - Use `capi.client.connect_signal` instead of `add_signal`
   (Ref: https://github.com/Elv13/awesome-1/commit/b292b09#commitcomment-9750466).

Pull request: https://github.com/awesomeWM/awesome/pull/33
2015-02-14 23:36:26 +01:00
Daniel Hahler 6183d8587a Merge pull request #118 from blueyed/fix-proper-activate-via-rules
Properly fix activating an "invisible" client via rules
2015-02-14 20:55:04 +01:00
Daniel Hahler e510799a7c Add support for setting client.name
Fixes: https://awesome.naquadah.org/bugs/index.php?do=details&task_id=921
2015-02-14 16:07:09 +01:00
Uli Schlachter 5d7d3fa6ce Add c:apply_size_hints() to client objects
This function gets a width and height of a client, applies the client's size
hints to these numbers and returns the result.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-02-14 15:12:46 +01:00
Daniel Hahler 2174b80c3f client_focus_update: allow "invisible" clients
This removes the check for `client_maybevisible`, which now allows for
`client.focus = c` from Lua for clients that do not are assigned to a
tag yet.
2015-02-14 14:39:26 +01:00
Emmanuel Lepage Vallee d688ebe6cd Add new request::urgent signal
This fix two things:

(1) Clients asking to be urgent while focussed, this have been reported
a few time for urxvt and I usually link a patch that fix this. This may
not be considered a bug by some, but I think it is.

(2) Add the ability to stop noisy clients from setting the urgent state
themselves.
2015-02-10 19:27:46 +00:00
Daniel Hahler dea5a23eac Remove urgent state for already focused client
- Remove urgent state in `client_focus_update` always.
- Make `client_focus_update` indicate if focus changed and use this from
`client_focus` to update `globalconf.focus.need_update`.

Fixes: https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1310
2015-01-10 20:57:49 +01:00
Uli Schlachter 3aeac3870c 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 00:04:11 +01:00
Uli Schlachter 30b313f77a Implement icon_pixmap and icon_mask from WM_HINTS (FS#1297)
Fun fact: ICCCM specifies that icon_pixmap must have depth 1. Xterm uses a
pixmap with depth 24. Yay... As such, I don't have any test for the depth == 1
case and will just assume that it does the right thing. If it doesn't, I bet no
one will notice anyway.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-07 14:16:17 +01:00
Uli Schlachter 8eed5e7bcf client: Include c.name in the result of tostring(c)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 18:16:05 +01:00
Uli Schlachter e5120e1bec Hide globalconf.L
Everything that needs the lua_State should create a local variable like this:

  lua_State *L = globalconf_get_lua_State();

This ensures that the compiler warns if there are two variables with name "L" in
scope. The idea here is that it should become harder to accidentally use the
global lua state instead of the state of the current state.

While writing this commit, I found another place that gets its wrong: Reading
client.focus from a coroutine was broken, since it was returning the result on
the main thread instead of the current one.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 11:56:58 +01:00
Uli Schlachter da15317ac2 tag_client: Add explicit lua_State argument
tag_client() said that it refers to the tag ontop of the lua stack. However, it
implicitly used globalconf.L as its stack. So if you tagged a client with a tag
from a coroutine, thinks would Go Wrong (tm). Fix this by adding an explicit
lua_State* argument.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 11:14:59 +01:00
Uli Schlachter d668268591 Fix some more dubious uses of globalconf.L
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 11:07:20 +01:00
Uli Schlachter f957764e52 drawable/drawin: Pass both lua_State and stack index around
A stack index without the corresponding lua_State pointer is useless, because it
could reference another coroutine than the main thread and thus just assuming
globalconf.L is wrong. Fix this by also passing around the corresponding
lua_State pointer.

This improves the result for the following test:

  coroutine.resume(coroutine.create(function()
      drawin({}).visible = true
  end))

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 10:46:45 +01:00
Uli Schlachter daeb9aee19 Add signals for titlebar resizes (FS#1233)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-10-18 21:41:38 +02:00
Uli Schlachter d2b1e92f9e Clean up header includes
Every .c file has to include the corresponding .h file first to make sure the
headers are self-contained. Additionally, this moves some unneeded includes
around.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 20:07:48 +02:00
Uli Schlachter fed199eee5 Also allow screen objects were screen indices are expected
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 17:55:42 +02:00
Uli Schlachter 271f084735 screen: Turn into proper lua object
This makes the screen objects use our existing infrastructure for implementing
classes and objects with lua instead of hand-rolling an own version.

This results in some small API change: Screen objects no longer have an
add_signal() function and instead this function exists on the parent screen
class.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 16:37:19 +02:00
Uli Schlachter d8b73de739 screen.[ch]: Move into objects/
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 15:12:47 +02:00
Uli Schlachter 03fec2b0f5 Don't set a background-pixel for our client frame windows
Previously we would get a short black flicker when a client closes. This
happened because first the client's window would get hidden and only a short
moment later would awesome react to this and close its own window. In the mean
time, the X server filled the frame window with its background-pixel which was
black.

Just removing the background-pixel means we get the default value which is None.
This means that the content will be left untouched and the client's window will
be visible for a moment longer.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 14:58:03 +02:00
Uli Schlachter 163fc18ab8 Ignore enter/leave events when unmanaging a window (FS#1239)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-28 13:15:24 +01:00
Uli Schlachter 7c3702e60a Fixup indentation
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 16:34:35 +01:00
Uli Schlachter 86f3b7f11f Drawable: Ignore exposes when we have nothing to draw
The X11 server tells us about things that need to be redrawn via expose events.
When we get such an expose event before lua drew the drawable, we just fill the
exposed area with old data (which is black for newly-created drawables).

Fix this by tracking if we have any usable data in a drawable's double buffering
pixmap. This flag is unset whenever we throw away the old content (e.g. due to a
resize) and is set when lua gave us some new content to display.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 16:27:10 +01:00
Uli Schlachter 873358a0b8 EWMH: Handle _NET_WM_DESKTOP in lua
We now handle all "important" EWMH messages in lua and lua can decide to do
different things than the current obvious one.

Consistency!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 16:15:20 +01:00
Uli Schlachter fed803a6bc client manage signal: Remove startup argument
We now have awesome.startup which does the same thing in better.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 20:15:02 +01:00
Uli Schlachter 794318c1a0 drawable: Add pixmap member
Previously, ownership of the pixmaps that we are using for double buffering was
a little weird. The pixmap belonged to the drawin/titlebar, but the
corresponding cairo surface was owned by the drawable. Clean this up by moving
the pixmap to the drawable.

This cleans up lots of ugly code and also fixes a crash: When a drawable was
garbage collected before its drawin, drawin_wipe() would crash accessing the
drawable. This was needed to make it forget about the cairo surface we gave to
it for the pixmap that is being destroyed.

By moving the pixmap to the drawable, this whole issues goes away.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 17:08:36 +01:00
Uli Schlachter 1da87eca3c Fix cairo surface memory leak
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 16:06:18 +01:00
Uli Schlachter 6b8bd49c0b Redraw titlebars more intelligently
Whenever a titlebar of a client needed to be refreshed, all (possibly) four
titlebars would get completely refreshed. So if someone actually added more than
one titlebar to a client, awesome would copy each titlebar's content to the
window four times. Fix this by introducing more fine-grined functions for
uploads.

This also makes awesome only update the affected area when it gets an expose
event for a titlebar instead of all four titlebars completely.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 15:29:11 +01:00
Emmanuel Lepage Vallee d6e06450d3 Add end to end support for spawning tracking using startup notifications
This allow to spawn something, then apply some properties or rules when
the client show up ("manage").

This commit add:
 * "startup_id" property for all clients object (immutable, can be nil)
 * Second return value to awful.util.spawn() with the startup_id
 * Update the documentation

Example:

  local wait_for_it = {}

  local pid,snid = awful.util.spawn("urxvtc")
  wait_for_it[snid] = {ontop=true,sticky=false,
     tag = awful.tag.gettags(mouse.screen)[1] }

  client.connect_signal("manage", function (c, startup)
     if c.startup_id and wait_for_it[c.startup_id] then
        for k,v in pairs(wait_for_it[c.startup_id]) do
           c[k] = v
        end
        if wait_for_it[c.startup_id].tag then
           c:tags({wait_for_it[c.startup_id].tag})
        end
     end
  end)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-15 23:14:02 +01:00
Uli Schlachter ef27189ffe Client: Add (and use) visualtype member to client_t objects
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-15 11:56:57 +01:00
Daniel Hahler a15e53deec Minor doc fixes 2014-03-15 08:52:14 +01:00
Daniel Hahler ac45dc9f59 Add client.maximized (a shortcut for ~_horizontal and ~_vertical)
This also adds the signals `property::maximized`.

Signed-off-by: Daniel Hahler <git@thequod.de>
2014-03-15 08:49:43 +01:00
Daniel Hahler c855b1babb Do not raise clients in client_manage
Instead, use stack_client_push and emit the `request::activate` signal
from awful.rules.apply, if the client gets focus.

Signed-off-by: Daniel Hahler <git@thequod.de>
2014-03-12 16:01:01 +01:00
Uli Schlachter 1b21dce46c Revert "client: Add c.blob property"
This reverts commit a54636751b.

We now have the new xproperty API which does the same thing in a much nicer way.
Thanks to Elv13 for the idea!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-07 16:21:11 +01:00
Uli Schlachter 910cbe401d client: Emit property::screen after geometry
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-06 18:08:21 +01:00
Uli Schlachter 04dee81d13 client: Add request::activate signal (FS#848)
When we receive a _NET_ACTIVE_WINDOW request on the root window, we used to just
focus and raise the window. This didn't do much for clients which are on
non-selected tags.

Thus, this commit makes awesome emit request::activate on the client instead.
This is used in awful.ewmh to implement the old behavior again, but with
additionally marking the client as urgent if it isn't visible.

People who don't like this behavior can use client.disconnect_signal to disable
this behavior again. To make this really possible, awful.ewmh becomes a
"non-nil" module.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-06 17:47:55 +01:00
Uli Schlachter a54636751b client: Add c.blob property
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-02-23 12:26:13 +01:00
Uli Schlachter 56c5797905 Finish C-side support for window shapes (FS#1051)
A drawin's and a client's bounding and clip shape can now be queried and is
returned as a cairo surface.  Also, a client window's shape (e.g. xeyes setting
its own shape) can be queried via c.shape_client_bounding and
c.shape_client_clip.  All of these properties now emit signals when changed.

(This also silently fixes a bug in luaA_drawin_set_shape_bounding() which forgot
to include the drawin's border in its size calculation)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-01-03 17:01:43 +01:00
Uli Schlachter db167ebe80 Revert "client: Don't move clients around across restarts (FS#1159)"
This reverts commit c3bca6ac34.

This caused problems where clients would always spawn on the top-left screen and
couldn't be moved around. This was because lua placed them on the other screen,
but when the titlebar got added, their top-left corner was moved over again.
2013-10-06 10:22:49 +02:00
Uli Schlachter c3bca6ac34 client: Don't move clients around across restarts (FS#1159)
This kind of forces every client to have a window gravity of "static".

This fixes most of the problem of clients moving around across restarts due to
the titlebar. What is left is that they move due to the border width which
should be handled in another patch. Also, another patch should make this honor
the client's actual window gravity.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-10-04 16:12:06 +02:00
Uli Schlachter bcea1aab66 Stop linking against xcb-image
Since the previous commit we don't use this library any more.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 12:12:16 +02:00
Uli Schlachter 813fb94ce8 client.content: Return a cairo xcb surface
We no longer have to turn the client's content into an image buffer "by hand".
Instead, we can just use cairo for the job.

Even more exciting, we don't need to turn this into an image buffer at all. We
can just directly return a cairo xcb surface for the client window. Depending on
how lua will use this surface, this could make it possible to avoid having to
create the image buffer at all!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 12:09:40 +02:00
Uli Schlachter 11bef0795a client.content: Use correct client size (FS#1150)
The size saved in c->geometry also includes the titlebars. Thus, for getting the
window content, we have to subtract this from the size.

Before this, the call to xcb_image_get() was failing with a BadMatch error,
because we were asking for an area that is outside of the actual client's
window's geometry.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-16 12:06:10 +02:00
Uli Schlachter a0e45e878e client: Ignore "fake" string property changes
I noticed high CPU usage while using asunder. The reason was that asunder
re-sets its window name every 0.1 seconds (and awesome's drawing code is way too
slow).

A semi-fix for this is to ignore string property changes if the old and new
value for the property are equal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-01 11:48:03 +02:00
Uli Schlachter bc1507f96d Send correct size to fullscreen clients (FS#1093)
Titlebars are not visible for fullscreen clients, so it doesn't make sense to
substract the area used for the titlebar in ConfigureNotify events.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-13 21:20:13 +01:00
Uli Schlachter d0ab8dc0c1 Fix ignoring size hints
The function c:geometry() should only honor size hints if this was enabled for
this client. Whoops.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-12 11:33:05 +01:00
Uli Schlachter 23b30be106 Move size hints handling back into C (FS#1117)
Having this in lua means that size hints are only applied after the client got
resized. The bad side effect of this is some flickering if awesome is being
slow. And apparently, it is slow for way too many people...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-03-10 12:13:32 +01:00
Uli Schlachter 983001613a Drawable: Improve signal behavior
When property::surface is emitted, the drawable didn't know its geometry yet,
which had weird side effects. Fix this by changing the C API a little. The
function drawable_set_surface() now no longer allows a NULL surface as its
argument.

The required changes for the titlebar code also means that we no longer throw
away the double-buffering surface when a client is moved.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-02-20 14:09:19 +01:00
Jeremy Bethmont 882099f900 Fixed bounding shape size to take into account border size.
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-12 17:51:41 +01:00
Uli Schlachter 265060f1f7 Fix a bug when switching fullscreen mode
The code assumed that a window gets resized when it enters/leaves the fullscreen
mode. This was needed because the code for resizing a window hides and shows the
titlebars.

However, it is possible for a window to enter/leave fullscreen mode without
getting resized, because it already has the correct geometry. In this case,
titlebars were not handled correctly.

This commit fixes that by forcing a resize to the current geometry when the
fullscreen flag is toggled.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-09 18:50:38 +01:00
Uli Schlachter c18f5f22f9 client: Re-add shape support
Same reasoning as for the recent commit which adds these to drawins.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-06 20:51:54 +01:00
Uli Schlachter 52d618c811 Fix fullscreen windows
Fullscreen windows only worked on a screen which had x and y coordinates 0.
Otherwise, the window inside the frame window was completely misplaced.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-04 21:35:32 +01:00
Uli Schlachter 3c320927f8 Hide titlebars on fullscreen clients
Fullscreen clients shouldn't be decorated, thus hide titlebars on those.

This commits assumes that clients get resized when they enter or leave the
fullscreen state. I don't think that this assumption is necessarily true, but
let's just wait for bug reports. :-)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-03 19:34:16 +01:00
Uli Schlachter e57e4a99c5 Enlarge clients when adding titlebars
Previously, the area of the window that the client could draw to got smaller
when titlebars are added. This causes all sorts of odd-looking effects, so
instead this should enlarge the window suitably.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-03 18:44:44 +01:00
Uli Schlachter 10d48e1fc8 Send correct geometry in ConfigureNotifies
The code was sending out ConfigureNotify events which contained the size of the
frame window. Thus, the client assumed that it is was larger than it actually
was.

Fix this by subtracting the size of the titlebars from the geometry for the
event.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-29 10:20:03 +01:00
Uli Schlachter 1f69f36993 Client: Properly get rid of titlebars on unmanage
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-23 10:19:10 +02:00
Uli Schlachter 8348d44444 Tags: Remove screen property
A tag's screen is now implemented purely in lua and it is no longer C's
business.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-23 10:05:34 +02:00
Uli Schlachter 1e418cbe3b drawable: Add property::surface
This new property is used for fixing some missing redraws that the old code had.
Those could be seen via awful.menu. Open and close a submenu repeatedly and the
submenu will appear black.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-20 22:51:52 +02:00
Uli Schlachter 41ef107b88 Add titlebars on the C side
This commit makes it possible to add titlebars to a client. These titlebars are
drawables.

The drawin's input handling is moved to the drawable. This allows it to use the
same code for drawin and titlebar input handling, although there are lots of
differences between the two on the C side.

On the lua side, a new wibox.drawable module is created which handles all the
drawable-specific magic and which can also be used for titlebars.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-14 17:30:59 +02:00
Uli Schlachter 29b09cf7da Ignore re-focusing the focused client
When something gives the input focus to the client which already has the input
focus, bad things can happen. Normally, you'd expect nothing to happen in this
case, but X11 is not that simple.

When updating the input focus and the focused client has the nofocus hint set,
we are actually taking away the focus from this client.

Hopefully this fixes FS#973.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-06 13:37:58 +02:00
Uli Schlachter fc76521edb Don't change focus in response to FocusIn events
Previously, when we received a FocusIn event, we would update the input focus,
because client_focus_update set globalconf.focus.need_update to true.

However, this is wrong for clients following the globally active focus model,
because in this case its the client which controls which window has the input
focus. It could happen that we thus took away the focus from the client which
just gave itself the focus.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-07-06 13:33:27 +02:00
Arvydas Sidorenko d61cdb86c9 Renamed luaL_reg to luaL_Reg
The original struct name is luaL_Reg, but Lua v5.1 had a
`typedef luaL_reg luaL_Reg`, which in v5.2 was removed
and as a result breaking the build in Awesome which uses luaL_reg
version exclusively.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 10:52:10 +02:00
Uli Schlachter e57af377bb Don't pass cairo surfaces around on the lua stack
Now that the C code uses lightuserdata for passing around cairo surfaces, they
are no longer automatically garbage collected. To avoid memleaks, this commit
compares the C code to use cairo_surface_t pointers instead of the lua stack.

This also fixes a memleak were a client's icon was leaked.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-28 09:29:47 +02:00
Uli Schlachter 4f30dfd198 Switch from oocairo to lgi.cairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-27 19:20:34 +02:00
Uli Schlachter f252746e86 Fix a harmless compiler warning
objects/client.c:678:1: warning: no previous prototype for ‘client_set_hidden’

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-05 12:13:08 +02:00
Anurag Priyam c654cfd8d2 unset hidden state when a client regains focus
This should be the expected behavior, imo.  Otherwise the client doesn't appear
in tasklist regardless of being focussed.

[Thanks Uli][1] :).

[1]: http://thread.gmane.org/gmane.comp.window-managers.awesome.devel/7096

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-05 12:09:39 +02:00
Uli Schlachter ba64f3c3cd client_focus_refresh: Always set input focus
Lua code can give the input focus to unfocusable clients. That means they have
nofocus set and they don't implement WM_TAKE_FOCUS.

Previously, the previously focused client continued getting input events in that
event. Now the last client is properly unfocused.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-04-06 12:24:34 +02:00
Majic 0e8fc995bb Minor readability fixes, STREQ()-like macros added
Signed-off-by: Julien Danjou <julien@danjou.info>
2011-11-18 17:56:21 +01:00
Uli Schlachter bf76b3842b Ungrab the server before parsing the config
This moves the loading of the rc.lua and managing of pre-existing clients to
after we ungrab the server during startup. To make sure we have no races with
clients which start up parallel to awesome, we do the QueryTree for all the
clients that we have to manage before the ungrab, but start managing the clients
only after the ungrab.

This means that we have already selected our event mask on the root window in
scan() and thus received an UnmapNotify event when we reparent windows into a
frame window. This has the effect that we immediately unmanage the client again,
whoops.

To fix this, we grab the server again and remove our event mask on the root
window again while we reparent.

This should hopefully fix all cases where we deadlock during startup because
pulseaudio wants to talk to the X server, but is being ignored because we have
the server grabbed while at the same time we are waiting for pulseaudio.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-19 15:11:11 +02:00
David Palacio db1610c7dc Desktop clients may not be visible on all tags.
Usually desktop clients are on a sticky state. If the client
is not sticky, only show on selected tags.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-04 20:24:39 +02:00
Gregor Best c2ea920ca0 remove encoding=utf-8 from modelines
This option is no longer valid in modelines, so it has been removed from
all modelines using the following shellscript:

    #!/bin/ksh

    git ls-tree -r HEAD | cut -f2 | while read f; do
        egrep -e '^(//|--) vim: .*encoding=' $f >/dev/null || continue
        sed -E -e '/^(\/\/|--) vim:/s/:encoding=utf-8//' $f > /tmp/foo
        mv /tmp/foo $f
    done

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-11 17:34:09 +02:00
Arnaud Fontaine be7fda45d8 Update the code following release of xcb-util 0.3.8.
xcb-util is now split into several repositories since 0.3.8. This
release also cleaned up the API a lot, thus update the code
accordingly.

Signed-off-by: Arnaud Fontaine <arnau@debian.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-05-10 18:27:39 +02:00
Uli Schlachter af5e5e8e9c Remove a useless function argument
Both client_isvisible() and client_maybevisible() where almost exclusively
called with the client's screen as their second argument. Remove this second
argument and let these functions instead always act on the client's screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-27 20:07:14 +02:00
Uli Schlachter 244d19fd0e Stop doing per-screen banning
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-27 20:01:05 +02:00
Uli Schlachter b6baca5857 Client: Only emit property::{x,y,width,height} if necessary
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-11 17:21:00 +01:00
Uli Schlachter eff4474c6d Move size-hints handling to lua
The C core now completely ignores size hints and let's lua handle them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-11 17:21:00 +01:00
Uli Schlachter dafcc68427 Send correct signals when c.name updates
When a client sets WM_NAME (client->alt_name) but doesn't set _NET_WM_NAME
(client->name), we give alt_name to lua when c.name is used. However, we still
emitted property::alt_name instead of property::name to lua. Obviously, this
breaks stuff.

(The same applies to client->alt_icon_name)

I noticed this via feh whose tasklist entry wasn't refreshed when multiple
images were displayed and I switched to the next one.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-10 17:04:26 +01:00
Uli Schlachter 659d949052 Tag clients more intelligently (FS#700)
Before this commit, c:tags(tags) and t:clients(clients) first removed all
tags/clients and then added the new one.

This is now changed into only removing the tags/clients that have to be removed
and leaving the others in place. Hopefully, this avoids all kinds of weird
issues which we had.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-18 14:21:37 +01:00
Uli Schlachter 6494540b0c Unban clients when they are focused
In commit 3dbf89c I removed a client_unban() in the code path for focusing
clients. The idea was that client focusing is now done after rebanning, so that
it should already be visible by the time this code is executed.

However, minimized clients obviously don't get unbanned, So we have to call
client_unban() here to make sure the client is unminimized.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-01-09 10:44:19 +01:00
Uli Schlachter b9c427d48f Fix another lua stack balance problem
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-10 15:07:07 +02:00
Uli Schlachter 8b16d1ee4b client_unfocus_update: Merge into client_unfocus
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-10 14:59:02 +02:00
Uli Schlachter 3dbf89c990 Lazyle set the input focus (FS#804)
Instead of immediately setting the X11 input focus when client.focus is assigned
something, we now just remember that we'll have to do something later. The focus
is then set in the next prepare call by libev (= after the current main loop run
is done).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-10 14:57:14 +02:00
Uli Schlachter f931af7ce1 Rename globalconf.client_focus to focus.client
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-10 14:46:56 +02:00
Julien Danjou fe43b99a2a client: remove prev_client_focus
Not sure it's good however.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-10-10 14:05:52 +02:00
Uli Schlachter af8fd15a8f client_unmanage(): Handle destroyed windows
When we receive a DestroyNotify, we have to unmanage the client. However, we
were just informed that the window was destroyed, so it doesn't make sense to
try to do "something" with the window.

This commits fixes some errors from the X server (which we ignored, but still
they are gone now).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-07 12:05:43 +02:00
Uli Schlachter 6826e5dfc4 Remove globalconf.colors
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 20:01:44 +02:00