Introduce a flag to create a window without showing it - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/window.cpp
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年11月09日 14:11:57 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年11月09日 14:11:57 +0100
commit018813c6e5f2b1d7e1809cde0ebae790d57aa3fd (patch)
tree09f2712a8572eeb9de45dc63df5c45d43baa6007 /agg-plot/window.cpp
parent096abfe85cc5b961e943fa5970aac4f0dbbda5ab (diff)
downloadgsl-shell-018813c6e5f2b1d7e1809cde0ebae790d57aa3fd.tar.gz
Introduce a flag to create a window without showing it
Diffstat (limited to 'agg-plot/window.cpp')
-rw-r--r--agg-plot/window.cpp 31
1 files changed, 17 insertions, 14 deletions
diff --git a/agg-plot/window.cpp b/agg-plot/window.cpp
index 3868de85..3114f430 100644
--- a/agg-plot/window.cpp
+++ b/agg-plot/window.cpp
@@ -19,7 +19,6 @@ extern "C" {
__BEGIN_DECLS
-static int window_show (lua_State *L);
static int window_free (lua_State *L);
static int window_split (lua_State *L);
static int window_save_svg (lua_State *L);
@@ -406,17 +405,22 @@ void window::start (lua_State *L, gslshell::ret_status& st)
}
}
-int
-window_new (lua_State *L)
+static void
+show_window(lua_State* L, window* win)
{
- window *win = push_new_object<window>(L, GS_WINDOW, global_state);
- const char *spec = lua_tostring (L, 1);
-
gslshell::ret_status st;
win->start(L, st);
if (st.error_msg())
- return luaL_error (L, "%s (reported during %s)", st.error_msg(), st.context());
+ luaL_error (L, "%s (reported during %s)", st.error_msg(), st.context());
+}
+
+int
+window_new (lua_State *L)
+{
+ window *win = push_new_object<window>(L, GS_WINDOW, global_state);
+ const char *spec = lua_tostring (L, 1);
+ int defer_show = lua_toboolean(L, 2);
if (spec)
{
@@ -424,6 +428,11 @@ window_new (lua_State *L)
return luaL_error(L, "invalid layout specification");
}
+ if (!defer_show)
+ {
+ show_window(L, win);
+ }
+
return 1;
}
@@ -431,13 +440,7 @@ int
window_show (lua_State *L)
{
window *win = object_check<window>(L, 1, GS_WINDOW);
-
- gslshell::ret_status st;
- win->start(L, st);
-
- if (st.error_msg())
- return luaL_error (L, "%s (reported during %s)", st.error_msg(), st.context());
-
+ show_window(L, win);
return 0;
}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月13日 06:45:50 +0000

AltStyle によって変換されたページ (->オリジナル) /