summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-02-09 06:54:44 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-02-09 06:54:44 +0000
commit116fc5546f3ab87a6a2650aa7afa4aa5c842a9bd (patch)
tree3ddd3567dbce8ed6b996d9f85608bb934ef7154e
parent844a8ac13f057f235cf3044f23b23cabf10e65f7 (diff)
downloadmetacity-116fc5546f3ab87a6a2650aa7afa4aa5c842a9bd.tar.gz
put in some kind of distinctive frame for UTILITY, though it's ugly. Also
2002-02-09 Havoc Pennington <hp@pobox.com> * src/themes/Atlanta/metacity-theme-1.xml: put in some kind of distinctive frame for UTILITY, though it's ugly. Also put in the borderless look for maximized windows. * src/stack.c (compute_layer): put splash screen in the splash layer * src/stack.h (enum): create a splash screen layer * src/place.c (meta_window_place): center splashscreen, and fix a typo in the centering code * src/window.c (recalc_window_features): disable most features on splash screens * src/screen.c (set_supported_hint): add UTILITY and SPLASHSCREEN hints * src/window.c: add UTILITY, SPLASHSCREEN implementation * src/window.h (enum): add UTILITY, SPLASHSCREEN types * src/theme-parser.c (parse_toplevel_element): parser support for has_title attribute * src/theme.c (meta_frame_layout_get_borders): handle a has_title field in the layout, for utility windows that don't display a title (would be better to be able to shrink the title text, but that's kind of tricky to implement :-/)
-rw-r--r--ChangeLog32
-rw-r--r--src/core.c5
-rw-r--r--src/display.c6
-rw-r--r--src/display.h2
-rw-r--r--src/place.c7
-rw-r--r--src/screen.c4
-rw-r--r--src/session.c10
-rw-r--r--src/stack.c4
-rw-r--r--src/stack.h3
-rw-r--r--src/theme-parser.c10
-rw-r--r--src/theme.c7
-rw-r--r--src/theme.h3
-rw-r--r--src/themes/Atlanta/metacity-theme-1.xml76
-rw-r--r--src/window.c24
-rw-r--r--src/window.h5
15 files changed, 172 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index f03f1813..449bc1f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+2002-02-09 Havoc Pennington <hp@pobox.com>
+
+ * src/themes/Atlanta/metacity-theme-1.xml: put in some kind of
+ distinctive frame for UTILITY, though it's ugly. Also put in the
+ borderless look for maximized windows.
+
+ * src/stack.c (compute_layer): put splash screen in the splash
+ layer
+
+ * src/stack.h (enum): create a splash screen layer
+
+ * src/place.c (meta_window_place): center splashscreen, and fix a
+ typo in the centering code
+
+ * src/window.c (recalc_window_features): disable most features on
+ splash screens
+
+ * src/screen.c (set_supported_hint): add UTILITY and SPLASHSCREEN
+ hints
+
+ * src/window.c: add UTILITY, SPLASHSCREEN implementation
+
+ * src/window.h (enum): add UTILITY, SPLASHSCREEN types
+
+ * src/theme-parser.c (parse_toplevel_element): parser support
+ for has_title attribute
+
+ * src/theme.c (meta_frame_layout_get_borders): handle a has_title
+ field in the layout, for utility windows that don't display a
+ title (would be better to be able to shrink the title text,
+ but that's kind of tricky to implement :-/)
+
2002-02-08 Havoc Pennington <hp@pobox.com>
* src/screen.c (set_supported_hint): add _NET_WM_STATE_HIDDEN
diff --git a/src/core.c b/src/core.c
index c490d88c..631f46cd 100644
--- a/src/core.c
+++ b/src/core.c
@@ -91,9 +91,14 @@ meta_core_get_frame_type (Display *xdisplay,
return META_FRAME_TYPE_MENU;
break;
+ case META_WINDOW_UTILITY:
+ return META_FRAME_TYPE_UTILITY;
+ break;
+
case META_WINDOW_DESKTOP:
case META_WINDOW_DOCK:
case META_WINDOW_TOOLBAR:
+ case META_WINDOW_SPLASHSCREEN:
/* No frame */
return META_FRAME_TYPE_LAST;
break;
diff --git a/src/display.c b/src/display.c
index 5b969e55..afda00af 100644
--- a/src/display.c
+++ b/src/display.c
@@ -144,7 +144,9 @@ meta_display_open (const char *name)
"_WIN_HINTS",
"_METACITY_RELOAD_THEME_MESSAGE",
"_METACITY_SET_KEYBINDINGS_MESSAGE",
- "_NET_WM_STATE_HIDDEN"
+ "_NET_WM_STATE_HIDDEN",
+ "_NET_WM_WINDOW_TYPE_UTILITY",
+ "_NET_WM_WINDOW_TYPE_SPLASHSCREEN"
};
Atom atoms[G_N_ELEMENTS(atom_names)];
@@ -243,6 +245,8 @@ meta_display_open (const char *name)
display->atom_metacity_reload_theme_message = atoms[47];
display->atom_metacity_set_keybindings_message = atoms[48];
display->atom_net_wm_state_hidden = atoms[49];
+ display->atom_net_wm_window_type_utility = atoms[50];
+ display->atom_net_wm_window_type_splashscreen = atoms[51];
/* Offscreen unmapped window used for _NET_SUPPORTING_WM_CHECK,
* created in screen_new
diff --git a/src/display.h b/src/display.h
index 746a423c..71aa1d90 100644
--- a/src/display.h
+++ b/src/display.h
@@ -109,6 +109,8 @@ struct _MetaDisplay
Atom atom_metacity_reload_theme_message;
Atom atom_metacity_set_keybindings_message;
Atom atom_net_wm_state_hidden;
+ Atom atom_net_wm_window_type_utility;
+ Atom atom_net_wm_window_type_splashscreen;
/* This is the actual window from focus events,
* not the one we last set
diff --git a/src/place.c b/src/place.c
index 94195155..ae255f73 100644
--- a/src/place.c
+++ b/src/place.c
@@ -253,7 +253,8 @@ meta_window_place (MetaWindow *window,
}
if (window->type == META_WINDOW_DIALOG ||
- window->type == META_WINDOW_MODAL_DIALOG)
+ window->type == META_WINDOW_MODAL_DIALOG ||
+ window->type == META_WINDOW_SPLASHSCREEN)
{
/* Center on screen */
int w, h;
@@ -263,14 +264,14 @@ meta_window_place (MetaWindow *window,
h = window->screen->height;
x = (w - window->rect.width) / 2;
- y = (y - window->rect.height) / 2;
+ y = (h - window->rect.height) / 2;
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s on screen\n",
window->desc);
goto done;
}
-
+
/* Find windows that matter (not minimized, on same workspace
* as placed window, may be shaded - if shaded we pretend it isn't
* for placement purposes)
diff --git a/src/screen.c b/src/screen.c
index eb607ada..b75ccab2 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -78,7 +78,7 @@ set_wm_check_hint (MetaScreen *screen)
static int
set_supported_hint (MetaScreen *screen)
{
-#define N_SUPPORTED 24
+#define N_SUPPORTED 26
#define N_WIN_SUPPORTED 1
Atom atoms[N_SUPPORTED];
@@ -106,6 +106,8 @@ set_supported_hint (MetaScreen *screen)
atoms[21] = screen->display->atom_net_wm_icon;
atoms[22] = screen->display->atom_net_wm_moveresize;
atoms[23] = screen->display->atom_net_wm_state_hidden;
+ atoms[24] = screen->display->atom_net_wm_window_type_utility;
+ atoms[25] = screen->display->atom_net_wm_window_type_splashscreen;
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom_net_supported,
diff --git a/src/session.c b/src/session.c
index 8a61fe95..66fa2aa9 100644
--- a/src/session.c
+++ b/src/session.c
@@ -588,6 +588,12 @@ window_type_to_string (MetaWindowType type)
case META_WINDOW_MENU:
return "menu";
break;
+ case META_WINDOW_SPLASHSCREEN:
+ return "splashscreen";
+ break;
+ case META_WINDOW_UTILITY:
+ return "utility";
+ break;
}
return "";
@@ -610,6 +616,10 @@ window_type_from_string (const char *str)
return META_WINDOW_TOOLBAR;
else if (strcmp (str, "menu") == 0)
return META_WINDOW_MENU;
+ else if (strcmp (str, "utility") == 0)
+ return META_WINDOW_UTILITY;
+ else if (strcmp (str, "splashscreen") == 0)
+ return META_WINDOW_SPLASHSCREEN;
else
return META_WINDOW_NORMAL;
}
diff --git a/src/stack.c b/src/stack.c
index cf70f12b..37834aec 100644
--- a/src/stack.c
+++ b/src/stack.c
@@ -269,6 +269,10 @@ compute_layer (MetaWindow *window)
/* still experimenting here */
window->layer = META_LAYER_NORMAL;
break;
+
+ case META_WINDOW_SPLASHSCREEN:
+ window->layer = META_LAYER_SPLASH;
+ break;
default:
window->layer = META_LAYER_NORMAL;
diff --git a/src/stack.h b/src/stack.h
index 505c63b7..2e61fc0c 100644
--- a/src/stack.h
+++ b/src/stack.h
@@ -38,7 +38,8 @@ typedef enum
META_LAYER_TOP = 3,
META_LAYER_DOCK = 4,
META_LAYER_FULLSCREEN = 5,
- META_LAYER_LAST = 6
+ META_LAYER_SPLASH = 6,
+ META_LAYER_LAST = 7
} MetaStackLayer;
struct _MetaStack
diff --git a/src/theme-parser.c b/src/theme-parser.c
index c1805f47..331b565d 100644
--- a/src/theme-parser.c
+++ b/src/theme-parser.c
@@ -656,11 +656,14 @@ parse_toplevel_element (GMarkupParseContext *context,
{
const char *name = NULL;
const char *parent = NULL;
+ const char *has_title = NULL;
+ gboolean has_title_val;
MetaFrameLayout *parent_layout;
if (!locate_attributes (context, element_name, attribute_names, attribute_values,
error,
"name", &name, "parent", &parent,
+ "has_title", &has_title,
NULL))
return;
@@ -672,6 +675,10 @@ parse_toplevel_element (GMarkupParseContext *context,
return;
}
+ has_title_val = TRUE;
+ if (has_title && !parse_boolean (has_title, &has_title_val, context, error))
+ return;
+
if (meta_theme_lookup_layout (info->theme, name))
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
@@ -700,6 +707,9 @@ parse_toplevel_element (GMarkupParseContext *context,
else
info->layout = meta_frame_layout_new ();
+ if (has_title) /* only if explicit, otherwise inherit */
+ info->layout->has_title = has_title_val;
+
meta_theme_insert_layout (info->theme, name, info->layout);
push_state (info, STATE_FRAME_GEOMETRY);
diff --git a/src/theme.c b/src/theme.c
index ba9c6428..95bf0abb 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -333,6 +333,8 @@ meta_frame_layout_new (void)
layout->button_width = -1;
layout->button_height = -1;
+ layout->has_title = TRUE;
+
init_border (&layout->button_border);
return layout;
@@ -468,12 +470,15 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
int *right_width)
{
int buttons_height, title_height;
-
+
g_return_if_fail (top_height != NULL);
g_return_if_fail (bottom_height != NULL);
g_return_if_fail (left_width != NULL);
g_return_if_fail (right_width != NULL);
+ if (!layout->has_title)
+ text_height = 0;
+
buttons_height = layout->button_height +
layout->button_border.top + layout->button_border.bottom;
title_height = text_height +
diff --git a/src/theme.h b/src/theme.h
index 5e806192..8f9936f2 100644
--- a/src/theme.h
+++ b/src/theme.h
@@ -78,6 +78,9 @@ struct _MetaFrameLayout
/* Space around buttons */
GtkBorder button_border;
+
+ /* Whether title text will be displayed */
+ guint has_title : 1;
};
diff --git a/src/themes/Atlanta/metacity-theme-1.xml b/src/themes/Atlanta/metacity-theme-1.xml
index dd767325..8913a6f3 100644
--- a/src/themes/Atlanta/metacity-theme-1.xml
+++ b/src/themes/Atlanta/metacity-theme-1.xml
@@ -23,11 +23,24 @@
<!-- strip borders off the normal geometry -->
<frame_geometry name="normal_borderless" parent="normal">
- <distance name="left_width" value="0"/>
- <distance name="right_width" value="0"/>
- <distance name="bottom_height" value="0"/>
- <distance name="left_titlebar_edge" value="0"/>
- <distance name="right_titlebar_edge" value="0"/>
+ <distance name="left_width" value="4"/>
+ <distance name="right_width" value="4"/>
+ <distance name="bottom_height" value="5"/>
+ <distance name="left_titlebar_edge" value="4"/>
+ <distance name="right_titlebar_edge" value="4"/>
+</frame_geometry>
+
+<frame_geometry name="utility" has_title="false">
+ <distance name="left_width" value="3"/>
+ <distance name="right_width" value="3"/>
+ <distance name="bottom_height" value="4"/>
+ <distance name="left_titlebar_edge" value="3"/>
+ <distance name="right_titlebar_edge" value="3"/>
+ <distance name="button_width" value="11"/>
+ <distance name="button_height" value="11"/>
+ <distance name="title_vertical_pad" value="11"/>
+ <border name="title_border" left="3" right="4" top="3" bottom="3"/>
+ <border name="button_border" left="0" right="0" top="1" bottom="1"/>
</frame_geometry>
<!-- define constants -->
@@ -136,19 +149,30 @@
x1="1" y1="height-2" x2="width-2" y2="height-2"/>
</draw_ops>
-<draw_ops name="focus_background">
- <include name="outer_bevel"/>
+<draw_ops name="blank">
+<!-- nothing -->
+</draw_ops>
+
+<draw_ops name="focus_outline">
<rectangle color="#000000"
x="left_width-1" y="top_height-1"
width="width-left_width-right_width+1"
height="height-top_height-bottom_height+1"/>
</draw_ops>
+<draw_ops name="focus_background">
+ <include name="outer_bevel"/>
+ <include name="focus_outline"/>
+</draw_ops>
+
<draw_ops name="title_gradient">
<gradient type="diagonal" x="0" y="0" width="width-SpacerWidth" height="height">
<color value="blend/gtk:bg[NORMAL]/gtk:bg[SELECTED]/0.6"/>
<color value="gtk:bg[SELECTED]"/>
</gradient>
+</draw_ops>
+
+<draw_ops name="title_spacer">
<gtk_vline state="normal" x="width+1-SpacerWidth/2"
y1="(height-SpacerHeight)/2"
y2="height - (height-SpacerHeight)/2"/>
@@ -175,14 +199,25 @@
</draw_ops>
<draw_ops name="title_normal">
+ <include name="title_spacer"/>
<include name="title_text"/>
</draw_ops>
<draw_ops name="title_focused">
<include name="title_gradient"/>
+ <include name="title_spacer"/>
<include name="title_text_focused"/>
</draw_ops>
+<draw_ops name="title_utility">
+ <include name="title_spacer"/>
+</draw_ops>
+
+<draw_ops name="title_utility_focused">
+ <include name="title_gradient"/>
+ <include name="title_spacer"/>
+</draw_ops>
+
<frame_style name="normal_unfocused" geometry="normal">
<piece position="entire_background" draw_ops="outer_bevel"/>
<piece position="title" draw_ops="title_normal"/>
@@ -203,16 +238,25 @@
<piece position="title" draw_ops="title_focused"/>
</frame_style>
-<frame_style name="maximized_unfocused" parent="normal_unfocused">
+<frame_style name="maximized_unfocused" geometry="normal_borderless" parent="normal_unfocused">
+ <piece position="entire_background" draw_ops="blank"/>
<button function="maximize" state="normal" draw_ops="restore_button"/>
<button function="maximize" state="pressed" draw_ops="restore_button_pressed"/>
</frame_style>
-<frame_style name="maximized_focused" parent="normal_focused">
+<frame_style name="maximized_focused" geometry="normal_borderless" parent="normal_focused">
+ <piece position="entire_background" draw_ops="focus_outline"/>
<button function="maximize" state="normal" draw_ops="restore_button"/>
<button function="maximize" state="pressed" draw_ops="restore_button_pressed"/>
</frame_style>
+<frame_style name="utility_unfocused" geometry="utility" parent="normal_unfocused">
+ <piece position="title" draw_ops="title_utility"/>
+</frame_style>
+
+<frame_style name="utility_focused" geometry="utility" parent="normal_focused">
+ <piece position="title" draw_ops="title_utility_focused"/>
+</frame_style>
<frame_style_set name="normal">
<frame focus="yes" state="normal" resize="both" style="normal_focused"/>
@@ -225,11 +269,23 @@
<frame focus="no" state="maximized_and_shaded" style="maximized_unfocused"/>
</frame_style_set>
+<frame_style_set name="utility" parent="normal">
+<frame focus="yes" state="normal" resize="both" style="utility_focused"/>
+<frame focus="no" state="normal" resize="both" style="utility_unfocused"/>
+<!-- this is a bunch of crack since utility windows shouldn't be maximized -->
+<frame focus="yes" state="maximized" style="utility_focused"/>
+<frame focus="no" state="maximized" style="utility_unfocused"/>
+<frame focus="yes" state="shaded" style="utility_focused"/>
+<frame focus="no" state="shaded" style="utility_unfocused"/>
+<frame focus="yes" state="maximized_and_shaded" style="utility_focused"/>
+<frame focus="no" state="maximized_and_shaded" style="utility_unfocused"/>
+</frame_style_set>
+
<window type="normal" style_set="normal"/>
<window type="dialog" style_set="normal"/>
<window type="modal_dialog" style_set="normal"/>
<window type="menu" style_set="normal"/>
-<window type="utility" style_set="normal"/>
+<window type="utility" style_set="utility"/>
<menu_icon function="close" state="normal" draw_ops="close_button"/>
<menu_icon function="maximize" state="normal" draw_ops="maximize_button"/>
diff --git a/src/window.c b/src/window.c
index 112ad05a..07c71404 100644
--- a/src/window.c
+++ b/src/window.c
@@ -526,7 +526,8 @@ meta_window_new (MetaDisplay *display, Window xwindow,
if (window->type == META_WINDOW_DESKTOP ||
window->type == META_WINDOW_DOCK ||
window->type == META_WINDOW_TOOLBAR ||
- window->type == META_WINDOW_MENU)
+ window->type == META_WINDOW_MENU ||
+ window->type == META_WINDOW_UTILITY)
{
if (window->size_hints.flags & PPosition)
{
@@ -2645,7 +2646,8 @@ meta_window_configure_request (MetaWindow *window,
window->type == META_WINDOW_DOCK ||
window->type == META_WINDOW_TOOLBAR ||
window->type == META_WINDOW_MENU ||
- window->type == META_WINDOW_NORMAL) &&
+ window->type == META_WINDOW_NORMAL ||
+ window->type == META_WINDOW_UTILITY) &&
(window->size_hints.flags & PPosition)) ||
(window->size_hints.flags & USPosition))
{
@@ -2666,7 +2668,8 @@ meta_window_configure_request (MetaWindow *window,
window->type == META_WINDOW_DOCK ||
window->type == META_WINDOW_TOOLBAR ||
window->type == META_WINDOW_MENU ||
- window->type == META_WINDOW_NORMAL)
+ window->type == META_WINDOW_NORMAL ||
+ window->type == META_WINDOW_UTILITY)
{
if (event->xconfigurerequest.value_mask & CWWidth)
width = event->xconfigurerequest.width;
@@ -4135,13 +4138,14 @@ update_net_wm_type (MetaWindow *window)
/* We break as soon as we find one we recognize,
* supposed to prefer those near the front of the list
*/
- /* FIXME modal dialog (? see if it's in spec), utility, splashscreen */
if (atoms[i] == window->display->atom_net_wm_window_type_desktop ||
atoms[i] == window->display->atom_net_wm_window_type_dock ||
atoms[i] == window->display->atom_net_wm_window_type_toolbar ||
atoms[i] == window->display->atom_net_wm_window_type_menu ||
atoms[i] == window->display->atom_net_wm_window_type_dialog ||
- atoms[i] == window->display->atom_net_wm_window_type_normal)
+ atoms[i] == window->display->atom_net_wm_window_type_normal ||
+ atoms[i] == window->display->atom_net_wm_window_type_utility ||
+ atoms[i] == window->display->atom_net_wm_window_type_splashscreen)
{
window->type_atom = atoms[i];
break;
@@ -4974,8 +4978,13 @@ recalc_window_type (MetaWindow *window)
window->type = META_WINDOW_DIALOG;
else if (window->type_atom == window->display->atom_net_wm_window_type_normal)
window->type = META_WINDOW_NORMAL;
+ else if (window->type_atom == window->display->atom_net_wm_window_type_utility)
+ window->type = META_WINDOW_UTILITY;
+ else if (window->type_atom == window->display->atom_net_wm_window_type_splashscreen)
+ window->type = META_WINDOW_SPLASHSCREEN;
else
- meta_bug ("Set a type atom for %s that wasn't handled in recalc_window_type\n");
+ meta_bug ("Set a type atom for %s that wasn't handled in recalc_window_type\n",
+ window->desc);
}
else if (window->xtransient_for != None)
{
@@ -5026,7 +5035,8 @@ recalc_window_features (MetaWindow *window)
/* Semantic category overrides the MWM hints */
if (window->type == META_WINDOW_DESKTOP ||
- window->type == META_WINDOW_DOCK)
+ window->type == META_WINDOW_DOCK ||
+ window->type == META_WINDOW_SPLASHSCREEN)
{
window->decorated = FALSE;
window->has_close_func = FALSE;
diff --git a/src/window.h b/src/window.h
index 18a3ca99..21f8c847 100644
--- a/src/window.h
+++ b/src/window.h
@@ -37,8 +37,9 @@ typedef enum
META_WINDOW_DIALOG,
META_WINDOW_MODAL_DIALOG,
META_WINDOW_TOOLBAR,
- META_WINDOW_MENU
- /* FIXME add UTILITY, SPLASHSCREEN */
+ META_WINDOW_MENU,
+ META_WINDOW_UTILITY,
+ META_WINDOW_SPLASHSCREEN
} MetaWindowType;
struct _MetaWindow