Commit Graph

491 Commits

Author SHA1 Message Date
Daniel Hahler d9cd0a4f0e Merge pull request #948 from psychon/deprecate-add-signal
Deprecate add_signal
2016-06-07 22:58:14 +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 3d2c877762 Add a function for faking screen move 2016-06-04 17:39:51 +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 a569487ba2 Merge branch 'dev_fix_desktop' of https://github.com/schmellow/awesome 2016-06-04 16:01:17 +02:00
Mikhail Schemelev 0befee6dfa Attempt at better handling of NET_CURRENT_DESKTOP property.
NET_CURRENT_DESKTOP is now being set to the index of the tag with currently focused client.
In case of no focused clients present, first selected tag index is taken, with fallback value being 0.
Current desktop is updated on next client signals: focus, unfocus, tagged, untagged.
Current desktop is also updated on tag property::selected signal.

This should fix drag and drop issues with chrome-based applications on multihead setups
2016-06-04 16:42:54 +03:00
Daniel Hahler 4e35d1fdd7 objects/screen.c: fix warning about unused var: "found" (#943) 2016-06-04 01:38:44 +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 b8920c2a7a doc: `for s, screen do` -> `for s in screen do` 2016-05-15 23:44:09 -04:00
Emmanuel Lepage Vallee dafd29f2a3 awful.wibox: Rename to awful.wibar
Why:

 * Two different (but related) concepts had the same name
 * Users were confused for years on IRC
 * The wibar name was already in use in some doc to avoid confusion
2016-05-15 17:17:12 -04:00
Emmanuel Lepage Vallee 43ef623dc6 client: Add x, y, width and height properties 2016-05-15 17:15:55 -04:00
Uli Schlachter 992b03d8d2 struts: Avoid an integer underflow
Fixes #900
2016-05-15 17:15:55 -04:00
Uli Schlachter 959913dcd2 Merge branch 'fix_window_type_fallback' of https://github.com/psychon/awesome 2016-05-15 16:39:33 +02:00
Uli Schlachter 15cb1daff8 Merge branch 'workarea-change-on-wibox-move' of https://github.com/psychon/awesome 2016-05-15 16:15:45 +02:00
Uli Schlachter 394ff06589 Fix mouse clicks on titlebars (#901)
Commit 7dad0b3b87 made awesome only ask for mouse events on the actual
client window. Obviously, this means that we no longer get reports for clicks on
the titlebar. Whoops.

Fix this by asking for mouse events on *both* the actual client window and the
frame window. The passive grab on the actual client window is actually unneeded,
but we keep it so that the fix that was done by the above commit is still
present (xev will no longer report leave/enter events just for a mouse click).

Since we now get mouse events inside of a client reported twice, the event
handling code in event.c has to be fixed to handle both cases. E.g. x/y are
relative to the top-left corner of the window and thus needs to be fixed for
titlebar size; the second click has to be ignored.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-14 16:16:24 +02:00
Uli Schlachter cbdf403637 Fix fallback for the window type
EWMH specifies that

   If _NET_WM_WINDOW_TYPE is not set, then managed windows with WM_TRANSIENT_FOR
   set MUST be taken as [_NET_WM_WINDOW_TYPE_DIALOG].

We implement this by forcing a window's type to be "dialog" when it has a
WM_TRANSIENT_FOR property. For windows that have a _NET_WM_WINDOW_TYPE property,
this type change is then later undone. However, when a window changes its
WM_TRANSIENT_FOR property during runtime, then we would set its type to "dialog"
unconditionally.

This commit fixes this by explicitly tracking if we found a _NET_WM_WINDOW_TYPE
property on the window and only applying the fallback if we did not find such a
property.

Fixes-one-of-the-sub-issues-from: https://github.com/awesomeWM/awesome/issues/889
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-14 14:10:27 +02:00
Uli Schlachter 11553b931e Update workarea when drawin moves to another screen
Fixes: https://github.com/awesomeWM/awesome/issues/892
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-14 13:13:20 +02:00
Uli Schlachter 64f3677c96 Fix screen.fake_add()
Commit 8a6787bd54 added screen.fake_add(). Commit 08845c7a4b made us cache a
screen's workarea in the struct screen_t. This new member needs to be
initialized to the screen's geometry when a new screen is added. Since both
these commits were developed concurrently, the workarea was not initialized in
screen.fake_add().

Fix this by calling in fake_add() the helper function added in 08845c7a4b.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-09 19:22:21 +02:00
Uli Schlachter 208327bed0 Merge branch 'superflous-enter-leave' of https://github.com/psychon/awesome 2016-05-09 18:42:04 +02:00
Uli Schlachter c62da0dcc7 Merge branch 'fake-screen2' of https://github.com/psychon/awesome 2016-05-09 18:40:50 +02:00
Uli Schlachter 7dad0b3b87 Grab buttons on the child window
Since commit 102063dbbd, awesome is a reparenting WM. That means that we put our
own frame windows around child windows. This means that we have the option of
grabbing input events on the frame window or the child window. This commit chose
the frame window for this.

For keyboard events, this decision was already reverted in 532ec0cd90. This
commit does the same thing for mouse events.

This fixes the spurious leave/enter events that were visible on mouse clicks.
They occurred because the click activated a passive grab (all mouse events now
"belonged" to awesome). This passive grab caused the X server to inform clients
that they "lost" the mouse pointer (with the detail field set to "a grab
activated").

Fixes: https://github.com/awesomeWM/awesome/issues/427
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 17:30:01 +02: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 8a6787bd54 Add functions for faking screen additions and removals
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-08 14:51:33 +02:00
Emmanuel Lepage Vallée d497cdf081 Merge pull request #875 from psychon/sn-fix
Startup-Notification fix
2016-05-08 01:03:16 -04: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 d50acedb35 drawin: Hide from ldoc
This object should not be used directly by the vast majority
of users.
2016-05-03 17:12:54 -04:00
Uli Schlachter 8ca65cbc26 Update screen geometry and outputs on changes
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +02:00
Uli Schlachter 66ad236d2e Clean up after a removed screen
When a screen is removed, we have to update screen.primary (if it was the
removed screen) and assign a different screen to all clients which were on the
removed screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +02:00
Uli Schlachter dceb532d26 Re-add duplicate screen removal
An earlier commit removed this code (back when it was still part of
screen_add()).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +02:00
Uli Schlachter 080609f6ec Add a screen checker.
A client cannot be used any more after it was unmanaged. Similarly, Lua
shouldn't be allowed to e.g. assign a client to a screen that was removed. This
commit adds such a checker which "breaks" all screens which are not in the
global screen list.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +02:00
Uli Schlachter b651373cda Stop restarting on RandR changes
This commit adds a "removed" signal to screens. Together with the "added" signal
that we have since a while, this allows the C code to update the list of
available screens dynamically without needing to restart.

So far, this code received only minimal testing. So far, I don't have a nice
idea on how to easily test this...

Closes: https://github.com/awesomeWM/awesome/issues/672
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +02:00
Uli Schlachter 8de8df1415 Move call to xcb_randr_select_input into screen.c
The code in screen.c should decide about this kind of thing.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +02:00
Uli Schlachter cba8655ca8 Switch to a more specific nvidia binary blob work-around
We once had the problem that with the nvidia blob, the X11 server told us that
"yes, I do support RandR; there is just a single big screen" even though there
were multiple screens and they could be queried for via Xinerama. To work around
this, we started to ignore RandR if it only provided information about a single
screen.

Our long-term goal is to stop restarting on RandR screen changes. Thus, even if
only a single screen is defined during startup, we should still use RandR later
when another screen is added. This means that we cannot just ignore RandR if it
only mentions a single screen.

This commit copies what GTK+ does: If there is an output named "default", then
some compatibility layer is assumed and we ignore RandR.

I have no way to test if this really does the right thing.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +02:00
Uli Schlachter ebe86e32d7 Restructure the way screen_scan() works
Instead of adding all screens directly to globalconf.screens, the individual
"scanner functions" now get a screen_array_t as their argument and add the
screens there. Also, they no longer emit the "added" signal themselves (through
screen_add()), but the caller does now does this instead once all screens are
found.

This commit drops the "deduplication" of screens. This likely means that clone
mode causes duplicate screens. This will have to be re-added later.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-01 10:09:26 +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
Uli Schlachter 3e75e800ad Fix build warning
Commit c543f59696 introduced the following warnings:

objects/screen.c:307:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
objects/screen.c:307:1: warning: no previous prototype for ‘screen_scan_randr_monitors’ [-Wmissing-prototypes]

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-15 19:38:09 +02:00
Kirill A. Shutemov c543f59696 screen: XRandR 1.5 support
XRandR 1.5 adds support for the new monitor objects.

'Monitor' is a rectangular subset of the screen which represents a
coherent collection of pixels presented to the user. Each Monitor is be
associated with a list of outputs (which may be empty).

The patch below matches 1:1 screens in AwesomeWM with XRandR's Monitors.
This way I get one screen across my 4K monitor, which is represented by
two CRTCs.

Background info: http://keithp.com/blogs/MST-monitors/

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2016-04-13 02:31:37 +03: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 7772386f23 tag: Add better documentation 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 643e35af22 tag: Use the new property ldoc syntax 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 1bbdbc7053 screen: Add more documentation 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 5927c1ceed screen: Update the documentation 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
Daniel Hahler ae17c66e27 Merge pull request #798 from blueyed/fix-crash-in-screen_getbycoord
Fix crash in screen_getbycoord without any screens [ci skip]
2016-04-04 20:34:12 +02:00
Uli Schlachter b643279e4a Fix crash in screen_getbycoord without any screens
Ref: https://github.com/awesomeWM/awesome/issues/793#issuecomment-205245346
2016-04-04 20:13:27 +02:00
Daniel Hahler 449974ca61 luaA_checkscreen: display number of existing screens with error
This is meant to be helpful in the case of 0 existing screens, e.g.
during executing the config initially.
2016-04-04 20:04:19 +02:00
Daniel Hahler 3ad0a9d8d2 Merge pull request #780 from psychon/screen-add-signal
Add screen add signal
2016-04-03 18:35:08 +02:00
Emmanuel Lepage Vallee 8a09ef707a Fix an ldoc mistake 2016-04-02 04:08:24 -04:00
Uli Schlachter 2432dda3e3 screen: Add "added" signal
This signal is emitted when a new screen is added.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-27 10:51:28 +02: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 5ccdb933bf C-API: Return screen objects instead of indicies
This commit makes all C code that previously returned a screen index now return
a screen object, continuing the deprecation of screen indicies. Note that this
is an API break and will likely cause all kinds of problems for users.

The change also breaks some tests which are suitably fixed in this commit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-26 18:09:24 +01:00
Daniel Hahler c5526ca336 Merge pull request #746 from psychon/indexless-screen-iteration
Indexless screen iteration
2016-03-07 00:26:22 +01:00
Uli Schlachter 93e50b2e23 Merge branch 'lua-index-handlers' of https://github.com/psychon/awesome 2016-03-06 14:19:00 +01:00
Uli Schlachter 0a39459605 Add a non-index way to iterate over screens
This is a preparation for getting rid of screen indices.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-06 14:05:28 +01:00
Emmanuel Lepage Vallee 167f5e2821 drawin: Use numbers rather than integers
This solve issues when using wibox with `awful.placement`
2016-03-04 02:43:19 -05: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 d1f43d895f Merge pull request #710 from psychon/primary-screen
Primary screen
2016-02-28 22:16:03 +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 b02b2f7956 Fix screen index by output name
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 16:45:43 +01:00
Uli Schlachter 2027dd8b02 Correctly set globalconf.primary_screen under RandR
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 16:45:35 +01:00
Uli Schlachter 110893d9cb Add screen.primary
Right now this just always returns the first screens, but this can easily be
implemented properly later.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 15:44: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 d09ece6b5a Require "integer" instead of "number" in more places
E.g. trying to press mouse button 1.5 via root.fake_input() doesn't make sense.
Previously the code silently truncated the number to an integer. Now it
complains about this instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-06 13:59:14 +01:00
Uli Schlachter 051d0de85f Replace many pushnumber calls with pushinteger
The only remaining calls are for a window's opacity and in the DBus type
handling. Everything else wants integers, not something with a comma.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-06 13:46:46 +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 Vallée d202c1f1c2 Merge pull request #629 from Elv13/upstream_dynamic_p1
client: Add swapped, raised and lowered signals
2016-01-18 16:40:07 -05: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 43896f68ca drawable.surface: Return nil if there is a surface
Before this commit, it would return a NULL pointer as a lightuserdata.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:38:51 +01: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
Uli Schlachter 5e6a893207 Replace various calls to warn() with luaA_warn()
luaA_warn() prints a Lua backtrace and thus generates more useful output. warn()
should only be used in awesome-internal places (e.g. receiving an error from the
X11 server).

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-31 15:35:13 +01:00
Uli Schlachter a86d1137ee Select button press/release events on drawins
Some words about X11 event handling: Every X11 client can select input on any
window. For this, inside the X11 server each window has for each client a
bitmask for the kind of events that this client is interested in. When a mouse
button is pressed inside of a window, a corresponding event is generated for
that window and sent to all X11 clients which asked for
XCB_EVENT_MASK_BUTTON_PRESS. When no client is interested in this event, the
event is propagated to the parent window and the same procedure is done again
here. This continues up until the root window is reached.

Some words about the event masks that awesome uses: For clients, we ask for
button press events on the frame window that we reparent the client window into
so that we get any kind of press on the titlebar (and also events inside of the
client window if the client itself doesn't care for click events?). We are also
interested in button presses / releases on the root window. However, before this
commit, we didn't actually ask for button events on drawins (e.g. the wibox).
This worked fine, because no one asked for these events and the event propagated
to the root window where it was then sent to awesome.

However, newer Qt versions do something weird and the above broke. I don't
actually know what is going on. I know about the above propagation rules, but
looking at protocol traces of what Qt does, awesome should still get the button
events. During startup, Qt asks for button events on its own windows. After a
hotplug event, it asks the same again, but now also includes the root window.
So... how can Qt asking for button events on the root window cause awesome not
to get them? I have no idea.

(And yes, I guess that Qt asking for mouse events on the root window is a bug,
but I have no idea how exactly this happens nor about any other side effects of
it).

This commit makes us ask for button events on our drawins so that the server
will send them to us. This is the right thing to do anyway and it was reported
to have some positive effects.

Ref: https://github.com/awesomeWM/awesome/issues/415
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-13 18:10:29 +01:00
Uli Schlachter 6ca85af53b Set WM_CLASS and WM_NAME on all our windows (#551)
The only exception is the window for _NET_SUPPORTING_WM_CHECK. That window
already had a _NET_WM_NAME property before and doesn't get a WM_NAME property in
this commit. I just decided for myself that it doesn't need one. :-)

Right after startup with the default config we now have the following situation:

$ xwininfo -root -tree

xwininfo: Window id: 0x2d7 (the root window) (has no name)

  Root window id: 0x2d7 (the root window) (has no name)
  Parent window id: 0x0 (none)
     7 children:
     0x200011 "Awesome drawin": ("awesome" "awesome")  1500x20+0+0  +0+0
     0x200010 "Awesome drawin": ("awesome" "awesome")  1x1+0+0  +0+0
     0x20000d "Awesome drawin": ("awesome" "awesome")  100x30+0+0  +0+0
     0x20000a "Awesome no input window": ("awesome" "awesome")  1x1+-1+-1  +-1+-1
     0x200009 "Awesome systray window": ("awesome" "awesome")  1x1+-1+-1  +-1+-1
     0x200008 "awesome": ("awesome" "awesome")  1x1+-1+-1  +-1+-1
     0x200007 "Awesome WM_Sn selection owner window": ("awesome" "awesome")  1x1+-1+-1  +-1+-1

One of those drawin is the awful.wibox. Another drawin is created by awful.menu.
I guess that the third one is created by awful.tooltip, but I'm not sure. Wow,
so many windows...

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-19 22:23:25 +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
Daniel Hahler 872c321e81 Merge pull request #507 from psychon/closest_screen
Update the definition of "closest screen" to take into account that a
screen is a rectangle and not just the top-left corner.

Closes https://github.com/awesomeWM/awesome/pull/507.
2015-10-26 23:07:43 +01:00
Kazunobu Kuriyama 4db998fdf2 Accept keysym/unicode symbols on keys
This is an enhancement to make non-ASCII symbol keys usable for
implementation and configuration of Awesome.

The enhancement was proposed and had been developed under the
initiative of Daniel Hahler.  Thanks to his sharing of his results with our
community, we gradually deepened our understanding on the issue.  This
commit is the fruit his enthusiasm spawned.

Closes https://github.com/awesomeWM/awesome/pull/538.
2015-10-26 23:00:15 +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
Uli Schlachter 438a10973b Add property::geometry to drawin/drawable [#411]
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-14 19:39:27 +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 d4168f3c36 screen_getbycoord: Change definition of 'closest screen'
Instead of comparing only the top-left corner of the screen to the provided
coordinate, this now compares the screen in a more intuitive way, e.g.
coordinates inside of the screen have a distance of zero.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:10:23 +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
Uli Schlachter 9408b61a97 drawin: lazily configure drawin windows
Ref: https://github.com/awesomeWM/awesome/issues/411.
Source: https://github.com/awesomeWM/awesome/pull/174#commitcomment-12708326.
(With some minor changes)
2015-08-23 15:25:23 +02:00
Daniel Hahler 178f479d15 drawin.c: check for integer for x, y, width, height
This adds luaA_getopt_integer, luaA_optinteger and luaA_checkinteger.

Lua 5.2 does not have support for this, but it would be available in Lua
5.3.

Closes https://github.com/awesomeWM/awesome/pull/320.
2015-08-12 14:07:22 +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 d5e365804c screen_client_moveto: only emit property::screen if it changed
While debugging #331, I have noticed that the call to `client_resize`
might have changed the screen (and emitted the signal) already, via
a call to `screen_client_moveto` with `doresize=False`.

Closes https://github.com/awesomeWM/awesome/pull/332.
2015-07-26 00:49:35 +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 27fb170744 screen_getbycoord: fallback to nearest screen
This removes the handling of negative x/y from `screen_coord_in_screen`,
which was added in 0f840d2e and does not make sense in
screen_coord_in_screen.

Ref: 50982fc082 (commitcomment-12358053).
Ref: https://github.com/awesomeWM/awesome/pull/331.
2015-07-25 20:12:45 +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 9dad4f59a4 doc: remove references to Zaphod mode
This has been removed a long time ago (in 32d9a5b).
2015-07-24 15:22:03 +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 94814c7512 screen_client_moveto: add comment/whitespace for 'emit signal' 2015-07-12 17:42:53 +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 d2f583d839 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-06-13 11:18:47 +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
Daniel Hahler 84d764f3ba Merge pull request #227 from petoju/master
Support for XKB - changing keyboard layouts

Closes https://github.com/awesomeWM/awesome/pull/227
2015-06-10 17:52:24 +02:00
Peter Junos e2562227ab Less reloading of keymap, fixes from psychon comments
Response to psychon comments in PR#227 -
https://github.com/awesomeWM/awesome/pull/227

With this commit, we don't reload keymap, when we are not
notified about its change.
2015-05-28 23:20:17 +02:00
Peter Junos 19137a55c3 Support for XKB - changing keyboard layouts
This commit adds support for writing in prompt (<Super>+R by default)
while different keymap is selected

Signed-off-by: Peter Júnoš <petoju@gmail.com>
2015-05-28 23:20:17 +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 d1984a7a1f Merge pull request #95 from blueyed/signal-client-property-screen-old
Send old_screen with "property::screen" client signal
2015-02-20 23:25:38 +01:00
Daniel Hahler 5140ef1764 Send old_screen with "property::screen" client signal
This should improve layout re-arranging with 2+ screens.
2015-02-15 13:26:46 +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 94e61ec94b timer: Move from C to lua as gears.timer
No API-change (besides the obvious no-longer-a-global-object) intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 16:44:04 +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 4cfea189f0 drawin: Use the correct lua_State for the stack index
This just pushed the drawin onto the stack L, but then tries to access it via
globalconf.L. This just calls for problems...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 10:55:21 +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 d76e20bbce drawin_update_drawing: Remove optimization for invisible drawins
This fixes the following code:

   local d = drawin({})
   d.visible = true

The drawin now has a cairo surface assigned

   d.visible = false
   d.width = 1234
   d.visible = true

The width change while the drawin was not visible would not get propagated to
the drawable because of the code that this patch removes. The expectation was
that drawin_map() would update the drawable later.

However, because the drawin was already visible, its drawable also already has
a surface assigned. Thus, drawin_map() wouldn't update the drawable either.

Fix this by just removing this optimizations.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-10-11 13:27:29 +02:00
Uli Schlachter 70fef83e50 drawin: Don't special-case moves
The code in drawin_moveresize() tries to be clever and only updates the drawing
state of the drawable when it is resized, not when it is moved around. This used
to be necessary because once upon a time, drawin_update_drawing() threw away all
of the drawing state and thus forcing a repaint. These days it just calls
drawable_set_geometry() as well and that function special-cases moves.

So this old code in drawin_moveresize() is no longer necessary and actually
caused problems.

These problems occurred because drawin_update_drawing() is being clever and
doesn't do anything for .visible = false drawins, because their drawing state
will be updated once they become visible. However, not skipping
drawable_set_geometry() means that this broke, because drawin_map() thought that
the drawing state was up to date while in reality it wasn't.

References: http://article.gmane.org/gmane.comp.window-managers.awesome/10852
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-10-11 13:12:57 +02:00
Uli Schlachter 14c4dcc969 screen: Fix output deletion
The screen_output_t* that is passed to screen_output_wipe() points into the
middle of the output array table and is a pointer that we never allocated.
Instead, what we want to free here is the name of the output.

Thanks to luzie for reporting this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-31 13:17:34 +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