Commit Graph

78 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee c6491e169c doc: Remove the signal name hack 2018-05-28 14:11:41 -04:00
Uli Schlachter 681025dc50 Make fake screens permanent (#2201)
* Make fake screens permanent

Before this, screen_scan() made sure that awesome's information about
available screens conforms to what the X11 server reports. Since fake
screens are, well, fake, this meant that they were deleted.

This commit marks fake screen and handles them specially in
screen_scan() so that they are not deleted.

Note that I did not test this commit at all since I still haven't
figured out how to test RandR stuff without actually messing with
hardware.

Thanks to @madduck for bringing this up and making me fix this long
standing "huh? is that really supposed to work like that?".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-22 02:07:31 -04:00
Uli Schlachter c51a2c2f47 screen_refresh: Protect against globalconf.screens changing
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-11-19 15:53:07 +01:00
Uli Schlachter ea413969f3 screen:swap(): Avoid segfault on almost-deleted screens
When a screen is in the process of being removed, it is still valid, but
no longer in the global list of screens (globalconf.screens). In this
time frame, trying to swap screens could cause a NULL pointer
dereference.

Fix this by throwing a Lua error in this case instead.

Fixes: https://github.com/awesomeWM/awesome/issues/2110
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-11-19 15:40:20 +01:00
Uli Schlachter ab559a6f36 Provide better error message for unknown screen names
The screen object can be indexed by strings to find a screen via some
RANDR output name. However, if a string is used which does not
correspond to a known output, the code just falls through to a function
which will complain "string provided, userdata expected".

This commit provides a slightly more useful error message instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-07-02 13:28:03 +02:00
Uli Schlachter 1332288f9d screen_client_moveto: Make sure client ends up on target screen
This function tried to move the client to its new screen based on
shifting around its current geometry. However, it assumed that the
client was actually visible on its current screen, which is not always
the case.

Fix this by just forcing the client into its new screen if our moving
approach does not work.

This also reverts commit d5e365804c which
is no longer necessary. This commit only hid the issue (partly).

Fixes: https://github.com/awesomeWM/awesome/issues/318
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-15 08:15:50 +02:00
Uli Schlachter c57208d1a8 client_resize(): Stop trying to force on screen
The code here made sure that clients were not moved outside of the root
window. However, that's not enough, because clients can still end up
inside the root window, but outside of anything that is visible in some
output. Thus, just remove this.

Related-to: https://github.com/awesomeWM/awesome/issues/318
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-15 08:15:38 +02:00
Uli Schlachter 01e61079c3 Add & use a non-fatal kind of assert() (#1779)
Aborting the process is sometimes a bit harsh for a failed assertion.
This adds a non-fatal assert() macro called "check()" and uses it in
some places where we might be able to survive the error.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-05-13 23:22:15 +02:00
Uli Schlachter 7d2a83f7d0 screen.c: Always emit "primary_changed" when needed
Without RandR telling us what the primary screen is, we just pick the
first one. However, the code here did not emit the right signal.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-03 13:25:28 +01:00
Holger Schurig bf2c1993db doc: fix signals (#1455)
- rule reordering was mentioned twice in the NEWS
- fix all shown luadoc errors
- add missing descriptions for signals in module "awesome"
2017-01-28 15:03:56 +01:00
Emmanuel Lepage Vallee a93084947a doc: Add a virtual screen example 2016-12-21 11:41:30 -05:00
Uli Schlachter 13e8088d62 Handle unexpected XCB failures (#1260)
We have many places where we are sending an XCB request and expect an
answer where the protocol guarantees that no error can occur and we are
sure to get an answer. However, for example if the X11 server crashes,
these places can still fail. This commit tries to handle failures at all
these places.

I went through the code and tried to add missing error checking (well,
NULL-pointer-checking) to all affected places.

In most cases these errors are just silently ignored. The exception is
in screen querying during startup. If, for example, querying RandR info
fails, we will fall back to Xinerama or zaphod mode. This is serious
enough that it warrants a warning. In most cases, we should exit shortly
afterwards anyway, because, as explained above, these requests should
only fail when our connection to the X11 server breaks.

References: https://github.com/awesomeWM/awesome/issues/1205#issuecomment-265869874
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-10 00:48:53 +01:00
Uli Schlachter 3189996507 screen: Implement :swap(s)
This allows to change the order in which screens appear in our list of
screens.

Fixes: https://github.com/awesomeWM/awesome/issues/1122
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:36:31 +02:00
Uli Schlachter c347c0a54c screen: Add a "list" signal
Similarly to what we do with the client list, this signal is emitted
whenever the list of screens changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-29 09:35:02 +02:00
Uli Schlachter 259c4f716f Remove @release @AWESOME_VERSION@ everywhere (#1157)
It does not provide much value. The version number is already known to
ldoc globally in the "description" variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-09 22:36:20 +02:00
Daniel Hahler d513e2c4fc doc fixes for awful.{client,screen,tag} (#1134)
This adds a tparam alias "@screen" for "@tparam screen" (when used to
document e.g. arguments for callbacks), and "@screen_or_idx" when a
function accepts a "screen" or "number".
2016-10-02 16:03:11 +02: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
Uli Schlachter 128933c115 Correctly disable RandR if it provides no usable data (#1012)
Fixes: https://github.com/awesomeWM/awesome/issues/1003
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-31 16:52:44 +02:00
Uli Schlachter bdfc0c0d71 screen: Mention the property::geometry signal in the docs
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-24 16:33:06 +02:00
Uli Schlachter 311a41b646 screen: Add old geometry as argument to property::geometry
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-24 16:32:12 +02:00
Uli Schlachter 338064ae96 screen: Add old workarea as argument to property::workarea
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-07-24 16:29:56 +02:00
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
Daniel Hahler 4e35d1fdd7 objects/screen.c: fix warning about unused var: "found" (#943) 2016-06-04 01:38:44 +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
Uli Schlachter 992b03d8d2 struts: Avoid an integer underflow
Fixes #900
2016-05-15 17:15:55 -04: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 c62da0dcc7 Merge branch 'fake-screen2' of https://github.com/psychon/awesome 2016-05-09 18:40:50 +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 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
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 1bbdbc7053 screen: Add more documentation 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 5927c1ceed screen: Update the documentation 2016-04-11 23:54:28 -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