Commit 2218b791 authored by Rob Adams's avatar Rob Adams Committed by Rob Adams

Try harder to find a theme in the event that the theme in the preference

2003-11-07  Rob Adams  <readams@readams.net>

	* src/main.c (main): Try harder to find a theme in the event that
	the theme in the preference cannot be found.  Patch from Marcin
	Krzyzanowski.  See #125815.

	* src/place.c (meta_window_place): use "visual" centering for
	dialog placement and clip new dialogs to an xinerama workspace.
	Fix for #118336.
parent 17b8a1f3
2003-11-07 Rob Adams <readams@readams.net>
* src/main.c (main): Try harder to find a theme in the event that
the theme in the preference cannot be found. Patch from Marcin
Krzyzanowski. See #125815.
* src/place.c (meta_window_place): use "visual" centering for
dialog placement and clip new dialogs to an xinerama workspace.
Fix for #118336.
2003-10-30 Havoc Pennington <hp@redhat.com>
* src/menu.c (meta_window_menu_new): patch to avoid creating
......
......@@ -421,18 +421,36 @@ main (int argc, char **argv)
meta_ui_set_current_theme (meta_prefs_get_theme (), FALSE);
/* Try some panic stuff, this is lame but we really
* don't want users to lose their WM :-/
/* Try to find some theme that'll work if the theme preference
* doesn't exist. First try Simple (the default theme) then just
* try anything in the themes directory.
*/
if (!meta_ui_have_a_theme ())
meta_ui_set_current_theme ("Simple", FALSE);
if (!meta_ui_have_a_theme ())
meta_ui_set_current_theme ("Atlanta", FALSE);
if (!meta_ui_have_a_theme ())
meta_ui_set_current_theme ("Crux", FALSE);
{
gchar *dir_entry = NULL;
GError *err = NULL;
GDir *themes_dir = NULL;
if (!(themes_dir = g_dir_open (METACITY_DATADIR"/themes", 0, &err)))
{
meta_fatal (_("Failed to scan themes directory : %s\n"), err->message);
g_error_free (err);
}
else
{
while (((dir_entry = g_dir_read_name (themes_dir)) != NULL) &&
(!meta_ui_have_a_theme ()))
{
meta_ui_set_current_theme (dir_entry, FALSE);
}
g_dir_close (themes_dir);
}
}
if (!meta_ui_have_a_theme ())
meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes."),
METACITY_DATADIR"/themes");
......
......@@ -668,6 +668,7 @@ meta_window_place (MetaWindow *window,
if (parent)
{
int w;
MetaRectangle area;
meta_window_get_position (parent, &x, &y);
w = parent->rect.width;
......@@ -677,17 +678,25 @@ meta_window_place (MetaWindow *window,
/* center of child over center of parent */
x -= window->rect.width / 2;
/* put child down 1/5 or so from the top of parent, unless
* it makes us have more of parent showing above child than
* below
/* "visually" center window over parent, leaving twice as
* much space below as on top.
*/
if (window->rect.height <= (parent->rect.height - (parent->rect.height / 5) * 2))
y += parent->rect.height / 5;
y += (parent->rect.height - window->rect.height)/3;
/* put top of child's frame, not top of child's client */
if (fgeom)
y += fgeom->top_height;
/* clip to xinerama of parent*/
meta_window_get_work_area_current_xinerama (parent, &area);
if (x + window->rect.width > area.x + area.width)
x = area.x + area.width - window->rect.width;
if (y + window->rect.height > area.y + area.height)
y = area.y + area.height - window->rect.height;
if (x < area.x) x = area.x;
if (y < area.y) y = area.y;
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s over transient parent\n",
window->desc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment