From 2679d3cf00512374a0e35953c0be6ffa556f044a Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 11 May 2002 03:37:51 +0000 Subject: [PATCH] when maximizing/fullscreening something with a grid, like a terminal, 2002-05-10 Havoc Pennington * src/window.c (constrain_position): when maximizing/fullscreening something with a grid, like a terminal, center it in the maximization area in case it can't fill the whole area. #70554 * src/main.c (main): use g_strerror() to get proper UTF-8. --- ChangeLog | 9 +++++++++ src/main.c | 6 ++++-- src/window.c | 20 ++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52a0aebc6..ead83d7b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-05-10 Havoc Pennington + + * src/window.c (constrain_position): when maximizing/fullscreening + something with a grid, like a terminal, center it in the + maximization area in case it can't fill the whole area. + #70554 + + * src/main.c (main): use g_strerror() to get proper UTF-8. + 2002-05-10 Havoc Pennington * src/keybindings.c (reload_modmap): put LockMask into the diff --git a/src/main.c b/src/main.c index 509a161b4..e99c9235f 100644 --- a/src/main.c +++ b/src/main.c @@ -84,10 +84,12 @@ main (int argc, char **argv) act.sa_mask = empty_mask; act.sa_flags = 0; if (sigaction (SIGPIPE, &act, 0) < 0) - g_printerr ("Failed to register SIGPIPE handler: %s\n", strerror (errno)); + g_printerr ("Failed to register SIGPIPE handler: %s\n", + g_strerror (errno)); #ifdef SIGXFSZ if (sigaction (SIGXFSZ, &act, 0) < 0) - g_printerr ("Failed to register SIGXFSZ handler: %s\n", strerror (errno)); + g_printerr ("Failed to register SIGXFSZ handler: %s\n", + g_strerror (errno)); #endif if (g_getenv ("METACITY_VERBOSE")) diff --git a/src/window.c b/src/window.c index 180a61757..b5339f96a 100644 --- a/src/window.c +++ b/src/window.c @@ -5057,6 +5057,16 @@ constrain_position (MetaWindow *window, { x = 0; y = 0; + + /* If the window's geometry gridding (e.g. for a terminal) + * prevents fullscreen, center the window within + * the screen area. + */ + x += (window->screen->width - window->rect.width - + (window->frame ? (fgeom->left_width + fgeom->right_width) : 0)) / 2; + + y += (window->screen->height - window->rect.height - + (window->frame ? (fgeom->top_height + fgeom->bottom_height) : 0)) / 2; } else if (window->maximized) { @@ -5067,6 +5077,16 @@ constrain_position (MetaWindow *window, x += fgeom->left_width; y += fgeom->top_height; } + + /* If the window's geometry gridding (e.g. for a terminal) + * prevents full maximization, center the window within + * the maximized area. + */ + x += (work_area.width - window->rect.width - + (window->frame ? (fgeom->left_width + fgeom->right_width) : 0)) / 2; + + y += (work_area.height - window->rect.height - + (window->frame ? (fgeom->top_height + fgeom->bottom_height) : 0)) / 2; } else if (window->type != META_WINDOW_DESKTOP && window->type != META_WINDOW_DOCK)