Commit Graph

19 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 464e103a4e screen: Add a `name` property to the C API.
This will be useful to address the screens by roles/names in the client
and tag rules. Since the sceen rules will make setups where sceens are
attached and removed much easier to work with, using indexes or output
names in the rules becomes a limitation.
2019-09-30 00:49:40 -04:00
Emmanuel Lepage Vallee 875941e9ac screen: Store the lifecycle metadata.
With this commit, the C code stores if the screen was created with
`fake_screen` and also stores if the Lua side "promise" to manage
(aka, track the viewport and remove it) the object. There is now
3 kind of screens:

 * Managed by C (created and deleted by the core code)
 * Managed by Lua (replicate the core code, but with more hooks)
 * Unmanaged (created directly with fake_screen)
2019-09-30 00:48:12 -04:00
Emmanuel Lepage Vallee 1304f46c0c screen: Split the `outputs` code away from the screen logic.
It moves the actual place where when screen array is stored into the
area object. This allows to store the outputs when screens are not
automatically created.
2019-09-29 18:56:06 -04:00
Emmanuel Lepage Vallee 433898599d init: Add a command line option to start AwesomeWM without screens.
This commit add an optional `--screen off` command to initialize Lua
without first adding the screens. This is inconvinient for most users
since it restrict the APIs that are usable out of the box.

However, this allows AwesomeWM to work independently from the hardware.
This means that when a screen is unplugged, it is the Lua code that will
remove the screen instead of CAPI pulling the carpet from under. It also
allows to ignore some screen areas before the screen is ever created.
Combined, it makes it possible to work with screens even when they are
physically disconnected. Finally, it will allow for an awful.rules like
API to control how screens are created.

All in all, some people need this for their setup and some people might
want to do it anyway for fine grained and/or dynamaic multi-screen
setups.

This commit also adds 4 new signals to `capi` to be able to
execute code at specific points during the initialization. The commit
improves naughty error notifications to work even if problems occurs
before the screens are added.

Note that AwesomeWM will exit if no screens are created. While it would
be easy to just call `refresh_screen();` after unsetting the magic
variable, doing so would have corner cases. Better be harsher and
prevent the user from shooting themselves in the foot from not reading
the f****** manual. Code introduced in future commits will take care
of automatically calling fake_screen in the event nothing is created.

Fixes #1382
2019-09-29 18:52:00 -04:00
Uli Schlachter a22479c97b Screen scanning: Use an idle source
Instead of refreshing screens at the end of the current main loop
iteration, this now uses a GLib idle source with a very low priority.
This increases the chance of batching multiple refreshes together. Also,
this means that awesome_refresh() does less work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-18 10:42:29 +01: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
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 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 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 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 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
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
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