2006-10-01 22:30:10 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2001-06-12 04:38:24 +00:00
|
|
|
/* Metacity window frame manager widget */
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/*
|
2001-06-12 04:38:24 +00:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
2003-11-24 18:09:47 +00:00
|
|
|
* Copyright (C) 2003 Red Hat, Inc.
|
2006-01-10 19:43:21 +00:00
|
|
|
* Copyright (C) 2005, 2006 Elijah Newren
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-06-12 04:38:24 +00: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.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-06-12 04:38:24 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-12 08:42:06 +07:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-06-12 04:38:24 +00:00
|
|
|
*/
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
#include <config.h>
|
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 16:56:47 +00:00
|
|
|
#include <math.h>
|
2011-03-18 13:56:30 +01:00
|
|
|
#include <string.h>
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/boxes.h>
|
2001-06-12 04:38:24 +00:00
|
|
|
#include "frames.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/util.h>
|
2001-06-18 06:11:53 +00:00
|
|
|
#include "core.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/theme.h>
|
|
|
|
#include <meta/prefs.h>
|
2007-05-25 14:36:12 +00:00
|
|
|
#include "ui.h"
|
2001-06-21 05:23:24 +00:00
|
|
|
|
2015-01-01 11:47:03 -08:00
|
|
|
#include "core/window-private.h"
|
|
|
|
#include "core/frame.h"
|
2015-01-01 11:50:57 -08:00
|
|
|
#include "x11/window-x11.h"
|
|
|
|
#include "x11/window-x11-private.h"
|
2015-01-01 11:47:03 -08:00
|
|
|
|
2010-09-24 13:30:40 +02:00
|
|
|
#include <cairo-xlib.h>
|
|
|
|
|
2001-06-21 05:23:24 +00:00
|
|
|
#define DEFAULT_INNER_BUTTON_BORDER 3
|
2001-06-12 04:38:24 +00:00
|
|
|
|
2010-12-09 14:52:16 +01:00
|
|
|
static void meta_frames_destroy (GtkWidget *object);
|
|
|
|
static void meta_frames_finalize (GObject *object);
|
|
|
|
static void meta_frames_style_updated (GtkWidget *widget);
|
2001-07-03 01:45:43 +00:00
|
|
|
|
2010-09-24 13:30:40 +02:00
|
|
|
static gboolean meta_frames_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr);
|
2001-06-12 04:38:24 +00:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
static void meta_ui_frame_attach_style (MetaUIFrame *frame);
|
2009-01-28 01:47:18 +00:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
static void meta_ui_frame_paint (MetaUIFrame *frame,
|
|
|
|
cairo_t *cr);
|
2001-06-15 04:33:21 +00:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
static void meta_ui_frame_calc_geometry (MetaUIFrame *frame,
|
|
|
|
MetaFrameGeometry *fgeom);
|
|
|
|
|
|
|
|
static void meta_ui_frame_update_prelit_control (MetaUIFrame *frame,
|
|
|
|
MetaFrameControl control);
|
2001-06-15 04:33:21 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
static void meta_frames_font_changed (MetaFrames *frames);
|
|
|
|
static void meta_frames_button_layout_changed (MetaFrames *frames);
|
|
|
|
|
2001-06-20 04:29:28 +00:00
|
|
|
|
|
|
|
static GdkRectangle* control_rect (MetaFrameControl control,
|
|
|
|
MetaFrameGeometry *fgeom);
|
2014-12-31 22:04:11 -08:00
|
|
|
static MetaFrameControl get_control (MetaUIFrame *frame,
|
2001-06-20 04:29:28 +00:00
|
|
|
int x,
|
|
|
|
int y);
|
|
|
|
|
2010-06-26 18:08:53 +03:00
|
|
|
G_DEFINE_TYPE (MetaFrames, meta_frames, GTK_TYPE_WINDOW);
|
2001-06-12 04:38:24 +00:00
|
|
|
|
2010-04-11 20:30:44 +02:00
|
|
|
static GObject *
|
|
|
|
meta_frames_constructor (GType gtype,
|
|
|
|
guint n_properties,
|
|
|
|
GObjectConstructParam *properties)
|
|
|
|
{
|
|
|
|
GObject *object;
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
|
2010-06-26 18:08:53 +03:00
|
|
|
gobject_class = G_OBJECT_CLASS (meta_frames_parent_class);
|
2010-04-11 20:30:44 +02:00
|
|
|
object = gobject_class->constructor (gtype, n_properties, properties);
|
|
|
|
|
|
|
|
g_object_set (object,
|
|
|
|
"type", GTK_WINDOW_POPUP,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
|
2001-06-12 04:38:24 +00:00
|
|
|
static void
|
|
|
|
meta_frames_class_init (MetaFramesClass *class)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GtkWidgetClass *widget_class;
|
|
|
|
|
|
|
|
gobject_class = G_OBJECT_CLASS (class);
|
|
|
|
widget_class = (GtkWidgetClass*) class;
|
|
|
|
|
2010-04-11 20:30:44 +02:00
|
|
|
gobject_class->constructor = meta_frames_constructor;
|
2001-06-12 04:38:24 +00:00
|
|
|
gobject_class->finalize = meta_frames_finalize;
|
2010-09-27 13:47:54 -04:00
|
|
|
|
|
|
|
widget_class->destroy = meta_frames_destroy;
|
2001-06-12 04:38:24 +00:00
|
|
|
|
2010-12-09 14:52:16 +01:00
|
|
|
widget_class->style_updated = meta_frames_style_updated;
|
2001-06-15 04:33:21 +00:00
|
|
|
|
2010-09-24 13:30:40 +02:00
|
|
|
widget_class->draw = meta_frames_draw;
|
2001-06-15 04:33:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
unsigned_long_equal (gconstpointer v1,
|
|
|
|
gconstpointer v2)
|
|
|
|
{
|
|
|
|
return *((const gulong*) v1) == *((const gulong*) v2);
|
|
|
|
}
|
2001-06-12 04:38:24 +00:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
static guint
|
|
|
|
unsigned_long_hash (gconstpointer v)
|
|
|
|
{
|
|
|
|
gulong val = * (const gulong *) v;
|
|
|
|
|
|
|
|
/* I'm not sure this works so well. */
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
#if GLIB_SIZEOF_LONG > 4
|
2001-06-15 04:33:21 +00:00
|
|
|
return (guint) (val ^ (val >> 32));
|
|
|
|
#else
|
|
|
|
return val;
|
|
|
|
#endif
|
2001-06-12 04:38:24 +00:00
|
|
|
}
|
|
|
|
|
2002-05-24 02:55:54 +00:00
|
|
|
static void
|
2002-10-04 02:28:57 +00:00
|
|
|
prefs_changed_callback (MetaPreference pref,
|
|
|
|
void *data)
|
2002-05-24 02:55:54 +00:00
|
|
|
{
|
2002-10-04 02:28:57 +00:00
|
|
|
switch (pref)
|
2002-05-24 02:55:54 +00:00
|
|
|
{
|
2002-10-04 02:28:57 +00:00
|
|
|
case META_PREF_TITLEBAR_FONT:
|
2002-05-24 02:55:54 +00:00
|
|
|
meta_frames_font_changed (META_FRAMES (data));
|
2002-10-04 02:28:57 +00:00
|
|
|
break;
|
|
|
|
case META_PREF_BUTTON_LAYOUT:
|
|
|
|
meta_frames_button_layout_changed (META_FRAMES (data));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2002-05-24 02:55:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-31 22:04:11 -08:00
|
|
|
static void
|
|
|
|
invalidate_whole_window (MetaUIFrame *frame)
|
|
|
|
{
|
|
|
|
gdk_window_invalidate_rect (frame->window, NULL, FALSE);
|
|
|
|
}
|
|
|
|
|
2014-09-24 00:07:21 +02:00
|
|
|
static MetaStyleInfo *
|
2011-03-18 13:56:30 +01:00
|
|
|
meta_frames_get_theme_variant (MetaFrames *frames,
|
|
|
|
const gchar *variant)
|
|
|
|
{
|
2014-09-24 00:07:21 +02:00
|
|
|
MetaStyleInfo *style_info;
|
2011-03-18 13:56:30 +01:00
|
|
|
|
2014-09-24 00:07:21 +02:00
|
|
|
style_info = g_hash_table_lookup (frames->style_variants, variant);
|
|
|
|
if (style_info == NULL)
|
2011-03-18 13:56:30 +01:00
|
|
|
{
|
2014-09-24 00:07:21 +02:00
|
|
|
style_info = meta_theme_create_style_info (gtk_widget_get_screen (GTK_WIDGET (frames)), variant);
|
|
|
|
g_hash_table_insert (frames->style_variants, g_strdup (variant), style_info);
|
2011-03-18 13:56:30 +01:00
|
|
|
}
|
|
|
|
|
2014-09-24 00:07:21 +02:00
|
|
|
return style_info;
|
2011-03-18 13:56:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_style_contexts (MetaFrames *frames)
|
|
|
|
{
|
2014-09-24 00:07:21 +02:00
|
|
|
MetaStyleInfo *style_info;
|
2011-03-18 13:56:30 +01:00
|
|
|
GList *variants, *variant;
|
2012-12-16 17:54:33 -05:00
|
|
|
GdkScreen *screen;
|
|
|
|
|
|
|
|
screen = gtk_widget_get_screen (GTK_WIDGET (frames));
|
2011-03-18 13:56:30 +01:00
|
|
|
|
|
|
|
if (frames->normal_style)
|
2014-09-24 00:07:21 +02:00
|
|
|
meta_style_info_unref (frames->normal_style);
|
|
|
|
frames->normal_style = meta_theme_create_style_info (screen, NULL);
|
2011-03-18 13:56:30 +01:00
|
|
|
|
|
|
|
variants = g_hash_table_get_keys (frames->style_variants);
|
|
|
|
for (variant = variants; variant; variant = variants->next)
|
|
|
|
{
|
2014-09-24 00:07:21 +02:00
|
|
|
style_info = meta_theme_create_style_info (screen, (char *)variant->data);
|
2011-03-18 13:56:30 +01:00
|
|
|
g_hash_table_insert (frames->style_variants,
|
2014-09-24 00:07:21 +02:00
|
|
|
g_strdup (variant->data), style_info);
|
2011-03-18 13:56:30 +01:00
|
|
|
}
|
|
|
|
g_list_free (variants);
|
|
|
|
}
|
|
|
|
|
2001-06-12 04:38:24 +00:00
|
|
|
static void
|
|
|
|
meta_frames_init (MetaFrames *frames)
|
|
|
|
{
|
2005-06-11 02:28:04 +00:00
|
|
|
frames->text_heights = g_hash_table_new (NULL, NULL);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
frames->frames = g_hash_table_new (unsigned_long_hash, unsigned_long_equal);
|
2001-06-20 04:29:28 +00:00
|
|
|
|
2011-03-18 13:56:30 +01:00
|
|
|
frames->style_variants = g_hash_table_new_full (g_str_hash, g_str_equal,
|
2014-09-24 00:07:21 +02:00
|
|
|
g_free, (GDestroyNotify)meta_style_info_unref);
|
2014-03-05 15:23:46 -05:00
|
|
|
|
2012-03-10 21:28:13 +01:00
|
|
|
update_style_contexts (frames);
|
2011-03-18 13:56:30 +01:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
meta_prefs_add_listener (prefs_changed_callback, frames);
|
2001-06-12 04:38:24 +00:00
|
|
|
}
|
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
static void
|
|
|
|
listify_func (gpointer key, gpointer value, gpointer data)
|
|
|
|
{
|
|
|
|
GSList **listp;
|
2001-06-12 04:38:24 +00:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
listp = data;
|
|
|
|
*listp = g_slist_prepend (*listp, value);
|
2001-06-12 04:38:24 +00:00
|
|
|
}
|
|
|
|
|
2010-09-27 13:47:54 -04:00
|
|
|
static void
|
|
|
|
meta_frames_destroy (GtkWidget *object)
|
2001-06-12 04:38:24 +00:00
|
|
|
{
|
2001-06-15 04:33:21 +00:00
|
|
|
GSList *winlist;
|
|
|
|
GSList *tmp;
|
2001-06-18 03:24:25 +00:00
|
|
|
MetaFrames *frames;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
frames = META_FRAMES (object);
|
2002-05-24 02:55:54 +00:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
winlist = NULL;
|
Replace while loops iterating over sequences with for loops. Also, replace
2006-04-19 Björn Lindqvist <bjourne@gmail.com>
* src/frames.c (struct CachedPixels, meta_frames_destroy,
invalidate_cache, generate_pixmap, populate_cache,
cached_pixels_draw, meta_frames_expose_event,
meta_frames_paint_to_drawable):
Replace while loops iterating over sequences with for loops. Also,
replace the attributes in the CachedPixels struct with a list of
four CachedFramePiece:s, this allows iteration over the four
pixmaps instead of treating each one separately. Fixes #338359.
2006-04-19 15:22:07 +00:00
|
|
|
g_hash_table_foreach (frames->frames, listify_func, &winlist);
|
2001-06-15 04:33:21 +00:00
|
|
|
|
|
|
|
/* Unmanage all frames */
|
Replace while loops iterating over sequences with for loops. Also, replace
2006-04-19 Björn Lindqvist <bjourne@gmail.com>
* src/frames.c (struct CachedPixels, meta_frames_destroy,
invalidate_cache, generate_pixmap, populate_cache,
cached_pixels_draw, meta_frames_expose_event,
meta_frames_paint_to_drawable):
Replace while loops iterating over sequences with for loops. Also,
replace the attributes in the CachedPixels struct with a list of
four CachedFramePiece:s, this allows iteration over the four
pixmaps instead of treating each one separately. Fixes #338359.
2006-04-19 15:22:07 +00:00
|
|
|
for (tmp = winlist; tmp != NULL; tmp = tmp->next)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2014-12-31 22:09:23 -08:00
|
|
|
MetaUIFrame *frame = tmp->data;
|
|
|
|
meta_ui_frame_unmanage (frame);
|
2001-06-15 04:33:21 +00:00
|
|
|
}
|
|
|
|
g_slist_free (winlist);
|
|
|
|
|
2011-07-12 13:07:15 -04:00
|
|
|
if (frames->normal_style)
|
|
|
|
{
|
2014-09-24 00:07:21 +02:00
|
|
|
meta_style_info_unref (frames->normal_style);
|
2011-07-12 13:07:15 -04:00
|
|
|
frames->normal_style = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (frames->style_variants)
|
|
|
|
{
|
|
|
|
g_hash_table_destroy (frames->style_variants);
|
|
|
|
frames->style_variants = NULL;
|
|
|
|
}
|
2011-03-18 13:56:30 +01:00
|
|
|
|
2010-09-27 13:47:54 -04:00
|
|
|
GTK_WIDGET_CLASS (meta_frames_parent_class)->destroy (object);
|
2001-06-18 03:24:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_frames_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
MetaFrames *frames;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-18 03:24:25 +00:00
|
|
|
frames = META_FRAMES (object);
|
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
meta_prefs_remove_listener (prefs_changed_callback, frames);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
g_hash_table_destroy (frames->text_heights);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
g_assert (g_hash_table_size (frames->frames) == 0);
|
|
|
|
g_hash_table_destroy (frames->frames);
|
|
|
|
|
2010-06-26 18:08:53 +03:00
|
|
|
G_OBJECT_CLASS (meta_frames_parent_class)->finalize (object);
|
2001-06-15 04:33:21 +00:00
|
|
|
}
|
|
|
|
|
2001-06-18 06:11:53 +00:00
|
|
|
static void
|
|
|
|
queue_recalc_func (gpointer key, gpointer value, gpointer data)
|
|
|
|
{
|
2014-12-31 22:04:11 -08:00
|
|
|
MetaUIFrame *frame = value;
|
2001-06-18 06:11:53 +00:00
|
|
|
|
2014-12-31 22:04:11 -08:00
|
|
|
invalidate_whole_window (frame);
|
2010-09-10 07:17:55 +00:00
|
|
|
meta_core_queue_frame_resize (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
2001-06-18 06:11:53 +00:00
|
|
|
frame->xwindow);
|
2001-06-21 06:08:35 +00:00
|
|
|
|
2015-01-09 16:35:30 -08:00
|
|
|
g_clear_object (&frame->text_layout);
|
2001-06-18 06:11:53 +00:00
|
|
|
}
|
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
static void
|
2002-05-24 02:55:54 +00:00
|
|
|
meta_frames_font_changed (MetaFrames *frames)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2002-02-09 17:02:38 +00:00
|
|
|
if (g_hash_table_size (frames->text_heights) > 0)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
2002-02-09 17:02:38 +00:00
|
|
|
g_hash_table_destroy (frames->text_heights);
|
2005-06-11 02:28:04 +00:00
|
|
|
frames->text_heights = g_hash_table_new (NULL, NULL);
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-18 06:11:53 +00:00
|
|
|
/* Queue a draw/resize on all frames */
|
|
|
|
g_hash_table_foreach (frames->frames,
|
|
|
|
queue_recalc_func, frames);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-05-24 02:55:54 +00:00
|
|
|
}
|
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
static void
|
|
|
|
queue_draw_func (gpointer key, gpointer value, gpointer data)
|
|
|
|
{
|
2014-12-31 22:04:11 -08:00
|
|
|
MetaUIFrame *frame = value;
|
|
|
|
invalidate_whole_window (frame);
|
2002-10-04 02:28:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_frames_button_layout_changed (MetaFrames *frames)
|
|
|
|
{
|
|
|
|
g_hash_table_foreach (frames->frames,
|
|
|
|
queue_draw_func, frames);
|
|
|
|
}
|
|
|
|
|
2009-01-28 01:47:18 +00:00
|
|
|
static void
|
|
|
|
reattach_style_func (gpointer key, gpointer value, gpointer data)
|
|
|
|
{
|
2014-12-31 22:04:11 -08:00
|
|
|
MetaUIFrame *frame = value;
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_attach_style (frame);
|
2009-01-28 01:47:18 +00:00
|
|
|
}
|
|
|
|
|
2002-05-24 02:55:54 +00:00
|
|
|
static void
|
2010-12-09 14:52:16 +01:00
|
|
|
meta_frames_style_updated (GtkWidget *widget)
|
2002-05-24 02:55:54 +00:00
|
|
|
{
|
|
|
|
MetaFrames *frames;
|
|
|
|
|
|
|
|
frames = META_FRAMES (widget);
|
|
|
|
|
|
|
|
meta_frames_font_changed (frames);
|
|
|
|
|
2011-03-18 13:56:30 +01:00
|
|
|
update_style_contexts (frames);
|
|
|
|
|
2014-12-31 22:04:11 -08:00
|
|
|
g_hash_table_foreach (frames->frames, reattach_style_func, NULL);
|
2009-01-28 01:47:18 +00:00
|
|
|
|
2014-09-26 00:30:29 +02:00
|
|
|
meta_retheme_all ();
|
|
|
|
|
2010-12-09 14:52:16 +01:00
|
|
|
GTK_WIDGET_CLASS (meta_frames_parent_class)->style_updated (widget);
|
2001-06-15 04:33:21 +00:00
|
|
|
}
|
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
static void
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_ensure_layout (MetaUIFrame *frame,
|
|
|
|
MetaFrameType type)
|
2002-02-09 17:02:38 +00:00
|
|
|
{
|
2014-12-31 22:04:11 -08:00
|
|
|
MetaFrames *frames = frame->frames;
|
2002-02-09 17:02:38 +00:00
|
|
|
GtkWidget *widget;
|
2014-09-25 09:04:31 +02:00
|
|
|
MetaFrameLayout *layout;
|
2002-02-09 17:02:38 +00:00
|
|
|
|
|
|
|
widget = GTK_WIDGET (frames);
|
2010-04-11 20:30:44 +02:00
|
|
|
|
|
|
|
g_return_if_fail (gtk_widget_get_realized (widget));
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-12-31 21:43:48 -08:00
|
|
|
layout = meta_theme_get_frame_layout (meta_theme_get_default (), type);
|
2002-02-15 02:32:48 +00:00
|
|
|
|
2014-09-25 09:04:31 +02:00
|
|
|
if (layout != frame->cache_layout)
|
2015-01-09 16:35:30 -08:00
|
|
|
g_clear_object (&frame->text_layout);
|
2002-02-15 02:32:48 +00:00
|
|
|
|
2014-09-25 09:04:31 +02:00
|
|
|
frame->cache_layout = layout;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-27 08:10:59 +02:00
|
|
|
if (frame->text_layout == NULL)
|
2002-02-09 17:02:38 +00:00
|
|
|
{
|
|
|
|
gpointer key, value;
|
|
|
|
PangoFontDescription *font_desc;
|
|
|
|
int size;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-27 08:10:59 +02:00
|
|
|
frame->text_layout = gtk_widget_create_pango_layout (widget, frame->title);
|
2007-06-03 06:26:29 +00:00
|
|
|
|
2014-09-27 08:10:59 +02:00
|
|
|
pango_layout_set_ellipsize (frame->text_layout, PANGO_ELLIPSIZE_END);
|
|
|
|
pango_layout_set_auto_dir (frame->text_layout, FALSE);
|
|
|
|
pango_layout_set_single_paragraph_mode (frame->text_layout, TRUE);
|
2012-08-30 15:38:40 -04:00
|
|
|
|
2014-09-25 06:44:45 +02:00
|
|
|
font_desc = meta_style_info_create_font_desc (frame->style_info);
|
2014-09-25 09:04:31 +02:00
|
|
|
meta_frame_layout_apply_scale (layout, font_desc);
|
2002-02-09 17:02:38 +00:00
|
|
|
|
|
|
|
size = pango_font_description_get_size (font_desc);
|
2005-06-11 02:28:04 +00:00
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
if (g_hash_table_lookup_extended (frames->text_heights,
|
2005-06-11 02:28:04 +00:00
|
|
|
GINT_TO_POINTER (size),
|
2002-02-09 17:02:38 +00:00
|
|
|
&key, &value))
|
|
|
|
{
|
|
|
|
frame->text_height = GPOINTER_TO_INT (value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
frame->text_height =
|
|
|
|
meta_pango_font_desc_get_text_height (font_desc,
|
|
|
|
gtk_widget_get_pango_context (widget));
|
|
|
|
|
2002-03-06 22:27:24 +00:00
|
|
|
g_hash_table_replace (frames->text_heights,
|
2005-06-11 02:28:04 +00:00
|
|
|
GINT_TO_POINTER (size),
|
2002-03-06 22:27:24 +00:00
|
|
|
GINT_TO_POINTER (frame->text_height));
|
2002-02-09 17:02:38 +00:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-27 08:10:59 +02:00
|
|
|
pango_layout_set_font_description (frame->text_layout,
|
changed all tabs to spaces. Removed and replaced with meta_core_get(). New
2007-06-06 Thomas Thurman <thomas@thurman.org.uk>
* frames.c, core.[ch]: changed all tabs to spaces.
* core.[ch] (meta_core_get_client_size, meta_core_window_has_frame,
meta_core_titlebar_is_onscreen, meta_core_get_client_xwindow,
meta_core_get_frame_flags, meta_core_get_frame_type,
meta_core_get_mini_icon, meta_core_get_icon, meta_core_get_position,
meta_core_get_size, meta_core_get_frame_workspace,
meta_core_get_frame_extents, meta_core_get_screen_size): Removed
and replaced with meta_core_get().
* core.[ch] (meta_core_get): New function.
* core.h (MetaCoreGetType): New enum.
* frames.c (meta_frames_ensure_layout, meta_frames_calc_geometry,
meta_frames_get_geometry, meta_frames_apply_shapes,
meta_frame_titlebar_event, meta_frames_button_press_event,
populate_cache, clip_to_screen, meta_frames_paint_to_drawable,
meta_frames_set_window_background, get_control): Replace use of
removed functions in ui.c with meta_core_get().
All this should make things a little faster. Closes #377495.
svn path=/trunk/; revision=3233
2007-06-07 03:31:17 +00:00
|
|
|
font_desc);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
pango_font_description_free (font_desc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
static void
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_calc_geometry (MetaUIFrame *frame,
|
|
|
|
MetaFrameGeometry *fgeom)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2001-06-18 06:11:53 +00:00
|
|
|
MetaFrameFlags flags;
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaFrameType type;
|
2002-10-04 02:28:57 +00:00
|
|
|
MetaButtonLayout button_layout;
|
2015-01-01 11:50:57 -08:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (frame->meta_window);
|
|
|
|
MetaWindowX11Private *priv = window_x11->priv;
|
2002-02-09 17:02:38 +00:00
|
|
|
|
2015-01-01 11:47:03 -08:00
|
|
|
flags = meta_frame_get_flags (frame->meta_window->frame);
|
2015-01-13 18:09:20 +01:00
|
|
|
type = meta_window_get_frame_type (frame->meta_window);
|
2015-01-01 11:47:03 -08:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_ensure_layout (frame, type);
|
2002-10-04 02:28:57 +00:00
|
|
|
|
|
|
|
meta_prefs_get_button_layout (&button_layout);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-26 00:26:01 +02:00
|
|
|
meta_theme_calc_geometry (meta_theme_get_default (),
|
2014-09-23 04:20:22 +02:00
|
|
|
frame->style_info,
|
2002-02-07 03:07:56 +00:00
|
|
|
type,
|
2002-02-09 17:02:38 +00:00
|
|
|
frame->text_height,
|
2002-02-07 03:07:56 +00:00
|
|
|
flags,
|
2015-01-01 11:50:57 -08:00
|
|
|
priv->client_rect.width,
|
|
|
|
priv->client_rect.height,
|
2002-10-04 02:28:57 +00:00
|
|
|
&button_layout,
|
2002-02-07 03:07:56 +00:00
|
|
|
fgeom);
|
2001-06-12 04:38:24 +00:00
|
|
|
}
|
|
|
|
|
2001-06-18 06:11:53 +00:00
|
|
|
MetaFrames*
|
2002-05-08 16:24:28 +00:00
|
|
|
meta_frames_new (int screen_number)
|
2001-06-18 06:11:53 +00:00
|
|
|
{
|
2002-05-08 16:24:28 +00:00
|
|
|
GdkScreen *screen;
|
2014-03-05 15:23:46 -05:00
|
|
|
MetaFrames *frames;
|
2002-05-08 16:24:28 +00:00
|
|
|
|
2002-06-25 07:08:18 +00:00
|
|
|
screen = gdk_display_get_screen (gdk_display_get_default (),
|
changed all tabs to spaces. Removed and replaced with meta_core_get(). New
2007-06-06 Thomas Thurman <thomas@thurman.org.uk>
* frames.c, core.[ch]: changed all tabs to spaces.
* core.[ch] (meta_core_get_client_size, meta_core_window_has_frame,
meta_core_titlebar_is_onscreen, meta_core_get_client_xwindow,
meta_core_get_frame_flags, meta_core_get_frame_type,
meta_core_get_mini_icon, meta_core_get_icon, meta_core_get_position,
meta_core_get_size, meta_core_get_frame_workspace,
meta_core_get_frame_extents, meta_core_get_screen_size): Removed
and replaced with meta_core_get().
* core.[ch] (meta_core_get): New function.
* core.h (MetaCoreGetType): New enum.
* frames.c (meta_frames_ensure_layout, meta_frames_calc_geometry,
meta_frames_get_geometry, meta_frames_apply_shapes,
meta_frame_titlebar_event, meta_frames_button_press_event,
populate_cache, clip_to_screen, meta_frames_paint_to_drawable,
meta_frames_set_window_background, get_control): Replace use of
removed functions in ui.c with meta_core_get().
All this should make things a little faster. Closes #377495.
svn path=/trunk/; revision=3233
2007-06-07 03:31:17 +00:00
|
|
|
screen_number);
|
2002-05-08 16:24:28 +00:00
|
|
|
|
2014-03-05 15:23:46 -05:00
|
|
|
frames = g_object_new (META_TYPE_FRAMES,
|
|
|
|
"screen", screen,
|
|
|
|
"type", GTK_WINDOW_POPUP,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Put the window at an arbitrary offscreen location; the one place
|
|
|
|
* it can't be is at -100x-100, since the meta_window_new() will
|
|
|
|
* mistake it for a window created via meta_create_offscreen_window()
|
|
|
|
* and ignore it, and we need this window to get frame-synchronization
|
|
|
|
* messages so that GTK+'s style change handling works.
|
|
|
|
*/
|
|
|
|
gtk_window_move (GTK_WINDOW (frames), -200, -200);
|
|
|
|
gtk_window_resize (GTK_WINDOW (frames), 1, 1);
|
|
|
|
|
|
|
|
return frames;
|
2001-06-18 06:11:53 +00:00
|
|
|
}
|
|
|
|
|
2015-01-02 09:19:17 -08:00
|
|
|
static const char *
|
2016-02-04 15:26:50 +02:00
|
|
|
get_global_theme_variant (MetaFrames *frames)
|
2015-01-02 09:19:17 -08:00
|
|
|
{
|
|
|
|
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (frames));
|
|
|
|
GtkSettings *settings = gtk_settings_get_for_screen (screen);
|
|
|
|
gboolean dark_theme_requested;
|
|
|
|
|
|
|
|
g_object_get (settings,
|
|
|
|
"gtk-application-prefer-dark-theme", &dark_theme_requested,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (dark_theme_requested)
|
|
|
|
return "dark";
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-01-28 01:47:18 +00:00
|
|
|
/* In order to use a style with a window it has to be attached to that
|
|
|
|
* window. Actually, the colormaps just have to match, but since GTK+
|
|
|
|
* already takes care of making sure that its cheap to attach a style
|
|
|
|
* to multiple windows with the same colormap, we can just go ahead
|
|
|
|
* and attach separately for each window.
|
|
|
|
*/
|
|
|
|
static void
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_attach_style (MetaUIFrame *frame)
|
2009-01-28 01:47:18 +00:00
|
|
|
{
|
2014-12-31 22:04:11 -08:00
|
|
|
MetaFrames *frames = frame->frames;
|
2015-01-01 11:50:57 -08:00
|
|
|
const char *variant;
|
2011-03-18 13:56:30 +01:00
|
|
|
|
2014-09-24 00:07:21 +02:00
|
|
|
if (frame->style_info != NULL)
|
|
|
|
meta_style_info_unref (frame->style_info);
|
2009-01-28 01:47:18 +00:00
|
|
|
|
2016-02-04 15:26:50 +02:00
|
|
|
variant = frame->meta_window->gtk_theme_variant;
|
|
|
|
if (variant == NULL)
|
|
|
|
variant = get_global_theme_variant (frame->frames);;
|
2011-03-18 13:56:30 +01:00
|
|
|
|
2016-02-04 15:23:16 +02:00
|
|
|
if (variant == NULL || *variant == '\0')
|
2014-09-24 00:07:21 +02:00
|
|
|
frame->style_info = meta_style_info_ref (frames->normal_style);
|
2011-03-18 13:56:30 +01:00
|
|
|
else
|
2014-09-24 00:07:21 +02:00
|
|
|
frame->style_info = meta_style_info_ref (meta_frames_get_theme_variant (frames,
|
|
|
|
variant));
|
2009-01-28 01:47:18 +00:00
|
|
|
}
|
|
|
|
|
2014-12-31 21:55:36 -08:00
|
|
|
MetaUIFrame *
|
2001-06-12 04:38:24 +00:00
|
|
|
meta_frames_manage_window (MetaFrames *frames,
|
2015-01-01 11:39:55 -08:00
|
|
|
MetaWindow *meta_window,
|
2003-08-16 16:32:10 +00:00
|
|
|
Window xwindow,
|
changed all tabs to spaces. Removed and replaced with meta_core_get(). New
2007-06-06 Thomas Thurman <thomas@thurman.org.uk>
* frames.c, core.[ch]: changed all tabs to spaces.
* core.[ch] (meta_core_get_client_size, meta_core_window_has_frame,
meta_core_titlebar_is_onscreen, meta_core_get_client_xwindow,
meta_core_get_frame_flags, meta_core_get_frame_type,
meta_core_get_mini_icon, meta_core_get_icon, meta_core_get_position,
meta_core_get_size, meta_core_get_frame_workspace,
meta_core_get_frame_extents, meta_core_get_screen_size): Removed
and replaced with meta_core_get().
* core.[ch] (meta_core_get): New function.
* core.h (MetaCoreGetType): New enum.
* frames.c (meta_frames_ensure_layout, meta_frames_calc_geometry,
meta_frames_get_geometry, meta_frames_apply_shapes,
meta_frame_titlebar_event, meta_frames_button_press_event,
populate_cache, clip_to_screen, meta_frames_paint_to_drawable,
meta_frames_set_window_background, get_control): Replace use of
removed functions in ui.c with meta_core_get().
All this should make things a little faster. Closes #377495.
svn path=/trunk/; revision=3233
2007-06-07 03:31:17 +00:00
|
|
|
GdkWindow *window)
|
2001-06-12 04:38:24 +00:00
|
|
|
{
|
2001-06-18 06:11:53 +00:00
|
|
|
MetaUIFrame *frame;
|
2001-06-15 04:33:21 +00:00
|
|
|
|
2003-08-16 16:32:10 +00:00
|
|
|
g_assert (window);
|
|
|
|
|
2001-06-18 06:11:53 +00:00
|
|
|
frame = g_new (MetaUIFrame, 1);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-12-31 22:04:11 -08:00
|
|
|
frame->frames = frames;
|
2003-08-16 16:32:10 +00:00
|
|
|
frame->window = window;
|
2001-06-12 04:38:24 +00:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
gdk_window_set_user_data (frame->window, frames);
|
2004-08-27 02:17:49 +00:00
|
|
|
|
2014-09-24 00:07:21 +02:00
|
|
|
frame->style_info = NULL;
|
2009-01-28 01:47:18 +00:00
|
|
|
|
2001-07-04 02:10:54 +00:00
|
|
|
/* Don't set event mask here, it's in frame.c */
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
frame->xwindow = xwindow;
|
2015-01-01 11:39:55 -08:00
|
|
|
frame->meta_window = meta_window;
|
2014-09-25 09:04:31 +02:00
|
|
|
frame->cache_layout = NULL;
|
2014-09-27 08:10:59 +02:00
|
|
|
frame->text_layout = NULL;
|
2002-02-09 17:02:38 +00:00
|
|
|
frame->text_height = -1;
|
|
|
|
frame->title = NULL;
|
2002-02-12 05:01:22 +00:00
|
|
|
frame->prelit_control = META_FRAME_CONTROL_NONE;
|
2014-09-29 19:57:55 -06:00
|
|
|
frame->button_state = META_BUTTON_STATE_NORMAL;
|
2007-04-23 22:44:01 +00:00
|
|
|
|
2010-09-10 07:17:55 +00:00
|
|
|
meta_core_grab_buttons (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), frame->xwindow);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-03-06 22:27:24 +00:00
|
|
|
g_hash_table_replace (frames->frames, &frame->xwindow, frame);
|
2014-12-31 21:55:36 -08:00
|
|
|
|
|
|
|
return frame;
|
2001-06-15 04:33:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-12-31 22:09:23 -08:00
|
|
|
meta_ui_frame_unmanage (MetaUIFrame *frame)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2014-12-31 22:09:23 -08:00
|
|
|
MetaFrames *frames = frame->frames;
|
2002-05-07 14:42:47 +00:00
|
|
|
|
2014-12-31 22:42:31 -08:00
|
|
|
/* restore the cursor */
|
|
|
|
meta_core_set_screen_cursor (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
|
|
|
frame->xwindow,
|
|
|
|
META_CURSOR_DEFAULT);
|
2001-06-30 23:17:52 +00:00
|
|
|
|
2014-12-31 22:42:31 -08:00
|
|
|
gdk_window_set_user_data (frame->window, NULL);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-12-31 22:42:31 -08:00
|
|
|
g_hash_table_remove (frames->frames, &frame->xwindow);
|
2009-01-28 01:47:18 +00:00
|
|
|
|
2014-12-31 22:42:31 -08:00
|
|
|
meta_style_info_unref (frame->style_info);
|
2001-06-15 04:33:21 +00:00
|
|
|
|
2014-12-31 22:42:31 -08:00
|
|
|
gdk_window_destroy (frame->window);
|
2002-02-09 17:02:38 +00:00
|
|
|
|
2014-12-31 22:42:31 -08:00
|
|
|
if (frame->text_layout)
|
|
|
|
g_object_unref (G_OBJECT (frame->text_layout));
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-12-31 22:42:31 -08:00
|
|
|
g_free (frame->title);
|
|
|
|
|
|
|
|
g_free (frame);
|
2001-06-15 04:33:21 +00:00
|
|
|
}
|
|
|
|
|
2014-12-31 22:09:23 -08:00
|
|
|
void
|
2014-12-31 22:04:11 -08:00
|
|
|
meta_ui_frame_get_borders (MetaUIFrame *frame,
|
2013-04-11 16:55:41 +01:00
|
|
|
MetaFrameBorders *borders)
|
2001-06-18 03:24:25 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaFrameFlags flags;
|
|
|
|
MetaFrameType type;
|
2001-06-18 03:24:25 +00:00
|
|
|
|
2015-01-01 11:47:03 -08:00
|
|
|
flags = meta_frame_get_flags (frame->meta_window->frame);
|
2015-01-13 18:09:20 +01:00
|
|
|
type = meta_window_get_frame_type (frame->meta_window);
|
2001-06-18 03:24:25 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
2002-02-09 17:02:38 +00:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_ensure_layout (frame, type);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-01-19 03:50:03 +00:00
|
|
|
/* We can't get the full geometry, because that depends on
|
|
|
|
* the client window size and probably we're being called
|
|
|
|
* by the core move/resize code to decide on the client
|
|
|
|
* window size
|
|
|
|
*/
|
2014-09-26 00:26:01 +02:00
|
|
|
meta_theme_get_frame_borders (meta_theme_get_default (),
|
2014-09-23 04:20:22 +02:00
|
|
|
frame->style_info,
|
2002-02-07 03:07:56 +00:00
|
|
|
type,
|
2002-02-09 17:02:38 +00:00
|
|
|
frame->text_height,
|
2002-02-07 03:07:56 +00:00
|
|
|
flags,
|
2011-07-12 00:37:41 -04:00
|
|
|
borders);
|
2001-06-18 03:24:25 +00:00
|
|
|
}
|
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
/* The client rectangle surrounds client window; it subtracts both
|
|
|
|
* the visible and invisible borders from the frame window's size.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
get_client_rect (MetaFrameGeometry *fgeom,
|
|
|
|
cairo_rectangle_int_t *rect)
|
|
|
|
{
|
|
|
|
rect->x = fgeom->borders.total.left;
|
|
|
|
rect->y = fgeom->borders.total.top;
|
2015-01-01 11:04:11 -08:00
|
|
|
rect->width = fgeom->width - fgeom->borders.total.right - rect->x;
|
|
|
|
rect->height = fgeom->height - fgeom->borders.total.bottom - rect->y;
|
2011-07-12 01:16:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The visible frame rectangle surrounds the visible portion of the
|
|
|
|
* frame window; it subtracts only the invisible borders from the frame
|
|
|
|
* window's size.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
get_visible_frame_rect (MetaFrameGeometry *fgeom,
|
|
|
|
cairo_rectangle_int_t *rect)
|
|
|
|
{
|
|
|
|
rect->x = fgeom->borders.invisible.left;
|
|
|
|
rect->y = fgeom->borders.invisible.top;
|
2015-01-01 10:33:27 -08:00
|
|
|
rect->width = fgeom->width - fgeom->borders.invisible.right - rect->x;
|
|
|
|
rect->height = fgeom->height - fgeom->borders.invisible.bottom - rect->y;
|
2011-07-12 01:16:48 -04:00
|
|
|
}
|
|
|
|
|
2011-03-22 15:36:12 -04:00
|
|
|
static cairo_region_t *
|
2014-12-31 22:04:11 -08:00
|
|
|
get_visible_region (MetaUIFrame *frame,
|
2015-01-01 10:33:27 -08:00
|
|
|
MetaFrameGeometry *fgeom)
|
2002-05-31 00:02:54 +00:00
|
|
|
{
|
2011-03-20 16:26:27 -04:00
|
|
|
cairo_region_t *corners_region;
|
2011-07-12 01:16:48 -04:00
|
|
|
cairo_region_t *visible_region;
|
2011-03-22 15:36:12 -04:00
|
|
|
cairo_rectangle_int_t rect;
|
2011-07-12 01:16:48 -04:00
|
|
|
cairo_rectangle_int_t frame_rect;
|
2002-05-31 00:02:54 +00:00
|
|
|
|
2011-03-20 16:26:27 -04:00
|
|
|
corners_region = cairo_region_create ();
|
2015-01-01 10:33:27 -08:00
|
|
|
get_visible_frame_rect (fgeom, &frame_rect);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-03-22 15:36:12 -04:00
|
|
|
if (fgeom->top_left_corner_rounded_radius != 0)
|
2002-05-31 00:02:54 +00:00
|
|
|
{
|
2011-03-22 15:36:12 -04:00
|
|
|
const int corner = fgeom->top_left_corner_rounded_radius;
|
2014-10-02 00:45:13 +02:00
|
|
|
const float radius = corner;
|
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 16:56:47 +00:00
|
|
|
int i;
|
2002-05-31 00:02:54 +00:00
|
|
|
|
2007-03-21 02:22:10 +00:00
|
|
|
for (i=0; i<corner; i++)
|
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 16:56:47 +00:00
|
|
|
{
|
2007-03-21 02:22:10 +00:00
|
|
|
const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
|
2011-07-12 01:16:48 -04:00
|
|
|
rect.x = frame_rect.x;
|
|
|
|
rect.y = frame_rect.y + i;
|
2011-03-20 16:26:27 -04:00
|
|
|
rect.width = width;
|
|
|
|
rect.height = 1;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-03-20 16:26:27 -04:00
|
|
|
cairo_region_union_rectangle (corners_region, &rect);
|
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 16:56:47 +00:00
|
|
|
}
|
2002-05-31 00:02:54 +00:00
|
|
|
}
|
|
|
|
|
2011-03-22 15:36:12 -04:00
|
|
|
if (fgeom->top_right_corner_rounded_radius != 0)
|
2002-05-31 00:02:54 +00:00
|
|
|
{
|
2011-03-22 15:36:12 -04:00
|
|
|
const int corner = fgeom->top_right_corner_rounded_radius;
|
2014-10-02 00:45:13 +02:00
|
|
|
const float radius = corner;
|
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 16:56:47 +00:00
|
|
|
int i;
|
2002-05-31 00:02:54 +00:00
|
|
|
|
2007-03-21 02:22:10 +00:00
|
|
|
for (i=0; i<corner; i++)
|
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 16:56:47 +00:00
|
|
|
{
|
2007-03-21 02:22:10 +00:00
|
|
|
const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
|
2011-07-12 01:16:48 -04:00
|
|
|
rect.x = frame_rect.x + frame_rect.width - width;
|
|
|
|
rect.y = frame_rect.y + i;
|
2011-03-20 16:26:27 -04:00
|
|
|
rect.width = width;
|
|
|
|
rect.height = 1;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-03-20 16:26:27 -04:00
|
|
|
cairo_region_union_rectangle (corners_region, &rect);
|
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 16:56:47 +00:00
|
|
|
}
|
2002-05-31 00:02:54 +00:00
|
|
|
}
|
|
|
|
|
2011-03-22 15:36:12 -04:00
|
|
|
if (fgeom->bottom_left_corner_rounded_radius != 0)
|
2002-05-31 00:02:54 +00:00
|
|
|
{
|
2011-03-22 15:36:12 -04:00
|
|
|
const int corner = fgeom->bottom_left_corner_rounded_radius;
|
2014-10-02 00:45:13 +02:00
|
|
|
const float radius = corner;
|
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 16:56:47 +00:00
|
|
|
int i;
|
|
|
|
|
2007-03-21 02:22:10 +00:00
|
|
|
for (i=0; i<corner; i++)
|
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 16:56:47 +00:00
|
|
|
{
|
2007-03-21 02:22:10 +00:00
|
|
|
const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
|
2011-07-12 01:16:48 -04:00
|
|
|
rect.x = frame_rect.x;
|
|
|
|
rect.y = frame_rect.y + frame_rect.height - i - 1;
|
2011-03-20 16:26:27 -04:00
|
|
|
rect.width = width;
|
|
|
|
rect.height = 1;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-03-20 16:26:27 -04:00
|
|
|
cairo_region_union_rectangle (corners_region, &rect);
|
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 16:56:47 +00:00
|
|
|
}
|
2002-05-31 00:02:54 +00:00
|
|
|
}
|
|
|
|
|
2011-03-22 15:36:12 -04:00
|
|
|
if (fgeom->bottom_right_corner_rounded_radius != 0)
|
2002-05-31 00:02:54 +00:00
|
|
|
{
|
2011-03-22 15:36:12 -04:00
|
|
|
const int corner = fgeom->bottom_right_corner_rounded_radius;
|
2014-10-02 00:45:13 +02:00
|
|
|
const float radius = corner;
|
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 16:56:47 +00:00
|
|
|
int i;
|
|
|
|
|
2007-03-21 02:22:10 +00:00
|
|
|
for (i=0; i<corner; i++)
|
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 16:56:47 +00:00
|
|
|
{
|
2007-03-21 02:22:10 +00:00
|
|
|
const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
|
2011-08-29 21:32:47 -04:00
|
|
|
rect.x = frame_rect.x + frame_rect.width - width;
|
2011-07-12 01:16:48 -04:00
|
|
|
rect.y = frame_rect.y + frame_rect.height - i - 1;
|
2011-03-20 16:26:27 -04:00
|
|
|
rect.width = width;
|
|
|
|
rect.height = 1;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-03-20 16:26:27 -04:00
|
|
|
cairo_region_union_rectangle (corners_region, &rect);
|
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 16:56:47 +00:00
|
|
|
}
|
2002-05-31 00:02:54 +00:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
visible_region = cairo_region_create_rectangle (&frame_rect);
|
|
|
|
cairo_region_subtract (visible_region, corners_region);
|
2011-03-20 16:26:27 -04:00
|
|
|
cairo_region_destroy (corners_region);
|
2011-03-22 15:36:12 -04:00
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
return visible_region;
|
2011-03-22 15:36:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
cairo_region_t *
|
2015-01-01 10:33:27 -08:00
|
|
|
meta_ui_frame_get_bounds (MetaUIFrame *frame)
|
2011-03-22 15:36:12 -04:00
|
|
|
{
|
|
|
|
MetaFrameGeometry fgeom;
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_calc_geometry (frame, &fgeom);
|
2015-01-01 10:33:27 -08:00
|
|
|
return get_visible_region (frame, &fgeom);
|
2011-03-22 15:36:12 -04:00
|
|
|
}
|
|
|
|
|
2003-08-16 16:32:10 +00:00
|
|
|
void
|
2014-12-31 22:09:23 -08:00
|
|
|
meta_ui_frame_move_resize (MetaUIFrame *frame,
|
|
|
|
int x, int y, int width, int height)
|
2003-08-16 16:32:10 +00:00
|
|
|
{
|
2010-09-20 20:19:57 +02:00
|
|
|
int old_width, old_height;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2010-09-24 13:30:40 +02:00
|
|
|
old_width = gdk_window_get_width (frame->window);
|
|
|
|
old_height = gdk_window_get_height (frame->window);
|
2003-08-16 16:32:10 +00:00
|
|
|
|
|
|
|
gdk_window_move_resize (frame->window, x, y, width, height);
|
|
|
|
|
|
|
|
if (old_width != width || old_height != height)
|
2014-12-31 22:04:11 -08:00
|
|
|
invalidate_whole_window (frame);
|
2003-08-16 16:32:10 +00:00
|
|
|
}
|
|
|
|
|
2001-06-18 03:24:25 +00:00
|
|
|
void
|
2014-12-31 22:09:23 -08:00
|
|
|
meta_ui_frame_queue_draw (MetaUIFrame *frame)
|
2001-06-18 03:24:25 +00:00
|
|
|
{
|
2014-12-31 22:04:11 -08:00
|
|
|
invalidate_whole_window (frame);
|
2001-06-18 03:24:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-12-31 22:09:23 -08:00
|
|
|
meta_ui_frame_set_title (MetaUIFrame *frame,
|
|
|
|
const char *title)
|
2001-06-18 03:24:25 +00:00
|
|
|
{
|
2002-02-09 17:02:38 +00:00
|
|
|
g_free (frame->title);
|
|
|
|
frame->title = g_strdup (title);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-09-27 08:10:59 +02:00
|
|
|
g_clear_object (&frame->text_layout);
|
2005-06-26 21:58:37 +00:00
|
|
|
|
2014-12-31 22:04:11 -08:00
|
|
|
invalidate_whole_window (frame);
|
2001-06-18 03:24:25 +00:00
|
|
|
}
|
|
|
|
|
2011-03-20 23:10:49 +01:00
|
|
|
void
|
2014-12-31 22:09:23 -08:00
|
|
|
meta_ui_frame_update_style (MetaUIFrame *frame)
|
2011-03-20 23:10:49 +01:00
|
|
|
{
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_attach_style (frame);
|
2014-12-31 22:04:11 -08:00
|
|
|
invalidate_whole_window (frame);
|
2011-03-20 23:10:49 +01:00
|
|
|
}
|
|
|
|
|
2001-06-21 03:40:14 +00:00
|
|
|
static void
|
2014-12-31 22:04:11 -08:00
|
|
|
redraw_control (MetaUIFrame *frame,
|
2001-06-21 03:40:14 +00:00
|
|
|
MetaFrameControl control)
|
|
|
|
{
|
|
|
|
MetaFrameGeometry fgeom;
|
|
|
|
GdkRectangle *rect;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_calc_geometry (frame, &fgeom);
|
2001-06-21 03:40:14 +00:00
|
|
|
|
|
|
|
rect = control_rect (control, &fgeom);
|
|
|
|
|
|
|
|
gdk_window_invalidate_rect (frame->window, rect, FALSE);
|
|
|
|
}
|
|
|
|
|
2007-02-17 21:15:59 +00:00
|
|
|
static gboolean
|
2015-01-19 11:27:27 -08:00
|
|
|
meta_frame_titlebar_event (MetaUIFrame *frame,
|
|
|
|
ClutterButtonEvent *event,
|
|
|
|
int action)
|
2007-02-17 21:15:59 +00:00
|
|
|
{
|
|
|
|
MetaFrameFlags flags;
|
2010-09-10 07:17:55 +00:00
|
|
|
Display *display;
|
|
|
|
|
|
|
|
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2015-01-01 11:47:03 -08:00
|
|
|
flags = meta_frame_get_flags (frame->meta_window->frame);
|
|
|
|
|
2007-02-17 21:15:59 +00:00
|
|
|
switch (action)
|
|
|
|
{
|
2011-06-24 18:14:15 +02:00
|
|
|
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_SHADE:
|
2007-02-17 21:15:59 +00:00
|
|
|
{
|
|
|
|
if (flags & META_FRAME_ALLOWS_SHADE)
|
|
|
|
{
|
|
|
|
if (flags & META_FRAME_SHADED)
|
2015-01-01 12:00:06 -08:00
|
|
|
meta_window_unshade (frame->meta_window, event->time);
|
2007-02-17 21:15:59 +00:00
|
|
|
else
|
2015-01-01 12:00:06 -08:00
|
|
|
meta_window_shade (frame->meta_window, event->time);
|
2007-02-17 21:15:59 +00:00
|
|
|
}
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
break;
|
|
|
|
|
2011-06-24 18:14:15 +02:00
|
|
|
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE:
|
2007-02-17 21:15:59 +00:00
|
|
|
{
|
|
|
|
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
|
|
|
|
{
|
2010-09-10 07:17:55 +00:00
|
|
|
meta_core_toggle_maximize (display, frame->xwindow);
|
2007-02-17 21:15:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-06-24 18:14:15 +02:00
|
|
|
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_HORIZONTALLY:
|
2008-03-03 01:58:54 +00:00
|
|
|
{
|
|
|
|
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
|
|
|
|
{
|
2010-09-10 07:17:55 +00:00
|
|
|
meta_core_toggle_maximize_horizontally (display, frame->xwindow);
|
2008-03-03 01:58:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-06-24 18:14:15 +02:00
|
|
|
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE_VERTICALLY:
|
2008-03-03 01:58:54 +00:00
|
|
|
{
|
|
|
|
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
|
|
|
|
{
|
2010-09-10 07:17:55 +00:00
|
|
|
meta_core_toggle_maximize_vertically (display, frame->xwindow);
|
2008-03-03 01:58:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-06-24 18:14:15 +02:00
|
|
|
case G_DESKTOP_TITLEBAR_ACTION_MINIMIZE:
|
2007-02-17 21:15:59 +00:00
|
|
|
{
|
|
|
|
if (flags & META_FRAME_ALLOWS_MINIMIZE)
|
2015-01-01 12:00:06 -08:00
|
|
|
meta_window_minimize (frame->meta_window);
|
2007-02-17 21:15:59 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-06-24 18:14:15 +02:00
|
|
|
case G_DESKTOP_TITLEBAR_ACTION_NONE:
|
2007-02-17 21:15:59 +00:00
|
|
|
/* Yaay, a sane user that doesn't use that other weird crap! */
|
|
|
|
break;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-06-24 18:14:15 +02:00
|
|
|
case G_DESKTOP_TITLEBAR_ACTION_LOWER:
|
2010-09-10 07:17:55 +00:00
|
|
|
meta_core_user_lower_and_unfocus (display,
|
2007-02-17 21:34:00 +00:00
|
|
|
frame->xwindow,
|
|
|
|
event->time);
|
|
|
|
break;
|
|
|
|
|
2011-06-24 18:14:15 +02:00
|
|
|
case G_DESKTOP_TITLEBAR_ACTION_MENU:
|
2010-09-10 07:17:55 +00:00
|
|
|
meta_core_show_window_menu (display,
|
2007-02-17 21:34:00 +00:00
|
|
|
frame->xwindow,
|
2014-05-23 23:14:51 +02:00
|
|
|
META_WINDOW_MENU_WM,
|
2015-01-19 11:27:27 -08:00
|
|
|
event->x,
|
|
|
|
event->y,
|
2007-02-17 21:34:00 +00:00
|
|
|
event->time);
|
|
|
|
break;
|
2007-02-17 21:15:59 +00:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-02-17 21:15:59 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2015-01-19 11:27:27 -08:00
|
|
|
meta_frame_double_click_event (MetaUIFrame *frame,
|
|
|
|
ClutterButtonEvent *event)
|
2007-02-17 21:15:59 +00:00
|
|
|
{
|
|
|
|
int action = meta_prefs_get_action_double_click_titlebar ();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-02-17 21:15:59 +00:00
|
|
|
return meta_frame_titlebar_event (frame, event, action);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2015-01-19 11:27:27 -08:00
|
|
|
meta_frame_middle_click_event (MetaUIFrame *frame,
|
|
|
|
ClutterButtonEvent *event)
|
2007-02-17 21:15:59 +00:00
|
|
|
{
|
2007-03-10 01:15:14 +00:00
|
|
|
int action = meta_prefs_get_action_middle_click_titlebar();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-03-10 01:15:14 +00:00
|
|
|
return meta_frame_titlebar_event (frame, event, action);
|
2007-02-17 21:15:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2015-01-19 11:27:27 -08:00
|
|
|
meta_frame_right_click_event (MetaUIFrame *frame,
|
|
|
|
ClutterButtonEvent *event)
|
2007-02-17 21:15:59 +00:00
|
|
|
{
|
2007-03-10 01:15:14 +00:00
|
|
|
int action = meta_prefs_get_action_right_click_titlebar();
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-03-10 01:15:14 +00:00
|
|
|
return meta_frame_titlebar_event (frame, event, action);
|
2007-02-17 21:15:59 +00:00
|
|
|
}
|
|
|
|
|
frames: Keep information about the ongoing grab operation, and retry if needed.
When a passive touch grab is rejected over the frame, management is punted to
the frame itself, and pointer events emulated, but the attempt to transfer the
grab from the GDK connection to the Clutter one fails with AlreadyGrabbed, and
will fail until the Clutter connection receives the XI_TouchEnd resulting from
XIRejectTouch, gotten after the XI_ButtonPress on the GDK connection.
In order to bypass this shortcoming, store the current grab operation on the
frame as long as the button is pressed, so it is retried once on the next
motion event happening during frame dragging, that will have a recent enough
timestamp to succeed. If no grabbing succeeded, the current grab operation
data will be reset on GDK_BUTTON_RELEASE.
2014-06-19 23:26:15 +02:00
|
|
|
static gboolean
|
2014-12-31 22:04:11 -08:00
|
|
|
meta_frames_try_grab_op (MetaUIFrame *frame,
|
frames: Keep information about the ongoing grab operation, and retry if needed.
When a passive touch grab is rejected over the frame, management is punted to
the frame itself, and pointer events emulated, but the attempt to transfer the
grab from the GDK connection to the Clutter one fails with AlreadyGrabbed, and
will fail until the Clutter connection receives the XI_TouchEnd resulting from
XIRejectTouch, gotten after the XI_ButtonPress on the GDK connection.
In order to bypass this shortcoming, store the current grab operation on the
frame as long as the button is pressed, so it is retried once on the next
motion event happening during frame dragging, that will have a recent enough
timestamp to succeed. If no grabbing succeeded, the current grab operation
data will be reset on GDK_BUTTON_RELEASE.
2014-06-19 23:26:15 +02:00
|
|
|
MetaGrabOp op,
|
|
|
|
gdouble grab_x,
|
|
|
|
gdouble grab_y,
|
|
|
|
guint32 time)
|
|
|
|
{
|
2014-12-31 22:04:11 -08:00
|
|
|
MetaFrames *frames = frame->frames;
|
frames: Keep information about the ongoing grab operation, and retry if needed.
When a passive touch grab is rejected over the frame, management is punted to
the frame itself, and pointer events emulated, but the attempt to transfer the
grab from the GDK connection to the Clutter one fails with AlreadyGrabbed, and
will fail until the Clutter connection receives the XI_TouchEnd resulting from
XIRejectTouch, gotten after the XI_ButtonPress on the GDK connection.
In order to bypass this shortcoming, store the current grab operation on the
frame as long as the button is pressed, so it is retried once on the next
motion event happening during frame dragging, that will have a recent enough
timestamp to succeed. If no grabbing succeeded, the current grab operation
data will be reset on GDK_BUTTON_RELEASE.
2014-06-19 23:26:15 +02:00
|
|
|
Display *display;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
|
|
|
ret = meta_core_begin_grab_op (display,
|
|
|
|
frame->xwindow,
|
|
|
|
op,
|
|
|
|
FALSE,
|
|
|
|
TRUE,
|
|
|
|
frame->grab_button,
|
|
|
|
0,
|
|
|
|
time,
|
|
|
|
grab_x, grab_y);
|
|
|
|
if (!ret)
|
|
|
|
{
|
|
|
|
frames->current_grab_op = op;
|
|
|
|
frames->grab_frame = frame;
|
|
|
|
frames->grab_x = grab_x;
|
|
|
|
frames->grab_y = grab_y;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_frames_retry_grab_op (MetaFrames *frames,
|
|
|
|
guint time)
|
|
|
|
{
|
|
|
|
Display *display;
|
|
|
|
MetaGrabOp op;
|
|
|
|
|
|
|
|
if (frames->current_grab_op == META_GRAB_OP_NONE)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
op = frames->current_grab_op;
|
|
|
|
frames->current_grab_op = META_GRAB_OP_NONE;
|
|
|
|
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
|
|
|
|
|
|
|
return meta_core_begin_grab_op (display,
|
|
|
|
frames->grab_frame->xwindow,
|
|
|
|
op,
|
|
|
|
FALSE,
|
|
|
|
TRUE,
|
|
|
|
frames->grab_frame->grab_button,
|
|
|
|
0,
|
|
|
|
time,
|
|
|
|
frames->grab_x,
|
|
|
|
frames->grab_y);
|
|
|
|
}
|
|
|
|
|
2015-03-08 20:19:50 -07:00
|
|
|
static MetaGrabOp
|
|
|
|
grab_op_from_resize_control (MetaFrameControl control)
|
|
|
|
{
|
|
|
|
switch (control)
|
|
|
|
{
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SE:
|
|
|
|
return META_GRAB_OP_RESIZING_SE;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_S:
|
|
|
|
return META_GRAB_OP_RESIZING_S;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SW:
|
|
|
|
return META_GRAB_OP_RESIZING_SW;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NE:
|
|
|
|
return META_GRAB_OP_RESIZING_NE;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_N:
|
|
|
|
return META_GRAB_OP_RESIZING_N;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NW:
|
|
|
|
return META_GRAB_OP_RESIZING_NW;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_E:
|
|
|
|
return META_GRAB_OP_RESIZING_E;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_W:
|
|
|
|
return META_GRAB_OP_RESIZING_W;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-03 01:45:43 +00:00
|
|
|
static gboolean
|
2015-03-08 20:13:13 -07:00
|
|
|
meta_frame_left_click_event (MetaUIFrame *frame,
|
|
|
|
ClutterButtonEvent *event)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2015-03-08 20:18:13 -07:00
|
|
|
Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
|
|
|
MetaFrameControl control = get_control (frame, event->x, event->y);
|
|
|
|
|
|
|
|
switch (control)
|
2001-06-21 03:40:14 +00:00
|
|
|
{
|
2015-03-08 20:18:13 -07:00
|
|
|
case META_FRAME_CONTROL_MAXIMIZE:
|
|
|
|
case META_FRAME_CONTROL_UNMAXIMIZE:
|
|
|
|
case META_FRAME_CONTROL_MINIMIZE:
|
|
|
|
case META_FRAME_CONTROL_DELETE:
|
|
|
|
case META_FRAME_CONTROL_MENU:
|
|
|
|
case META_FRAME_CONTROL_APPMENU:
|
2014-04-24 13:04:15 -04:00
|
|
|
frame->grab_button = event->button;
|
|
|
|
frame->button_state = META_BUTTON_STATE_PRESSED;
|
2006-08-07 21:04:44 +00:00
|
|
|
frame->prelit_control = control;
|
2014-12-31 22:04:11 -08:00
|
|
|
redraw_control (frame, control);
|
2001-06-21 05:23:24 +00:00
|
|
|
|
2014-05-23 23:14:51 +02:00
|
|
|
if (control == META_FRAME_CONTROL_MENU ||
|
|
|
|
control == META_FRAME_CONTROL_APPMENU)
|
2014-05-22 08:35:11 -04:00
|
|
|
{
|
|
|
|
MetaFrameGeometry fgeom;
|
|
|
|
GdkRectangle *rect;
|
2014-05-31 00:52:06 +02:00
|
|
|
MetaRectangle root_rect;
|
2014-05-23 23:14:51 +02:00
|
|
|
MetaWindowMenuType menu;
|
2014-05-31 00:52:06 +02:00
|
|
|
int win_x, win_y;
|
2014-05-22 08:35:11 -04:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_calc_geometry (frame, &fgeom);
|
2014-05-22 08:35:11 -04:00
|
|
|
|
2014-05-23 23:14:51 +02:00
|
|
|
rect = control_rect (control, &fgeom);
|
2014-05-22 08:35:11 -04:00
|
|
|
|
2015-01-19 11:27:27 -08:00
|
|
|
gdk_window_get_position (frame->window, &win_x, &win_y);
|
2014-05-22 08:35:11 -04:00
|
|
|
|
2014-05-31 00:52:06 +02:00
|
|
|
root_rect.x = win_x + rect->x;
|
|
|
|
root_rect.y = win_y + rect->y;
|
|
|
|
root_rect.width = rect->width;
|
|
|
|
root_rect.height = rect->height;
|
2014-05-22 08:35:11 -04:00
|
|
|
|
2014-05-23 23:14:51 +02:00
|
|
|
menu = control == META_FRAME_CONTROL_MENU ? META_WINDOW_MENU_WM
|
2015-03-08 20:18:13 -07:00
|
|
|
: META_WINDOW_MENU_APP;
|
2014-05-23 23:14:51 +02:00
|
|
|
|
2014-05-31 02:22:21 +02:00
|
|
|
/* if the compositor takes a grab for showing the menu, we will
|
|
|
|
* get a LeaveNotify event we want to ignore, to keep the pressed
|
|
|
|
* button state while the menu is open
|
|
|
|
*/
|
|
|
|
frame->maybe_ignore_leave_notify = TRUE;
|
2014-05-31 00:52:06 +02:00
|
|
|
meta_core_show_window_menu_for_rect (display,
|
|
|
|
frame->xwindow,
|
|
|
|
menu,
|
|
|
|
&root_rect,
|
|
|
|
event->time);
|
2014-05-22 08:35:11 -04:00
|
|
|
}
|
2015-01-19 11:27:27 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_frames_try_grab_op (frame, META_GRAB_OP_FRAME_BUTTON,
|
|
|
|
event->x, event->y,
|
|
|
|
event->time);
|
|
|
|
}
|
2015-03-08 20:13:13 -07:00
|
|
|
|
|
|
|
return TRUE;
|
2015-03-08 20:18:13 -07:00
|
|
|
case META_FRAME_CONTROL_RESIZE_SE:
|
|
|
|
case META_FRAME_CONTROL_RESIZE_S:
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SW:
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NE:
|
|
|
|
case META_FRAME_CONTROL_RESIZE_N:
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NW:
|
|
|
|
case META_FRAME_CONTROL_RESIZE_E:
|
|
|
|
case META_FRAME_CONTROL_RESIZE_W:
|
2015-03-08 20:19:50 -07:00
|
|
|
meta_frames_try_grab_op (frame,
|
|
|
|
grab_op_from_resize_control (control),
|
|
|
|
event->x, event->y,
|
|
|
|
event->time);
|
2015-03-08 20:13:13 -07:00
|
|
|
|
|
|
|
return TRUE;
|
2015-03-08 20:18:13 -07:00
|
|
|
case META_FRAME_CONTROL_TITLE:
|
|
|
|
{
|
|
|
|
MetaFrameFlags flags = meta_frame_get_flags (frame->meta_window->frame);
|
changed all tabs to spaces. Removed and replaced with meta_core_get(). New
2007-06-06 Thomas Thurman <thomas@thurman.org.uk>
* frames.c, core.[ch]: changed all tabs to spaces.
* core.[ch] (meta_core_get_client_size, meta_core_window_has_frame,
meta_core_titlebar_is_onscreen, meta_core_get_client_xwindow,
meta_core_get_frame_flags, meta_core_get_frame_type,
meta_core_get_mini_icon, meta_core_get_icon, meta_core_get_position,
meta_core_get_size, meta_core_get_frame_workspace,
meta_core_get_frame_extents, meta_core_get_screen_size): Removed
and replaced with meta_core_get().
* core.[ch] (meta_core_get): New function.
* core.h (MetaCoreGetType): New enum.
* frames.c (meta_frames_ensure_layout, meta_frames_calc_geometry,
meta_frames_get_geometry, meta_frames_apply_shapes,
meta_frame_titlebar_event, meta_frames_button_press_event,
populate_cache, clip_to_screen, meta_frames_paint_to_drawable,
meta_frames_set_window_background, get_control): Replace use of
removed functions in ui.c with meta_core_get().
All this should make things a little faster. Closes #377495.
svn path=/trunk/; revision=3233
2007-06-07 03:31:17 +00:00
|
|
|
|
2015-03-08 20:18:13 -07:00
|
|
|
if (flags & META_FRAME_ALLOWS_MOVE)
|
|
|
|
{
|
|
|
|
meta_frames_try_grab_op (frame,
|
|
|
|
META_GRAB_OP_MOVING,
|
|
|
|
event->x, event->y,
|
|
|
|
event->time);
|
|
|
|
}
|
|
|
|
}
|
2015-03-08 20:13:13 -07:00
|
|
|
|
|
|
|
return TRUE;
|
2015-07-03 11:28:00 +02:00
|
|
|
case META_FRAME_CONTROL_NONE:
|
|
|
|
/* We can get this for example when trying to resize window
|
|
|
|
* that cannot be resized (e. g. it is maximized and the theme
|
|
|
|
* currently used has borders for maximized windows), see #751884 */
|
|
|
|
return FALSE;
|
2015-03-08 20:18:13 -07:00
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2001-06-20 04:29:28 +00:00
|
|
|
}
|
2015-03-08 20:13:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
handle_button_press_event (MetaUIFrame *frame,
|
|
|
|
ClutterButtonEvent *event)
|
|
|
|
{
|
|
|
|
MetaFrameControl control;
|
|
|
|
Display *display;
|
|
|
|
|
|
|
|
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
|
|
|
|
|
|
|
control = get_control (frame, event->x, event->y);
|
|
|
|
|
2015-10-20 17:50:40 +02:00
|
|
|
/* don't do the rest of this if on client area */
|
|
|
|
if (control == META_FRAME_CONTROL_CLIENT_AREA)
|
|
|
|
return FALSE; /* not on the frame, just passed through from client */
|
|
|
|
|
2015-03-08 20:13:13 -07:00
|
|
|
if (event->button == 1 &&
|
|
|
|
!(control == META_FRAME_CONTROL_MINIMIZE ||
|
|
|
|
control == META_FRAME_CONTROL_DELETE ||
|
|
|
|
control == META_FRAME_CONTROL_MAXIMIZE))
|
2002-10-11 18:42:40 +00:00
|
|
|
{
|
2015-03-08 20:13:13 -07:00
|
|
|
meta_topic (META_DEBUG_FOCUS,
|
|
|
|
"Focusing window with frame 0x%lx due to button 1 press\n",
|
|
|
|
frame->xwindow);
|
|
|
|
meta_window_focus (frame->meta_window, event->time);
|
2002-10-11 18:42:40 +00:00
|
|
|
}
|
2015-03-08 20:13:13 -07:00
|
|
|
|
|
|
|
/* We want to shade even if we have a GrabOp, since we'll have a move grab
|
|
|
|
* if we double click the titlebar.
|
|
|
|
*/
|
|
|
|
if (control == META_FRAME_CONTROL_TITLE &&
|
|
|
|
event->button == 1 &&
|
|
|
|
event->click_count == 2)
|
2001-07-04 02:10:54 +00:00
|
|
|
{
|
2015-03-08 20:13:13 -07:00
|
|
|
meta_core_end_grab_op (display, event->time);
|
|
|
|
return meta_frame_double_click_event (frame, event);
|
2001-07-04 02:10:54 +00:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2015-03-08 20:13:13 -07:00
|
|
|
if (meta_core_get_grab_op (display) != META_GRAB_OP_NONE)
|
|
|
|
return FALSE; /* already up to something */
|
|
|
|
|
|
|
|
frame->grab_button = event->button;
|
|
|
|
|
|
|
|
switch (event->button)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
return meta_frame_left_click_event (frame, event);
|
|
|
|
case 2:
|
|
|
|
return meta_frame_middle_click_event (frame, event);
|
|
|
|
case 3:
|
|
|
|
return meta_frame_right_click_event (frame, event);
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
2001-06-15 04:33:21 +00:00
|
|
|
}
|
|
|
|
|
2001-07-03 01:45:43 +00:00
|
|
|
static gboolean
|
2015-01-19 11:27:27 -08:00
|
|
|
handle_button_release_event (MetaUIFrame *frame,
|
|
|
|
ClutterButtonEvent *event)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2015-01-19 11:27:27 -08:00
|
|
|
Display *display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2016-06-23 15:38:03 +02:00
|
|
|
frame->frames->current_grab_op = META_GRAB_OP_NONE;
|
2015-01-19 11:27:27 -08:00
|
|
|
meta_core_end_grab_op (display, event->time);
|
2001-06-15 04:33:21 +00:00
|
|
|
|
2001-07-26 03:14:45 +00:00
|
|
|
/* We only handle the releases we handled the presses for (things
|
|
|
|
* involving frame controls). Window ops that don't require a
|
|
|
|
* frame are handled in the Xlib part of the code, display.c/window.c
|
|
|
|
*/
|
2015-01-19 11:27:27 -08:00
|
|
|
if (((int) event->button) == frame->grab_button &&
|
2014-04-24 13:04:15 -04:00
|
|
|
frame->button_state == META_BUTTON_STATE_PRESSED)
|
2001-06-20 04:29:28 +00:00
|
|
|
{
|
2014-04-24 13:04:15 -04:00
|
|
|
switch (frame->prelit_control)
|
2001-06-20 04:29:28 +00:00
|
|
|
{
|
2014-04-24 13:04:15 -04:00
|
|
|
case META_FRAME_CONTROL_MINIMIZE:
|
2015-01-01 12:00:06 -08:00
|
|
|
meta_window_minimize (frame->meta_window);
|
2001-06-21 03:40:14 +00:00
|
|
|
break;
|
2014-04-24 13:04:15 -04:00
|
|
|
case META_FRAME_CONTROL_MAXIMIZE:
|
|
|
|
/* Focus the window on the maximize */
|
2015-01-01 12:00:06 -08:00
|
|
|
meta_window_focus (frame->meta_window, event->time);
|
|
|
|
if (meta_prefs_get_raise_on_click ())
|
|
|
|
meta_window_raise (frame->meta_window);
|
|
|
|
meta_window_maximize (frame->meta_window, META_MAXIMIZE_BOTH);
|
2001-09-11 03:54:54 +00:00
|
|
|
break;
|
2014-04-24 13:04:15 -04:00
|
|
|
case META_FRAME_CONTROL_UNMAXIMIZE:
|
2015-01-01 12:00:06 -08:00
|
|
|
if (meta_prefs_get_raise_on_click ())
|
|
|
|
meta_window_raise (frame->meta_window);
|
|
|
|
meta_window_unmaximize (frame->meta_window, META_MAXIMIZE_BOTH);
|
2001-06-21 03:40:14 +00:00
|
|
|
break;
|
2014-04-24 13:04:15 -04:00
|
|
|
case META_FRAME_CONTROL_DELETE:
|
2015-01-01 12:00:06 -08:00
|
|
|
meta_window_delete (frame->meta_window, event->time);
|
2001-06-21 03:40:14 +00:00
|
|
|
break;
|
2001-07-26 03:14:45 +00:00
|
|
|
default:
|
2001-06-20 04:29:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-07-26 03:14:45 +00:00
|
|
|
|
2006-08-07 21:04:44 +00:00
|
|
|
/* Update the prelit control regardless of what button the mouse
|
|
|
|
* was released over; needed so that the new button can become
|
|
|
|
* prelit so to let the user know that it can now be pressed.
|
|
|
|
* :)
|
|
|
|
*/
|
2014-12-31 22:04:11 -08:00
|
|
|
MetaFrameControl control = get_control (frame, event->x, event->y);
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_update_prelit_control (frame, control);
|
2001-06-20 04:29:28 +00:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-02-12 05:01:22 +00:00
|
|
|
static void
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_update_prelit_control (MetaUIFrame *frame,
|
|
|
|
MetaFrameControl control)
|
2002-02-12 05:01:22 +00:00
|
|
|
{
|
|
|
|
MetaFrameControl old_control;
|
2002-08-20 20:18:18 +00:00
|
|
|
MetaCursor cursor;
|
2002-02-12 05:01:22 +00:00
|
|
|
|
2006-01-20 22:03:56 +00:00
|
|
|
meta_verbose ("Updating prelit control from %u to %u\n",
|
2002-08-20 20:18:18 +00:00
|
|
|
frame->prelit_control, control);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-08-20 20:18:18 +00:00
|
|
|
cursor = META_CURSOR_DEFAULT;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-08-20 20:18:18 +00:00
|
|
|
switch (control)
|
|
|
|
{
|
|
|
|
case META_FRAME_CONTROL_CLIENT_AREA:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_NONE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_TITLE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_DELETE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_MENU:
|
|
|
|
break;
|
2014-05-23 23:14:51 +02:00
|
|
|
case META_FRAME_CONTROL_APPMENU:
|
|
|
|
break;
|
2002-08-20 20:18:18 +00:00
|
|
|
case META_FRAME_CONTROL_MINIMIZE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_MAXIMIZE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_UNMAXIMIZE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SE:
|
|
|
|
cursor = META_CURSOR_SE_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_S:
|
|
|
|
cursor = META_CURSOR_SOUTH_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SW:
|
|
|
|
cursor = META_CURSOR_SW_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_N:
|
|
|
|
cursor = META_CURSOR_NORTH_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NE:
|
|
|
|
cursor = META_CURSOR_NE_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NW:
|
|
|
|
cursor = META_CURSOR_NW_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_W:
|
|
|
|
cursor = META_CURSOR_WEST_RESIZE;
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_E:
|
|
|
|
cursor = META_CURSOR_EAST_RESIZE;
|
|
|
|
break;
|
2014-05-02 09:34:02 -04:00
|
|
|
}
|
2002-08-20 20:18:18 +00:00
|
|
|
|
|
|
|
/* set/unset the prelight cursor */
|
2010-09-10 07:17:55 +00:00
|
|
|
meta_core_set_screen_cursor (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
2002-08-20 20:18:18 +00:00
|
|
|
frame->xwindow,
|
2014-05-02 09:34:02 -04:00
|
|
|
cursor);
|
2002-09-04 02:21:26 +00:00
|
|
|
|
|
|
|
switch (control)
|
|
|
|
{
|
|
|
|
case META_FRAME_CONTROL_MENU:
|
2014-05-23 23:14:51 +02:00
|
|
|
case META_FRAME_CONTROL_APPMENU:
|
2002-09-04 02:21:26 +00:00
|
|
|
case META_FRAME_CONTROL_MINIMIZE:
|
|
|
|
case META_FRAME_CONTROL_MAXIMIZE:
|
|
|
|
case META_FRAME_CONTROL_DELETE:
|
|
|
|
case META_FRAME_CONTROL_UNMAXIMIZE:
|
|
|
|
/* leave control set */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Only prelight buttons */
|
|
|
|
control = META_FRAME_CONTROL_NONE;
|
|
|
|
break;
|
2014-05-02 09:34:02 -04:00
|
|
|
}
|
2002-02-12 05:01:22 +00:00
|
|
|
|
2014-05-31 03:30:58 +02:00
|
|
|
if (control == frame->prelit_control &&
|
|
|
|
frame->button_state == META_BUTTON_STATE_PRELIGHT)
|
2002-02-12 05:01:22 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* Save the old control so we can unprelight it */
|
|
|
|
old_control = frame->prelit_control;
|
|
|
|
|
2014-04-24 13:04:15 -04:00
|
|
|
frame->button_state = META_BUTTON_STATE_PRELIGHT;
|
2002-02-12 05:01:22 +00:00
|
|
|
frame->prelit_control = control;
|
|
|
|
|
2014-12-31 22:04:11 -08:00
|
|
|
redraw_control (frame, old_control);
|
|
|
|
redraw_control (frame, control);
|
2002-02-12 05:01:22 +00:00
|
|
|
}
|
|
|
|
|
2001-07-03 01:45:43 +00:00
|
|
|
static gboolean
|
2015-01-19 11:27:27 -08:00
|
|
|
handle_motion_notify_event (MetaUIFrame *frame,
|
|
|
|
ClutterMotionEvent *event)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2015-01-19 11:27:27 -08:00
|
|
|
MetaFrames *frames = frame->frames;
|
2014-04-24 13:04:15 -04:00
|
|
|
MetaFrameControl control;
|
|
|
|
|
2014-12-31 22:04:11 -08:00
|
|
|
control = get_control (frame, event->x, event->y);
|
2001-07-26 03:14:45 +00:00
|
|
|
|
2014-04-24 13:04:15 -04:00
|
|
|
if (frame->button_state == META_BUTTON_STATE_PRESSED)
|
|
|
|
{
|
|
|
|
/* If the user leaves the frame button, set the state
|
|
|
|
* back to normal and redraw. */
|
|
|
|
if (frame->prelit_control != control)
|
|
|
|
{
|
|
|
|
frame->button_state = META_BUTTON_STATE_NORMAL;
|
2014-12-31 22:04:11 -08:00
|
|
|
redraw_control (frame, frame->prelit_control);
|
2014-04-24 13:04:15 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Update prelit control and cursor */
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_update_prelit_control (frame, control);
|
2001-06-20 04:29:28 +00:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2015-01-19 11:27:27 -08:00
|
|
|
if ((event->modifier_state & CLUTTER_BUTTON1_MASK) &&
|
frames: Keep information about the ongoing grab operation, and retry if needed.
When a passive touch grab is rejected over the frame, management is punted to
the frame itself, and pointer events emulated, but the attempt to transfer the
grab from the GDK connection to the Clutter one fails with AlreadyGrabbed, and
will fail until the Clutter connection receives the XI_TouchEnd resulting from
XIRejectTouch, gotten after the XI_ButtonPress on the GDK connection.
In order to bypass this shortcoming, store the current grab operation on the
frame as long as the button is pressed, so it is retried once on the next
motion event happening during frame dragging, that will have a recent enough
timestamp to succeed. If no grabbing succeeded, the current grab operation
data will be reset on GDK_BUTTON_RELEASE.
2014-06-19 23:26:15 +02:00
|
|
|
frames->current_grab_op != META_GRAB_OP_NONE)
|
|
|
|
meta_frames_retry_grab_op (frames, event->time);
|
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-06-21 13:40:00 -04:00
|
|
|
static cairo_region_t *
|
|
|
|
get_visible_frame_border_region (MetaUIFrame *frame)
|
2010-09-17 11:11:37 +02:00
|
|
|
{
|
2010-10-18 11:32:50 -04:00
|
|
|
cairo_rectangle_int_t area;
|
2012-05-21 12:48:31 -04:00
|
|
|
cairo_region_t *frame_border;
|
2010-09-17 11:11:37 +02:00
|
|
|
MetaFrameFlags flags;
|
|
|
|
MetaFrameType type;
|
2011-07-12 00:37:41 -04:00
|
|
|
MetaFrameBorders borders;
|
2016-06-23 12:30:47 +02:00
|
|
|
MetaRectangle buffer_rect = frame->meta_window->buffer_rect;
|
2012-05-21 12:48:31 -04:00
|
|
|
|
2015-01-01 11:47:03 -08:00
|
|
|
flags = meta_frame_get_flags (frame->meta_window->frame);
|
2015-01-13 18:09:20 +01:00
|
|
|
type = meta_window_get_frame_type (frame->meta_window);
|
2015-01-01 11:47:03 -08:00
|
|
|
|
2014-09-26 00:26:01 +02:00
|
|
|
meta_theme_get_frame_borders (meta_theme_get_default (), frame->style_info,
|
2014-05-02 09:34:02 -04:00
|
|
|
type, frame->text_height, flags,
|
2011-07-12 00:37:41 -04:00
|
|
|
&borders);
|
|
|
|
|
2016-06-23 12:30:47 +02:00
|
|
|
/* Frame rect */
|
|
|
|
area.x = 0;
|
|
|
|
area.y = 0;
|
|
|
|
area.width = buffer_rect.width;
|
|
|
|
area.height = buffer_rect.height;
|
2010-09-17 11:11:37 +02:00
|
|
|
|
2012-05-21 12:48:31 -04:00
|
|
|
frame_border = cairo_region_create_rectangle (&area);
|
2010-09-17 11:11:37 +02:00
|
|
|
|
2012-05-21 12:48:31 -04:00
|
|
|
/* Client rect */
|
2016-06-23 12:30:47 +02:00
|
|
|
area.x += borders.total.left;
|
|
|
|
area.y += borders.total.top;
|
|
|
|
area.width -= borders.total.left + borders.total.right;
|
|
|
|
area.height -= borders.total.top + borders.total.bottom;
|
Replace while loops iterating over sequences with for loops. Also, replace
2006-04-19 Björn Lindqvist <bjourne@gmail.com>
* src/frames.c (struct CachedPixels, meta_frames_destroy,
invalidate_cache, generate_pixmap, populate_cache,
cached_pixels_draw, meta_frames_expose_event,
meta_frames_paint_to_drawable):
Replace while loops iterating over sequences with for loops. Also,
replace the attributes in the CachedPixels struct with a list of
four CachedFramePiece:s, this allows iteration over the four
pixmaps instead of treating each one separately. Fixes #338359.
2006-04-19 15:22:07 +00:00
|
|
|
|
2012-05-21 12:48:31 -04:00
|
|
|
/* Visible frame border */
|
|
|
|
cairo_region_subtract_rectangle (frame_border, &area);
|
2014-06-21 13:40:00 -04:00
|
|
|
return frame_border;
|
Replace while loops iterating over sequences with for loops. Also, replace
2006-04-19 Björn Lindqvist <bjourne@gmail.com>
* src/frames.c (struct CachedPixels, meta_frames_destroy,
invalidate_cache, generate_pixmap, populate_cache,
cached_pixels_draw, meta_frames_expose_event,
meta_frames_paint_to_drawable):
Replace while loops iterating over sequences with for loops. Also,
replace the attributes in the CachedPixels struct with a list of
four CachedFramePiece:s, this allows iteration over the four
pixmaps instead of treating each one separately. Fixes #338359.
2006-04-19 15:22:07 +00:00
|
|
|
}
|
|
|
|
|
2013-04-12 18:00:15 +01:00
|
|
|
/*
|
|
|
|
* Draw the opaque and semi-opaque pixels of this frame into a mask.
|
|
|
|
*
|
|
|
|
* (0,0) in Cairo coordinates is assumed to be the top left corner of the
|
|
|
|
* invisible border.
|
|
|
|
*
|
|
|
|
* The parts of @cr's surface in the clip region are assumed to be
|
|
|
|
* initialized to fully-transparent, and the clip region is assumed to
|
|
|
|
* contain the invisible border and the visible parts of the frame, but
|
|
|
|
* not the client area.
|
|
|
|
*
|
|
|
|
* This function uses @cr to draw pixels of arbitrary color (it will
|
|
|
|
* typically be drawing in a %CAIRO_FORMAT_A8 surface, so the color is
|
|
|
|
* discarded anyway) with appropriate alpha values to reproduce this
|
|
|
|
* frame's alpha channel, as a mask to be applied to an opaque pixmap.
|
|
|
|
*
|
|
|
|
* @frame: This frame
|
|
|
|
* @xwindow: The X window for the frame, which has the client window as a child
|
|
|
|
* @cr: Used to draw the resulting mask
|
|
|
|
*/
|
|
|
|
void
|
2014-12-31 22:09:23 -08:00
|
|
|
meta_ui_frame_get_mask (MetaUIFrame *frame,
|
|
|
|
cairo_t *cr)
|
2013-04-12 18:00:15 +01:00
|
|
|
{
|
|
|
|
MetaFrameBorders borders;
|
2014-10-02 00:45:13 +02:00
|
|
|
MetaFrameFlags flags;
|
2015-01-01 11:06:47 -08:00
|
|
|
MetaRectangle frame_rect;
|
2014-10-02 01:05:18 +02:00
|
|
|
int scale = meta_theme_get_window_scaling_factor ();
|
2013-04-12 18:00:15 +01:00
|
|
|
|
2015-01-01 11:50:57 -08:00
|
|
|
meta_window_get_frame_rect (frame->meta_window, &frame_rect);
|
2013-04-12 18:00:15 +01:00
|
|
|
|
2015-01-01 11:47:03 -08:00
|
|
|
flags = meta_frame_get_flags (frame->meta_window->frame);
|
|
|
|
|
2014-10-02 00:45:13 +02:00
|
|
|
meta_style_info_set_flags (frame->style_info, flags);
|
2014-12-31 22:04:11 -08:00
|
|
|
meta_ui_frame_get_borders (frame, &borders);
|
2014-10-02 01:05:18 +02:00
|
|
|
|
|
|
|
/* See comment in meta_frame_layout_draw_with_style() for details on HiDPI handling */
|
|
|
|
cairo_scale (cr, scale, scale);
|
2014-10-02 00:45:13 +02:00
|
|
|
gtk_render_background (frame->style_info->styles[META_STYLE_ELEMENT_FRAME], cr,
|
2014-10-02 01:05:18 +02:00
|
|
|
borders.invisible.left / scale,
|
|
|
|
borders.invisible.top / scale,
|
|
|
|
frame_rect.width / scale, frame_rect.height / scale);
|
2016-01-18 19:31:20 +01:00
|
|
|
gtk_render_background (frame->style_info->styles[META_STYLE_ELEMENT_TITLEBAR], cr,
|
|
|
|
borders.invisible.left / scale,
|
|
|
|
borders.invisible.top / scale,
|
|
|
|
frame_rect.width / scale, borders.total.top / scale);
|
2013-04-12 18:00:15 +01:00
|
|
|
}
|
|
|
|
|
2014-06-21 13:28:35 -04:00
|
|
|
/* XXX -- this is disgusting. Find a better approach here.
|
|
|
|
* Use multiple widgets? */
|
|
|
|
static MetaUIFrame *
|
|
|
|
find_frame_to_draw (MetaFrames *frames,
|
|
|
|
cairo_t *cr)
|
|
|
|
{
|
|
|
|
GHashTableIter iter;
|
|
|
|
MetaUIFrame *frame;
|
|
|
|
|
|
|
|
g_hash_table_iter_init (&iter, frames->frames);
|
2014-12-31 22:31:45 -08:00
|
|
|
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &frame))
|
2014-06-21 13:28:35 -04:00
|
|
|
if (gtk_cairo_should_draw_window (cr, frame->window))
|
|
|
|
return frame;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-09-24 13:30:40 +02:00
|
|
|
static gboolean
|
|
|
|
meta_frames_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr)
|
|
|
|
{
|
|
|
|
MetaUIFrame *frame;
|
|
|
|
MetaFrames *frames;
|
2012-05-21 12:48:31 -04:00
|
|
|
cairo_region_t *region;
|
2010-09-24 13:30:40 +02:00
|
|
|
|
|
|
|
frames = META_FRAMES (widget);
|
|
|
|
|
2014-06-21 13:28:35 -04:00
|
|
|
frame = find_frame_to_draw (frames, cr);
|
2010-09-24 13:30:40 +02:00
|
|
|
if (frame == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
2014-06-21 13:40:00 -04:00
|
|
|
region = get_visible_frame_border_region (frame);
|
2012-05-21 12:48:31 -04:00
|
|
|
gdk_cairo_region (cr, region);
|
|
|
|
cairo_clip (cr);
|
2010-09-24 13:30:40 +02:00
|
|
|
|
2016-06-23 12:35:44 +02:00
|
|
|
/* The target may be cleared to black or transparent, depending
|
|
|
|
* on the frame's visual; we don't want decorations to appear
|
|
|
|
* differently when the theme's decorations aren't fully opaque,
|
|
|
|
* so clear to black first
|
|
|
|
*/
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_paint (frame, cr);
|
2010-10-18 11:32:50 -04:00
|
|
|
cairo_region_destroy (region);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2010-09-24 13:30:40 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-01-27 05:27:11 +00:00
|
|
|
|
|
|
|
static void
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_paint (MetaUIFrame *frame,
|
|
|
|
cairo_t *cr)
|
2002-01-27 05:27:11 +00:00
|
|
|
{
|
|
|
|
MetaFrameFlags flags;
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaFrameType type;
|
2014-12-31 20:39:36 -08:00
|
|
|
cairo_surface_t *mini_icon;
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaButtonState button_states[META_BUTTON_TYPE_LAST];
|
|
|
|
int i;
|
2014-04-24 13:04:15 -04:00
|
|
|
int button_type = -1;
|
2002-10-04 02:28:57 +00:00
|
|
|
MetaButtonLayout button_layout;
|
2015-01-01 11:50:57 -08:00
|
|
|
MetaWindowX11 *window_x11 = META_WINDOW_X11 (frame->meta_window);
|
|
|
|
MetaWindowX11Private *priv = window_x11->priv;
|
2001-06-18 06:11:53 +00:00
|
|
|
|
Replace while loops iterating over sequences with for loops. Also, replace
2006-04-19 Björn Lindqvist <bjourne@gmail.com>
* src/frames.c (struct CachedPixels, meta_frames_destroy,
invalidate_cache, generate_pixmap, populate_cache,
cached_pixels_draw, meta_frames_expose_event,
meta_frames_paint_to_drawable):
Replace while loops iterating over sequences with for loops. Also,
replace the attributes in the CachedPixels struct with a list of
four CachedFramePiece:s, this allows iteration over the four
pixmaps instead of treating each one separately. Fixes #338359.
2006-04-19 15:22:07 +00:00
|
|
|
for (i = 0; i < META_BUTTON_TYPE_LAST; i++)
|
|
|
|
button_states[i] = META_BUTTON_STATE_NORMAL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-02-12 05:01:22 +00:00
|
|
|
/* Set prelight state */
|
|
|
|
switch (frame->prelit_control)
|
|
|
|
{
|
|
|
|
case META_FRAME_CONTROL_MENU:
|
2014-04-24 13:04:15 -04:00
|
|
|
button_type = META_BUTTON_TYPE_MENU;
|
2002-02-12 05:01:22 +00:00
|
|
|
break;
|
2014-05-23 23:14:51 +02:00
|
|
|
case META_FRAME_CONTROL_APPMENU:
|
|
|
|
button_type = META_BUTTON_TYPE_APPMENU;
|
|
|
|
break;
|
2002-02-12 05:01:22 +00:00
|
|
|
case META_FRAME_CONTROL_MINIMIZE:
|
2014-04-24 13:04:15 -04:00
|
|
|
button_type = META_BUTTON_TYPE_MINIMIZE;
|
2002-02-12 05:01:22 +00:00
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_MAXIMIZE:
|
2014-04-24 13:04:15 -04:00
|
|
|
button_type = META_BUTTON_TYPE_MAXIMIZE;
|
2003-05-16 23:09:49 +00:00
|
|
|
break;
|
2002-09-04 02:21:26 +00:00
|
|
|
case META_FRAME_CONTROL_UNMAXIMIZE:
|
2014-04-24 13:04:15 -04:00
|
|
|
button_type = META_BUTTON_TYPE_MAXIMIZE;
|
2002-02-12 05:01:22 +00:00
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_DELETE:
|
2014-04-24 13:04:15 -04:00
|
|
|
button_type = META_BUTTON_TYPE_CLOSE;
|
2002-02-12 05:01:22 +00:00
|
|
|
break;
|
|
|
|
default:
|
2002-08-04 20:20:53 +00:00
|
|
|
break;
|
2002-02-12 05:01:22 +00:00
|
|
|
}
|
2014-04-24 13:04:15 -04:00
|
|
|
|
|
|
|
if (button_type > -1)
|
|
|
|
button_states[button_type] = frame->button_state;
|
|
|
|
|
2015-01-01 11:50:57 -08:00
|
|
|
mini_icon = frame->meta_window->mini_icon;
|
2015-01-01 11:47:03 -08:00
|
|
|
flags = meta_frame_get_flags (frame->meta_window->frame);
|
2015-01-13 18:09:20 +01:00
|
|
|
type = meta_window_get_frame_type (frame->meta_window);
|
2015-01-01 11:47:03 -08:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_ensure_layout (frame, type);
|
2002-05-05 00:21:17 +00:00
|
|
|
|
2007-04-12 03:48:50 +00:00
|
|
|
meta_prefs_get_button_layout (&button_layout);
|
2002-05-05 00:21:17 +00:00
|
|
|
|
2014-09-26 00:26:01 +02:00
|
|
|
meta_theme_draw_frame (meta_theme_get_default (),
|
2014-09-24 00:07:21 +02:00
|
|
|
frame->style_info,
|
2012-12-16 17:31:00 -05:00
|
|
|
cr,
|
|
|
|
type,
|
|
|
|
flags,
|
2015-01-01 11:50:57 -08:00
|
|
|
priv->client_rect.width,
|
|
|
|
priv->client_rect.height,
|
2014-09-27 08:10:59 +02:00
|
|
|
frame->text_layout,
|
2012-12-16 17:31:00 -05:00
|
|
|
frame->text_height,
|
|
|
|
&button_layout,
|
|
|
|
button_states,
|
2014-09-23 04:20:22 +02:00
|
|
|
mini_icon);
|
2001-06-15 04:33:21 +00:00
|
|
|
}
|
2004-08-27 22:09:13 +00:00
|
|
|
|
2001-07-03 01:45:43 +00:00
|
|
|
static gboolean
|
2015-01-19 11:27:27 -08:00
|
|
|
handle_enter_notify_event (MetaUIFrame *frame,
|
|
|
|
ClutterCrossingEvent *event)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2002-02-12 05:01:22 +00:00
|
|
|
MetaFrameControl control;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2014-05-31 02:22:21 +02:00
|
|
|
frame->maybe_ignore_leave_notify = FALSE;
|
|
|
|
|
2014-12-31 22:04:11 -08:00
|
|
|
control = get_control (frame, event->x, event->y);
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_update_prelit_control (frame, control);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-07-03 01:45:43 +00:00
|
|
|
static gboolean
|
2015-01-19 11:27:27 -08:00
|
|
|
handle_leave_notify_event (MetaUIFrame *frame,
|
|
|
|
ClutterCrossingEvent *event)
|
2001-06-15 04:33:21 +00:00
|
|
|
{
|
2014-05-31 02:22:21 +02:00
|
|
|
Display *display;
|
|
|
|
MetaGrabOp grab_op;
|
2001-06-15 04:33:21 +00:00
|
|
|
|
2014-05-31 02:22:21 +02:00
|
|
|
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
|
|
|
grab_op = meta_core_get_grab_op (display);
|
|
|
|
|
|
|
|
/* ignore the first LeaveNotify event after opening a window menu
|
|
|
|
* if it is the result of a compositor grab
|
|
|
|
*/
|
|
|
|
frame->maybe_ignore_leave_notify = frame->maybe_ignore_leave_notify &&
|
|
|
|
grab_op == META_GRAB_OP_COMPOSITOR;
|
|
|
|
|
|
|
|
if (frame->maybe_ignore_leave_notify)
|
|
|
|
return FALSE;
|
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_update_prelit_control (frame, META_FRAME_CONTROL_NONE);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-15 04:33:21 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-01-19 11:27:27 -08:00
|
|
|
gboolean
|
|
|
|
meta_ui_frame_handle_event (MetaUIFrame *frame,
|
|
|
|
const ClutterEvent *event)
|
|
|
|
{
|
|
|
|
switch (event->any.type)
|
|
|
|
{
|
|
|
|
case CLUTTER_BUTTON_PRESS:
|
|
|
|
return handle_button_press_event (frame, (ClutterButtonEvent *) event);
|
|
|
|
case CLUTTER_BUTTON_RELEASE:
|
|
|
|
return handle_button_release_event (frame, (ClutterButtonEvent *) event);
|
|
|
|
case CLUTTER_MOTION:
|
|
|
|
return handle_motion_notify_event (frame, (ClutterMotionEvent *) event);
|
|
|
|
case CLUTTER_ENTER:
|
|
|
|
return handle_enter_notify_event (frame, (ClutterCrossingEvent *) event);
|
|
|
|
case CLUTTER_LEAVE:
|
|
|
|
return handle_leave_notify_event (frame, (ClutterCrossingEvent *) event);
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-20 04:29:28 +00:00
|
|
|
static GdkRectangle*
|
|
|
|
control_rect (MetaFrameControl control,
|
|
|
|
MetaFrameGeometry *fgeom)
|
|
|
|
{
|
|
|
|
GdkRectangle *rect;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-06-20 04:29:28 +00:00
|
|
|
rect = NULL;
|
|
|
|
switch (control)
|
|
|
|
{
|
|
|
|
case META_FRAME_CONTROL_TITLE:
|
|
|
|
rect = &fgeom->title_rect;
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_DELETE:
|
2006-08-07 18:01:21 +00:00
|
|
|
rect = &fgeom->close_rect.visible;
|
2001-06-20 04:29:28 +00:00
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_MENU:
|
2006-08-07 18:01:21 +00:00
|
|
|
rect = &fgeom->menu_rect.visible;
|
2001-06-20 04:29:28 +00:00
|
|
|
break;
|
2014-05-23 23:14:51 +02:00
|
|
|
case META_FRAME_CONTROL_APPMENU:
|
|
|
|
rect = &fgeom->appmenu_rect.visible;
|
|
|
|
break;
|
2001-06-20 04:29:28 +00:00
|
|
|
case META_FRAME_CONTROL_MINIMIZE:
|
2006-08-07 18:01:21 +00:00
|
|
|
rect = &fgeom->min_rect.visible;
|
2001-06-20 04:29:28 +00:00
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_MAXIMIZE:
|
2001-09-11 03:54:54 +00:00
|
|
|
case META_FRAME_CONTROL_UNMAXIMIZE:
|
2006-08-07 18:01:21 +00:00
|
|
|
rect = &fgeom->max_rect.visible;
|
2001-06-20 04:29:28 +00:00
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_S:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_SW:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_N:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NE:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_NW:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_W:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_RESIZE_E:
|
|
|
|
break;
|
|
|
|
case META_FRAME_CONTROL_NONE:
|
|
|
|
break;
|
2001-10-14 04:11:42 +00:00
|
|
|
case META_FRAME_CONTROL_CLIENT_AREA:
|
|
|
|
break;
|
2001-06-20 04:29:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return rect;
|
|
|
|
}
|
|
|
|
|
2011-07-12 01:16:48 -04:00
|
|
|
#define TOP_RESIZE_HEIGHT 4
|
2012-06-05 16:16:29 -04:00
|
|
|
#define CORNER_SIZE_MULT 2
|
2001-06-20 04:29:28 +00:00
|
|
|
static MetaFrameControl
|
2015-01-19 11:27:27 -08:00
|
|
|
get_control (MetaUIFrame *frame, int root_x, int root_y)
|
2001-06-20 04:29:28 +00:00
|
|
|
{
|
|
|
|
MetaFrameGeometry fgeom;
|
2001-07-03 01:45:43 +00:00
|
|
|
MetaFrameFlags flags;
|
2011-08-16 01:15:33 -04:00
|
|
|
MetaFrameType type;
|
2001-07-03 01:45:43 +00:00
|
|
|
gboolean has_vert, has_horiz;
|
2011-09-01 12:17:26 -04:00
|
|
|
gboolean has_north_resize;
|
2010-10-18 11:32:50 -04:00
|
|
|
cairo_rectangle_int_t client;
|
2015-01-19 11:27:27 -08:00
|
|
|
int x, y;
|
|
|
|
int win_x, win_y;
|
|
|
|
|
|
|
|
gdk_window_get_position (frame->window, &win_x, &win_y);
|
|
|
|
x = root_x - win_x;
|
|
|
|
y = root_y - win_y;
|
2001-07-03 01:45:43 +00:00
|
|
|
|
2014-12-31 22:51:29 -08:00
|
|
|
meta_ui_frame_calc_geometry (frame, &fgeom);
|
2015-01-01 11:04:11 -08:00
|
|
|
get_client_rect (&fgeom, &client);
|
2001-07-03 01:45:43 +00:00
|
|
|
|
|
|
|
if (POINT_IN_RECT (x, y, client))
|
2001-10-14 04:11:42 +00:00
|
|
|
return META_FRAME_CONTROL_CLIENT_AREA;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
if (POINT_IN_RECT (x, y, fgeom.close_rect.clickable))
|
2001-06-20 04:29:28 +00:00
|
|
|
return META_FRAME_CONTROL_DELETE;
|
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
if (POINT_IN_RECT (x, y, fgeom.min_rect.clickable))
|
2001-06-20 04:29:28 +00:00
|
|
|
return META_FRAME_CONTROL_MINIMIZE;
|
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
if (POINT_IN_RECT (x, y, fgeom.menu_rect.clickable))
|
2001-06-20 04:29:28 +00:00
|
|
|
return META_FRAME_CONTROL_MENU;
|
2002-12-02 01:34:27 +00:00
|
|
|
|
2014-05-23 23:14:51 +02:00
|
|
|
if (POINT_IN_RECT (x, y, fgeom.appmenu_rect.clickable))
|
|
|
|
return META_FRAME_CONTROL_APPMENU;
|
|
|
|
|
2015-01-01 11:47:03 -08:00
|
|
|
flags = meta_frame_get_flags (frame->meta_window->frame);
|
2015-01-13 18:09:20 +01:00
|
|
|
type = meta_window_get_frame_type (frame->meta_window);
|
2011-09-01 12:17:26 -04:00
|
|
|
|
|
|
|
has_north_resize = (type != META_FRAME_TYPE_ATTACHED);
|
2002-12-02 01:34:27 +00:00
|
|
|
has_vert = (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE) != 0;
|
|
|
|
has_horiz = (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE) != 0;
|
2011-09-01 12:17:26 -04:00
|
|
|
|
2001-06-20 04:29:28 +00:00
|
|
|
if (POINT_IN_RECT (x, y, fgeom.title_rect))
|
2002-08-20 20:18:18 +00:00
|
|
|
{
|
2011-09-01 12:17:26 -04:00
|
|
|
if (has_vert && y <= TOP_RESIZE_HEIGHT && has_north_resize)
|
2002-08-20 20:18:18 +00:00
|
|
|
return META_FRAME_CONTROL_RESIZE_N;
|
|
|
|
else
|
|
|
|
return META_FRAME_CONTROL_TITLE;
|
|
|
|
}
|
2001-07-03 01:45:43 +00:00
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
if (POINT_IN_RECT (x, y, fgeom.max_rect.clickable))
|
2001-09-11 03:54:54 +00:00
|
|
|
{
|
|
|
|
if (flags & META_FRAME_MAXIMIZED)
|
|
|
|
return META_FRAME_CONTROL_UNMAXIMIZE;
|
|
|
|
else
|
|
|
|
return META_FRAME_CONTROL_MAXIMIZE;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-12-02 01:34:27 +00:00
|
|
|
/* South resize always has priority over north resize,
|
|
|
|
* in case of overlap.
|
|
|
|
*/
|
2002-01-27 08:21:53 +00:00
|
|
|
|
2012-06-05 16:16:29 -04:00
|
|
|
if (y >= (fgeom.height - fgeom.borders.total.bottom * CORNER_SIZE_MULT) &&
|
|
|
|
x >= (fgeom.width - fgeom.borders.total.right * CORNER_SIZE_MULT))
|
2002-12-02 01:34:27 +00:00
|
|
|
{
|
|
|
|
if (has_vert && has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_SE;
|
|
|
|
else if (has_vert)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_S;
|
|
|
|
else if (has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_E;
|
2001-07-03 01:45:43 +00:00
|
|
|
}
|
2012-06-05 16:16:29 -04:00
|
|
|
else if (y >= (fgeom.height - fgeom.borders.total.bottom * CORNER_SIZE_MULT) &&
|
|
|
|
x <= fgeom.borders.total.left * CORNER_SIZE_MULT)
|
2002-12-02 01:34:27 +00:00
|
|
|
{
|
|
|
|
if (has_vert && has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_SW;
|
2011-09-15 15:08:07 -04:00
|
|
|
else if (has_vert)
|
2002-12-02 01:34:27 +00:00
|
|
|
return META_FRAME_CONTROL_RESIZE_S;
|
|
|
|
else if (has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_W;
|
|
|
|
}
|
2012-06-05 16:16:29 -04:00
|
|
|
else if (y < (fgeom.borders.invisible.top * CORNER_SIZE_MULT) &&
|
|
|
|
x <= (fgeom.borders.total.left * CORNER_SIZE_MULT) && has_north_resize)
|
2002-12-02 01:34:27 +00:00
|
|
|
{
|
|
|
|
if (has_vert && has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_NW;
|
|
|
|
else if (has_vert)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_N;
|
|
|
|
else if (has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_W;
|
|
|
|
}
|
2012-06-05 16:16:29 -04:00
|
|
|
else if (y < (fgeom.borders.invisible.top * CORNER_SIZE_MULT) &&
|
|
|
|
x >= (fgeom.width - fgeom.borders.total.right * CORNER_SIZE_MULT) && has_north_resize)
|
2002-12-02 01:34:27 +00:00
|
|
|
{
|
|
|
|
if (has_vert && has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_NE;
|
|
|
|
else if (has_vert)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_N;
|
|
|
|
else if (has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_E;
|
|
|
|
}
|
2011-07-12 01:16:48 -04:00
|
|
|
else if (y < (fgeom.borders.invisible.top + TOP_RESIZE_HEIGHT))
|
2002-12-02 01:34:27 +00:00
|
|
|
{
|
2011-09-01 12:17:26 -04:00
|
|
|
if (has_vert && has_north_resize)
|
2011-07-12 01:16:48 -04:00
|
|
|
return META_FRAME_CONTROL_RESIZE_N;
|
2002-12-02 01:34:27 +00:00
|
|
|
}
|
2011-10-04 20:00:59 -04:00
|
|
|
else if (y >= (fgeom.height - fgeom.borders.total.bottom))
|
2002-12-02 01:34:27 +00:00
|
|
|
{
|
|
|
|
if (has_vert)
|
2011-07-12 01:16:48 -04:00
|
|
|
return META_FRAME_CONTROL_RESIZE_S;
|
2002-12-02 01:34:27 +00:00
|
|
|
}
|
2011-10-04 20:00:59 -04:00
|
|
|
else if (x <= fgeom.borders.total.left)
|
2002-12-02 01:34:27 +00:00
|
|
|
{
|
|
|
|
if (has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_W;
|
|
|
|
}
|
2011-10-04 20:00:59 -04:00
|
|
|
else if (x >= (fgeom.width - fgeom.borders.total.right))
|
2002-12-02 01:34:27 +00:00
|
|
|
{
|
|
|
|
if (has_horiz)
|
|
|
|
return META_FRAME_CONTROL_RESIZE_E;
|
|
|
|
}
|
|
|
|
|
2011-09-15 15:54:51 -04:00
|
|
|
if (y >= fgeom.borders.total.top)
|
|
|
|
return META_FRAME_CONTROL_NONE;
|
|
|
|
else
|
|
|
|
return META_FRAME_CONTROL_TITLE;
|
2001-06-20 04:29:28 +00:00
|
|
|
}
|