doc: Add some screen example sequences.

This commit is contained in:
Emmanuel Lepage Vallee 2019-09-29 23:16:34 -04:00
parent 271e2822a7
commit fa2433192a
4 changed files with 68 additions and 1 deletions

View File

@ -1726,6 +1726,9 @@ luaA_screen_fake_add(lua_State *L)
} }
/** Remove a screen. /** Remove a screen.
*
* @DOC_sequences_screen_fake_remove_EXAMPLE@
*
* @method fake_remove * @method fake_remove
*/ */
static int static int
@ -1753,7 +1756,13 @@ luaA_screen_fake_remove(lua_State *L)
return 0; return 0;
} }
/** Fake-resize a screen /** Resize a screen.
*
* Calling this will resize the screen even if it no longer matches the viewport
* size.
*
* @DOC_sequences_screen_fake_resize_EXAMPLE@
*
* @tparam integer x The new X-coordinate for screen. * @tparam integer x The new X-coordinate for screen.
* @tparam integer y The new Y-coordinate for screen. * @tparam integer y The new Y-coordinate for screen.
* @tparam integer width The new width for screen. * @tparam integer width The new width for screen.
@ -1789,6 +1798,9 @@ luaA_screen_fake_resize(lua_State *L)
} }
/** Swap a screen with another one in global screen list. /** Swap a screen with another one in global screen list.
*
* @DOC_sequences_screen_swap_EXAMPLE@
*
* @client s A screen to swap with. * @client s A screen to swap with.
* @method swap * @method swap
*/ */

View File

@ -0,0 +1,23 @@
--DOC_GEN_IMAGE --DOC_ASTERISK
local module = ... --DOC_HIDE
screen[1]:fake_resize(0, 0, 800, 600) --DOC_HIDE
screen.fake_add(800,0,800,600) --DOC_HIDE
screen.fake_add(800*2,0,800,600) --DOC_HIDE
assert(screen.count()==3) --DOC_HIDE
assert(screen[1].geometry.width == 800) --DOC_HIDE
assert(screen[1].geometry.height == 600) --DOC_HIDE
assert(screen[3].geometry.x == 800*2)--DOC_HIDE
local rw, rh = root.size() --DOC_HIDE
assert(rw == 3*800) --DOC_HIDE
assert(rh == 600) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.add_event("Calling :fake_remove()", function() --DOC_HIDE
require("gears.timer").run_delayed_calls_now() --DOC_HIDE
screen[2]:fake_remove()
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute {display_screen=true} --DOC_HIDE

View File

@ -0,0 +1,15 @@
--DOC_GEN_IMAGE --DOC_ASTERISK
local module = ... --DOC_HIDE
screen[1]:fake_resize(0, 0, 1280, 720) --DOC_HIDE
assert(screen[1].geometry.width == 1280) --DOC_HIDE
assert(screen[1].geometry.height == 720) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.add_event("Calling :fake_resize()", function() --DOC_HIDE
screen[1]:fake_resize(100, 0, 1024, 768)
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute {display_screen=true, show_code_pointer=false} --DOC_HIDE

View File

@ -0,0 +1,17 @@
--DOC_GEN_IMAGE --DOC_ASTERISK
local module = ... --DOC_HIDE
screen[1]:fake_resize(0, 0, 1280, 720) --DOC_HIDE
screen.fake_add(1280,0,1280,720) --DOC_HIDE
assert(screen.count()==2) --DOC_HIDE
assert(screen[1].geometry.width == 1280) --DOC_HIDE
assert(screen[1].geometry.height == 720) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.add_event("Calling :swap()", function() --DOC_HIDE
screen[2]:swap(screen[1])
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute {display_screen=true, show_code_pointer=false} --DOC_HIDE