From b9002db37faf078b2b4ea6c81cedd6fa3b3f5c34 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sat, 24 Aug 2002 20:54:23 +0000 Subject: [PATCH] translate some strings that should have been, and convert to locale 2002-08-24 Havoc Pennington * src/util.c: translate some strings that should have been, and convert to locale encoding before printing stuff. * src/stack.c (group_member_is_fullscreen): if window itself is fullscreen, return TRUE immediately. * src/window.c (meta_window_configure_request): add hack to fullscreenize large undecorated windows. --- ChangeLog | 11 +++++++ src/stack.c | 3 ++ src/util.c | 38 +++++++++++++++------- src/window.c | 92 +++++++++++++++++++++++++++++++++++++++++++--------- 4 files changed, 118 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 956962819..e82af6f6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2002-08-24 Havoc Pennington + + * src/util.c: translate some strings that should have been, and + convert to locale encoding before printing stuff. + + * src/stack.c (group_member_is_fullscreen): if window itself is + fullscreen, return TRUE immediately. + + * src/window.c (meta_window_configure_request): add hack to + fullscreenize large undecorated windows. + 2002-08-21 Deepa Natarajan * src/keybindings.c, src/metacity.schemas.in, src/prefs.[ch]: diff --git a/src/stack.c b/src/stack.c index 94f1f3af7..709dcfa2d 100644 --- a/src/stack.c +++ b/src/stack.c @@ -264,6 +264,9 @@ group_member_is_fullscreen (MetaWindow *window) MetaGroup *group; GSList *tmp; gboolean retval; + + if (window->fullscreen) + return TRUE; group = meta_window_get_group (window); if (group == NULL) diff --git a/src/util.c b/src/util.c index b604a612a..03ebf2d01 100644 --- a/src/util.c +++ b/src/util.c @@ -153,6 +153,22 @@ meta_set_replace_current_wm (gboolean setting) replace_current = setting; } +static int +utf8_fputs (const char *str, + FILE *f) +{ + char *l; + + l = g_locale_from_utf8 (str, -1, NULL, NULL, NULL); + + if (l == NULL) + fputs (str, f); /* just print it anyway, better than nothing */ + else + fputs (l, f); + + g_free (l); +} + void meta_debug_spew (const char *format, ...) { @@ -172,8 +188,8 @@ meta_debug_spew (const char *format, ...) out = logfile ? logfile : stderr; if (no_prefix == 0) - fputs ("Window manager: ", out); - fputs (str, out); + utf8_fputs (_("Window manager: "), out); + utf8_fputs (str, out); fflush (out); @@ -199,8 +215,8 @@ meta_verbose (const char *format, ...) out = logfile ? logfile : stderr; if (no_prefix == 0) - fputs ("Window manager: ", out); - fputs (str, out); + utf8_fputs ("Window manager: ", out); + utf8_fputs (str, out); fflush (out); @@ -265,7 +281,7 @@ meta_topic (MetaDebugTopic topic, if (no_prefix == 0) fprintf (out, "%s: ", topic_name (topic)); - fputs (str, out); + utf8_fputs (str, out); fflush (out); @@ -288,8 +304,8 @@ meta_bug (const char *format, ...) out = logfile ? logfile : stderr; if (no_prefix == 0) - fputs ("Bug in window manager: ", out); - fputs (str, out); + utf8_fputs (_("Bug in window manager: "), out); + utf8_fputs (str, out); fflush (out); @@ -317,8 +333,8 @@ meta_warning (const char *format, ...) out = logfile ? logfile : stderr; if (no_prefix == 0) - fputs ("Window manager warning: ", out); - fputs (str, out); + utf8_fputs (_("Window manager warning: "), out); + utf8_fputs (str, out); g_free (str); } @@ -339,8 +355,8 @@ meta_fatal (const char *format, ...) out = logfile ? logfile : stderr; if (no_prefix == 0) - fputs ("Window manager error: ", out); - fputs (str, out); + utf8_fputs (_("Window manager error: "), out); + utf8_fputs (str, out); fflush (out); diff --git a/src/window.c b/src/window.c index 49faa2444..2f0936f7a 100644 --- a/src/window.c +++ b/src/window.c @@ -3196,6 +3196,42 @@ meta_window_configure_request (MetaWindow *window, break; } } + + /* If we went full-size for an undecorated window, then enter + * fullscreen mode. A hack for lame clients. + */ + if (window->has_fullscreen_func && !window->decorated && + !window->maximized) + { + const MetaXineramaScreenInfo *xinerama; + MetaRectangle outer; + + xinerama = meta_screen_get_xinerama_for_window (window->screen, + window); + + meta_window_get_outer_rect (window, &outer); + + if (outer.width >= xinerama->width && + outer.height >= xinerama->height) + meta_window_make_fullscreen (window); + else + { + meta_topic (META_DEBUG_GEOMETRY, + "Did not fullscreen %s size %dx%d with xinerama %dx%d\n", + window->desc, + outer.width, outer.height, + xinerama->width, xinerama->height); + } + } + else + { + meta_topic (META_DEBUG_GEOMETRY, + "Did not fullscreen %s has_fullscreen = %d decorated = %d maximized = %d\n", + window->desc, + window->has_fullscreen_func, + window->decorated, + window->maximized); + } return TRUE; } @@ -5226,7 +5262,30 @@ recalc_window_features (MetaWindow *window) window->has_minimize_func = window->mwm_has_minimize_func; window->has_maximize_func = window->mwm_has_maximize_func; window->has_move_func = window->mwm_has_move_func; - window->has_resize_func = window->mwm_has_resize_func; + + window->has_resize_func = TRUE; + + /* If min_size == max_size, then don't allow resize */ + if (window->size_hints.min_width == window->size_hints.max_width && + window->size_hints.min_height == window->size_hints.max_height) + window->has_resize_func = FALSE; + else if (!window->mwm_has_resize_func) + { + /* We ignore mwm_has_resize_func because WM_NORMAL_HINTS is the + * authoritative source for that info. Some apps such as mplayer or + * xine disable resize via MWM but not WM_NORMAL_HINTS, but that + * leads to e.g. us not fullscreening their windows. Apps that set + * MWM but not WM_NORMAL_HINTS are basically broken. We complain + * about these apps but make them work. + */ + + meta_warning (_("Window %s sets an MWM hint indicating it isn't resizable, but sets min size %d x %d and max size %d x %d; this doesn't make much sense.\n"), + window->desc, + window->size_hints.min_width, + window->size_hints.min_height, + window->size_hints.max_width, + window->size_hints.max_height); + } window->has_shade_func = TRUE; window->has_fullscreen_func = TRUE; @@ -5277,27 +5336,30 @@ recalc_window_features (MetaWindow *window) window->has_move_func = FALSE; window->has_resize_func = FALSE; window->has_maximize_func = FALSE; - } - - /* If min_size == max_size, then don't allow resize */ - if (window->size_hints.min_width == window->size_hints.max_width && - window->size_hints.min_height == window->size_hints.max_height) - window->has_resize_func = FALSE; - - /* don't allow fullscreen if we can't resize, unless the size - * is entire screen size (kind of broken, because we - * actually fullscreen to xinerama head size not screen size) - */ - if (!window->has_resize_func) - { - window->has_maximize_func = FALSE; + } + if (!window->has_resize_func) + { + window->has_maximize_func = FALSE; + + /* don't allow fullscreen if we can't resize, unless the size + * is entire screen size (kind of broken, because we + * actually fullscreen to xinerama head size not screen size) + */ if (window->size_hints.min_width == window->screen->width && window->size_hints.min_height == window->screen->height && !window->decorated) ; /* leave fullscreen available */ else window->has_fullscreen_func = FALSE; + + meta_topic (META_DEBUG_WINDOW_OPS, + "Window %s not resizable, maximizable = %d fullscreenable = %d min size %dx%d max size %dx%d\n", + window->desc, window->has_maximize_func, window->has_fullscreen_func, + window->size_hints.min_width, + window->size_hints.min_height, + window->size_hints.max_width, + window->size_hints.max_height); } /* no shading if not decorated */