On 15.01.2012 16:34, Anurag Priyam wrote:
> On Sun, Jan 15, 2012 at 8:43 PM, Uli Schlachter <[email protected]> wrote:
>> Patch gets a NACK, see next paragraph. :-)
>
> Attached is a 3 parts series I wrote in the evening, but decided to
> get a snack before sending it to the list. The first can be applied as
> it is, but I will need to re-roll 2nd and 3rd to account for the
> changes you just made. I am still sending the original series in case
> you decide my approach is better and want to revert your commit -- I
> decided to put the `by_ccord` in `awful.screen` as
> `awful.screen.getbycoord`.
Heh. First two patches are merged.
For the third one:
> --- a/lib/awful/placement.lua.in
> +++ b/lib/awful/placement.lua.in
> @@ -16,6 +16,7 @@ local capi =
> client = client
> }
> local client = require("awful.client")
> +local screen = require("awful.screen")
> local layout = require("awful.layout")
>
> --- Places client according to special criteria.
> @@ -105,8 +106,9 @@ end
> function no_offscreen(c)
> local c = c or capi.client.focus
> local geometry = c:geometry()
> + local screen = c.screen or screen.getbycoord(geometry.x, geometry.y)
We now have two variables named screen, the global one and the local one. Also
"local foo = bar or foo.foobar()" looks weird.
However, I don't have any ideas how to change that. The best I can think of is
"local a_screen = require("awful.screen")" instead of the above version.
> local border = c.border_width
> - local screen_geometry = capi.screen[c.screen].workarea
> + local screen_geometry = capi.screen[screen].workarea
>
> if geometry.x + geometry.width + 2*border > screen_geometry.x +
> screen_geometry.width then
> geometry.x = screen_geometry.x + screen_geometry.width -
> geometry.width
> @@ -126,10 +128,11 @@ end
> --- Place the client where there's place available with minimum overlap.
> -- @param c The client.
> function no_overlap(c)
> - local cls = client.visible(c.screen)
> + local cls = client.visible(screen)
Uhm, what?! This doesn't look like it has any chance of not erroring out.
(client.visible() will call capi.client.get(screen) and the C code will complain
that awful.screen is not a screen object)
Search and replace error?
> local curlay = layout.get()
> - local areas = { capi.screen[c.screen].workarea }
> + local areas = { capi.screen[screen].workarea }
> local geometry = c:geometry()
> + local screen = c.screen or screen.getbycoord(geometry.x, geometry.y)
You first use the variable and only afterwards do you define it. (I assume this
"local screen =" was supposed to be one of the first lines in this function?)
> for i, cl in pairs(cls) do
> if cl ~= c and cl.type ~= "desktop" and (client.floating.get(cl) or
> curlay == layout.suit.floating) then
> areas = area_remove(areas, cl:geometry())
> @@ -192,11 +195,12 @@ end
> function centered(c, p)
> local c = c or capi.client.focus
> local c_geometry = c:geometry()
> + local screen = c.screen or screen.getbycoord(c_geometry.x, c_geometry.y)
> local s_geometry
> if p then
> s_geometry = p:geometry()
> else
> - s_geometry = capi.screen[c.screen].geometry
> + s_geometry = capi.screen[screen].geometry
> end
> return c:geometry({ x = s_geometry.x + (s_geometry.width -
> c_geometry.width) / 2,
> y = s_geometry.y + (s_geometry.height -
> c_geometry.height) / 2 })
> @@ -209,11 +213,12 @@ end
> function center_horizontal(c, p)
> local c = c or capi.client.focus
> local c_geometry = c:geometry()
> + local screen = c.screen or screen.getbycoord(c_geometry.x, c_geometry.y)
> local s_geometry
> if p then
> s_geometry = p:geometry()
> else
> - s_geometry = capi.screen[c.screen].geometry
> + s_geometry = capi.screen[screen].geometry
> end
> return c:geometry({ x = s_geometry.x + (s_geometry.width -
> c_geometry.width) / 2 })
> end
> @@ -225,11 +230,12 @@ end
> function center_vertical(c, p)
> local c = c or capi.client.focus
> local c_geometry = c:geometry()
> + local screen = c.screen or screen.getbycoord(c_geometry.x, c_geometry.y)
> local s_geometry
> if p then
> s_geometry = p:geometry()
> else
> - s_geometry = capi.screen[c.screen].geometry
> + s_geometry = capi.screen[screen].geometry
> end
> return c:geometry({ y = s_geometry.y + (s_geometry.height -
> c_geometry.height) / 2 })
> end
--
- Captain, I think I should tell you I've never
actually landed a starship before.
- That's all right, Lieutenant, neither have I.
--
To unsubscribe, send mail to [email protected].