aboutsummaryrefslogtreecommitdiff
path: root/src/textadept.c
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2013-07-16 16:05:48 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2013-07-16 16:05:48 -0400
commit6321bc4d638c2d2584b539e5755da9edebe10eec (patch)
treec64445e1f9ec7ae70792cc33448239033f1bc765 /src/textadept.c
parent02c3bd574f0c1f2c5e49539ba1c86d8b65b0080a (diff)
downloadtextadept-6321bc4d638c2d2584b539e5755da9edebe10eec.tar.gz
textadept-6321bc4d638c2d2584b539e5755da9edebe10eec.zip
Save window maximized state in sessions.
Also ensure backward-compatibility with existing session files.
Diffstat (limited to 'src/textadept.c')
-rw-r--r--src/textadept.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/textadept.c b/src/textadept.c
index ede35e19..0e028291 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -919,7 +919,14 @@ static int lgui__index(lua_State *L) {
lua_pushlstring(L, text, scintilla_get_clipboard(focused_view, NULL));
free(text);
#endif
- } else if (strcmp(key, "size") == 0) {
+ } else if (strcmp(key, "maximized") == 0)
+#if GTK
+ lua_pushboolean(L, gdk_window_get_state(window->window) &
+ GDK_WINDOW_STATE_MAXIMIZED);
+#elif CURSES
+ lua_pushboolean(L, FALSE);
+#endif
+ else if (strcmp(key, "size") == 0) {
#if GTK
int width, height;
gtk_window_get_size(GTK_WINDOW(window), &width, &height);
@@ -982,7 +989,12 @@ static int lgui__newindex(lua_State *L) {
gtk_widget_hide(new_menubar);
#endif
#endif
- } else if (strcmp(key, "size") == 0) {
+ } else if (strcmp(key, "maximized") == 0)
+#if GTK
+ lua_toboolean(L, 3) ? gtk_window_maximize(GTK_WINDOW(window))
+ : gtk_window_unmaximize(GTK_WINDOW(window));
+#endif
+ else if (strcmp(key, "size") == 0) {
#if GTK
luaL_argcheck(L, lua_istable(L, 3) && lua_rawlen(L, 3) == 2, 3,
"{ width, height } table expected");