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.
This commit is contained in:
Rob Adams 2003-11-08 04:43:18 +00:00 committed by Rob Adams
parent 17b8a1f3e6
commit 2218b79143
3 changed files with 49 additions and 12 deletions

View File

@ -1,3 +1,13 @@
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> 2003-10-30 Havoc Pennington <hp@redhat.com>
* src/menu.c (meta_window_menu_new): patch to avoid creating * src/menu.c (meta_window_menu_new): patch to avoid creating

View File

@ -421,17 +421,35 @@ main (int argc, char **argv)
meta_ui_set_current_theme (meta_prefs_get_theme (), FALSE); meta_ui_set_current_theme (meta_prefs_get_theme (), FALSE);
/* Try some panic stuff, this is lame but we really /* Try to find some theme that'll work if the theme preference
* don't want users to lose their WM :-/ * doesn't exist. First try Simple (the default theme) then just
* try anything in the themes directory.
*/ */
if (!meta_ui_have_a_theme ()) if (!meta_ui_have_a_theme ())
meta_ui_set_current_theme ("Simple", FALSE); meta_ui_set_current_theme ("Simple", FALSE);
if (!meta_ui_have_a_theme ()) if (!meta_ui_have_a_theme ())
meta_ui_set_current_theme ("Atlanta", FALSE); {
gchar *dir_entry = NULL;
GError *err = NULL;
GDir *themes_dir = NULL;
if (!meta_ui_have_a_theme ()) if (!(themes_dir = g_dir_open (METACITY_DATADIR"/themes", 0, &err)))
meta_ui_set_current_theme ("Crux", FALSE); {
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 ()) if (!meta_ui_have_a_theme ())
meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes."), meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes."),

View File

@ -668,6 +668,7 @@ meta_window_place (MetaWindow *window,
if (parent) if (parent)
{ {
int w; int w;
MetaRectangle area;
meta_window_get_position (parent, &x, &y); meta_window_get_position (parent, &x, &y);
w = parent->rect.width; w = parent->rect.width;
@ -677,17 +678,25 @@ meta_window_place (MetaWindow *window,
/* center of child over center of parent */ /* center of child over center of parent */
x -= window->rect.width / 2; x -= window->rect.width / 2;
/* put child down 1/5 or so from the top of parent, unless /* "visually" center window over parent, leaving twice as
* it makes us have more of parent showing above child than * much space below as on top.
* below
*/ */
if (window->rect.height <= (parent->rect.height - (parent->rect.height / 5) * 2)) y += (parent->rect.height - window->rect.height)/3;
y += parent->rect.height / 5;
/* put top of child's frame, not top of child's client */ /* put top of child's frame, not top of child's client */
if (fgeom) if (fgeom)
y += fgeom->top_height; 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", meta_topic (META_DEBUG_PLACEMENT, "Centered window %s over transient parent\n",
window->desc); window->desc);