Commit Graph

60 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee 14c074fb6b screen: Disable trying to auto-compute the DPI by default.
As long as Awesome provides APIs that uses pixels are points, this
cannot be enabled by default.

For example, a wibar size defined in pixels may be too small to
render the text once a dense display is connected.
2017-11-23 23:28:32 -05:00
Stefan Loewen 8ebea11df0 Fix doc: get_clients methods belong to screen (#2099)
not to client
2017-11-03 17:27:17 +01:00
Uli Schlachter c7d75ed119 awful.screen.object.get_dpi: Ignore outputs with size 0 (#2063)
For example, Xephyr reports its output with a size of 0x0. Since a
division by zero is in no one's interest, just ignore such outputs when
trying to compute the DPI value.

Thanks to @timroes for pointing this out:
c8fac753c4 (commitcomment-25072296)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-21 19:23:04 +02:00
Uli Schlachter d0fbb96d2d screen.dpi: Use RandR for per-screen DPI
This commit makes awesome automatically compute the DPI of a screen
based on its RandR outputs. If multiple outputs exist, the lowest DPI is
used.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-08 14:40:20 +02:00
Uli Schlachter a137655791 Add & use a dpi property on screen objects
Once upon a time, beautiful.xresources.get_dpi was added to query
Xft.dpi. That made sense since this queried an xresources property. Over
time, other, non-xresources-based ways to query DPI were added to this
function. Now, it makes no more sense to have this function here.

Also, recently it became possible to add new properties to C objects
from Lua code. Thus, we no longer need to have a get_dpi() function
somewhere, but can add s.dpi directly.

Thus, this commit adds s.dpi and makes everything use it. No functional
changes are intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-10-08 12:30:21 +02:00
Kevin Zander 7687275607 Move awful.util.deprecate and awful.util.deprecate_class to gears.debug
Change all awful.util function calls to gears.debug function calls
Update all old deprecate calls to have deprecated_in=4
2017-03-15 20:08:22 -05:00
Christoph Mertz 2d91d49b30 awful.screen.focus_bydirecttion: fix setting screen focus (#1635)
This was broken in 9cb60b8 in PR #1597 (from myself).

focus() is not defined on the screen instance as method
but on the screen module as function.

Signed-off-by: Christoph Mertz <chris@nimel.de>

Fix #1644
2017-03-09 00:07:35 -05:00
Uli Schlachter ad113fa3aa Fix code using awful.util.cycle
This gets rid of lots of deprecation warnings.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-06 17:15:40 +01:00
Christoph Mertz 9cb60b8130 awful.screen: extract screen:get_next_in_direction() (#1597)
This extracts the code for finding the next screen
from focus_bydirection to a separate method on
the screen object.

The main reason was to use the finding code without
actually changing the screen focus but this should
incidentally make the code slightly easier to test
as well since both concerns can be tested in
isolation.

Signed-off-by: Christoph Mertz <chris@nimel.de>
2017-03-04 22:16:15 -05:00
Daniel Hahler d13f465374 awful.screen: add stacked arg to some functions (#1301)
Fixes https://github.com/awesomeWM/awesome/issues/1300
2016-12-28 12:41:59 +01:00
Daniel Hahler fc13b1b4eb doc: s/Wether/Whether/ 2016-11-22 02:40:15 +01: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
Uli Schlachter 4ef63d9416 awful.screen: Save last mouse position as screen property
Instead of using a weak table to save the last mouse position, this is
now saved directly as a property under the screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-05 21:00:47 +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
Emmanuel Lepage Vallee 1c177cabce awesomerc: Explicitly select a default screen
A client is supposed to go to a screen when:

 * It has been started using `awful.spawn` with explicit instructions [1]
 * An `awful.rules` rule **or any of its callbacks** set the screen [2]
 * When something handle `request::screen` and/or `request::tag` in some
   custom ways. [3]
 * Some clients can request a screen and mean it (like MythTV/Kodi/XBMC and
   some multi-window DAW) [4]

A client is supposed to go to the focused screen when none of the above are
true [5].

Other constraints:

 * The screen need to be set only once, anything will will emit
   `property::screen` many time and cause side effects.
 * There has to be a single entry point to the algorithm, no multiple
   "manage" handler.
 * Awesome internals must use the `request::` signal API and not force
   their decision outside of request handlers.
 * Restarting Awesome must not change the client screen

Commit 2178744 fix use case number [1] and [2]. It actually fix [4] too, but
it is an accident and I am not sure we care about [4] anyway. Use case [1]
and [2], however, are very important.

Fix #1091
2016-09-21 22:15:09 +02:00
Emmanuel Lepage Vallee e8649d0a29 screen: Add a function to get the client preferred screen 2016-09-15 16:50:10 -04:00
Emmanuel Lepage Vallée 39aace50e9 Merge pull request #1084 from Elv13/use_screen_props
Use screen props
2016-09-11 04:40:35 -04:00
Emmanuel Lepage Vallee 8c2d85523f screen: Do not use the deprecated geometry access 2016-09-11 02:09:44 -04:00
Emmanuel Lepage Vallee e66120913f screen: Fix a memory leak.
Found while investigating #1079
2016-09-10 23:54:45 -04:00
Emmanuel Lepage Vallee 01db39f5bb screen: Use math.huge instead of 9999 2016-08-22 17:27:48 -04:00
Emmanuel Lepage Vallée e3c24c8e09 Revert "screen: Fix potential nil index" (#1037)
This reverts commit facf676b13.

Using capi.client.focus.screen to decide which screen is focused breaks
a multiscreen setup. At least makes it extremely annoying to use.

In particular, if you have a focused client on screen 1, move the mouse
to screen 2 and launch a new client, the new client appears in screen 1,
since screen.focused reports that current focused screen is 1, not 2
because of the focused client.

Close #1035
Fix #1029
2016-08-11 19:03:17 +02:00
Emmanuel Lepage Vallee facf676b13 screen: Fix potential nil index
This looks like a copy-paste error.
2016-08-01 15:29:02 -04:00
Uli Schlachter 2d511e2ab5 gears.object.properties: Implement read-only properties
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-08 20:28:31 +02:00
Uli Schlachter 0857f6f1b5 Lua: Remove calls to add_signal()
The requirement to call add_signal() was added to catch typos. However, this
requirement became increasingly annoying with property::<name> signals and e.g.
gears.object allowing arbitrary properties to be changed.

All of this ended up in a single commit because tests/examples fails if I first
let add_signal() emit a deprecation warning.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-04 18:23:48 +02:00
Emmanuel Lepage Vallee 1ce92bb550 get_rect_by_dir: Move to `gears.geometry`
Begin to break down `awful.util`
2016-05-16 14:03:00 -04:00
Emmanuel Lepage Vallee 1a05d53cab screen: Use `gears.geometry` 2016-05-16 14:03:00 -04:00
Uli Schlachter ae738db58a Fix awful.screen.getbycoord when no screens exist
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-15 14:43:25 +02:00
Uli Schlachter 13bce88fa0 Fix awful.screen.getbycoord() for top-left corner of a screen
The problem was that get_square_distance() made the screen one pixel larger to
the bottom/right than it really was. Thus, the (x+0,y+0)-pixel of a screen that
was below or to the right of some other screen had distance zero to both of
these screens.

This commit fixes the screen size computation and adds a small unit test for
getbycoord() and get_square_distance().

Reported by Elv13 here:
https://github.com/awesomeWM/awesome/pull/878#issuecomment-219272864

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-15 14:40:00 +02:00
Uli Schlachter ede88d8bce Fix awful.screen.getbycoord when no screens exist
When there are no screens, screen[1] causes an error. Thus, this isn't a safe
fallback for these functions. Instead, this commit makes the code prefer the
primary screen, if possible. If no screen exists, then screen.primary will be
nil, but at least it won't throw an error like screen[1] does.

(This also changes the outdated copy of getbycoord that exists in
wibox.drawable)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-28 17:42:15 +02:00
Daniel Hahler 473df11e1f Streamline/cleanup util.deprecate calls 2016-04-18 23:20:16 +02:00
Emmanuel Lepage Vallee dd52f1ce86 awful.tag: Move functions to awful.client and screen 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 493684a5c0 awful.tag: Merge API documentation with tag 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 00d782f3d3 awful.screen: Deprecate functions, add methods 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee a4bc49b540 awful.screen: Merge screen and awful.screen API doc 2016-04-11 23:54:28 -04:00
Emmanuel Lepage Vallee 8a0738a4bc gears.screen: Merge into awful.screen
gears modules usually don't depend on Awesome C-API. This code has
been placed there for unclear reasons.

Also, there is ongoing work to unify each "concepts" API into one
single page. Having `gears.screen` go against this effort.
2016-04-06 23:32:44 -04:00
Daniel Hahler 742717ec22 doc: improve doc for awful.screen.focused 2016-04-04 23:49:43 +02:00
Emmanuel Lepage Vallée 0953db56d8 Merge pull request #757 from Elv13/properties
C-API objects properties
2016-03-30 23:32:12 -04:00
Emmanuel Lepage Vallee 3322a17182 screen: Support property fallback 2016-03-30 23:25:44 -04:00
Emmanuel Lepage Vallee 995361449a awful.screen: Fix addition between object and number
Fix #784
2016-03-28 04:39:19 -04:00
Emmanuel Lepage Vallee 83df30d3a4 awful.screen.focused: Fix documentation and make more flexible.
Telling the user a method can be monkeypatched is **not** a good
idea.
2016-03-26 03:37:04 -04:00
Emmanuel Lepage Vallee e66166ccee awful.screen: Add a method to apply various paddings.
This avoid code duplications.
2016-03-26 03:37:04 -04:00
Emmanuel Lepage Vallee 9fd329c449 awful.screen.padding: Always return a valid table.
This also fix a bug when the user edit the table. In that case,
the padding was (accidentally) changed without the correct
signals.
2016-03-26 03:15:00 -04:00
Emmanuel Lepage Vallee 242652be94 awful.screen.padding: Support padding number value 2016-03-26 03:14:42 -04:00
Emmanuel Lepage Vallee d2c5e36294 Fix a documentation typo 2016-03-23 18:12:04 -04:00
Uli Schlachter 95e5bdf5d2 Use the new way to iterate over screens in Lua
This gets us one step closer to removing screen indices.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-03-06 14:05:28 +01:00
Emmanuel Lepage Vallee 924e889271 awful.screen: Fix regression 2016-02-29 04:21:10 -05:00
Uli Schlachter d56b5c031b Remove some now unnecessary uses of s.index
Because all our Lua code can now work with screen objects, most of the uses of
s.index that the previous patches added for reaching this goal can be removed
again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 09:24:19 +01:00
Uli Schlachter c17e331b92 Support screen objects in awful.screen
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-26 19:56:07 +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