2006-10-01 18:30:10 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
/*
|
2001-05-31 12:18:40 -04:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
2002-02-06 22:07:56 -05:00
|
|
|
*
|
2001-05-31 12:18:40 -04:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
2002-02-06 22:07:56 -05:00
|
|
|
*
|
2001-05-31 12:18:40 -04:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-11 20:42:06 -05:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-05-31 12:18:40 -04:00
|
|
|
*/
|
|
|
|
|
2002-01-27 21:09:12 -05:00
|
|
|
#include <config.h>
|
2010-10-18 14:34:14 -04:00
|
|
|
#include "theme-private.h"
|
2012-12-16 17:54:33 -05:00
|
|
|
#include "frames.h" /* for META_TYPE_FRAMES */
|
2013-09-11 04:18:53 -04:00
|
|
|
#include "util-private.h"
|
2011-07-12 00:55:50 -04:00
|
|
|
#include <meta/prefs.h>
|
2008-11-11 22:43:51 -05:00
|
|
|
#include <gtk/gtk.h>
|
2002-01-05 23:51:53 -05:00
|
|
|
#include <string.h>
|
2002-01-27 21:09:12 -05:00
|
|
|
#include <stdlib.h>
|
2014-09-22 22:20:22 -04:00
|
|
|
#include <stdarg.h>
|
2002-06-06 00:00:22 -04:00
|
|
|
#include <math.h>
|
2001-05-31 12:18:40 -04:00
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
#define DEBUG_FILL_STRUCT(s) memset ((s), 0xef, sizeof (*(s)))
|
2002-01-27 02:32:46 -05:00
|
|
|
|
2014-10-01 19:05:18 -04:00
|
|
|
static void scale_border (GtkBorder *border, double factor);
|
|
|
|
|
2015-02-11 20:50:29 -05:00
|
|
|
static MetaFrameLayout *
|
2002-01-18 22:50:03 -05:00
|
|
|
meta_frame_layout_new (void)
|
|
|
|
{
|
|
|
|
MetaFrameLayout *layout;
|
|
|
|
|
|
|
|
layout = g_new0 (MetaFrameLayout, 1);
|
|
|
|
|
2014-09-30 23:44:19 -04:00
|
|
|
/* Spacing as hardcoded in GTK+:
|
|
|
|
* https://git.gnome.org/browse/gtk+/tree/gtk/gtkheaderbar.c?h=gtk-3-14#n53
|
|
|
|
*/
|
|
|
|
layout->titlebar_spacing = 6;
|
2002-02-09 01:54:44 -05:00
|
|
|
layout->has_title = TRUE;
|
2014-09-26 10:10:56 -04:00
|
|
|
layout->title_scale = PANGO_SCALE_MEDIUM;
|
2014-09-27 21:40:17 -04:00
|
|
|
layout->icon_size = META_MINI_ICON_WIDTH;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
return layout;
|
|
|
|
}
|
|
|
|
|
2015-02-11 20:50:29 -05:00
|
|
|
static void
|
2015-02-11 20:49:21 -05:00
|
|
|
meta_frame_layout_free (MetaFrameLayout *layout)
|
2002-02-06 22:07:56 -05:00
|
|
|
{
|
|
|
|
g_return_if_fail (layout != NULL);
|
|
|
|
|
2015-02-11 20:49:21 -05:00
|
|
|
DEBUG_FILL_STRUCT (layout);
|
|
|
|
g_free (layout);
|
2002-01-18 22:50:03 -05:00
|
|
|
}
|
|
|
|
|
2015-02-11 20:50:29 -05:00
|
|
|
static void
|
2002-01-18 22:50:03 -05:00
|
|
|
meta_frame_layout_get_borders (const MetaFrameLayout *layout,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
2011-09-14 19:06:02 -04:00
|
|
|
MetaFrameType type,
|
2011-07-12 00:37:41 -04:00
|
|
|
MetaFrameBorders *borders)
|
2002-01-18 22:50:03 -05:00
|
|
|
{
|
2014-09-26 10:10:56 -04:00
|
|
|
int buttons_height, content_height, draggable_borders;
|
2014-10-01 19:05:18 -04:00
|
|
|
int scale = meta_theme_get_window_scaling_factor ();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-09-22 14:52:10 -04:00
|
|
|
meta_frame_borders_clear (borders);
|
|
|
|
|
|
|
|
/* For a full-screen window, we don't have any borders, visible or not. */
|
|
|
|
if (flags & META_FRAME_FULLSCREEN)
|
|
|
|
return;
|
|
|
|
|
2010-09-17 05:19:46 -04:00
|
|
|
g_return_if_fail (layout != NULL);
|
2002-02-06 22:07:56 -05:00
|
|
|
|
2002-02-09 01:54:44 -05:00
|
|
|
if (!layout->has_title)
|
|
|
|
text_height = 0;
|
2016-01-14 11:32:46 -05:00
|
|
|
else
|
|
|
|
text_height = layout->title_margin.top + text_height + layout->title_margin.bottom;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2016-01-14 09:25:49 -05:00
|
|
|
buttons_height = MAX ((int)layout->icon_size, layout->button_min_size.height) +
|
2016-01-14 11:32:46 -05:00
|
|
|
layout->button_margin.top + layout->button_border.top +
|
|
|
|
layout->button_margin.bottom + layout->button_border.bottom;
|
2016-01-14 09:25:49 -05:00
|
|
|
content_height = MAX (buttons_height, text_height);
|
|
|
|
content_height = MAX (content_height, layout->titlebar_min_size.height) +
|
2014-09-26 10:10:56 -04:00
|
|
|
layout->titlebar_border.top + layout->titlebar_border.bottom;
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2014-09-26 10:10:56 -04:00
|
|
|
borders->visible.top = layout->frame_border.top + content_height;
|
|
|
|
borders->visible.left = layout->frame_border.left;
|
|
|
|
borders->visible.right = layout->frame_border.right;
|
|
|
|
borders->visible.bottom = layout->frame_border.bottom;
|
2002-06-08 02:07:21 -04:00
|
|
|
|
2016-01-20 12:01:41 -05:00
|
|
|
borders->invisible = layout->invisible_border;
|
|
|
|
|
2011-07-12 00:55:50 -04:00
|
|
|
draggable_borders = meta_prefs_get_draggable_border_width ();
|
|
|
|
|
2011-09-22 14:52:10 -04:00
|
|
|
if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
|
|
|
|
{
|
2016-01-20 12:01:41 -05:00
|
|
|
borders->invisible.left = MAX (borders->invisible.left,
|
|
|
|
draggable_borders - borders->visible.left);
|
|
|
|
borders->invisible.right = MAX (borders->invisible.right,
|
|
|
|
draggable_borders - borders->visible.right);
|
2011-09-22 14:52:10 -04:00
|
|
|
}
|
2011-07-12 00:55:50 -04:00
|
|
|
|
2011-09-22 14:52:10 -04:00
|
|
|
if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
|
|
|
|
{
|
2016-01-20 12:01:41 -05:00
|
|
|
borders->invisible.bottom = MAX (borders->invisible.bottom,
|
|
|
|
draggable_borders - borders->visible.bottom);
|
2016-01-10 09:16:06 -05:00
|
|
|
|
2011-09-22 14:52:10 -04:00
|
|
|
/* borders.visible.top is the height of the *title bar*. We can't do the same
|
|
|
|
* algorithm here, titlebars are expectedly much bigger. Just subtract a couple
|
|
|
|
* pixels to get a proper feel. */
|
2016-01-10 09:16:06 -05:00
|
|
|
if (type != META_FRAME_TYPE_ATTACHED)
|
2016-01-20 12:01:41 -05:00
|
|
|
borders->invisible.top = MAX (borders->invisible.top, draggable_borders - 2);
|
2011-09-22 14:52:10 -04:00
|
|
|
}
|
2011-09-16 20:21:53 -04:00
|
|
|
|
2011-07-12 00:55:50 -04:00
|
|
|
borders->total.left = borders->invisible.left + borders->visible.left;
|
|
|
|
borders->total.right = borders->invisible.right + borders->visible.right;
|
|
|
|
borders->total.bottom = borders->invisible.bottom + borders->visible.bottom;
|
|
|
|
borders->total.top = borders->invisible.top + borders->visible.top;
|
2014-10-01 19:05:18 -04:00
|
|
|
|
|
|
|
/* Scale geometry for HiDPI, see comment in meta_frame_layout_draw_with_style() */
|
|
|
|
scale_border (&borders->visible, scale);
|
|
|
|
scale_border (&borders->invisible, scale);
|
|
|
|
scale_border (&borders->total, scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2015-07-01 01:14:51 -04:00
|
|
|
meta_theme_get_window_scaling_factor (void)
|
2014-10-01 19:05:18 -04:00
|
|
|
{
|
|
|
|
GdkScreen *screen;
|
|
|
|
GValue value = G_VALUE_INIT;
|
|
|
|
|
|
|
|
g_value_init (&value, G_TYPE_INT);
|
|
|
|
|
|
|
|
screen = gdk_screen_get_default ();
|
|
|
|
if (gdk_screen_get_setting (screen, "gdk-window-scaling-factor", &value))
|
|
|
|
return g_value_get_int (&value);
|
|
|
|
else
|
|
|
|
return 1;
|
2002-01-18 22:50:03 -05:00
|
|
|
}
|
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
void
|
|
|
|
meta_frame_layout_apply_scale (const MetaFrameLayout *layout,
|
|
|
|
PangoFontDescription *font_desc)
|
|
|
|
{
|
|
|
|
int size = pango_font_description_get_size (font_desc);
|
2014-10-01 19:05:18 -04:00
|
|
|
double scale = layout->title_scale / meta_theme_get_window_scaling_factor ();
|
|
|
|
pango_font_description_set_size (font_desc, MAX (size * scale, 1));
|
2014-09-25 03:04:31 -04:00
|
|
|
}
|
|
|
|
|
2006-08-07 14:01:21 -04:00
|
|
|
static MetaButtonSpace*
|
2002-10-03 22:28:57 -04:00
|
|
|
rect_for_function (MetaFrameGeometry *fgeom,
|
|
|
|
MetaFrameFlags flags,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
MetaButtonFunction function,
|
|
|
|
MetaTheme *theme)
|
2002-10-03 22:28:57 -04:00
|
|
|
{
|
|
|
|
switch (function)
|
|
|
|
{
|
|
|
|
case META_BUTTON_FUNCTION_MENU:
|
|
|
|
if (flags & META_FRAME_ALLOWS_MENU)
|
|
|
|
return &fgeom->menu_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
2014-05-23 17:14:51 -04:00
|
|
|
case META_BUTTON_FUNCTION_APPMENU:
|
|
|
|
if (flags & META_FRAME_ALLOWS_APPMENU)
|
|
|
|
return &fgeom->appmenu_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
2002-10-03 22:28:57 -04:00
|
|
|
case META_BUTTON_FUNCTION_MINIMIZE:
|
|
|
|
if (flags & META_FRAME_ALLOWS_MINIMIZE)
|
|
|
|
return &fgeom->min_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_MAXIMIZE:
|
|
|
|
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
|
|
|
|
return &fgeom->max_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_CLOSE:
|
|
|
|
if (flags & META_FRAME_ALLOWS_DELETE)
|
|
|
|
return &fgeom->close_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
case META_BUTTON_FUNCTION_LAST:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2006-08-07 14:01:21 -04:00
|
|
|
strip_button (MetaButtonSpace *func_rects[MAX_BUTTONS_PER_CORNER],
|
|
|
|
int *n_rects,
|
|
|
|
MetaButtonSpace *to_strip)
|
2002-10-03 22:28:57 -04:00
|
|
|
{
|
|
|
|
int i;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
i = 0;
|
|
|
|
while (i < *n_rects)
|
|
|
|
{
|
|
|
|
if (func_rects[i] == to_strip)
|
|
|
|
{
|
|
|
|
*n_rects -= 1;
|
|
|
|
|
|
|
|
/* shift the other rects back in the array */
|
|
|
|
while (i < *n_rects)
|
|
|
|
{
|
|
|
|
func_rects[i] = func_rects[i+1];
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
func_rects[i] = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE; /* did not strip anything */
|
|
|
|
}
|
|
|
|
|
2014-09-27 21:40:17 -04:00
|
|
|
static void
|
|
|
|
get_padding_and_border (GtkStyleContext *style,
|
|
|
|
GtkBorder *border)
|
|
|
|
{
|
|
|
|
GtkBorder tmp;
|
|
|
|
GtkStateFlags state = gtk_style_context_get_state (style);
|
|
|
|
|
|
|
|
gtk_style_context_get_border (style, state, border);
|
|
|
|
gtk_style_context_get_padding (style, state, &tmp);
|
|
|
|
|
|
|
|
border->left += tmp.left;
|
|
|
|
border->top += tmp.top;
|
|
|
|
border->right += tmp.right;
|
|
|
|
border->bottom += tmp.bottom;
|
|
|
|
}
|
|
|
|
|
2016-01-14 09:25:49 -05:00
|
|
|
static void
|
|
|
|
get_min_size (GtkStyleContext *style,
|
|
|
|
GtkRequisition *requisition)
|
|
|
|
{
|
|
|
|
gtk_style_context_get (style, gtk_style_context_get_state (style),
|
|
|
|
"min-width", &requisition->width,
|
|
|
|
"min-height", &requisition->height,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2014-09-25 16:55:53 -04:00
|
|
|
static void
|
|
|
|
scale_border (GtkBorder *border,
|
|
|
|
double factor)
|
|
|
|
{
|
|
|
|
border->left *= factor;
|
|
|
|
border->right *= factor;
|
|
|
|
border->top *= factor;
|
|
|
|
border->bottom *= factor;
|
|
|
|
}
|
|
|
|
|
2014-09-27 21:40:17 -04:00
|
|
|
static void
|
|
|
|
meta_frame_layout_sync_with_style (MetaFrameLayout *layout,
|
|
|
|
MetaStyleInfo *style_info,
|
|
|
|
MetaFrameFlags flags)
|
|
|
|
{
|
|
|
|
GtkStyleContext *style;
|
|
|
|
GtkBorder border;
|
2016-01-14 09:25:49 -05:00
|
|
|
GtkRequisition requisition;
|
2016-01-20 12:01:41 -05:00
|
|
|
GdkRectangle clip_rect;
|
2014-09-27 21:40:17 -04:00
|
|
|
int border_radius, max_radius;
|
|
|
|
|
|
|
|
meta_style_info_set_flags (style_info, flags);
|
|
|
|
|
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_FRAME];
|
2014-09-26 10:10:56 -04:00
|
|
|
get_padding_and_border (style, &layout->frame_border);
|
|
|
|
scale_border (&layout->frame_border, layout->title_scale);
|
2014-09-27 21:40:17 -04:00
|
|
|
|
2016-01-20 12:01:41 -05:00
|
|
|
gtk_render_background_get_clip (style, 0, 0, 0, 0, &clip_rect);
|
|
|
|
layout->invisible_border.left = -clip_rect.x;
|
|
|
|
layout->invisible_border.right = clip_rect.width + clip_rect.x;
|
|
|
|
layout->invisible_border.top = -clip_rect.y;
|
|
|
|
layout->invisible_border.bottom = clip_rect.height + clip_rect.y;
|
|
|
|
|
2014-09-27 21:40:17 -04:00
|
|
|
if (layout->hide_buttons)
|
|
|
|
layout->icon_size = 0;
|
|
|
|
|
|
|
|
if (!layout->has_title && layout->hide_buttons)
|
|
|
|
return; /* border-only - be done */
|
|
|
|
|
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_TITLEBAR];
|
|
|
|
gtk_style_context_get (style, gtk_style_context_get_state (style),
|
|
|
|
"border-radius", &border_radius,
|
|
|
|
NULL);
|
|
|
|
/* GTK+ currently does not allow us to look up radii of individual
|
|
|
|
* corners; however we don't clip the client area, so with the
|
|
|
|
* current trend of using small/no visible frame borders, most
|
|
|
|
* themes should work fine with this.
|
|
|
|
*/
|
|
|
|
layout->top_left_corner_rounded_radius = border_radius;
|
|
|
|
layout->top_right_corner_rounded_radius = border_radius;
|
2014-09-26 10:10:56 -04:00
|
|
|
max_radius = MIN (layout->frame_border.bottom, layout->frame_border.left);
|
2014-09-27 21:40:17 -04:00
|
|
|
layout->bottom_left_corner_rounded_radius = MAX (border_radius, max_radius);
|
2014-09-26 10:10:56 -04:00
|
|
|
max_radius = MIN (layout->frame_border.bottom, layout->frame_border.right);
|
2014-09-27 21:40:17 -04:00
|
|
|
layout->bottom_right_corner_rounded_radius = MAX (border_radius, max_radius);
|
|
|
|
|
2016-01-14 09:25:49 -05:00
|
|
|
get_min_size (style, &layout->titlebar_min_size);
|
2014-09-26 10:10:56 -04:00
|
|
|
get_padding_and_border (style, &layout->titlebar_border);
|
|
|
|
scale_border (&layout->titlebar_border, layout->title_scale);
|
2014-09-27 21:40:17 -04:00
|
|
|
|
2016-01-14 11:32:46 -05:00
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_TITLE];
|
|
|
|
gtk_style_context_get_margin (style, gtk_style_context_get_state (style),
|
|
|
|
&layout->title_margin);
|
|
|
|
scale_border (&layout->title_margin, layout->title_scale);
|
|
|
|
|
2014-09-27 21:40:17 -04:00
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_BUTTON];
|
2016-01-14 09:25:49 -05:00
|
|
|
get_min_size (style, &layout->button_min_size);
|
2014-09-26 10:10:56 -04:00
|
|
|
get_padding_and_border (style, &layout->button_border);
|
|
|
|
scale_border (&layout->button_border, layout->title_scale);
|
2016-01-14 11:32:46 -05:00
|
|
|
gtk_style_context_get_margin (style, gtk_style_context_get_state (style),
|
|
|
|
&layout->button_margin);
|
|
|
|
scale_border (&layout->button_margin, layout->title_scale);
|
2014-09-27 21:40:17 -04:00
|
|
|
|
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_IMAGE];
|
2016-01-14 09:25:49 -05:00
|
|
|
get_min_size (style, &requisition);
|
2014-09-27 21:40:17 -04:00
|
|
|
get_padding_and_border (style, &border);
|
2014-09-25 16:55:53 -04:00
|
|
|
scale_border (&border, layout->title_scale);
|
2014-09-26 10:10:56 -04:00
|
|
|
|
|
|
|
layout->button_border.left += border.left;
|
|
|
|
layout->button_border.right += border.right;
|
|
|
|
layout->button_border.top += border.top;
|
|
|
|
layout->button_border.bottom += border.bottom;
|
2016-01-14 09:25:49 -05:00
|
|
|
|
2016-01-14 11:32:46 -05:00
|
|
|
gtk_style_context_get_margin (style, gtk_style_context_get_state (style),
|
|
|
|
&border);
|
|
|
|
layout->button_border.left += border.left;
|
|
|
|
layout->button_border.right += border.right;
|
|
|
|
layout->button_border.top += border.top;
|
|
|
|
layout->button_border.bottom += border.bottom;
|
|
|
|
|
2016-01-14 09:25:49 -05:00
|
|
|
layout->button_min_size.width = MAX(layout->button_min_size.width,
|
|
|
|
requisition.width);
|
|
|
|
layout->button_min_size.height = MAX(layout->button_min_size.height,
|
|
|
|
requisition.height);
|
2014-09-27 21:40:17 -04:00
|
|
|
}
|
|
|
|
|
2012-04-26 19:26:09 -04:00
|
|
|
static void
|
2014-09-22 22:20:22 -04:00
|
|
|
meta_frame_layout_calc_geometry (MetaFrameLayout *layout,
|
|
|
|
MetaStyleInfo *style_info,
|
2002-10-03 22:28:57 -04:00
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
int client_width,
|
|
|
|
int client_height,
|
|
|
|
const MetaButtonLayout *button_layout,
|
2011-09-14 19:06:02 -04:00
|
|
|
MetaFrameType type,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
MetaFrameGeometry *fgeom,
|
|
|
|
MetaTheme *theme)
|
2002-01-18 22:50:03 -05:00
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
int i, n_left, n_right, n_left_spacers, n_right_spacers;
|
2002-01-18 22:50:03 -05:00
|
|
|
int x;
|
|
|
|
int button_y;
|
|
|
|
int title_right_edge;
|
|
|
|
int width, height;
|
2014-09-26 10:10:56 -04:00
|
|
|
int content_width, content_height;
|
2002-06-03 22:13:00 -04:00
|
|
|
int button_width, button_height;
|
2002-08-27 22:48:59 -04:00
|
|
|
int min_size_for_rounding;
|
2014-10-01 19:05:18 -04:00
|
|
|
int scale = meta_theme_get_window_scaling_factor ();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
/* the left/right rects in order; the max # of rects
|
|
|
|
* is the number of button functions
|
|
|
|
*/
|
2006-08-07 14:01:21 -04:00
|
|
|
MetaButtonSpace *left_func_rects[MAX_BUTTONS_PER_CORNER];
|
|
|
|
MetaButtonSpace *right_func_rects[MAX_BUTTONS_PER_CORNER];
|
2008-02-29 15:41:07 -05:00
|
|
|
gboolean left_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
|
|
|
|
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
|
2011-07-12 00:37:41 -04:00
|
|
|
|
|
|
|
MetaFrameBorders borders;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
meta_frame_layout_sync_with_style (layout, style_info, flags);
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
meta_frame_layout_get_borders (layout, text_height,
|
2011-09-14 19:06:02 -04:00
|
|
|
flags, type,
|
2011-07-12 00:37:41 -04:00
|
|
|
&borders);
|
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
fgeom->borders = borders;
|
2011-07-12 00:37:41 -04:00
|
|
|
|
2014-10-01 19:05:18 -04:00
|
|
|
/* Scale geometry for HiDPI, see comment in meta_frame_layout_draw_with_style() */
|
2014-09-26 10:10:56 -04:00
|
|
|
fgeom->content_border = layout->frame_border;
|
2014-10-01 19:05:18 -04:00
|
|
|
fgeom->content_border.left += layout->titlebar_border.left * scale;
|
|
|
|
fgeom->content_border.right += layout->titlebar_border.right * scale;
|
|
|
|
fgeom->content_border.top += layout->titlebar_border.top * scale;
|
|
|
|
fgeom->content_border.bottom += layout->titlebar_border.bottom * scale;
|
2014-09-26 10:10:56 -04:00
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
width = client_width + borders.total.left + borders.total.right;
|
2002-06-13 13:26:39 -04:00
|
|
|
|
2014-05-21 12:21:05 -04:00
|
|
|
height = borders.total.top + borders.total.bottom;
|
|
|
|
if (!(flags & META_FRAME_SHADED))
|
|
|
|
height += client_height;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
2002-01-18 22:50:03 -05:00
|
|
|
fgeom->width = width;
|
|
|
|
fgeom->height = height;
|
|
|
|
|
2014-09-26 10:10:56 -04:00
|
|
|
content_width = width -
|
|
|
|
(fgeom->content_border.left + borders.invisible.left) -
|
|
|
|
(fgeom->content_border.right + borders.invisible.right);
|
|
|
|
content_height = borders.visible.top - fgeom->content_border.top - fgeom->content_border.bottom;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
2016-01-14 09:25:49 -05:00
|
|
|
button_width = MAX ((int)layout->icon_size, layout->button_min_size.width) +
|
2014-09-26 10:10:56 -04:00
|
|
|
layout->button_border.left + layout->button_border.right;
|
2016-01-14 09:25:49 -05:00
|
|
|
button_height = MAX ((int)layout->icon_size, layout->button_min_size.height) +
|
2014-09-26 10:10:56 -04:00
|
|
|
layout->button_border.top + layout->button_border.bottom;
|
2014-10-01 19:05:18 -04:00
|
|
|
button_width *= scale;
|
|
|
|
button_height *= scale;
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
/* FIXME all this code sort of pretends that duplicate buttons
|
|
|
|
* with the same function are allowed, but that breaks the
|
|
|
|
* code in frames.c, so isn't really allowed right now.
|
|
|
|
* Would need left_close_rect, right_close_rect, etc.
|
|
|
|
*/
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
/* Init all button rects to 0, lame hack */
|
|
|
|
memset (ADDRESS_OF_BUTTON_RECTS (fgeom), '\0',
|
|
|
|
LENGTH_OF_BUTTON_RECTS);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
n_left = 0;
|
|
|
|
n_right = 0;
|
2008-02-29 15:41:07 -05:00
|
|
|
n_left_spacers = 0;
|
|
|
|
n_right_spacers = 0;
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2007-07-22 02:39:29 -04:00
|
|
|
if (!layout->hide_buttons)
|
|
|
|
{
|
2002-10-03 22:28:57 -04:00
|
|
|
/* Try to fill in rects */
|
2007-07-22 02:39:29 -04:00
|
|
|
for (i = 0; i < MAX_BUTTONS_PER_CORNER && button_layout->left_buttons[i] != META_BUTTON_FUNCTION_LAST; i++)
|
2002-10-03 22:28:57 -04:00
|
|
|
{
|
|
|
|
left_func_rects[n_left] = rect_for_function (fgeom, flags,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
button_layout->left_buttons[i],
|
|
|
|
theme);
|
2002-10-03 22:28:57 -04:00
|
|
|
if (left_func_rects[n_left] != NULL)
|
2008-02-29 15:41:07 -05:00
|
|
|
{
|
|
|
|
left_buttons_has_spacer[n_left] = button_layout->left_buttons_has_spacer[i];
|
|
|
|
if (button_layout->left_buttons_has_spacer[i])
|
|
|
|
++n_left_spacers;
|
|
|
|
|
|
|
|
++n_left;
|
|
|
|
}
|
2002-10-03 22:28:57 -04:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-07-22 02:39:29 -04:00
|
|
|
for (i = 0; i < MAX_BUTTONS_PER_CORNER && button_layout->right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++)
|
2002-10-03 22:28:57 -04:00
|
|
|
{
|
|
|
|
right_func_rects[n_right] = rect_for_function (fgeom, flags,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
button_layout->right_buttons[i],
|
|
|
|
theme);
|
2002-10-03 22:28:57 -04:00
|
|
|
if (right_func_rects[n_right] != NULL)
|
2008-02-29 15:41:07 -05:00
|
|
|
{
|
|
|
|
right_buttons_has_spacer[n_right] = button_layout->right_buttons_has_spacer[i];
|
|
|
|
if (button_layout->right_buttons_has_spacer[i])
|
|
|
|
++n_right_spacers;
|
|
|
|
|
|
|
|
++n_right;
|
|
|
|
}
|
2002-10-03 22:28:57 -04:00
|
|
|
}
|
2002-01-18 22:50:03 -05:00
|
|
|
}
|
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
/* Be sure buttons fit */
|
|
|
|
while (n_left > 0 || n_right > 0)
|
2002-01-18 22:50:03 -05:00
|
|
|
{
|
2002-10-03 22:28:57 -04:00
|
|
|
int space_used_by_buttons;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
space_used_by_buttons = 0;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
2016-01-14 11:32:46 -05:00
|
|
|
space_used_by_buttons += layout->button_margin.left * scale * n_left;
|
2006-04-18 13:18:53 -04:00
|
|
|
space_used_by_buttons += button_width * n_left;
|
2016-01-14 11:32:46 -05:00
|
|
|
space_used_by_buttons += layout->button_margin.right * scale * n_left;
|
2008-02-29 15:41:07 -05:00
|
|
|
space_used_by_buttons += (button_width * 0.75) * n_left_spacers;
|
2014-10-01 19:05:18 -04:00
|
|
|
space_used_by_buttons += layout->titlebar_spacing * scale * MAX (n_left - 1, 0);
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2016-01-14 11:32:46 -05:00
|
|
|
space_used_by_buttons += layout->button_margin.left * scale * n_right;
|
2006-04-18 13:18:53 -04:00
|
|
|
space_used_by_buttons += button_width * n_right;
|
2016-01-14 11:32:46 -05:00
|
|
|
space_used_by_buttons += layout->button_margin.right * scale * n_right;
|
2008-02-29 15:41:07 -05:00
|
|
|
space_used_by_buttons += (button_width * 0.75) * n_right_spacers;
|
2014-10-01 19:05:18 -04:00
|
|
|
space_used_by_buttons += layout->titlebar_spacing * scale * MAX (n_right - 1, 0);
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2014-09-26 10:10:56 -04:00
|
|
|
if (space_used_by_buttons <= content_width)
|
2002-10-03 22:28:57 -04:00
|
|
|
break; /* Everything fits, bail out */
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-02-29 15:41:07 -05:00
|
|
|
/* First try to remove separators */
|
|
|
|
if (n_left_spacers > 0)
|
|
|
|
{
|
|
|
|
left_buttons_has_spacer[--n_left_spacers] = FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (n_right_spacers > 0)
|
|
|
|
{
|
|
|
|
right_buttons_has_spacer[--n_right_spacers] = FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
/* Otherwise we need to shave out a button. Shave
|
2015-09-29 08:24:05 -04:00
|
|
|
* min, max, close, then menu (menu is most useful);
|
2002-10-03 22:28:57 -04:00
|
|
|
* prefer the default button locations.
|
|
|
|
*/
|
2015-09-29 08:24:05 -04:00
|
|
|
if (strip_button (left_func_rects, &n_left, &fgeom->min_rect))
|
2002-10-03 22:28:57 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (right_func_rects, &n_right, &fgeom->min_rect))
|
2002-10-03 22:28:57 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (left_func_rects, &n_left, &fgeom->max_rect))
|
2002-10-03 22:28:57 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (right_func_rects, &n_right, &fgeom->max_rect))
|
2002-10-03 22:28:57 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (left_func_rects, &n_left, &fgeom->close_rect))
|
2002-10-03 22:28:57 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (right_func_rects, &n_right, &fgeom->close_rect))
|
2002-10-03 22:28:57 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (right_func_rects, &n_right, &fgeom->menu_rect))
|
2002-10-03 22:28:57 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (left_func_rects, &n_left, &fgeom->menu_rect))
|
2002-10-03 22:28:57 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (right_func_rects, &n_right, &fgeom->appmenu_rect))
|
2014-05-23 17:14:51 -04:00
|
|
|
continue;
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (strip_button (left_func_rects, &n_left, &fgeom->appmenu_rect))
|
2014-05-23 17:14:51 -04:00
|
|
|
continue;
|
2002-10-03 22:28:57 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_bug ("Could not find a button to strip. n_left = %d n_right = %d\n",
|
|
|
|
n_left, n_right);
|
|
|
|
}
|
2002-01-18 22:50:03 -05:00
|
|
|
}
|
2010-12-01 19:16:10 -05:00
|
|
|
|
|
|
|
/* Save the button layout */
|
|
|
|
fgeom->button_layout = *button_layout;
|
|
|
|
fgeom->n_left_buttons = n_left;
|
|
|
|
fgeom->n_right_buttons = n_right;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
/* center buttons vertically */
|
2014-09-26 10:10:56 -04:00
|
|
|
button_y = fgeom->content_border.top + borders.invisible.top +
|
|
|
|
(content_height - button_height) / 2;
|
2002-01-18 22:50:03 -05:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
/* right edge of farthest-right button */
|
2014-09-26 10:10:56 -04:00
|
|
|
x = width - fgeom->content_border.right - borders.invisible.right;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
i = n_right - 1;
|
|
|
|
while (i >= 0)
|
2002-01-18 22:50:03 -05:00
|
|
|
{
|
2006-08-07 14:01:21 -04:00
|
|
|
MetaButtonSpace *rect;
|
2002-10-03 22:28:57 -04:00
|
|
|
|
|
|
|
if (x < 0) /* if we go negative, leave the buttons we don't get to as 0-width */
|
|
|
|
break;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2016-01-14 11:32:46 -05:00
|
|
|
x -= layout->button_margin.right * scale;
|
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
rect = right_func_rects[i];
|
2014-09-30 23:44:19 -04:00
|
|
|
rect->visible.x = x - button_width;
|
2008-02-29 15:41:07 -05:00
|
|
|
if (right_buttons_has_spacer[i])
|
|
|
|
rect->visible.x -= (button_width * 0.75);
|
|
|
|
|
2006-08-07 14:01:21 -04:00
|
|
|
rect->visible.y = button_y;
|
|
|
|
rect->visible.width = button_width;
|
|
|
|
rect->visible.height = button_height;
|
2002-10-03 22:28:57 -04:00
|
|
|
|
2010-12-07 20:16:35 -05:00
|
|
|
if (flags & META_FRAME_MAXIMIZED ||
|
|
|
|
flags & META_FRAME_TILED_LEFT ||
|
|
|
|
flags & META_FRAME_TILED_RIGHT)
|
2006-08-07 14:01:21 -04:00
|
|
|
{
|
|
|
|
rect->clickable.x = rect->visible.x;
|
|
|
|
rect->clickable.y = 0;
|
|
|
|
rect->clickable.width = rect->visible.width;
|
|
|
|
rect->clickable.height = button_height + button_y;
|
|
|
|
|
|
|
|
if (i == n_right - 1)
|
2014-09-26 10:10:56 -04:00
|
|
|
rect->clickable.width += fgeom->content_border.right;
|
2006-08-07 14:01:21 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
|
|
|
|
|
2016-01-14 11:32:46 -05:00
|
|
|
x = rect->visible.x - layout->button_margin.left * scale;
|
2014-09-30 23:44:19 -04:00
|
|
|
|
|
|
|
if (i > 0)
|
|
|
|
x -= layout->titlebar_spacing;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
--i;
|
2002-01-18 22:50:03 -05:00
|
|
|
}
|
2002-02-06 22:07:56 -05:00
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
/* save right edge of titlebar for later use */
|
2014-09-26 10:10:56 -04:00
|
|
|
title_right_edge = x;
|
2002-10-03 22:28:57 -04:00
|
|
|
|
|
|
|
/* Now x changes to be position from the left and we go through
|
|
|
|
* the left-side buttons
|
|
|
|
*/
|
2014-09-26 10:10:56 -04:00
|
|
|
x = fgeom->content_border.left + borders.invisible.left;
|
2006-04-18 13:18:53 -04:00
|
|
|
for (i = 0; i < n_left; i++)
|
2002-01-18 22:50:03 -05:00
|
|
|
{
|
2006-08-07 14:01:21 -04:00
|
|
|
MetaButtonSpace *rect;
|
2006-04-18 13:18:53 -04:00
|
|
|
|
2016-01-14 11:32:46 -05:00
|
|
|
x += layout->button_margin.left * scale;
|
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
rect = left_func_rects[i];
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-30 23:44:19 -04:00
|
|
|
rect->visible.x = x;
|
2006-08-07 14:01:21 -04:00
|
|
|
rect->visible.y = button_y;
|
|
|
|
rect->visible.width = button_width;
|
|
|
|
rect->visible.height = button_height;
|
|
|
|
|
|
|
|
if (flags & META_FRAME_MAXIMIZED)
|
|
|
|
{
|
|
|
|
if (i==0)
|
|
|
|
{
|
|
|
|
rect->clickable.x = 0;
|
|
|
|
rect->clickable.width = button_width + x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rect->clickable.x = rect->visible.x;
|
|
|
|
rect->clickable.width = button_width;
|
|
|
|
}
|
|
|
|
|
2012-03-01 00:59:06 -05:00
|
|
|
rect->clickable.y = 0;
|
|
|
|
rect->clickable.height = button_height + button_y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
|
2006-04-18 13:18:53 -04:00
|
|
|
|
2016-01-14 11:32:46 -05:00
|
|
|
x = rect->visible.x + rect->visible.width + layout->button_margin.right * scale;
|
2014-09-30 23:44:19 -04:00
|
|
|
if (i < n_left - 1)
|
2014-10-01 19:05:18 -04:00
|
|
|
x += layout->titlebar_spacing * scale;
|
2008-02-29 15:41:07 -05:00
|
|
|
if (left_buttons_has_spacer[i])
|
|
|
|
x += (button_width * 0.75);
|
2002-01-18 22:50:03 -05:00
|
|
|
}
|
|
|
|
|
2014-09-26 10:10:56 -04:00
|
|
|
/* Center vertically in the available content area */
|
|
|
|
fgeom->title_rect.x = x;
|
|
|
|
fgeom->title_rect.y = fgeom->content_border.top + borders.invisible.top +
|
|
|
|
(content_height - text_height) / 2;
|
2002-01-18 22:50:03 -05:00
|
|
|
fgeom->title_rect.width = title_right_edge - fgeom->title_rect.x;
|
2014-09-26 10:10:56 -04:00
|
|
|
fgeom->title_rect.height = text_height;
|
2002-01-18 22:50:03 -05:00
|
|
|
|
|
|
|
/* Nuke title if it won't fit */
|
|
|
|
if (fgeom->title_rect.width < 0 ||
|
|
|
|
fgeom->title_rect.height < 0)
|
|
|
|
{
|
|
|
|
fgeom->title_rect.width = 0;
|
|
|
|
fgeom->title_rect.height = 0;
|
|
|
|
}
|
2002-05-30 20:02:54 -04:00
|
|
|
|
2002-08-27 22:48:59 -04:00
|
|
|
if (flags & META_FRAME_SHADED)
|
|
|
|
min_size_for_rounding = 0;
|
|
|
|
else
|
2014-10-01 19:05:18 -04:00
|
|
|
min_size_for_rounding = 5 * scale;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
fgeom->top_left_corner_rounded_radius = 0;
|
|
|
|
fgeom->top_right_corner_rounded_radius = 0;
|
|
|
|
fgeom->bottom_left_corner_rounded_radius = 0;
|
|
|
|
fgeom->bottom_right_corner_rounded_radius = 0;
|
2002-08-24 17:28:02 -04:00
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
if (borders.visible.top + borders.visible.left >= min_size_for_rounding)
|
2014-10-01 19:05:18 -04:00
|
|
|
fgeom->top_left_corner_rounded_radius = layout->top_left_corner_rounded_radius * scale;
|
2011-07-12 01:16:48 -04:00
|
|
|
if (borders.visible.top + borders.visible.right >= min_size_for_rounding)
|
2014-10-01 19:05:18 -04:00
|
|
|
fgeom->top_right_corner_rounded_radius = layout->top_right_corner_rounded_radius * scale;
|
2002-01-08 02:23:35 -05:00
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
if (borders.visible.bottom + borders.visible.left >= min_size_for_rounding)
|
2014-10-01 19:05:18 -04:00
|
|
|
fgeom->bottom_left_corner_rounded_radius = layout->bottom_left_corner_rounded_radius * scale;
|
2011-07-12 01:16:48 -04:00
|
|
|
if (borders.visible.bottom + borders.visible.right >= min_size_for_rounding)
|
2014-10-01 19:05:18 -04:00
|
|
|
fgeom->bottom_right_corner_rounded_radius = layout->bottom_right_corner_rounded_radius * scale;
|
2002-08-24 17:28:02 -04:00
|
|
|
}
|
2002-02-02 00:09:19 -05:00
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
static void
|
|
|
|
get_button_rect (MetaButtonType type,
|
|
|
|
const MetaFrameGeometry *fgeom,
|
|
|
|
GdkRectangle *rect)
|
2002-02-02 00:09:19 -05:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
2014-09-23 19:09:09 -04:00
|
|
|
case META_BUTTON_TYPE_CLOSE:
|
|
|
|
*rect = fgeom->close_rect.visible;
|
2002-02-02 00:09:19 -05:00
|
|
|
break;
|
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
case META_BUTTON_TYPE_MAXIMIZE:
|
|
|
|
*rect = fgeom->max_rect.visible;
|
2002-02-02 00:09:19 -05:00
|
|
|
break;
|
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
case META_BUTTON_TYPE_MINIMIZE:
|
|
|
|
*rect = fgeom->min_rect.visible;
|
2002-02-02 00:09:19 -05:00
|
|
|
break;
|
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
case META_BUTTON_TYPE_MENU:
|
|
|
|
*rect = fgeom->menu_rect.visible;
|
2011-05-04 10:13:55 -04:00
|
|
|
break;
|
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
case META_BUTTON_TYPE_APPMENU:
|
|
|
|
*rect = fgeom->appmenu_rect.visible;
|
2002-02-02 00:09:19 -05:00
|
|
|
break;
|
2002-06-06 00:00:22 -04:00
|
|
|
|
2015-03-12 16:03:28 -04:00
|
|
|
default:
|
2014-09-23 19:09:09 -04:00
|
|
|
case META_BUTTON_TYPE_LAST:
|
|
|
|
g_assert_not_reached ();
|
2002-06-06 00:00:22 -04:00
|
|
|
break;
|
2002-02-02 00:09:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-04 10:33:57 -05:00
|
|
|
static const char *
|
|
|
|
get_class_from_button_type (MetaButtonType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_BUTTON_TYPE_CLOSE:
|
|
|
|
return "close";
|
|
|
|
case META_BUTTON_TYPE_MAXIMIZE:
|
|
|
|
return "maximize";
|
|
|
|
case META_BUTTON_TYPE_MINIMIZE:
|
|
|
|
return "minimize";
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
static void
|
2014-09-25 03:04:31 -04:00
|
|
|
meta_frame_layout_draw_with_style (MetaFrameLayout *layout,
|
|
|
|
MetaStyleInfo *style_info,
|
|
|
|
cairo_t *cr,
|
|
|
|
const MetaFrameGeometry *fgeom,
|
|
|
|
PangoLayout *title_layout,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
2014-12-31 23:39:36 -05:00
|
|
|
cairo_surface_t *mini_icon)
|
2002-02-02 00:09:19 -05:00
|
|
|
{
|
2014-09-23 19:09:09 -04:00
|
|
|
GtkStyleContext *style;
|
|
|
|
GtkStateFlags state;
|
|
|
|
MetaButtonType button_type;
|
|
|
|
GdkRectangle visible_rect;
|
|
|
|
GdkRectangle titlebar_rect;
|
|
|
|
GdkRectangle button_rect;
|
|
|
|
const MetaFrameBorders *borders;
|
2014-10-01 19:05:18 -04:00
|
|
|
int scale = meta_theme_get_window_scaling_factor ();
|
|
|
|
|
|
|
|
/* We opt out of GTK+/Clutter's HiDPI handling, so we have to do the scaling
|
|
|
|
* ourselves; the nitty-gritty is a bit confusing, so here is an overview:
|
|
|
|
* - the values in MetaFrameLayout are always as they appear in the theme,
|
|
|
|
* i.e. unscaled
|
|
|
|
* - calculated values (borders, MetaFrameGeometry) include the scale - as
|
|
|
|
* the geometry is comprised of scaled decorations and the client size
|
|
|
|
* which we must not scale, we don't have another option
|
|
|
|
* - for drawing, we scale the canvas to have GTK+ render elements (borders,
|
|
|
|
* radii, ...) at the correct scale - as a result, we have to "unscale"
|
|
|
|
* the geometry again to not apply the scaling twice
|
|
|
|
*/
|
|
|
|
cairo_scale (cr, scale, scale);
|
2002-02-02 00:09:19 -05:00
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
borders = &fgeom->borders;
|
2011-08-07 12:55:30 -04:00
|
|
|
|
2014-10-01 19:05:18 -04:00
|
|
|
visible_rect.x = borders->invisible.left / scale;
|
|
|
|
visible_rect.y = borders->invisible.top / scale;
|
|
|
|
visible_rect.width = (fgeom->width - borders->invisible.left - borders->invisible.right) / scale;
|
|
|
|
visible_rect.height = (fgeom->height - borders->invisible.top - borders->invisible.bottom) / scale;
|
2011-05-04 10:13:55 -04:00
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
meta_style_info_set_flags (style_info, flags);
|
2011-05-04 10:13:55 -04:00
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_FRAME];
|
|
|
|
gtk_render_background (style, cr,
|
|
|
|
visible_rect.x, visible_rect.y,
|
|
|
|
visible_rect.width, visible_rect.height);
|
|
|
|
gtk_render_frame (style, cr,
|
|
|
|
visible_rect.x, visible_rect.y,
|
|
|
|
visible_rect.width, visible_rect.height);
|
2014-09-22 22:20:22 -04:00
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
titlebar_rect.x = visible_rect.x;
|
|
|
|
titlebar_rect.y = visible_rect.y;
|
|
|
|
titlebar_rect.width = visible_rect.width;
|
2014-10-01 19:05:18 -04:00
|
|
|
titlebar_rect.height = borders->visible.top / scale;
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_TITLEBAR];
|
|
|
|
gtk_render_background (style, cr,
|
|
|
|
titlebar_rect.x, titlebar_rect.y,
|
|
|
|
titlebar_rect.width, titlebar_rect.height);
|
|
|
|
gtk_render_frame (style, cr,
|
|
|
|
titlebar_rect.x, titlebar_rect.y,
|
|
|
|
titlebar_rect.width, titlebar_rect.height);
|
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
if (layout->has_title && title_layout)
|
2002-01-28 00:16:04 -05:00
|
|
|
{
|
2014-09-22 22:20:22 -04:00
|
|
|
PangoRectangle logical;
|
|
|
|
int text_width, x, y;
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
pango_layout_set_width (title_layout, -1);
|
|
|
|
pango_layout_get_pixel_extents (title_layout, NULL, &logical);
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-10-01 19:05:18 -04:00
|
|
|
text_width = MIN(fgeom->title_rect.width / scale, logical.width);
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
if (text_width < logical.width)
|
|
|
|
pango_layout_set_width (title_layout, PANGO_SCALE * text_width);
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
/* Center within the frame if possible */
|
|
|
|
x = titlebar_rect.x + (titlebar_rect.width - text_width) / 2;
|
|
|
|
y = titlebar_rect.y + (titlebar_rect.height - logical.height) / 2;
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-10-01 19:05:18 -04:00
|
|
|
if (x < fgeom->title_rect.x / scale)
|
|
|
|
x = fgeom->title_rect.x / scale;
|
|
|
|
else if (x + text_width > (fgeom->title_rect.x + fgeom->title_rect.width) / scale)
|
|
|
|
x = (fgeom->title_rect.x + fgeom->title_rect.width) / scale - text_width;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_TITLE];
|
|
|
|
gtk_render_layout (style, cr, x, y, title_layout);
|
|
|
|
}
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
style = style_info->styles[META_STYLE_ELEMENT_BUTTON];
|
|
|
|
state = gtk_style_context_get_state (style);
|
|
|
|
for (button_type = META_BUTTON_TYPE_CLOSE; button_type < META_BUTTON_TYPE_LAST; button_type++)
|
|
|
|
{
|
2015-03-04 10:33:57 -05:00
|
|
|
const char *button_class = get_class_from_button_type (button_type);
|
|
|
|
if (button_class)
|
|
|
|
gtk_style_context_add_class (style, button_class);
|
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
get_button_rect (button_type, fgeom, &button_rect);
|
2002-02-02 00:09:19 -05:00
|
|
|
|
2014-10-01 19:05:18 -04:00
|
|
|
button_rect.x /= scale;
|
|
|
|
button_rect.y /= scale;
|
|
|
|
button_rect.width /= scale;
|
|
|
|
button_rect.height /= scale;
|
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
if (button_states[button_type] == META_BUTTON_STATE_PRELIGHT)
|
2014-09-22 22:20:22 -04:00
|
|
|
gtk_style_context_set_state (style, state | GTK_STATE_PRELIGHT);
|
2014-09-23 19:09:09 -04:00
|
|
|
else if (button_states[button_type] == META_BUTTON_STATE_PRESSED)
|
2014-09-22 22:20:22 -04:00
|
|
|
gtk_style_context_set_state (style, state | GTK_STATE_ACTIVE);
|
|
|
|
else
|
|
|
|
gtk_style_context_set_state (style, state);
|
2002-01-28 02:30:44 -05:00
|
|
|
|
2010-09-23 11:35:41 -04:00
|
|
|
cairo_save (cr);
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2015-03-11 10:20:18 -04:00
|
|
|
if (button_rect.width > 0 && button_rect.height > 0)
|
2002-01-28 00:16:04 -05:00
|
|
|
{
|
2014-12-31 23:39:36 -05:00
|
|
|
cairo_surface_t *surface = NULL;
|
2014-09-22 22:20:22 -04:00
|
|
|
const char *icon_name = NULL;
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
gtk_render_background (style, cr,
|
|
|
|
button_rect.x, button_rect.y,
|
|
|
|
button_rect.width, button_rect.height);
|
|
|
|
gtk_render_frame (style, cr,
|
|
|
|
button_rect.x, button_rect.y,
|
|
|
|
button_rect.width, button_rect.height);
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
switch (button_type)
|
2006-04-18 13:18:53 -04:00
|
|
|
{
|
2014-09-22 22:20:22 -04:00
|
|
|
case META_BUTTON_TYPE_CLOSE:
|
|
|
|
icon_name = "window-close-symbolic";
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_MAXIMIZE:
|
|
|
|
if (flags & META_FRAME_MAXIMIZED)
|
|
|
|
icon_name = "window-restore-symbolic";
|
|
|
|
else
|
|
|
|
icon_name = "window-maximize-symbolic";
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_MINIMIZE:
|
|
|
|
icon_name = "window-minimize-symbolic";
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_MENU:
|
|
|
|
icon_name = "open-menu-symbolic";
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_APPMENU:
|
2014-12-31 23:39:36 -05:00
|
|
|
surface = cairo_surface_reference (mini_icon);
|
2014-09-22 22:20:22 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
icon_name = NULL;
|
|
|
|
break;
|
2006-04-18 13:18:53 -04:00
|
|
|
}
|
2002-01-28 00:16:04 -05:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
if (icon_name)
|
2006-04-18 13:18:53 -04:00
|
|
|
{
|
2014-09-22 22:20:22 -04:00
|
|
|
GtkIconTheme *theme = gtk_icon_theme_get_default ();
|
|
|
|
GtkIconInfo *info;
|
2014-12-31 23:39:36 -05:00
|
|
|
GdkPixbuf *pixbuf;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-10-01 19:05:18 -04:00
|
|
|
info = gtk_icon_theme_lookup_icon_for_scale (theme, icon_name,
|
|
|
|
layout->icon_size, scale, 0);
|
2014-09-22 22:20:22 -04:00
|
|
|
pixbuf = gtk_icon_info_load_symbolic_for_context (info, style, NULL, NULL);
|
2014-10-01 19:05:18 -04:00
|
|
|
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, NULL);
|
2014-09-22 22:20:22 -04:00
|
|
|
}
|
2010-09-23 11:35:41 -04:00
|
|
|
|
2014-12-31 23:39:36 -05:00
|
|
|
if (surface)
|
2014-09-22 22:20:22 -04:00
|
|
|
{
|
|
|
|
float width, height;
|
|
|
|
int x, y;
|
2010-09-23 11:35:41 -04:00
|
|
|
|
2014-10-01 19:05:18 -04:00
|
|
|
width = cairo_image_surface_get_width (surface) / scale;
|
|
|
|
height = cairo_image_surface_get_height (surface) / scale;
|
2014-09-22 22:20:22 -04:00
|
|
|
x = button_rect.x + (button_rect.width - width) / 2;
|
|
|
|
y = button_rect.y + (button_rect.height - height) / 2;
|
2010-09-23 11:35:41 -04:00
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
cairo_translate (cr, x, y);
|
|
|
|
cairo_scale (cr,
|
2014-09-25 03:04:31 -04:00
|
|
|
width / layout->icon_size,
|
|
|
|
height / layout->icon_size);
|
2014-12-31 23:39:36 -05:00
|
|
|
cairo_set_source_surface (cr, surface, 0, 0);
|
2014-09-22 22:20:22 -04:00
|
|
|
cairo_paint (cr);
|
2002-10-03 22:59:07 -04:00
|
|
|
|
2014-12-31 23:39:36 -05:00
|
|
|
cairo_surface_destroy (surface);
|
2002-06-12 17:12:53 -04:00
|
|
|
}
|
2002-01-28 00:16:04 -05:00
|
|
|
}
|
2014-09-22 22:20:22 -04:00
|
|
|
cairo_restore (cr);
|
2015-03-04 10:33:57 -05:00
|
|
|
if (button_class)
|
|
|
|
gtk_style_context_remove_class (style, button_class);
|
2015-10-15 21:21:14 -04:00
|
|
|
gtk_style_context_set_state (style, state);
|
2002-02-06 22:07:56 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-01 15:39:53 -04:00
|
|
|
/**
|
2014-09-25 18:26:01 -04:00
|
|
|
* meta_theme_get_default: (skip)
|
2010-09-01 15:39:53 -04:00
|
|
|
*
|
|
|
|
*/
|
2002-02-06 22:07:56 -05:00
|
|
|
MetaTheme*
|
2014-09-25 18:26:01 -04:00
|
|
|
meta_theme_get_default (void)
|
2002-02-06 22:07:56 -05:00
|
|
|
{
|
2014-09-25 18:26:01 -04:00
|
|
|
static MetaTheme *theme = NULL;
|
2014-09-25 03:04:31 -04:00
|
|
|
int frame_type;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
2014-09-25 18:26:01 -04:00
|
|
|
if (theme)
|
|
|
|
return theme;
|
|
|
|
|
|
|
|
theme = meta_theme_new ();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-25 11:58:20 -04:00
|
|
|
for (frame_type = 0; frame_type < META_FRAME_TYPE_LAST; frame_type++)
|
2002-02-06 22:07:56 -05:00
|
|
|
{
|
2014-09-25 03:04:31 -04:00
|
|
|
MetaFrameLayout *layout = meta_frame_layout_new ();
|
2014-09-25 11:58:20 -04:00
|
|
|
|
|
|
|
switch (frame_type)
|
|
|
|
{
|
|
|
|
case META_FRAME_TYPE_NORMAL:
|
|
|
|
case META_FRAME_TYPE_DIALOG:
|
|
|
|
case META_FRAME_TYPE_MODAL_DIALOG:
|
|
|
|
case META_FRAME_TYPE_ATTACHED:
|
|
|
|
break;
|
|
|
|
case META_FRAME_TYPE_MENU:
|
|
|
|
case META_FRAME_TYPE_UTILITY:
|
2014-09-25 03:04:31 -04:00
|
|
|
layout->title_scale = PANGO_SCALE_SMALL;
|
2014-09-25 11:58:20 -04:00
|
|
|
break;
|
|
|
|
case META_FRAME_TYPE_BORDER:
|
2014-09-25 03:04:31 -04:00
|
|
|
layout->has_title = FALSE;
|
|
|
|
layout->hide_buttons = TRUE;
|
2014-09-25 11:58:20 -04:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
theme->layouts[frame_type] = layout;
|
2002-02-06 22:07:56 -05:00
|
|
|
}
|
2014-09-25 18:26:01 -04:00
|
|
|
return theme;
|
2002-02-06 22:07:56 -05:00
|
|
|
}
|
|
|
|
|
2010-09-01 15:39:53 -04:00
|
|
|
/**
|
|
|
|
* meta_theme_new: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-06 22:07:56 -05:00
|
|
|
MetaTheme*
|
|
|
|
meta_theme_new (void)
|
|
|
|
{
|
2014-09-23 19:09:09 -04:00
|
|
|
return g_new0 (MetaTheme, 1);
|
2002-02-06 22:07:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_theme_free (MetaTheme *theme)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
g_return_if_fail (theme != NULL);
|
|
|
|
|
2006-04-18 13:18:53 -04:00
|
|
|
for (i = 0; i < META_FRAME_TYPE_LAST; i++)
|
2014-09-25 03:04:31 -04:00
|
|
|
if (theme->layouts[i])
|
2015-02-11 20:49:21 -05:00
|
|
|
meta_frame_layout_free (theme->layouts[i]);
|
2002-02-06 22:07:56 -05:00
|
|
|
|
|
|
|
DEBUG_FILL_STRUCT (theme);
|
|
|
|
g_free (theme);
|
|
|
|
}
|
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
MetaFrameLayout*
|
|
|
|
meta_theme_get_frame_layout (MetaTheme *theme,
|
2015-01-01 00:43:48 -05:00
|
|
|
MetaFrameType type)
|
2002-02-14 21:32:48 -05:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (type < META_FRAME_TYPE_LAST, NULL);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
return theme->layouts[type];
|
2002-02-14 21:32:48 -05:00
|
|
|
}
|
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
static GtkStyleContext *
|
|
|
|
create_style_context (GType widget_type,
|
|
|
|
GtkStyleContext *parent_style,
|
|
|
|
GtkCssProvider *provider,
|
2015-10-27 04:18:32 -04:00
|
|
|
const char *object_name,
|
2014-09-22 22:20:22 -04:00
|
|
|
const char *first_class,
|
|
|
|
...)
|
|
|
|
{
|
|
|
|
GtkStyleContext *style;
|
2016-04-07 21:13:15 -04:00
|
|
|
GtkStateFlags state;
|
2014-09-22 22:20:22 -04:00
|
|
|
GtkWidgetPath *path;
|
|
|
|
const char *name;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
style = gtk_style_context_new ();
|
2014-10-01 19:05:18 -04:00
|
|
|
gtk_style_context_set_scale (style, meta_theme_get_window_scaling_factor ());
|
2014-09-22 22:20:22 -04:00
|
|
|
gtk_style_context_set_parent (style, parent_style);
|
|
|
|
|
|
|
|
if (parent_style)
|
|
|
|
path = gtk_widget_path_copy (gtk_style_context_get_path (parent_style));
|
|
|
|
else
|
|
|
|
path = gtk_widget_path_new ();
|
|
|
|
|
|
|
|
gtk_widget_path_append_type (path, widget_type);
|
|
|
|
|
2015-10-27 04:18:32 -04:00
|
|
|
if (object_name)
|
|
|
|
gtk_widget_path_iter_set_object_name (path, -1, object_name);
|
|
|
|
|
2016-04-07 21:13:15 -04:00
|
|
|
state = gtk_style_context_get_state (style);
|
|
|
|
if (meta_get_locale_direction() == META_LOCALE_DIRECTION_RTL)
|
|
|
|
{
|
|
|
|
state |= GTK_STATE_FLAG_DIR_RTL;
|
|
|
|
state &= ~GTK_STATE_FLAG_DIR_LTR;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
state |= GTK_STATE_FLAG_DIR_LTR;
|
|
|
|
state &= ~GTK_STATE_FLAG_DIR_RTL;
|
|
|
|
}
|
|
|
|
gtk_style_context_set_state (style, state);
|
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
va_start (ap, first_class);
|
|
|
|
for (name = first_class; name; name = va_arg (ap, const char *))
|
|
|
|
gtk_widget_path_iter_add_class (path, -1, name);
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
gtk_style_context_set_path (style, path);
|
|
|
|
gtk_widget_path_unref (path);
|
|
|
|
|
|
|
|
gtk_style_context_add_provider (style, GTK_STYLE_PROVIDER (provider),
|
|
|
|
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
|
|
|
|
|
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
2014-09-23 18:07:21 -04:00
|
|
|
MetaStyleInfo *
|
|
|
|
meta_theme_create_style_info (GdkScreen *screen,
|
|
|
|
const gchar *variant)
|
2012-12-16 17:54:33 -05:00
|
|
|
{
|
2014-09-23 18:07:21 -04:00
|
|
|
MetaStyleInfo *style_info;
|
2014-09-22 22:20:22 -04:00
|
|
|
GtkCssProvider *provider;
|
2012-12-16 17:54:33 -05:00
|
|
|
char *theme_name;
|
|
|
|
|
|
|
|
g_object_get (gtk_settings_get_for_screen (screen),
|
|
|
|
"gtk-theme-name", &theme_name,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (theme_name && *theme_name)
|
2014-09-22 22:20:22 -04:00
|
|
|
provider = gtk_css_provider_get_named (theme_name, variant);
|
|
|
|
else
|
|
|
|
provider = gtk_css_provider_get_default ();
|
2013-01-10 16:15:38 -05:00
|
|
|
g_free (theme_name);
|
|
|
|
|
2014-09-22 22:20:22 -04:00
|
|
|
style_info = g_new0 (MetaStyleInfo, 1);
|
|
|
|
style_info->refcount = 1;
|
|
|
|
|
2016-01-18 13:31:20 -05:00
|
|
|
style_info->styles[META_STYLE_ELEMENT_WINDOW] =
|
2014-09-22 22:20:22 -04:00
|
|
|
create_style_context (META_TYPE_FRAMES,
|
|
|
|
NULL,
|
|
|
|
provider,
|
2016-01-18 13:31:20 -05:00
|
|
|
"window",
|
2014-09-22 22:20:22 -04:00
|
|
|
GTK_STYLE_CLASS_BACKGROUND,
|
|
|
|
"ssd",
|
|
|
|
NULL);
|
2016-01-18 13:31:20 -05:00
|
|
|
style_info->styles[META_STYLE_ELEMENT_FRAME] =
|
|
|
|
create_style_context (META_TYPE_FRAMES,
|
|
|
|
style_info->styles[META_STYLE_ELEMENT_WINDOW],
|
|
|
|
provider,
|
|
|
|
"decoration",
|
|
|
|
NULL);
|
2014-09-22 22:20:22 -04:00
|
|
|
style_info->styles[META_STYLE_ELEMENT_TITLEBAR] =
|
|
|
|
create_style_context (GTK_TYPE_HEADER_BAR,
|
|
|
|
style_info->styles[META_STYLE_ELEMENT_FRAME],
|
|
|
|
provider,
|
2015-11-06 16:01:45 -05:00
|
|
|
"headerbar",
|
2014-09-22 22:20:22 -04:00
|
|
|
GTK_STYLE_CLASS_TITLEBAR,
|
|
|
|
GTK_STYLE_CLASS_HORIZONTAL,
|
|
|
|
"default-decoration",
|
|
|
|
NULL);
|
|
|
|
style_info->styles[META_STYLE_ELEMENT_TITLE] =
|
|
|
|
create_style_context (GTK_TYPE_LABEL,
|
|
|
|
style_info->styles[META_STYLE_ELEMENT_TITLEBAR],
|
|
|
|
provider,
|
2015-11-06 16:01:45 -05:00
|
|
|
"label",
|
2014-09-22 22:20:22 -04:00
|
|
|
GTK_STYLE_CLASS_TITLE,
|
|
|
|
NULL);
|
|
|
|
style_info->styles[META_STYLE_ELEMENT_BUTTON] =
|
|
|
|
create_style_context (GTK_TYPE_BUTTON,
|
|
|
|
style_info->styles[META_STYLE_ELEMENT_TITLEBAR],
|
|
|
|
provider,
|
2015-11-06 16:01:45 -05:00
|
|
|
"button",
|
2014-09-22 22:20:22 -04:00
|
|
|
"titlebutton",
|
|
|
|
NULL);
|
|
|
|
style_info->styles[META_STYLE_ELEMENT_IMAGE] =
|
|
|
|
create_style_context (GTK_TYPE_IMAGE,
|
|
|
|
style_info->styles[META_STYLE_ELEMENT_BUTTON],
|
|
|
|
provider,
|
2015-11-06 16:01:45 -05:00
|
|
|
"image",
|
2014-09-22 22:20:22 -04:00
|
|
|
NULL);
|
2014-09-23 18:07:21 -04:00
|
|
|
return style_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaStyleInfo *
|
|
|
|
meta_style_info_ref (MetaStyleInfo *style_info)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (style_info != NULL, NULL);
|
|
|
|
g_return_val_if_fail (style_info->refcount > 0, NULL);
|
|
|
|
|
|
|
|
g_atomic_int_inc ((volatile int *)&style_info->refcount);
|
|
|
|
return style_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_style_info_unref (MetaStyleInfo *style_info)
|
|
|
|
{
|
|
|
|
g_return_if_fail (style_info != NULL);
|
|
|
|
g_return_if_fail (style_info->refcount > 0);
|
|
|
|
|
|
|
|
if (g_atomic_int_dec_and_test ((volatile int *)&style_info->refcount))
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < META_STYLE_ELEMENT_LAST; i++)
|
|
|
|
g_object_unref (style_info->styles[i]);
|
|
|
|
g_free (style_info);
|
|
|
|
}
|
2012-12-16 17:54:33 -05:00
|
|
|
}
|
|
|
|
|
2014-09-25 00:41:40 -04:00
|
|
|
static void
|
|
|
|
add_toplevel_class (GtkStyleContext *style,
|
|
|
|
const char *class_name)
|
|
|
|
{
|
|
|
|
if (gtk_style_context_get_parent (style))
|
|
|
|
{
|
|
|
|
GtkWidgetPath *path;
|
|
|
|
|
|
|
|
path = gtk_widget_path_copy (gtk_style_context_get_path (style));
|
|
|
|
gtk_widget_path_iter_add_class (path, 0, class_name);
|
|
|
|
gtk_style_context_set_path (style, path);
|
|
|
|
gtk_widget_path_unref (path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_style_context_add_class (style, class_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
remove_toplevel_class (GtkStyleContext *style,
|
|
|
|
const char *class_name)
|
|
|
|
{
|
|
|
|
if (gtk_style_context_get_parent (style))
|
|
|
|
{
|
|
|
|
GtkWidgetPath *path;
|
|
|
|
|
|
|
|
path = gtk_widget_path_copy (gtk_style_context_get_path (style));
|
|
|
|
gtk_widget_path_iter_remove_class (path, 0, class_name);
|
|
|
|
gtk_style_context_set_path (style, path);
|
|
|
|
gtk_widget_path_unref (path);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
gtk_style_context_remove_class (style, class_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_style_info_set_flags (MetaStyleInfo *style_info,
|
|
|
|
MetaFrameFlags flags)
|
|
|
|
{
|
|
|
|
GtkStyleContext *style;
|
|
|
|
const char *class_name = NULL;
|
|
|
|
gboolean backdrop;
|
|
|
|
GtkStateFlags state;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
backdrop = !(flags & META_FRAME_HAS_FOCUS);
|
|
|
|
if (flags & META_FRAME_IS_FLASHING)
|
|
|
|
backdrop = !backdrop;
|
|
|
|
|
|
|
|
if (flags & META_FRAME_MAXIMIZED)
|
|
|
|
class_name = "maximized";
|
|
|
|
else if (flags & META_FRAME_TILED_LEFT ||
|
|
|
|
flags & META_FRAME_TILED_RIGHT)
|
|
|
|
class_name = "tiled";
|
|
|
|
|
|
|
|
for (i = 0; i < META_STYLE_ELEMENT_LAST; i++)
|
|
|
|
{
|
|
|
|
style = style_info->styles[i];
|
|
|
|
|
|
|
|
state = gtk_style_context_get_state (style);
|
|
|
|
if (backdrop)
|
|
|
|
gtk_style_context_set_state (style, state | GTK_STATE_FLAG_BACKDROP);
|
|
|
|
else
|
|
|
|
gtk_style_context_set_state (style, state & ~GTK_STATE_FLAG_BACKDROP);
|
|
|
|
|
|
|
|
remove_toplevel_class (style, "maximized");
|
|
|
|
remove_toplevel_class (style, "tiled");
|
|
|
|
|
|
|
|
if (class_name)
|
|
|
|
add_toplevel_class (style, class_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-25 00:44:45 -04:00
|
|
|
PangoFontDescription*
|
|
|
|
meta_style_info_create_font_desc (MetaStyleInfo *style_info)
|
|
|
|
{
|
|
|
|
PangoFontDescription *font_desc;
|
|
|
|
const PangoFontDescription *override = meta_prefs_get_titlebar_font ();
|
2015-11-20 10:59:56 -05:00
|
|
|
GtkStyleContext *context = style_info->styles[META_STYLE_ELEMENT_TITLE];
|
2014-09-25 00:44:45 -04:00
|
|
|
|
2015-11-20 10:59:56 -05:00
|
|
|
gtk_style_context_get (context,
|
|
|
|
gtk_style_context_get_state (context),
|
2014-09-25 00:44:45 -04:00
|
|
|
"font", &font_desc, NULL);
|
|
|
|
|
|
|
|
if (override)
|
|
|
|
pango_font_description_merge (font_desc, override, TRUE);
|
|
|
|
|
|
|
|
return font_desc;
|
|
|
|
}
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
void
|
2012-12-16 17:31:00 -05:00
|
|
|
meta_theme_draw_frame (MetaTheme *theme,
|
2014-09-23 18:07:21 -04:00
|
|
|
MetaStyleInfo *style_info,
|
2012-12-16 17:31:00 -05:00
|
|
|
cairo_t *cr,
|
|
|
|
MetaFrameType type,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
int client_width,
|
|
|
|
int client_height,
|
|
|
|
PangoLayout *title_layout,
|
|
|
|
int text_height,
|
|
|
|
const MetaButtonLayout *button_layout,
|
|
|
|
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
2014-12-31 23:39:36 -05:00
|
|
|
cairo_surface_t *mini_icon)
|
2002-02-06 22:07:56 -05:00
|
|
|
{
|
|
|
|
MetaFrameGeometry fgeom;
|
2014-09-25 03:04:31 -04:00
|
|
|
MetaFrameLayout *layout;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
|
|
|
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
layout = theme->layouts[type];
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
/* Parser is not supposed to allow this currently */
|
2014-09-25 03:04:31 -04:00
|
|
|
if (layout == NULL)
|
2002-02-06 22:07:56 -05:00
|
|
|
return;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
meta_frame_layout_calc_geometry (layout,
|
2014-09-22 22:20:22 -04:00
|
|
|
style_info,
|
2002-02-06 22:07:56 -05:00
|
|
|
text_height,
|
|
|
|
flags,
|
|
|
|
client_width, client_height,
|
2002-10-03 22:28:57 -04:00
|
|
|
button_layout,
|
2011-09-14 19:06:02 -04:00
|
|
|
type,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
&fgeom,
|
2014-05-02 09:34:02 -04:00
|
|
|
theme);
|
2002-02-06 22:07:56 -05:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
meta_frame_layout_draw_with_style (layout,
|
|
|
|
style_info,
|
|
|
|
cr,
|
|
|
|
&fgeom,
|
|
|
|
title_layout,
|
|
|
|
flags,
|
|
|
|
button_states,
|
|
|
|
mini_icon);
|
2009-01-27 20:47:18 -05:00
|
|
|
}
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
void
|
2011-07-12 00:37:41 -04:00
|
|
|
meta_theme_get_frame_borders (MetaTheme *theme,
|
2014-09-23 19:09:09 -04:00
|
|
|
MetaStyleInfo *style_info,
|
|
|
|
MetaFrameType type,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
MetaFrameBorders *borders)
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
{
|
2014-09-25 03:04:31 -04:00
|
|
|
MetaFrameLayout *layout;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
layout = theme->layouts[type];
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
meta_frame_borders_clear (borders);
|
|
|
|
|
|
|
|
/* Parser is not supposed to allow this currently */
|
2014-09-25 03:04:31 -04:00
|
|
|
if (layout == NULL)
|
2014-09-23 19:09:09 -04:00
|
|
|
return;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
meta_frame_layout_sync_with_style (layout, style_info, flags);
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
meta_frame_layout_get_borders (layout,
|
2014-09-23 19:09:09 -04:00
|
|
|
text_height,
|
|
|
|
flags, type,
|
|
|
|
borders);
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
}
|
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
void
|
|
|
|
meta_theme_calc_geometry (MetaTheme *theme,
|
|
|
|
MetaStyleInfo *style_info,
|
|
|
|
MetaFrameType type,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
int client_width,
|
|
|
|
int client_height,
|
|
|
|
const MetaButtonLayout *button_layout,
|
|
|
|
MetaFrameGeometry *fgeom)
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
{
|
2014-09-25 03:04:31 -04:00
|
|
|
MetaFrameLayout *layout;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
layout = theme->layouts[type];
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
2014-09-23 19:09:09 -04:00
|
|
|
/* Parser is not supposed to allow this currently */
|
2014-09-25 03:04:31 -04:00
|
|
|
if (layout == NULL)
|
2014-09-23 19:09:09 -04:00
|
|
|
return;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
2014-09-25 03:04:31 -04:00
|
|
|
meta_frame_layout_calc_geometry (layout,
|
2014-09-23 19:09:09 -04:00
|
|
|
style_info,
|
|
|
|
text_height,
|
|
|
|
flags,
|
|
|
|
client_width, client_height,
|
|
|
|
button_layout,
|
|
|
|
type,
|
|
|
|
fgeom,
|
|
|
|
theme);
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
}
|
|
|
|
|
2009-02-07 18:55:39 -05:00
|
|
|
/**
|
2011-11-02 11:34:45 -04:00
|
|
|
* meta_pango_font_desc_get_text_height:
|
|
|
|
* @font_desc: the font
|
|
|
|
* @context: the context of the font
|
|
|
|
*
|
2009-02-07 18:55:39 -05:00
|
|
|
* Returns the height of the letters in a particular font.
|
|
|
|
*
|
2011-11-02 11:34:45 -04:00
|
|
|
* Returns: the height of the letters
|
2009-02-07 18:55:39 -05:00
|
|
|
*/
|
2002-02-06 22:07:56 -05:00
|
|
|
int
|
2004-01-10 12:16:07 -05:00
|
|
|
meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
|
2002-02-09 12:02:38 -05:00
|
|
|
PangoContext *context)
|
2002-01-27 21:09:12 -05:00
|
|
|
{
|
2002-02-06 22:07:56 -05:00
|
|
|
PangoFontMetrics *metrics;
|
|
|
|
PangoLanguage *lang;
|
|
|
|
int retval;
|
2002-02-13 17:50:57 -05:00
|
|
|
|
2002-02-09 12:02:38 -05:00
|
|
|
lang = pango_context_get_language (context);
|
2002-02-13 17:50:57 -05:00
|
|
|
metrics = pango_context_get_metrics (context, font_desc, lang);
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
retval = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
|
2002-02-06 22:07:56 -05:00
|
|
|
pango_font_metrics_get_descent (metrics));
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
pango_font_metrics_unref (metrics);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
return retval;
|
2002-01-27 21:09:12 -05:00
|
|
|
}
|
|
|
|
|
2010-11-11 16:14:07 -05:00
|
|
|
/**
|
|
|
|
* meta_frame_type_to_string:
|
2013-02-15 13:42:08 -05:00
|
|
|
* @type: a #MetaFrameType
|
2010-11-11 16:14:07 -05:00
|
|
|
*
|
|
|
|
* Converts a frame type enum value to the name string that would
|
|
|
|
* appear in the theme definition file.
|
|
|
|
*
|
|
|
|
* Return value: the string value
|
|
|
|
*/
|
2002-02-06 22:07:56 -05:00
|
|
|
const char*
|
|
|
|
meta_frame_type_to_string (MetaFrameType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_FRAME_TYPE_NORMAL:
|
|
|
|
return "normal";
|
|
|
|
case META_FRAME_TYPE_DIALOG:
|
|
|
|
return "dialog";
|
|
|
|
case META_FRAME_TYPE_MODAL_DIALOG:
|
|
|
|
return "modal_dialog";
|
|
|
|
case META_FRAME_TYPE_UTILITY:
|
|
|
|
return "utility";
|
|
|
|
case META_FRAME_TYPE_MENU:
|
|
|
|
return "menu";
|
2002-06-21 23:23:02 -04:00
|
|
|
case META_FRAME_TYPE_BORDER:
|
|
|
|
return "border";
|
2010-11-04 12:11:54 -04:00
|
|
|
case META_FRAME_TYPE_ATTACHED:
|
|
|
|
return "attached";
|
2002-02-06 22:07:56 -05:00
|
|
|
#if 0
|
|
|
|
case META_FRAME_TYPE_TOOLBAR:
|
|
|
|
return "toolbar";
|
|
|
|
#endif
|
|
|
|
case META_FRAME_TYPE_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "<unknown>";
|
|
|
|
}
|