Commit Graph

51 Commits

Author SHA1 Message Date
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
Uli Schlachter 0060ea9d63 Fix awful.screen.focus
This is broken since 23b2fae6a9.

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

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-11 17:10:16 +02:00
Uli Schlachter b1b2852887 awful.screen.getbycoord: Use the same algorithm as in C
We recently changed the C function screen_getbycoord() and this commit makes
awful.screen.getbycoord() use the same algorithm.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 20:25:26 +02:00
lesell_b 4003331b41 fix missing scope on the mouse position table 2015-10-09 21:27:17 +02:00
lesell_b f2b6aa105c Update saved mouse position on screen focus change
Signed-off-by: lesell_b <lesell_b@epitech.eu>
2015-10-08 04:40:59 +02:00
lesell_b 23b2fae6a9 Remember mouse position per screen
The mouse position is saved and restored when focusing another screen

If the target screen has no saved mouse position, the relative position
of the current screen is used

Signed-off-by: lesell_b <lesell_b@epitech.eu>
2015-10-08 03:52:03 +02:00
Daniel Hahler cbe684efd1 Add awful.screen.focused [FS#1029]
This allows to configure / override what gets considered to be the
"focused screen".

Ref: https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1029

Closes https://github.com/awesomeWM/awesome/pull/94.
2015-07-21 12:51:45 +02:00
Daniel Hahler cb7f4b06eb Use `hints` table argument with `request::activate` signal 2015-06-25 06:47:39 +02:00
Daniel Hahler ed09d8ed4f Use request::activate with raise=false instead
Ref: https://github.com/awesomeWM/awesome/pull/224#issuecomment-101790416
2015-06-25 06:47:39 +02:00
Daniel Hahler 401f21f8e2 Add request::focus signal, with ewmh.focus being the default handler
This still does `client.focus = c` by default, but allows to customize
it.

This was initially suggested in #194, but by using `request::activate`
instead, which would not be the same.  Therefore a new signal is being
used instead.

Helped-by: Samir Benmendil <samir.benmendil@gmail.com>
2015-06-25 06:47:39 +02:00