Compare commits

..

15 Commits

Author SHA1 Message Date
Owen W. Taylor
0a4cfde4e2 MetaWindowActor: Fix crashes when mapping and unmapping windows
The assumptions made when getting the size of the window for the
paint volume turned out not to be accurate in all cases -
get_paint_volume() could be called on windows without computed
bounds.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:47 -05:00
Owen W. Taylor
c853d197e3 Omit shadows for fullscreen and maximized windows
Fullscreen and maximized windows never have visible shadows - the only
case where we would ever see them is if they bleed onto an adjacent
monitor and that looks bad.

It's small performance win to avoid computing them, and this also avoids
painting the top shadow for all maximized windows in GNOME Shell - since
the top panel isn't a X window, it doesn't factor into the computation
of what parts of windows are visible and maximized windows are computed
as having a top shadow.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:47 -05:00
Owen W. Taylor
bf7ae3e4d3 Add meta_window_get_maximized() and meta_window_is_fullscreen()
These functions duplicate existing properties; they are added for
convenience and to avoid the GObject property code on some
performance critical painting paths.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:47 -05:00
Owen W. Taylor
2b21f1d48c Implement more accurate clipping of obscured shadows
Instead of making optimizing obscured shadows an all-or-none operation,
pass the clip region to meta_shadow_paint() and only paint the 9-slices
that are at least partially visible.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:47 -05:00
Owen W. Taylor
4c91e05b86 Report a correct paint volume for shadowed windows
Since we paint shadows directly now rather than using a child actor
in the ClutterGroup, we need to implement get_paint_volume() for
Clutter 1.5.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:47 -05:00
Owen W. Taylor
bc91c328f3 Use a template material for shadows
To avoid unnecessary shader recompilation, use a root template material
for all shadows.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:46 -05:00
Owen W. Taylor
5bbbac65d6 Make window shadows globally configurable
Instead of setting shadow parameters on individual windows, add the
idea of a "shadow class". Windows have default shadow classes based
on their frame and window type, which can be overriden by setting
the shadow-class property.

Each shadow class has separably configurable parameters for the
focused and unfocused state. New shadow classes can be defined with
arbitrary names.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:46 -05:00
Owen W. Taylor
a0a0fc14d7 Export meta_frame_type_to_string()
Frame types will form the bases of shadow classes, which are strings,
so export the to-string function so that we can do the conversion
uniformly.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:46 -05:00
Owen W. Taylor
cc9efe1289 Add meta_window_get_frame_type()
Add a public function to get the frame type for a window; the
code is refactored from existing code in core.c.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:46 -05:00
Owen W. Taylor
8825ded1ca Export meta_window_appears_focused()
Move meta_window_appears_focused() into the public window.h so
we can use it to change the shadow type.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:46 -05:00
Owen W. Taylor
b823ef0007 Make MetaShadowFactory public
The basic MetaShadowFactory type is moved to a public header, while
the functions to fetch and paint shadows are kept private.
The public object will be used for configuration of shadows by
plugins.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:45 -05:00
Owen W. Taylor
a846434bcf MetaShadowFactory: convert to a GObject
https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:45 -05:00
Owen W. Taylor
825fc2c0c8 MetaShadowFactory: Add the ability to top-fade a shadow
For attached modal dialogs, we want the shadow to fade out at the top
as if the window was glued to the parent at the top. Add a
shadow-top-fade property to MetaWindowActor and the corresponding
parameter to meta_shadow_factory_get_shadow().

The internal implementation of MetaShadow is adjusted to work
in terms of an "inner border" and "outer border" instead of doing
the calculations in terms of an aggregate border and the spread
of the shadow. The old way of doing things gets clumsy when the
top_fade distance is added in as well.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-13 11:44:45 -05:00
Owen W. Taylor
4fbe547f16 Add frame type for attached modal dialogs
Add a new frame type META_FRAME_TYPE_ATTACHED which is used for
attached modal dialogs.

The theme format version is bumped to 3.2, and attached windows
can have borders defined in a metacity-theme-3.xml as:

 <window version=">= 3.2" type="attached" style_set="[name]"/>

If no style is defined for "attached", drawing will fall back
to the "border" type.

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-11 18:47:38 -05:00
Owen W. Taylor
fc2ba0afbe Make shadows pretty and configurable
The current shadow code just uses a single fixed texture (the Gaussian
blur of a rectangle with a fixed blur radius) for drawing all window
shadows. This patch adds the ability

* Implement efficient blurring of arbitrary regions by approximating
  a Gaussian blur with multiple box blurs.

* Detect when multiple windows can use the same shadow texture by
  converting their shape into a size-invariant MetaWindowShape.

* Add properties shadow-radius, shadow-x-offset, shadow-y-offset,
  shadow-opacity to allow the shadow for a window to be configured.

* Add meta_window_actor_paint() and draw the shadow directly
  from there rather than using a child actor.

* Remove TidyTextureFrame, which is no longer used

https://bugzilla.gnome.org/show_bug.cgi?id=592382
2010-11-10 14:42:54 -05:00
81 changed files with 13182 additions and 12749 deletions

View File

@@ -2,7 +2,7 @@ AC_PREREQ(2.50)
m4_define([mutter_major_version], [2])
m4_define([mutter_minor_version], [91])
m4_define([mutter_micro_version], [90])
m4_define([mutter_micro_version], [2])
m4_define([mutter_version],
[mutter_major_version.mutter_minor_version.mutter_micro_version])
@@ -61,7 +61,73 @@ AC_CHECK_SIZEOF(__int64)
## byte order
AC_C_BIGENDIAN
GTK_MIN_VERSION=2.91.7
#### Warnings
# Stay command-line compatible with the gnome-common configure option. Here
# minimum/yes/maximum are the same, however.
AC_ARG_ENABLE(compile_warnings,
AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],[Turn on compiler warnings]),,
enable_compile_warnings=error)
changequote(,)dnl
if test "$enable_compile_warnings" != no ; then
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
# case " $CFLAGS " in
# *[\ \ ]-Wshadow[\ \ ]*) ;;
# *) CFLAGS="$CFLAGS -Wshadow" ;;
# esac
case " $CFLAGS " in
*[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wnested-externs[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wnested-externs" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wpointer-arith[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wpointer-arith" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wcast-align[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wcast-align" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wsign-compare[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wsign-compare" ;;
esac
if test "$enable_compile_warnings" = error; then
case " $CFLAGS " in
*[\ \ ]-Werror[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Werror" ;;
esac
fi
fi
fi
changequote([,])dnl
GTK_MIN_VERSION=2.90.7
CANBERRA_GTK=libcanberra-gtk3
CANBERRA_GTK_VERSION=0.26
@@ -452,72 +518,6 @@ AM_PATH_PYTHON([2.5])
# Use gnome-doc-utils:
GNOME_DOC_INIT([0.8.0])
#### Warnings (last since -Werror can disturb other tests)
# Stay command-line compatible with the gnome-common configure option. Here
# minimum/yes/maximum are the same, however.
AC_ARG_ENABLE(compile_warnings,
AS_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@],[Turn on compiler warnings]),,
enable_compile_warnings=error)
changequote(,)dnl
if test "$enable_compile_warnings" != no ; then
if test "x$GCC" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
# case " $CFLAGS " in
# *[\ \ ]-Wshadow[\ \ ]*) ;;
# *) CFLAGS="$CFLAGS -Wshadow" ;;
# esac
case " $CFLAGS " in
*[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wnested-externs[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wnested-externs" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wpointer-arith[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wpointer-arith" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wcast-align[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wcast-align" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wsign-compare[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wsign-compare" ;;
esac
if test "$enable_compile_warnings" = error; then
case " $CFLAGS " in
*[\ \ ]-Werror[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Werror" ;;
esac
fi
fi
fi
changequote([,])dnl
AC_CONFIG_FILES([
Makefile
doc/Makefile
@@ -574,7 +574,7 @@ if expr $MUTTER_MINOR_VERSION % 2 > /dev/null ; then
stable_version=`expr $MUTTER_MINOR_VERSION - 1`
echo "This is the UNSTABLE branch of mutter"
echo -n "Use 2.$stable_version.x for stable "
echo "(gnome-2-$stable_version branch in git)"
echo "(gnome-2-$stable_version branch in Subversion)"
else
echo "This is the stable branch of mutter"
fi

View File

@@ -22,24 +22,6 @@ This document has separate sections for each format version. You may
want to read the document in reverse order, since the base features
are discussed under version 1.
New Features in Theme Format Version 3.3
========================================
Add two additional button background functions - left_single_background and
right_single_background - for button groups with just a single button.
There are now additional frame states to style left/right tiled windows
differently ("tiled_left", "tiled_right", "tiled_left_and_shaded",
"tiled_right_and_shaded").
New Features in Theme Format Version 3.2
========================================
A new window type 'attached' is added for modal dialogs which are
attached to their parent window. (When the attach_modal_dialogs preference
is turned on.) If no style is defined for the 'attached' window type,
the 'border' window type will be used instead.
New Features in Theme Format Version 3.1
========================================

View File

@@ -82,7 +82,6 @@ te
th
tk
tr
ug
uk
vi
wa

2204
po/ar.po

File diff suppressed because it is too large Load Diff

527
po/bg.po

File diff suppressed because it is too large Load Diff

368
po/cs.po

File diff suppressed because it is too large Load Diff

600
po/el.po

File diff suppressed because it is too large Load Diff

972
po/es.po

File diff suppressed because it is too large Load Diff

2443
po/et.po

File diff suppressed because it is too large Load Diff

573
po/gl.po

File diff suppressed because it is too large Load Diff

1540
po/gu.po

File diff suppressed because it is too large Load Diff

460
po/he.po

File diff suppressed because it is too large Load Diff

584
po/hu.po

File diff suppressed because it is too large Load Diff

604
po/it.po

File diff suppressed because it is too large Load Diff

2770
po/ko.po

File diff suppressed because it is too large Load Diff

459
po/nb.po

File diff suppressed because it is too large Load Diff

689
po/pa.po

File diff suppressed because it is too large Load Diff

564
po/sl.po

File diff suppressed because it is too large Load Diff

906
po/sv.po

File diff suppressed because it is too large Load Diff

1841
po/ug.po

File diff suppressed because it is too large Load Diff

3600
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -21,12 +21,8 @@ mutter_SOURCES= \
core/boxes.c \
core/boxes-private.h \
include/boxes.h \
compositor/cogl-utils.c \
compositor/cogl-utils.h \
compositor/compositor.c \
compositor/compositor-private.h \
compositor/meta-background-actor.c \
compositor/meta-background-actor.h \
compositor/meta-module.c \
compositor/meta-module.h \
compositor/meta-plugin.c \
@@ -51,7 +47,6 @@ mutter_SOURCES= \
include/meta-shadow-factory.h \
include/meta-window-actor.h \
include/compositor-mutter.h \
core/above-tab-keycode.c \
core/constraints.c \
core/constraints.h \
core/core.c \

View File

@@ -1,104 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Utilities for use with Cogl
*
* Copyright 2010 Red Hat, Inc.
* Copyright 2010 Intel Corporation
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include "cogl-utils.h"
/**
* meta_create_color_texture_4ub:
* @red:
* @green:
* @blue:
* @alpha:
*
* Creates a texture that is a single pixel with the specified
* unpremultiplied color components.
*
* Return value: (transfer full): a newly created Cogl texture
*/
CoglHandle
meta_create_color_texture_4ub (guint8 red,
guint8 green,
guint8 blue,
guint8 alpha)
{
CoglColor color;
guint8 pixel[4];
cogl_color_set_from_4ub (&color, red, green, blue, alpha);
cogl_color_premultiply (&color);
pixel[0] = cogl_color_get_red_byte (&color);
pixel[1] = cogl_color_get_green_byte (&color);
pixel[2] = cogl_color_get_blue_byte (&color);
pixel[3] = cogl_color_get_alpha_byte (&color);
return cogl_texture_new_from_data (1, 1,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
4, pixel);
}
/* Based on gnome-shell/src/st/st-private.c:_st_create_texture_material.c */
/**
* meta_create_texture_material:
* @src_texture: (allow-none): texture to use initially for the layer
*
* Creates a material with a single layer. Using a common template
* allows sharing a shader for different uses in Mutter. To share the same
* shader with all other materials that are just texture plus opacity
* would require Cogl fixes.
* (See http://bugzilla.clutter-project.org/show_bug.cgi?id=2425)
*
* Return value: (transfer full): a newly created Cogl material
*/
CoglHandle
meta_create_texture_material (CoglHandle src_texture)
{
static CoglHandle texture_material_template = COGL_INVALID_HANDLE;
CoglHandle material;
/* We use a material that has a dummy texture as a base for all
texture materials. The idea is that only the Cogl texture object
would be different in the children so it is likely that Cogl will
be able to share GL programs between all the textures. */
if (G_UNLIKELY (texture_material_template == COGL_INVALID_HANDLE))
{
CoglHandle dummy_texture;
dummy_texture = meta_create_color_texture_4ub (0xff, 0xff, 0xff, 0xff);
texture_material_template = cogl_material_new ();
cogl_material_set_layer (texture_material_template, 0, dummy_texture);
cogl_handle_unref (dummy_texture);
}
material = cogl_material_copy (texture_material_template);
if (src_texture != COGL_INVALID_HANDLE)
cogl_material_set_layer (material, 0, src_texture);
return material;
}

View File

@@ -1,34 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* Utilities for use with Cogl
*
* Copyright 2010 Red Hat, Inc.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef __META_COGL_UTILS_H__
#define __META_COGL_UTILS_H__
#include <cogl/cogl.h>
CoglHandle meta_create_color_texture_4ub (guint8 red,
guint8 green,
guint8 blue,
guint8 alpha);
CoglHandle meta_create_texture_material (CoglHandle src_texture);
#endif /* __META_COGL_UTILS_H__ */

View File

@@ -35,7 +35,6 @@ struct _MetaCompScreen
MetaScreen *screen;
ClutterActor *stage, *window_group, *overlay_group;
ClutterActor *background_actor;
ClutterActor *hidden_group;
GList *windows;
GHashTable *windows_by_xid;

View File

@@ -14,7 +14,6 @@
#include "meta-shadow-factory.h"
#include "meta-window-actor-private.h"
#include "meta-window-group.h"
#include "meta-background-actor.h"
#include "../core/window-private.h" /* to check window->hidden */
#include "../core/display-private.h" /* for meta_display_lookup_x_window() */
#include <X11/extensions/shape.h>
@@ -35,7 +34,7 @@ composite_at_least_version (MetaDisplay *display, int maj, int min)
return (major > maj || (major == maj && minor >= min));
}
static void sync_actor_stacking (MetaCompScreen *info);
static void sync_actor_stacking (GList *windows);
static void
meta_finish_workspace_switch (MetaCompScreen *info)
@@ -49,7 +48,7 @@ meta_finish_workspace_switch (MetaCompScreen *info)
/*
* Fix up stacking order in case the plugin messed it up.
*/
sync_actor_stacking (info);
sync_actor_stacking (info->windows);
/* printf ("... FINISHED DESKTOP SWITCH\n"); */
@@ -88,7 +87,7 @@ add_win (MetaWindow *window)
meta_window_actor_new (window);
sync_actor_stacking (info);
sync_actor_stacking (info->windows);
}
static void
@@ -137,22 +136,6 @@ process_property_notify (MetaCompositor *compositor,
{
MetaWindowActor *window_actor;
if (event->atom == compositor->atom_x_root_pixmap)
{
GSList *l;
for (l = meta_display_get_screens (compositor->display); l; l = l->next)
{
MetaScreen *screen = l->data;
if (event->window == meta_screen_get_xroot (screen))
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
meta_background_actor_update (META_BACKGROUND_ACTOR (info->background_actor));
return;
}
}
}
if (window == NULL)
return;
@@ -253,27 +236,6 @@ meta_get_window_group_for_screen (MetaScreen *screen)
return info->window_group;
}
/**
* meta_get_background_actor_for_screen:
* @screen: a #MetaScreen
*
* Gets the actor that draws the root window background under the windows.
* The root window background automatically tracks the image or color set
* by the environment.
*
* Returns: (transfer none): The background actor corresponding to @screen
*/
ClutterActor *
meta_get_background_actor_for_screen (MetaScreen *screen)
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
if (!info)
return NULL;
return info->background_actor;
}
/**
* meta_get_window_actors:
* @screen: a #MetaScreen
@@ -532,14 +494,9 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
XSelectInput (xdisplay, xwin, event_mask);
info->window_group = meta_window_group_new (screen);
info->background_actor = meta_background_actor_new (screen);
info->overlay_group = clutter_group_new ();
info->hidden_group = clutter_group_new ();
clutter_container_add (CLUTTER_CONTAINER (info->window_group),
info->background_actor,
NULL);
clutter_container_add (CLUTTER_CONTAINER (info->stage),
info->window_group,
info->overlay_group,
@@ -870,73 +827,18 @@ meta_compositor_switch_workspace (MetaCompositor *compositor,
}
static void
sync_actor_stacking (MetaCompScreen *info)
sync_actor_stacking (GList *windows)
{
GList *children;
GList *tmp;
GList *old;
gboolean reordered;
/* NB: The first entries in the lists are stacked the lowest */
/* NB: The first entry in the list is stacked the lowest */
/* Restacking will trigger full screen redraws, so it's worth a
* little effort to make sure we actually need to restack before
* we go ahead and do it */
children = clutter_container_get_children (CLUTTER_CONTAINER (info->window_group));
reordered = FALSE;
old = children;
/* We allow for actors in the window group other than the actors we
* know about, but it's up to a plugin to try and keep them stacked correctly
* (we really need extra API to make that reliable.)
*/
/* Of the actors we know, the bottom actor should be the background actor */
while (old && old->data != info->background_actor && !META_IS_WINDOW_ACTOR (old->data))
old = old->next;
if (old == NULL || old->data != info->background_actor)
{
reordered = TRUE;
goto done_with_check;
}
/* Then the window actors should follow in sequence */
old = old->next;
for (tmp = info->windows; tmp != NULL; tmp = tmp->next)
{
while (old && !META_IS_WINDOW_ACTOR (old->data))
old = old->next;
/* old == NULL: someone reparented a window out of the window group,
* order undefined, always restack */
if (old == NULL || old->data != tmp->data)
{
reordered = TRUE;
goto done_with_check;
}
old = old->next;
}
done_with_check:
g_list_free (children);
if (!reordered)
return;
for (tmp = g_list_last (info->windows); tmp != NULL; tmp = tmp->prev)
for (tmp = g_list_last (windows); tmp != NULL; tmp = tmp->prev)
{
MetaWindowActor *window_actor = tmp->data;
clutter_actor_lower_bottom (CLUTTER_ACTOR (window_actor));
}
clutter_actor_lower_bottom (info->background_actor);
}
void
@@ -974,10 +876,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
if (old_window->hidden &&
!meta_window_actor_effect_in_progress (old_actor))
{
old_stack = g_list_delete_link (old_stack, old_stack);
old_actor = NULL;
}
old_stack = g_list_delete_link (old_stack, old_stack);
else
break;
}
@@ -1028,7 +927,7 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
old_stack = g_list_remove (old_stack, actor);
}
sync_actor_stacking (info);
sync_actor_stacking (info->windows);
}
void
@@ -1085,8 +984,6 @@ meta_compositor_sync_screen_size (MetaCompositor *compositor,
clutter_actor_set_size (info->stage, width, height);
meta_background_actor_screen_size_changed (META_BACKGROUND_ACTOR (info->background_actor));
meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
meta_screen_get_screen_number (screen),
width, height);

View File

@@ -1,418 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* meta-background-actor.c: Actor for painting the root window background
*
* Copyright 2009 Sander Dijkhuis
* Copyright 2010 Red Hat, Inc.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* Portions adapted from gnome-shell/src/shell-global.c
*/
#include <config.h>
#define COGL_ENABLE_EXPERIMENTAL_API
#include <cogl/cogl-texture-pixmap-x11.h>
#include <X11/Xatom.h>
#include "cogl-utils.h"
#include "compositor-private.h"
#include "errors.h"
#include "meta-background-actor.h"
struct _MetaBackgroundActorClass
{
ClutterActorClass parent_class;
};
struct _MetaBackgroundActor
{
ClutterActor parent;
CoglHandle material;
MetaScreen *screen;
cairo_region_t *visible_region;
float texture_width;
float texture_height;
guint have_pixmap : 1;
};
G_DEFINE_TYPE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR);
static void
update_wrap_mode (MetaBackgroundActor *self)
{
int width, height;
CoglMaterialWrapMode wrap_mode;
meta_screen_get_size (self->screen, &width, &height);
/* We turn off repeating when we have a full-screen pixmap to keep from
* getting artifacts from one side of the image sneaking into the other
* side of the image via bilinear filtering.
*/
if (width == self->texture_width && height == self->texture_height)
wrap_mode = COGL_MATERIAL_WRAP_MODE_CLAMP_TO_EDGE;
else
wrap_mode = COGL_MATERIAL_WRAP_MODE_REPEAT;
cogl_material_set_layer_wrap_mode (self->material, 0, wrap_mode);
}
static void
set_texture (MetaBackgroundActor *self,
CoglHandle texture)
{
MetaDisplay *display;
display = meta_screen_get_display (self->screen);
/* This may trigger destruction of an old texture pixmap, which, if
* the underlying X pixmap is already gone has the tendency to trigger
* X errors inside DRI. For safety, trap errors */
meta_error_trap_push (display);
cogl_material_set_layer (self->material, 0, texture);
meta_error_trap_pop (display);
self->texture_width = cogl_texture_get_width (texture);
self->texture_height = cogl_texture_get_height (texture);
update_wrap_mode (self);
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}
/* Sets our material to paint with a 1x1 texture of the stage's background
* color; doing this when we have no pixmap allows the application to turn
* off painting the stage. There might be a performance benefit to
* painting in this case with a solid color, but the normal solid color
* case is a 1x1 root pixmap, so we'd have to reverse-engineer that to
* actually pick up the (small?) performance win. This is just a fallback.
*/
static void
set_texture_to_stage_color (MetaBackgroundActor *self)
{
ClutterActor *stage = meta_get_stage_for_screen (self->screen);
ClutterColor color;
CoglHandle texture;
clutter_stage_get_color (CLUTTER_STAGE (stage), &color);
texture = meta_create_color_texture_4ub (color.red, color.green,
color.blue, 0xff);
set_texture (self, texture);
cogl_handle_unref (texture);
}
static void
on_notify_stage_color (GObject *stage,
GParamSpec *pspec,
MetaBackgroundActor *self)
{
if (!self->have_pixmap)
set_texture_to_stage_color (self);
}
static void
meta_background_actor_dispose (GObject *object)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (object);
meta_background_actor_set_visible_region (self, NULL);
if (self->material != COGL_INVALID_HANDLE)
{
cogl_handle_unref (self->material);
self->material = COGL_INVALID_HANDLE;
}
if (self->screen != NULL)
{
ClutterActor *stage = meta_get_stage_for_screen (self->screen);
g_signal_handlers_disconnect_by_func (stage,
(gpointer) on_notify_stage_color,
self);
self->screen = NULL;
}
}
static void
meta_background_actor_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
int width, height;
meta_screen_get_size (self->screen, &width, &height);
if (min_width_p)
*min_width_p = width;
if (natural_width_p)
*natural_width_p = height;
}
static void
meta_background_actor_get_preferred_height (ClutterActor *actor,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
int width, height;
meta_screen_get_size (self->screen, &width, &height);
if (min_height_p)
*min_height_p = height;
if (natural_height_p)
*natural_height_p = height;
}
static void
meta_background_actor_paint (ClutterActor *actor)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
guchar opacity = clutter_actor_get_paint_opacity (actor);
int width, height;
meta_screen_get_size (self->screen, &width, &height);
cogl_material_set_color4ub (self->material,
opacity, opacity, opacity, opacity);
cogl_set_source (self->material);
if (self->visible_region)
{
int n_rectangles = cairo_region_num_rectangles (self->visible_region);
int i;
for (i = 0; i < n_rectangles; i++)
{
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (self->visible_region, i, &rect);
cogl_rectangle_with_texture_coords (rect.x, rect.y,
rect.x + rect.width, rect.y + rect.height,
rect.x / self->texture_width,
rect.y / self->texture_height,
(rect.x + rect.width) / self->texture_width,
(rect.y + rect.height) / self->texture_height);
}
}
else
{
cogl_rectangle_with_texture_coords (0.0f, 0.0f,
width, height,
0.0f, 0.0f,
width / self->texture_width,
height / self->texture_height);
}
}
#if CLUTTER_CHECK_VERSION(1, 5, 2)
static gboolean
meta_background_actor_get_paint_volume (ClutterActor *actor,
ClutterPaintVolume *volume)
{
MetaBackgroundActor *self = META_BACKGROUND_ACTOR (actor);
int width, height;
meta_screen_get_size (self->screen, &width, &height);
clutter_paint_volume_set_width (volume, width);
clutter_paint_volume_set_height (volume, height);
return TRUE;
}
#endif
static void
meta_background_actor_class_init (MetaBackgroundActorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
object_class->dispose = meta_background_actor_dispose;
actor_class->get_preferred_width = meta_background_actor_get_preferred_width;
actor_class->get_preferred_height = meta_background_actor_get_preferred_height;
actor_class->paint = meta_background_actor_paint;
#if CLUTTER_CHECK_VERSION(1, 5, 2)
actor_class->get_paint_volume = meta_background_actor_get_paint_volume;
#endif
}
static void
meta_background_actor_init (MetaBackgroundActor *background_actor)
{
}
/**
* @screen: the #MetaScreen
* meta_background_actor_new:
*
* Creates a new actor to draw the background for the given screen.
*
* Return value: (transfer none): the newly created background actor
*/
ClutterActor *
meta_background_actor_new (MetaScreen *screen)
{
MetaBackgroundActor *self;
ClutterActor *stage;
g_return_val_if_fail (META_IS_SCREEN (screen), NULL);
self = g_object_new (META_TYPE_BACKGROUND_ACTOR, NULL);
self->screen = screen;
self->material = meta_create_texture_material (NULL);
cogl_material_set_layer_wrap_mode (self->material, 0,
COGL_MATERIAL_WRAP_MODE_REPEAT);
stage = meta_get_stage_for_screen (self->screen);
g_signal_connect (stage, "notify::color",
G_CALLBACK (on_notify_stage_color), self);
meta_background_actor_update (self);
return CLUTTER_ACTOR (self);
}
/**
* meta_background_actor_update:
* @self: a #MetaBackgroundActor
*
* Refetches the _XROOTPMAP_ID property for the root window and updates
* the contents of the background actor based on that. There's no attempt
* to optimize out pixmap values that don't change (since a root pixmap
* could be replaced by with another pixmap with the same ID under some
* circumstances), so this should only be called when we actually receive
* a PropertyNotify event for the property.
*/
void
meta_background_actor_update (MetaBackgroundActor *self)
{
MetaDisplay *display;
MetaCompositor *compositor;
Atom type;
int format;
gulong nitems;
gulong bytes_after;
guchar *data;
Pixmap root_pixmap_id;
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
display = meta_screen_get_display (self->screen);
compositor = meta_display_get_compositor (display);
root_pixmap_id = None;
if (!XGetWindowProperty (meta_display_get_xdisplay (display),
meta_screen_get_xroot (self->screen),
compositor->atom_x_root_pixmap,
0, LONG_MAX,
False,
AnyPropertyType,
&type, &format, &nitems, &bytes_after, &data) &&
type != None)
{
/* Got a property. */
if (type == XA_PIXMAP && format == 32 && nitems == 1)
{
/* Was what we expected. */
root_pixmap_id = *(Pixmap *)data;
}
XFree(data);
}
if (root_pixmap_id != None)
{
CoglHandle texture;
meta_error_trap_push (display);
texture = cogl_texture_pixmap_x11_new (root_pixmap_id, FALSE);
meta_error_trap_pop (display);
if (texture != COGL_INVALID_HANDLE)
{
set_texture (self, texture);
cogl_handle_unref (texture);
self->have_pixmap = True;
return;
}
}
self->have_pixmap = False;
set_texture_to_stage_color (self);
}
/**
* meta_background_actor_set_visible_region:
* @self: a #MetaBackgroundActor
* @visible_region: (allow-none): the area of the actor (in allocate-relative
* coordinates) that is visible.
*
* Sets the area of the background that is unobscured by overlapping windows.
* This is used to optimize and only paint the visible portions.
*/
void
meta_background_actor_set_visible_region (MetaBackgroundActor *self,
cairo_region_t *visible_region)
{
g_return_if_fail (META_IS_BACKGROUND_ACTOR (self));
if (self->visible_region)
{
cairo_region_destroy (self->visible_region);
self->visible_region = NULL;
}
if (visible_region)
{
cairo_rectangle_int_t screen_rect = { 0 };
meta_screen_get_size (self->screen, &screen_rect.width, &screen_rect.height);
/* Doing the intersection here is probably unnecessary - MetaWindowGroup
* should never compute a visible area that's larger than the root screen!
* but it's not that expensive and adds some extra robustness.
*/
self->visible_region = cairo_region_create_rectangle (&screen_rect);
cairo_region_intersect (self->visible_region, visible_region);
}
}
/**
* meta_background_actor_screen_size_changed:
* @self: a #MetaBackgroundActor
*
* Called by the compositor when the size of the #MetaScreen changes
*/
void
meta_background_actor_screen_size_changed (MetaBackgroundActor *self)
{
update_wrap_mode (self);
clutter_actor_queue_relayout (CLUTTER_ACTOR (self));
}

View File

@@ -1,58 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/*
* meta-background-actor.h: Actor for painting the root window background
*
* Copyright 2010 Red Hat, Inc.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef META_BACKGROUND_ACTOR_H
#define META_BACKGROUND_ACTOR_H
#include <clutter/clutter.h>
#include "screen.h"
/**
* MetaBackgroundActor:
*
* This class handles tracking and painting the root window background.
* By integrating with #MetaWindowGroup we can avoid painting parts of
* the background that are obscured by other windows.
*/
#define META_TYPE_BACKGROUND_ACTOR (meta_background_actor_get_type ())
#define META_BACKGROUND_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_BACKGROUND_ACTOR, MetaBackgroundActor))
#define META_BACKGROUND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_BACKGROUND_ACTOR, MetaBackgroundActorClass))
#define META_IS_BACKGROUND_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_TYPE_BACKGROUND_ACTOR))
#define META_IS_BACKGROUND_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_BACKGROUND_ACTOR))
#define META_BACKGROUND_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_BACKGROUND_ACTOR, MetaBackgroundActorClass))
typedef struct _MetaBackgroundActor MetaBackgroundActor;
typedef struct _MetaBackgroundActorClass MetaBackgroundActorClass;
typedef struct _MetaBackgroundActorPrivate MetaBackgroundActorPrivate;
GType meta_background_actor_get_type (void);
ClutterActor *meta_background_actor_new (MetaScreen *screen);
void meta_background_actor_update (MetaBackgroundActor *actor);
void meta_background_actor_set_visible_region (MetaBackgroundActor *self,
cairo_region_t *visible_region);
void meta_background_actor_screen_size_changed (MetaBackgroundActor *self);
#endif /* META_BACKGROUND_ACTOR_H */

View File

@@ -31,7 +31,6 @@
#include "../core/window-private.h"
#include <string.h>
#include <stdlib.h>
#include <clutter/x11/clutter-x11.h>
@@ -282,15 +281,8 @@ meta_plugin_manager_load (MetaPluginManager *plugin_mgr)
}
}
else
{
/* This is fatal under the assumption that a monitoring
* process like gnome-session will take over and handle
* our untimely exit.
*/
g_printerr ("Unable to load plugin module [%s]: %s",
path, g_module_error());
exit (1);
}
g_warning ("Unable to load plugin module [%s]: %s",
path, g_module_error());
g_free (path);
g_free (plugin_string);

View File

@@ -351,14 +351,6 @@ meta_plugin_get_window_group (MetaPlugin *plugin)
return meta_get_window_group_for_screen (priv->screen);
}
ClutterActor *
meta_plugin_get_background_actor (MetaPlugin *plugin)
{
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
return meta_get_background_actor_for_screen (priv->screen);
}
/**
* _meta_plugin_effect_started:
* @plugin: the plugin

View File

@@ -55,8 +55,6 @@ void meta_shadow_get_bounds (MetaShadow *shadow,
int window_height,
cairo_rectangle_int_t *bounds);
MetaShadowFactory *meta_shadow_factory_new (void);
MetaShadow *meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
MetaWindowShape *shape,
int width,

View File

@@ -5,6 +5,7 @@
* Create and cache shadow textures for abritrary window shapes
*
* Copyright 2010 Red Hat, Inc.
* Copyright 2010 Intel Corporation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -25,7 +26,6 @@
#include <math.h>
#include <string.h>
#include "cogl-utils.h"
#include "meta-shadow-factory-private.h"
#include "region-utils.h"
@@ -641,6 +641,49 @@ flip_buffer (guchar *buffer,
#undef BLOCK_SIZE
}
/* Creates a material with a single layer. Using a common template
* allows sharing a shader between all shadows. To share the same
* shader with all other materials that are just texture plus
* opacity would require cogl fixes. Based on
* gnome-shell/src/st/_st_create_texture_material.c
*/
static CoglHandle
create_texture_material (CoglHandle src_texture)
{
static CoglHandle texture_material_template = COGL_INVALID_HANDLE;
CoglHandle material;
g_return_val_if_fail (src_texture != COGL_INVALID_HANDLE,
COGL_INVALID_HANDLE);
/* We use a material that has a dummy texture as a base for all
texture materials. The idea is that only the Cogl texture object
would be different in the children so it is likely that Cogl will
be able to share GL programs between all the textures. */
if (G_UNLIKELY (texture_material_template == COGL_INVALID_HANDLE))
{
static const guint8 white_pixel[] = { 0xff, 0xff, 0xff, 0xff };
CoglHandle dummy_texture;
dummy_texture =
cogl_texture_new_from_data (1, 1,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
4, white_pixel);
texture_material_template = cogl_material_new ();
cogl_material_set_layer (texture_material_template, 0, dummy_texture);
cogl_handle_unref (dummy_texture);
}
material = cogl_material_copy (texture_material_template);
cogl_material_set_layer (material, 0, src_texture);
return material;
}
static void
make_shadow (MetaShadow *shadow,
cairo_region_t *region)
@@ -732,7 +775,7 @@ make_shadow (MetaShadow *shadow,
/* We offset the passed in pixels to crop off the extra area we allocated at the top
* in the case of top_fade >= 0. We also account for padding at the left for symmetry
* though that doesn't currently occur.
* though that doesn't currnetly occur.
*/
shadow->texture = cogl_texture_new_from_data (shadow->outer_border_left + extents.width + shadow->outer_border_right,
shadow->outer_border_top + extents.height + shadow->outer_border_bottom,
@@ -748,7 +791,7 @@ make_shadow (MetaShadow *shadow,
cairo_region_destroy (column_convolve_region);
g_free (buffer);
shadow->material = meta_create_texture_material (shadow->texture);
shadow->material = create_texture_material (shadow->texture);
}
static MetaShadowParams *

View File

@@ -187,10 +187,8 @@ meta_shaped_texture_dirty_mask (MetaShapedTexture *stex)
cogl_texture_get_gl_texture (priv->mask_texture,
&mask_gl_tex, &mask_gl_target);
#ifdef GL_TEXTURE_RECTANGLE_ARB
if (mask_gl_target == GL_TEXTURE_RECTANGLE_ARB)
glDeleteTextures (1, &mask_gl_tex);
#endif
cogl_handle_unref (priv->mask_texture);
priv->mask_texture = COGL_INVALID_HANDLE;
@@ -255,7 +253,6 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
cogl_texture_get_gl_texture (paint_tex, NULL, &paint_gl_target);
#ifdef GL_TEXTURE_RECTANGLE_ARB
if (paint_gl_target == GL_TEXTURE_RECTANGLE_ARB)
{
GLuint tex;
@@ -278,7 +275,6 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
COGL_PIXEL_FORMAT_A_8);
}
else
#endif /* GL_TEXTURE_RECTANGLE_ARB */
priv->mask_texture = cogl_texture_new_from_data (tex_width, tex_height,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_A_8,

View File

@@ -97,7 +97,6 @@ meta_texture_tower_free (MetaTextureTower *tower)
g_slice_free (MetaTextureTower, tower);
}
#ifdef GL_TEXTURE_RECTANGLE_ARB
static gboolean
texture_is_rectangle (CoglHandle texture)
{
@@ -107,12 +106,10 @@ texture_is_rectangle (CoglHandle texture)
cogl_texture_get_gl_texture (texture, &gl_tex, &gl_target);
return gl_target == GL_TEXTURE_RECTANGLE_ARB;
}
#endif /* GL_TEXTURE_RECTANGLE_ARB */
static void
free_texture (CoglHandle texture)
{
#ifdef GL_TEXTURE_RECTANGLE_ARB
GLuint gl_tex;
GLenum gl_target;
@@ -120,7 +117,6 @@ free_texture (CoglHandle texture)
if (gl_target == GL_TEXTURE_RECTANGLE_ARB)
glDeleteTextures (1, &gl_tex);
#endif /* GL_TEXTURE_RECTANGLE_ARB */
cogl_handle_unref (texture);
}
@@ -366,13 +362,11 @@ get_paint_level (int width, int height)
return (int)(0.5 + lambda);
}
#ifdef GL_TEXTURE_RECTANGLE_ARB
static gboolean
is_power_of_two (int x)
{
return (x & (x - 1)) == 0;
}
#endif /* GL_TEXTURE_RECTANGLE_ARB */
static void
texture_tower_create_texture (MetaTextureTower *tower,
@@ -380,7 +374,6 @@ texture_tower_create_texture (MetaTextureTower *tower,
int width,
int height)
{
#ifdef GL_TEXTURE_RECTANGLE_ARB
if ((!is_power_of_two (width) || !is_power_of_two (height)) &&
texture_is_rectangle (tower->textures[level - 1]))
{
@@ -403,7 +396,6 @@ texture_tower_create_texture (MetaTextureTower *tower,
TEXTURE_FORMAT);
}
else
#endif /* GL_TEXTURE_RECTANGLE_ARB */
{
tower->textures[level] = cogl_texture_new_with_size (width, height,
COGL_TEXTURE_NO_AUTO_MIPMAP,

View File

@@ -1,7 +1,5 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
#include <config.h>
#define _ISOC99_SOURCE /* for roundf */
#include <math.h>
@@ -24,15 +22,6 @@
#include "meta-shaped-texture.h"
#include "meta-window-actor-private.h"
enum {
POSITION_CHANGED,
SIZE_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = {0};
struct _MetaWindowActorPrivate
{
XWindowAttributes attrs;
@@ -50,7 +39,7 @@ struct _MetaWindowActorPrivate
* these will be the same. 2) when the shadow potentially changes we
* don't immediately unreference the old shadow, we just flag it as
* dirty and recompute it when we next need it (recompute_focused_shadow,
* recompute_unfocused_shadow.) Because of our extraction of
* recompute_unfocused_shadow.) Because of the our extraction of
* size-invariant window shape, we'll often find that the new shadow
* is the same as the old shadow.
*/
@@ -284,21 +273,6 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
g_object_class_install_property (object_class,
PROP_SHADOW_CLASS,
pspec);
signals[POSITION_CHANGED] =
g_signal_new ("position-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[SIZE_CHANGED] =
g_signal_new ("size-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
@@ -325,6 +299,7 @@ window_decorated_notify (MetaWindow *mw,
MetaDisplay *display = meta_screen_get_display (screen);
Display *xdisplay = meta_display_get_xdisplay (display);
Window new_xwindow;
MetaCompScreen *info;
XWindowAttributes attrs;
/*
@@ -340,6 +315,8 @@ window_decorated_notify (MetaWindow *mw,
meta_window_actor_detach (self);
info = meta_screen_get_compositor_data (screen);
/*
* First of all, clean up any resources we are currently using and will
* be replacing.
@@ -383,6 +360,9 @@ meta_window_actor_constructed (GObject *object)
Window xwindow = priv->xwindow;
Display *xdisplay = meta_display_get_xdisplay (display);
XRenderPictFormat *format;
MetaCompositor *compositor;
compositor = meta_display_get_compositor (display);
#ifdef HAVE_SHAPE
/* Listen for ShapeNotify events on the window */
@@ -661,7 +641,6 @@ meta_window_actor_get_shape_bounds (MetaWindowActor *self,
bounds->x = bounds->y = bounds->width = bounds->height = 0;
}
#if CLUTTER_CHECK_VERSION(1, 5, 2)
static void
meta_window_actor_get_shadow_bounds (MetaWindowActor *self,
gboolean appears_focused,
@@ -682,7 +661,6 @@ meta_window_actor_get_shadow_bounds (MetaWindowActor *self,
shape_bounds.height,
bounds);
}
#endif
static void
meta_window_actor_paint (ClutterActor *actor)
@@ -901,19 +879,6 @@ meta_window_actor_get_texture (MetaWindowActor *self)
return self->priv->actor;
}
/**
* meta_window_actor_is_destroyed:
*
* Gets whether the X window that the actor was displaying has been destroyed
*
* Return value: %TRUE when the window is destroyed, otherwise %FALSE
*/
gboolean
meta_window_actor_is_destroyed (MetaWindowActor *self)
{
return self->priv->disposed;
}
gboolean
meta_window_actor_is_override_redirect (MetaWindowActor *self)
{
@@ -1340,8 +1305,6 @@ meta_window_actor_sync_actor_position (MetaWindowActor *self)
window_rect.x, window_rect.y);
clutter_actor_set_size (CLUTTER_ACTOR (self),
window_rect.width, window_rect.height);
g_signal_emit (self, signals[POSITION_CHANGED], 0);
}
void
@@ -1633,8 +1596,6 @@ meta_window_actor_update_bounding_region (MetaWindowActor *self,
*/
if (!priv->shaped)
meta_window_actor_invalidate_shadow (self);
g_signal_emit (self, signals[SIZE_CHANGED], 0);
}
static void
@@ -1799,6 +1760,7 @@ check_needs_pixmap (MetaWindowActor *self)
MetaCompScreen *info = meta_screen_get_compositor_data (screen);
MetaCompositor *compositor;
Window xwindow = priv->xwindow;
gboolean full = FALSE;
if (!priv->needs_pixmap)
return;
@@ -1859,11 +1821,9 @@ check_needs_pixmap (MetaWindowActor *self)
* do it here.
* See: http://bugzilla.clutter-project.org/show_bug.cgi?id=2236
*/
#ifdef HAVE_GLX_TEXTURE_PIXMAP
if (G_UNLIKELY (!clutter_glx_texture_pixmap_using_extension (
CLUTTER_GLX_TEXTURE_PIXMAP (priv->actor))))
if (!clutter_glx_texture_pixmap_using_extension (
CLUTTER_GLX_TEXTURE_PIXMAP (priv->actor)))
g_warning ("NOTE: Not using GLX TFP!\n");
#endif
g_object_get (priv->actor,
"pixmap-width", &pxm_width,
@@ -1871,6 +1831,8 @@ check_needs_pixmap (MetaWindowActor *self)
NULL);
meta_window_actor_update_bounding_region (self, pxm_width, pxm_height);
full = TRUE;
}
meta_error_trap_pop (display);
@@ -1925,26 +1887,24 @@ check_needs_shadow (MetaWindowActor *self)
if (*shadow_location == NULL && should_have_shadow)
{
MetaShadowFactory *factory = meta_shadow_factory_get_default ();
const char *shadow_class = meta_window_actor_get_shadow_class (self);
cairo_rectangle_int_t shape_bounds;
if (priv->shadow_shape == NULL)
{
if (priv->shaped && priv->shape_region)
if (priv->shaped)
priv->shadow_shape = meta_window_shape_new (priv->shape_region);
else if (priv->bounding_region)
else
priv->shadow_shape = meta_window_shape_new (priv->bounding_region);
}
if (priv->shadow_shape != NULL)
{
MetaShadowFactory *factory = meta_shadow_factory_get_default ();
const char *shadow_class = meta_window_actor_get_shadow_class (self);
cairo_rectangle_int_t shape_bounds;
meta_window_actor_get_shape_bounds (self, &shape_bounds);
meta_window_actor_get_shape_bounds (self, &shape_bounds);
*shadow_location = meta_shadow_factory_get_shadow (factory,
priv->shadow_shape,
shape_bounds.width, shape_bounds.height,
shadow_class, appears_focused);
}
*shadow_location = meta_shadow_factory_get_shadow (factory,
priv->shadow_shape,
shape_bounds.width, shape_bounds.height,
shadow_class, appears_focused);
}
if (old_shadow != NULL)

View File

@@ -5,11 +5,8 @@
#define _ISOC99_SOURCE /* for roundf */
#include <math.h>
#include <gdk/gdk.h> /* for gdk_rectangle_intersect() */
#include "meta-window-actor-private.h"
#include "meta-window-group.h"
#include "meta-background-actor.h"
struct _MetaWindowGroupClass
{
@@ -105,9 +102,7 @@ meta_window_group_paint (ClutterActor *actor)
{
MetaWindowGroup *window_group = META_WINDOW_GROUP (actor);
cairo_region_t *visible_region;
GLboolean scissor_test;
cairo_rectangle_int_t screen_rect = { 0 };
cairo_rectangle_int_t scissor_rect;
GList *children, *l;
/* We walk the list from top to bottom (opposite of painting order),
@@ -123,67 +118,35 @@ meta_window_group_paint (ClutterActor *actor)
* optimization, however.)
*/
meta_screen_get_size (window_group->screen, &screen_rect.width, &screen_rect.height);
/* When doing a partial stage paint, Clutter will set the GL scissor
* box to the clip rectangle for the partial repaint. We combine the screen
* rectangle with the scissor box to get the region we need to
* paint. (Strangely, the scissor box sometimes seems to be bigger
* than the stage ... Clutter should probably be clampimg)
*/
glGetBooleanv (GL_SCISSOR_TEST, &scissor_test);
if (scissor_test)
{
GLint scissor_box[4];
glGetIntegerv (GL_SCISSOR_BOX, scissor_box);
scissor_rect.x = scissor_box[0];
scissor_rect.y = screen_rect.height - (scissor_box[1] + scissor_box[3]);
scissor_rect.width = scissor_box[2];
scissor_rect.height = scissor_box[3];
gdk_rectangle_intersect (&scissor_rect, &screen_rect, &scissor_rect);
}
else
{
scissor_rect = screen_rect;
}
visible_region = cairo_region_create_rectangle (&scissor_rect);
visible_region = cairo_region_create_rectangle (&screen_rect);
for (l = children; l; l = l->next)
{
if (!CLUTTER_ACTOR_IS_VISIBLE (l->data))
MetaWindowActor *window_actor;
gboolean x, y;
if (!META_IS_WINDOW_ACTOR (l->data) || !CLUTTER_ACTOR_IS_VISIBLE (l->data))
continue;
if (META_IS_WINDOW_ACTOR (l->data))
window_actor = l->data;
if (!actor_is_untransformed (CLUTTER_ACTOR (window_actor), &x, &y))
continue;
/* Temporarily move to the coordinate system of the actor */
cairo_region_translate (visible_region, - x, - y);
meta_window_actor_set_visible_region (window_actor, visible_region);
if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (window_actor)) == 0xff)
{
MetaWindowActor *window_actor = l->data;
gboolean x, y;
if (!actor_is_untransformed (CLUTTER_ACTOR (window_actor), &x, &y))
continue;
/* Temporarily move to the coordinate system of the actor */
cairo_region_translate (visible_region, - x, - y);
meta_window_actor_set_visible_region (window_actor, visible_region);
if (clutter_actor_get_paint_opacity (CLUTTER_ACTOR (window_actor)) == 0xff)
{
cairo_region_t *obscured_region = meta_window_actor_get_obscured_region (window_actor);
if (obscured_region)
cairo_region_subtract (visible_region, obscured_region);
}
meta_window_actor_set_visible_region_beneath (window_actor, visible_region);
cairo_region_translate (visible_region, x, y);
}
else if (META_IS_BACKGROUND_ACTOR (l->data))
{
MetaBackgroundActor *background_actor = l->data;
meta_background_actor_set_visible_region (background_actor, visible_region);
cairo_region_t *obscured_region = meta_window_actor_get_obscured_region (window_actor);
if (obscured_region)
cairo_region_subtract (visible_region, obscured_region);
}
meta_window_actor_set_visible_region_beneath (window_actor, visible_region);
cairo_region_translate (visible_region, x, y);
}
cairo_region_destroy (visible_region);
@@ -195,17 +158,13 @@ meta_window_group_paint (ClutterActor *actor)
*/
for (l = children; l; l = l->next)
{
if (META_IS_WINDOW_ACTOR (l->data))
{
MetaWindowActor *window_actor = l->data;
window_actor = l->data;
meta_window_actor_reset_visible_regions (window_actor);
}
else if (META_IS_BACKGROUND_ACTOR (l->data))
{
MetaBackgroundActor *background_actor = l->data;
meta_background_actor_set_visible_region (background_actor, NULL);
}
MetaWindowActor *window_actor;
if (!META_IS_WINDOW_ACTOR (l->data))
continue;
window_actor = l->data;
meta_window_actor_reset_visible_regions (window_actor);
}
g_list_free (children);

View File

@@ -141,9 +141,8 @@ meta_window_shape_new (cairo_region_t *region)
#if 0
g_print ("%d: +%d+%dx%dx%d => +%d+%dx%dx%d\n",
iter.i, iter.rectangle.x, iter.rectangle.y, iter.rectangle.width, iter.rectangle.height,
shape->rectangles[iter.i].x, shape->rectangles[iter.i].y,
hape->rectangles[iter.i].width, shape->rectangles[iter.i].height);
i, iter.rectangle.x, iter.rectangle.y, iter.rectangle.width, iter.rectangle.height,
shape->rectangles[i].x, shape->rectangles[i].y, shape->rectangles[i].width, shape->rectangles[i].height);
#endif
hash = hash * 31 + x1 * 17 + x2 * 27 + y1 * 37 + y2 * 43;

View File

@@ -32,8 +32,8 @@
* MetaWindowShape:
* #MetaWindowShape represents a 9-sliced region with borders on all sides that
* are unscaled, and a constant central region that is scaled. For example,
* the regions representing two windows that are rounded rectangles,
* with the same corner radius but different sizes, have the
* if you the regions representing two windows that around rounded rectangles,
* with the same corner regions, but different sizes, they have the
* same MetaWindowShape.
*
* #MetaWindowShape is designed to be used as part of a hash table key, so has

View File

@@ -319,10 +319,12 @@ switch_workspace (MetaPlugin *plugin,
{
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
GList *l;
gint n_workspaces;
ClutterActor *workspace0 = clutter_group_new ();
ClutterActor *workspace1 = clutter_group_new ();
ClutterActor *stage;
int screen_width, screen_height;
MetaScreen *screen = meta_plugin_get_screen (plugin);
ClutterAnimation *animation;
stage = meta_plugin_get_stage (plugin);
@@ -348,6 +350,8 @@ switch_workspace (MetaPlugin *plugin,
return;
}
n_workspaces = meta_screen_get_n_workspaces (screen);
l = g_list_last (meta_plugin_get_window_actors (plugin));
while (l)

View File

@@ -47,9 +47,7 @@
typedef struct
{
/* To merge regions in binary tree order, we need to keep track of
* the regions that we've already merged together at different
* levels of the tree. We fill in an array in the pattern:
/* To merge regions in a binary tree, we need to keep track of The way these are filled is in the pattern:
*
* |a |
* |b |a |
@@ -180,7 +178,7 @@ meta_region_iterator_next (MetaRegionIterator *iter)
iter->rectangle = iter->next_rectangle;
iter->line_start = iter->line_end;
if (iter->i + 1 < iter->n_rectangles)
if (iter->i < iter->n_rectangles)
{
cairo_region_get_rectangle (iter->region, iter->i + 1, &iter->next_rectangle);
iter->line_end = iter->next_rectangle.y != iter->rectangle.y;
@@ -203,12 +201,12 @@ add_expanded_rect (MetaRegionBuilder *builder,
{
if (flip)
meta_region_builder_add_rectangle (builder,
y - y_amount, x - x_amount,
height + 2 * y_amount, width + 2 * x_amount);
y - y_amount, x - x_amount,
height + 2 * y_amount, width + 2 * x_amount);
else
meta_region_builder_add_rectangle (builder,
x - x_amount, y - y_amount,
width + 2 * x_amount, height + 2 * y_amount);
x - x_amount, y - y_amount,
width + 2 * x_amount, height + 2 * y_amount);
}
static cairo_region_t *

View File

@@ -1,241 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* Find the keycode for the key above the tab key */
/*
* Copyright 2010 Red Hat, Inc.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
/* The standard cycle-windows keybinding should be the key above the
* tab key. This will have a different keysym on different keyboards -
* it's the ` (grave) key on US keyboards but something else on many
* other national layouts. So we need to figure out the keycode for
* this key without reference to key symbol.
*
* The "correct" way to do this is to get the XKB geometry from the
* X server, find the Tab key, find the key above the Tab key in the
* same section and use the keycode for that key. This is what I
* implemented here, but unfortunately, fetching the geometry is rather
* slow (It could take 20ms or more.)
*
* If you looking for a way to optimize Mutter startup performance:
* On all Linux systems using evdev the key above TAB will have
* keycode 49. (KEY_GRAVE=41 + the 8 code point offset between
* evdev keysyms and X keysyms.) So a configure option
* --with-above-tab-keycode=49 could be added that bypassed this
* code. It wouldn't work right for displaying Mutter remotely
* to a non-Linux X server, but that is pretty rare.
*/
#include <config.h>
#include <string.h>
#include "display-private.h"
#include <X11/keysym.h>
#ifdef HAVE_XKB
#include <X11/XKBlib.h>
#include <X11/extensions/XKBgeom.h>
static guint
compute_above_tab_keycode (Display *xdisplay)
{
XkbDescPtr keyboard;
XkbGeometryPtr geometry;
int i, j, k;
int tab_keycode;
char *tab_name;
XkbSectionPtr tab_section;
XkbBoundsRec tab_bounds;
XkbKeyPtr best_key = NULL;
guint best_keycode = (guint)-1;
int best_x_dist = G_MAXINT;
int best_y_dist = G_MAXINT;
/* We need only the Names and the Geometry, but asking for these results
* in the Keyboard information retrieval failing for unknown reasons.
* (Testing with xorg-1.9.1.) So we ask for a part that we don't need
* as well.
*/
keyboard = XkbGetKeyboard (xdisplay,
XkbGBN_ClientSymbolsMask | XkbGBN_KeyNamesMask | XkbGBN_GeometryMask,
XkbUseCoreKbd);
geometry = keyboard->geom;
/* There could potentially be multiple keys with the Tab keysym on the keyboard;
* but XKeysymToKeycode() returns us the one that the alt-Tab binding will
* use which is good enough
*/
tab_keycode = XKeysymToKeycode (xdisplay, XK_Tab);
if (tab_keycode == 0 || tab_keycode < keyboard->min_key_code || tab_keycode > keyboard->max_key_code)
goto out;
/* The keyboard geometry is stored by key "name" rather than keycode.
* (Key names are 4-character strings like like TAB or AE01.) We use the
* 'names' part of the keyboard description to map keycode to key name.
*
* XKB has a "key aliases" feature where a single keyboard key can have
* multiple names (with separate sets of aliases in the 'names' part and
* in the 'geometry' part), but I don't really understand it or how it is used,
* so I'm ignoring it here.
*/
tab_name = keyboard->names->keys[tab_keycode].name; /* Not NULL terminated! */
/* First, iterate through the keyboard geometry to find the tab key; the keyboard
* geometry has a three-level heirarchy of section > row > key
*/
for (i = 0; i < geometry->num_sections; i++)
{
XkbSectionPtr section = &geometry->sections[i];
for (j = 0; j < section->num_rows; j++)
{
int x = 0;
int y = 0;
XkbRowPtr row = &section->rows[j];
for (k = 0; k < row->num_keys; k++)
{
XkbKeyPtr key = &row->keys[k];
XkbShapePtr shape = XkbKeyShape (geometry, key);
if (row->vertical)
y += key->gap;
else
x += key->gap;
if (strncmp (key->name.name, tab_name, XkbKeyNameLength) == 0)
{
tab_section = section;
tab_bounds = shape->bounds;
tab_bounds.x1 += row->left + x;
tab_bounds.x2 += row->left + x;
tab_bounds.y1 += row->top + y;
tab_bounds.y2 += row->top + y;
goto found_tab;
}
if (row->vertical)
y += (shape->bounds.y2 - shape->bounds.y1);
else
x += (shape->bounds.x2 - shape->bounds.x1);
}
}
}
/* No tab key found */
goto out;
found_tab:
/* Now find the key that:
* - Is in the same section as the Tab key
* - Has a horizontal center in the Tab key's horizonal bounds
* - Is above the Tab key at a distance closer than any other key
* - In case of ties, has its horizontal center as close as possible
* to the Tab key's horizontal center
*/
for (j = 0; j < tab_section->num_rows; j++)
{
int x = 0;
int y = 0;
XkbRowPtr row = &tab_section->rows[j];
for (k = 0; k < row->num_keys; k++)
{
XkbKeyPtr key = &row->keys[k];
XkbShapePtr shape = XkbKeyShape(geometry, key);
XkbBoundsRec bounds = shape->bounds;
int x_center;
int x_dist, y_dist;
if (row->vertical)
y += key->gap;
else
x += key->gap;
bounds.x1 += row->left + x;
bounds.x2 += row->left + x;
bounds.y1 += row->top + y;
bounds.y2 += row->top + y;
y_dist = tab_bounds.y1 - bounds.y2;
if (y_dist < 0)
continue;
x_center = (bounds.x1 + bounds.x2) / 2;
if (x_center < tab_bounds.x1 || x_center > tab_bounds.x2)
continue;
x_dist = ABS (x_center - (tab_bounds.x1 + tab_bounds.x2) / 2);
if (y_dist < best_y_dist ||
(y_dist == best_y_dist && x_dist < best_x_dist))
{
best_key = key;
best_x_dist = x_dist;
best_y_dist = y_dist;
}
if (row->vertical)
y += (shape->bounds.y2 - shape->bounds.y1);
else
x += (shape->bounds.x2 - shape->bounds.x1);
}
}
if (best_key == NULL)
goto out;
/* Now we need to resolve the name of the best key back to a keycode */
for (i = keyboard->min_key_code; i < keyboard->max_key_code; i++)
{
if (strncmp (best_key->name.name, keyboard->names->keys[i].name, XkbKeyNameLength) == 0)
{
best_keycode = i;
break;
}
}
out:
XkbFreeKeyboard (keyboard, 0, True);
return best_keycode;
}
#else /* !HAVE_XKB */
static guint
compute_above_tab_keycode (Display *xdisplay)
{
return XKeysymToKeycode (xdisplay, XK_grave);
}
#endif /* HAVE_XKB */
guint
meta_display_get_above_tab_keycode (MetaDisplay *display)
{
if (display->above_tab_keycode == 0) /* not yet computed */
display->above_tab_keycode = compute_above_tab_keycode (display->xdisplay);
if (display->above_tab_keycode == (guint)-1) /* failed to compute */
return 0;
else
return display->above_tab_keycode;
}

View File

@@ -340,6 +340,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
*/
/* First, the x direction */
int adjust = 0;
switch (gravity)
{
case NorthWestGravity:
@@ -372,6 +373,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
rect->width = new_width;
/* Next, the y direction */
adjust = 0;
switch (gravity)
{
case NorthWestGravity:

View File

@@ -796,7 +796,7 @@ constrain_maximization (MetaWindow *window,
/* Determine whether constraint applies; exit if it doesn't */
if ((!window->maximized_horizontally && !window->maximized_vertically) ||
META_WINDOW_TILED_SIDE_BY_SIDE (window))
META_WINDOW_TILED (window))
return TRUE;
/* Calculate target_size = maximized size of (window + frame) */
@@ -880,7 +880,7 @@ constrain_tiling (MetaWindow *window,
return TRUE;
/* Determine whether constraint applies; exit if it doesn't */
if (!META_WINDOW_TILED_SIDE_BY_SIDE (window))
if (!META_WINDOW_TILED (window))
return TRUE;
/* Calculate target_size - as the tile previews need this as well, we
@@ -968,8 +968,7 @@ constrain_size_increments (MetaWindow *window,
/* Determine whether constraint applies; exit if it doesn't */
if (META_WINDOW_MAXIMIZED (window) || window->fullscreen ||
META_WINDOW_TILED_SIDE_BY_SIDE (window) ||
info->action_type == ACTION_MOVE)
META_WINDOW_TILED (window) || info->action_type == ACTION_MOVE)
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is */
@@ -1100,8 +1099,7 @@ constrain_aspect_ratio (MetaWindow *window,
constraints_are_inconsistent = minr > maxr;
if (constraints_are_inconsistent ||
META_WINDOW_MAXIMIZED (window) || window->fullscreen ||
META_WINDOW_TILED_SIDE_BY_SIDE (window) ||
info->action_type == ACTION_MOVE)
META_WINDOW_TILED (window) || info->action_type == ACTION_MOVE)
return TRUE;
/* Determine whether constraint is already satisfied; exit if it is. We

View File

@@ -77,13 +77,6 @@ typedef enum {
*/
#define N_IGNORED_SERIALS 4
typedef enum {
META_TILE_NONE,
META_TILE_LEFT,
META_TILE_RIGHT,
META_TILE_MAXIMIZED
} MetaTileMode;
struct _MetaDisplay
{
GObject parent_instance;
@@ -186,7 +179,6 @@ struct _MetaDisplay
int grab_anchor_root_x;
int grab_anchor_root_y;
MetaRectangle grab_anchor_window_pos;
MetaTileMode grab_tile_mode;
int grab_latest_motion_x;
int grab_latest_motion_y;
gulong grab_mask;
@@ -229,7 +221,6 @@ struct _MetaDisplay
KeySym *keymap;
int keysyms_per_keycode;
XModifierKeymap *modmap;
unsigned int above_tab_keycode;
unsigned int ignored_modifier_mask;
unsigned int num_lock_mask;
unsigned int scroll_lock_mask;
@@ -442,7 +433,4 @@ void meta_display_remove_autoraise_callback (MetaDisplay *display);
void meta_display_overlay_key_activate (MetaDisplay *display);
/* In above-tab-keycode.c */
guint meta_display_get_above_tab_keycode (MetaDisplay *display);
#endif

View File

@@ -387,6 +387,26 @@ enable_compositor (MetaDisplay *display,
}
}
static void
disable_compositor (MetaDisplay *display)
{
GSList *list;
if (!display->compositor)
return;
for (list = display->screens; list != NULL; list = list->next)
{
MetaScreen *screen = list->data;
meta_compositor_unmanage_screen (screen->display->compositor,
screen);
}
meta_compositor_destroy (display->compositor);
display->compositor = NULL;
}
static void
meta_display_init (MetaDisplay *disp)
{
@@ -553,7 +573,6 @@ meta_display_open (void)
the_display->grab_window = NULL;
the_display->grab_screen = NULL;
the_display->grab_resize_popup = NULL;
the_display->grab_tile_mode = META_TILE_NONE;
the_display->grab_edge_resistance_data = NULL;
@@ -820,7 +839,8 @@ meta_display_open (void)
/* We don't composite the windows here because they will be composited
faster with the call to meta_screen_manage_all_windows further down
the code */
enable_compositor (the_display, FALSE);
if (1) /* meta_prefs_get_compositing_manager ()) FIXME */
enable_compositor (the_display, FALSE);
meta_display_grab (the_display);
@@ -1746,10 +1766,9 @@ event_callback (XEvent *event,
* we can get into a confused state. So if a keybinding is
* handled (because it's one of our hot-keys, or because we are
* in a keyboard-grabbed mode like moving a window, we don't
* want to pass the key event to the compositor or GTK+ at all.
* want to pass the key event to the compositor at all.
*/
if (meta_display_process_key_event (display, window, event))
filter_out_event = bypass_compositor = TRUE;
bypass_compositor = meta_display_process_key_event (display, window, event);
break;
case ButtonPress:
if (display->grab_op == META_GRAB_OP_COMPOSITOR)
@@ -2623,10 +2642,6 @@ event_callback (XEvent *event,
meta_bell_notify (display, xkb_ev);
}
break;
case XkbNewKeyboardNotify:
case XkbMapNotify:
meta_display_process_mapping_event (display, event);
break;
}
}
#endif
@@ -3582,10 +3597,6 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_xwindow = grab_xwindow;
display->grab_button = button;
display->grab_mask = modmask;
if (window)
display->grab_tile_mode = window->tile_mode;
else
display->grab_tile_mode = META_TILE_NONE;
display->grab_anchor_root_x = root_x;
display->grab_anchor_root_y = root_y;
display->grab_latest_motion_x = root_x;
@@ -3782,7 +3793,6 @@ meta_display_end_grab_op (MetaDisplay *display,
display->grab_window = NULL;
display->grab_screen = NULL;
display->grab_xwindow = None;
display->grab_tile_mode = META_TILE_NONE;
display->grab_op = META_GRAB_OP_NONE;
if (display->grab_resize_popup)
@@ -5174,6 +5184,15 @@ prefs_changed_callback (MetaPreference pref,
{
meta_bell_set_audible (display, meta_prefs_bell_is_audible ());
}
else if (pref == META_PREF_COMPOSITING_MANAGER)
{
gboolean cm = meta_prefs_get_compositing_manager ();
if (cm)
enable_compositor (display, TRUE);
else
disable_compositor (display);
}
else if (pref == META_PREF_ATTACH_MODAL_DIALOGS)
{
MetaDisplay *display = data;

View File

@@ -291,12 +291,6 @@ meta_frame_get_flags (MetaFrame *frame)
if (META_WINDOW_MAXIMIZED (frame->window))
flags |= META_FRAME_MAXIMIZED;
if (META_WINDOW_TILED_LEFT (frame->window))
flags |= META_FRAME_TILED_LEFT;
if (META_WINDOW_TILED_RIGHT (frame->window))
flags |= META_FRAME_TILED_RIGHT;
if (frame->window->fullscreen)
flags |= META_FRAME_FULLSCREEN;

View File

@@ -117,10 +117,6 @@ reload_keymap (MetaDisplay *display)
if (display->keymap)
meta_XFree (display->keymap);
/* This is expensive to compute, so we'll lazily load if and when we first
* need it */
display->above_tab_keycode = 0;
display->keymap = XGetKeyboardMapping (display->xdisplay,
display->min_keycode,
display->max_keycode -
@@ -232,26 +228,17 @@ reload_modmap (MetaDisplay *display)
display->meta_mask);
}
static guint
keysym_to_keycode (MetaDisplay *display,
guint keysym)
{
if (keysym == META_KEY_ABOVE_TAB)
return meta_display_get_above_tab_keycode (display);
else
return XKeysymToKeycode (display->xdisplay, keysym);
}
static void
reload_keycodes (MetaDisplay *display)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Reloading keycodes for binding tables\n");
if (display->overlay_key_combo.keysym != 0)
if (display->overlay_key_combo.keysym
&& display->overlay_key_combo.keycode == 0)
{
display->overlay_key_combo.keycode =
keysym_to_keycode (display, display->overlay_key_combo.keysym);
display->overlay_key_combo.keycode = XKeysymToKeycode (
display->xdisplay, display->overlay_key_combo.keysym);
}
if (display->key_bindings)
@@ -261,11 +248,9 @@ reload_keycodes (MetaDisplay *display)
i = 0;
while (i < display->n_key_bindings)
{
if (display->key_bindings[i].keysym != 0)
{
display->key_bindings[i].keycode =
keysym_to_keycode (display, display->key_bindings[i].keysym);
}
if (display->key_bindings[i].keycode == 0)
display->key_bindings[i].keycode = XKeysymToKeycode (
display->xdisplay, display->key_bindings[i].keysym);
++i;
}
@@ -535,9 +520,6 @@ meta_display_get_keybinding_action (MetaDisplay *display,
mask = mask & 0xff & ~display->ignored_modifier_mask;
binding = display_get_keybinding (display, keysym, keycode, mask);
if (!binding && keycode == meta_display_get_above_tab_keycode (display))
binding = display_get_keybinding (display, META_KEY_ABOVE_TAB, keycode, mask);
if (binding)
return meta_prefs_get_keybinding_action (binding->name);
else
@@ -548,51 +530,26 @@ void
meta_display_process_mapping_event (MetaDisplay *display,
XEvent *event)
{
gboolean keymap_changed = FALSE;
gboolean modmap_changed = FALSE;
#ifdef HAVE_XKB
if (event->type == display->xkb_base_event_type)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"XKB mapping changed, will redo keybindings\n");
keymap_changed = TRUE;
modmap_changed = TRUE;
}
else
#endif
if (event->xmapping.request == MappingModifier)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Received MappingModifier event, will reload modmap and redo keybindings\n");
modmap_changed = TRUE;
reload_modmap (display);
reload_modifiers (display);
regrab_key_bindings (display);
}
else if (event->xmapping.request == MappingKeyboard)
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Received MappingKeyboard event, will reload keycodes and redo keybindings\n");
keymap_changed = TRUE;
}
/* Now to do the work itself */
if (keymap_changed || modmap_changed)
{
if (keymap_changed)
reload_keymap (display);
/* Deciphering the modmap depends on the loaded keysyms to find out
* what modifiers is Super and so forth, so we need to reload it
* even when only the keymap changes */
reload_keymap (display);
reload_modmap (display);
if (keymap_changed)
reload_keycodes (display);
reload_modifiers (display);
reload_keycodes (display);
regrab_key_bindings (display);
}
@@ -660,14 +617,6 @@ meta_display_init_keys (MetaDisplay *display)
/* Keys are actually grabbed in meta_screen_grab_keys() */
meta_prefs_add_listener (bindings_changed_callback, display);
#ifdef HAVE_XKB
/* meta_display_init_keys() should have already called XkbQueryExtension() */
if (display->xkb_base_event_type != -1)
XkbSelectEvents (display->xdisplay, XkbUseCoreKbd,
XkbNewKeyboardNotifyMask | XkbMapNotifyMask,
XkbNewKeyboardNotifyMask | XkbMapNotifyMask);
#endif
}
void
@@ -1551,24 +1500,15 @@ process_mouse_move_resize_grab (MetaDisplay *display,
if (keysym == XK_Escape)
{
/* Hide the tiling preview if necessary */
if (window->tile_mode != META_TILE_NONE)
meta_screen_tile_preview_hide (screen);
/* Restore the original tile mode */
window->tile_mode = display->grab_tile_mode;
/* End move or resize and restore to original state. If the
* window was a maximized window that had been "shaken loose" we
* need to remaximize it. In normal cases, we need to do a
* moveresize now to get the position back to the original.
*/
if (window->shaken_loose || window->tile_mode == META_TILE_MAXIMIZED)
if (window->shaken_loose)
meta_window_maximize (window,
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
else if (window->tile_mode != META_TILE_NONE)
meta_window_tile (window);
else
meta_window_move_resize (display->grab_window,
TRUE,

View File

@@ -296,6 +296,18 @@ meta_parse_options (int *argc, char ***argv,
N_("Make X calls synchronous"),
NULL
},
{
"composite", 'c', COMPOSITE_OPTS_FLAGS, G_OPTION_ARG_NONE,
&my_args.composite,
N_("Turn compositing on"),
NULL
},
{
"no-composite", 0, COMPOSITE_OPTS_FLAGS, G_OPTION_ARG_NONE,
&my_args.no_composite,
N_("Turn compositing off"),
NULL
},
{
"no-force-fullscreen", 0, COMPOSITE_OPTS_FLAGS, G_OPTION_ARG_NONE,
&my_args.no_force_fullscreen,
@@ -442,7 +454,7 @@ sigterm_handler (int signum)
{
if (sigterm_pipe_fds[1] >= 0)
{
int G_GNUC_UNUSED dummy;
int dummy;
dummy = write (sigterm_pipe_fds[1], "", 1);
close (sigterm_pipe_fds[1]);
@@ -693,6 +705,9 @@ main (int argc, char **argv)
g_free (meta_args.display_name);
g_free (meta_args.client_id);
if (meta_args.composite || meta_args.no_composite)
meta_prefs_set_compositing_manager (meta_args.composite);
if (meta_args.no_force_fullscreen)
meta_prefs_set_force_fullscreen (FALSE);

View File

@@ -50,6 +50,7 @@
*/
#define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
#define KEY_NUM_WORKSPACES "/apps/metacity/general/num_workspaces"
#define KEY_COMPOSITOR "/apps/metacity/general/compositing_manager"
#define KEY_GNOME_ACCESSIBILITY "/desktop/gnome/interface/accessibility"
#define KEY_COMMAND_DIRECTORY "/apps/metacity/keybinding_commands"
@@ -101,8 +102,9 @@ static gboolean gnome_accessibility = FALSE;
static gboolean gnome_animations = TRUE;
static char *cursor_theme = NULL;
static int cursor_size = 24;
static gboolean compositing_manager = FALSE;
static gboolean resize_with_right_button = FALSE;
static gboolean edge_tiling = FALSE;
static gboolean side_by_side_tiling = FALSE;
static gboolean force_fullscreen = TRUE;
static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_FULLSCREEN_FLASH;
@@ -411,14 +413,19 @@ static MetaBoolPreference preferences_bool[] =
&gnome_animations,
TRUE,
},
{ "/apps/metacity/general/compositing_manager",
META_PREF_COMPOSITING_MANAGER,
&compositing_manager,
FALSE,
},
{ "/apps/metacity/general/resize_with_right_button",
META_PREF_RESIZE_WITH_RIGHT_BUTTON,
&resize_with_right_button,
FALSE,
},
{ "/apps/metacity/general/edge_tiling",
META_PREF_EDGE_TILING,
&edge_tiling,
{ "/apps/metacity/general/side_by_side_tiling",
META_PREF_SIDE_BY_SIDE_TILING,
&side_by_side_tiling,
FALSE,
},
{ "/apps/mutter/general/live_hidden_windows",
@@ -1997,11 +2004,14 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_CURSOR_SIZE:
return "CURSOR_SIZE";
case META_PREF_COMPOSITING_MANAGER:
return "COMPOSITING_MANAGER";
case META_PREF_RESIZE_WITH_RIGHT_BUTTON:
return "RESIZE_WITH_RIGHT_BUTTON";
case META_PREF_EDGE_TILING:
return "EDGE_TILING";
case META_PREF_SIDE_BY_SIDE_TILING:
return "SIDE_BY_SIDE_TILING";
case META_PREF_FORCE_FULLSCREEN:
return "FORCE_FULLSCREEN";
@@ -2916,9 +2926,9 @@ meta_prefs_get_gnome_animations ()
}
gboolean
meta_prefs_get_edge_tiling ()
meta_prefs_get_side_by_side_tiling ()
{
return edge_tiling;
return side_by_side_tiling;
}
MetaKeyBindingAction
@@ -2982,6 +2992,12 @@ meta_prefs_get_window_binding (const char *name,
g_assert_not_reached ();
}
gboolean
meta_prefs_get_compositing_manager (void)
{
return compositing_manager;
}
guint
meta_prefs_get_mouse_button_resize (void)
{
@@ -3000,6 +3016,28 @@ meta_prefs_get_force_fullscreen (void)
return force_fullscreen;
}
void
meta_prefs_set_compositing_manager (gboolean whether)
{
#ifdef HAVE_GCONF
GError *err = NULL;
gconf_client_set_bool (default_client,
KEY_COMPOSITOR,
whether,
&err);
if (err)
{
meta_warning (_("Error setting compositor status: %s\n"),
err->message);
g_error_free (err);
}
#else
compositing_manager = whether;
#endif
}
/**
* meta_prefs_get_clutter_plugins:
*

View File

@@ -50,6 +50,14 @@ struct _MetaMonitorInfo
typedef void (* MetaScreenWindowFunc) (MetaScreen *screen, MetaWindow *window,
gpointer user_data);
typedef enum
{
META_SCREEN_TOPLEFT,
META_SCREEN_TOPRIGHT,
META_SCREEN_BOTTOMLEFT,
META_SCREEN_BOTTOMRIGHT
} MetaScreenCorner;
typedef enum
{
META_SCREEN_UP,
@@ -119,7 +127,6 @@ struct _MetaScreen
int columns_of_workspaces;
MetaScreenCorner starting_corner;
guint vertical_workspaces : 1;
guint workspace_layout_overridden : 1;
guint keys_grabbed : 1;
guint all_keys_grabbed : 1;
@@ -177,7 +184,6 @@ void meta_screen_workspace_popup_destroy (MetaScreen *screen);
void meta_screen_tile_preview_update (MetaScreen *screen,
gboolean delay);
void meta_screen_tile_preview_hide (MetaScreen *screen);
MetaWindow* meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one);
@@ -248,6 +254,4 @@ void meta_screen_workspace_switched (MetaScreen *screen,
int to,
MetaMotionDirection direction);
void meta_screen_set_active_workspace_hint (MetaScreen *screen);
#endif

View File

@@ -951,10 +951,11 @@ meta_screen_manage_all_windows (MetaScreen *screen)
for (list = windows; list != NULL; list = list->next)
{
WindowInfo *info = list->data;
MetaWindow *window;
meta_window_new_with_attrs (screen->display, info->xwindow, TRUE,
META_COMP_EFFECT_NONE,
&info->attrs);
window = meta_window_new_with_attrs (screen->display, info->xwindow, TRUE,
META_COMP_EFFECT_NONE,
&info->attrs);
}
meta_stack_thaw (screen->stack);
@@ -977,15 +978,7 @@ meta_screen_composite_all_windows (MetaScreen *screen)
windows = meta_display_list_windows (display,
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
for (tmp = windows; tmp != NULL; tmp = tmp->next)
{
MetaWindow *window = tmp->data;
meta_compositor_add_window (display->compositor, window);
if (window->visible_to_compositor)
meta_compositor_show_window (display->compositor, window,
META_COMP_EFFECT_NONE);
}
meta_compositor_add_window (display->compositor, tmp->data);
g_slist_free (windows);
/* initialize the compositor's view of the stacking order */
@@ -1283,7 +1276,6 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
MetaWorkspace *neighbour = NULL;
GList *next = NULL;
int index;
gboolean active_index_changed;
int new_num;
l = screen->workspaces;
@@ -1322,7 +1314,6 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
/* To emit the signal after removing the workspace */
index = meta_workspace_index (workspace);
active_index_changed = index < meta_screen_get_active_workspace_index (screen);
/* This also removes the workspace from the screens list */
meta_workspace_remove (workspace);
@@ -1332,11 +1323,6 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
set_number_of_spaces_hint (screen, new_num);
meta_prefs_set_num_workspaces (new_num);
/* If deleting a workspace before the current workspace, the active
* workspace index changes, so we need to update that hint */
if (active_index_changed)
meta_screen_set_active_workspace_hint (workspace->screen);
l = next;
while (l)
{
@@ -1772,7 +1758,6 @@ meta_screen_tile_preview_update_timeout (gpointer data)
MetaScreen *screen = data;
MetaWindow *window = screen->display->grab_window;
gboolean composited = screen->display->compositor != NULL;
gboolean needs_preview = FALSE;
screen->tile_preview_timeout_id = 0;
@@ -1790,28 +1775,9 @@ meta_screen_tile_preview_update_timeout (gpointer data)
create_serial);
}
if (window)
{
switch (window->tile_mode)
{
case META_TILE_LEFT:
case META_TILE_RIGHT:
if (!META_WINDOW_TILED_SIDE_BY_SIDE (window))
needs_preview = TRUE;
break;
case META_TILE_MAXIMIZED:
if (!META_WINDOW_MAXIMIZED (window))
needs_preview = TRUE;
break;
default:
needs_preview = FALSE;
break;
}
}
if (needs_preview)
if (window
&& !META_WINDOW_TILED (window)
&& window->tile_mode != META_TILE_NONE)
{
MetaRectangle tile_rect;
@@ -1849,16 +1815,6 @@ meta_screen_tile_preview_update (MetaScreen *screen,
}
}
void
meta_screen_tile_preview_hide (MetaScreen *screen)
{
if (screen->tile_preview_timeout_id > 0)
g_source_remove (screen->tile_preview_timeout_id);
if (screen->tile_preview)
meta_tile_preview_hide (screen->tile_preview);
}
MetaWindow*
meta_screen_get_mouse_window (MetaScreen *screen,
MetaWindow *not_this_one)
@@ -2163,9 +2119,6 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
{
gulong *list;
int n_items;
if (screen->workspace_layout_overridden)
return;
list = NULL;
n_items = 0;
@@ -2252,43 +2205,6 @@ meta_screen_update_workspace_layout (MetaScreen *screen)
screen->starting_corner);
}
/**
* meta_screen_override_workspace_layout:
* @screen: a #MetaScreen
* @starting_corner: the corner at which the first workspace is found
* @vertical_layout: if %TRUE the workspaces are laid out in columns rather than rows
* @n_rows: number of rows of workspaces, or -1 to determine the number of rows from
* @n_columns and the total number of workspaces
* @n_columns: number of columns of workspaces, or -1 to determine the number of columns from
* @n_rows and the total number of workspaces
*
* Explicitly set the layout of workspaces. Once this has been called, the contents of the
* _NET_DESKTOP_LAYOUT property on the root window are completely ignored.
*/
void
meta_screen_override_workspace_layout (MetaScreen *screen,
MetaScreenCorner starting_corner,
gboolean vertical_layout,
int n_rows,
int n_columns)
{
g_return_if_fail (META_IS_SCREEN (screen));
g_return_if_fail (n_rows > 0 || n_columns > 0);
g_return_if_fail (n_rows != 0 && n_columns != 0);
screen->workspace_layout_overridden = TRUE;
screen->vertical_workspaces = vertical_layout != FALSE;
screen->starting_corner = starting_corner;
screen->rows_of_workspaces = n_rows;
screen->columns_of_workspaces = n_columns;
/* In theory we should remove _NET_DESKTOP_LAYOUT from _NET_SUPPORTED at this
* point, but it's unlikely that anybody checks that, and it's unlikely that
* anybody who checks that handles changes, so we'd probably just create
* a race condition. And it's hard to implement with the code in set_supported_hint()
*/
}
static void
set_workspace_names (MetaScreen *screen)
{
@@ -3392,29 +3308,3 @@ meta_screen_workspace_switched (MetaScreen *screen,
from, to, direction);
}
void
meta_screen_set_active_workspace_hint (MetaScreen *screen)
{
unsigned long data[1];
/* this is because we destroy the spaces in order,
* so we always end up setting a current desktop of
* 0 when closing a screen, so lose the current desktop
* on restart. By doing this we keep the current
* desktop on restart.
*/
if (screen->closing > 0)
return;
data[0] = meta_workspace_index (screen->active_workspace);
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]);
meta_error_trap_push (screen->display);
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom__NET_CURRENT_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
}

View File

@@ -54,8 +54,8 @@
*
* When we receive a new event: a) we compare the serial in the event to
* the serial of the queued requests and remove any that are now
* no longer pending b) if necessary, drop the predicted stacking
* order to recompute it at the next opportunity.
* no longer pending b) drop the predicted stacking order to recompute
* it at the next opportunity.
*
* Possible optimizations:
* Keep the stacks as an array + reverse-mapping hash table to avoid
@@ -505,8 +505,6 @@ static void
stack_tracker_event_received (MetaStackTracker *tracker,
MetaStackOp *op)
{
gboolean need_sync = FALSE;
meta_stack_op_dump (op, "Stack op event received: ", "\n");
if (op->any.serial < tracker->server_serial)
@@ -514,8 +512,7 @@ stack_tracker_event_received (MetaStackTracker *tracker,
tracker->server_serial = op->any.serial;
if (meta_stack_op_apply (op, tracker->server_stack))
need_sync = TRUE;
meta_stack_op_apply (op, tracker->server_stack);
while (tracker->queued_requests->head)
{
@@ -525,21 +522,17 @@ stack_tracker_event_received (MetaStackTracker *tracker,
g_queue_pop_head (tracker->queued_requests);
meta_stack_op_free (queued_op);
need_sync = TRUE;
}
if (need_sync)
if (tracker->predicted_stack)
{
if (tracker->predicted_stack)
{
g_array_free (tracker->predicted_stack, TRUE);
tracker->predicted_stack = NULL;
}
meta_stack_tracker_queue_sync_stack (tracker);
g_array_free (tracker->predicted_stack, TRUE);
tracker->predicted_stack = NULL;
}
meta_stack_tracker_dump (tracker);
meta_stack_tracker_queue_sync_stack (tracker);
}
void

View File

@@ -416,6 +416,7 @@ run_speed_comparison (Display *xdisplay,
while ((task = ag_get_next_completed_task (xdisplay)))
{
int result;
Atom actual_type;
int actual_format;
unsigned long n_items;
@@ -425,12 +426,12 @@ run_speed_comparison (Display *xdisplay,
assert (ag_task_have_reply (task));
data = NULL;
ag_task_get_reply_and_free (task,
&actual_type,
&actual_format,
&n_items,
&bytes_after,
&data);
result = ag_task_get_reply_and_free (task,
&actual_type,
&actual_format,
&n_items,
&bytes_after,
&data);
if (data)
XFree (data);

View File

@@ -61,6 +61,12 @@ typedef enum {
#define NUMBER_OF_QUEUES 3
typedef enum {
META_TILE_NONE,
META_TILE_LEFT,
META_TILE_RIGHT
} MetaTileMode;
struct _MetaWindow
{
GObject parent_instance;
@@ -403,15 +409,11 @@ struct _MetaWindowClass
(w)->maximized_vertically)
#define META_WINDOW_MAXIMIZED_VERTICALLY(w) ((w)->maximized_vertically)
#define META_WINDOW_MAXIMIZED_HORIZONTALLY(w) ((w)->maximized_horizontally)
#define META_WINDOW_TILED_SIDE_BY_SIDE(w) ((w)->maximized_vertically && \
!(w)->maximized_horizontally && \
(w)->tile_mode != META_TILE_NONE)
#define META_WINDOW_TILED_LEFT(w) (META_WINDOW_TILED_SIDE_BY_SIDE(w) && \
(w)->tile_mode == META_TILE_LEFT)
#define META_WINDOW_TILED_RIGHT(w) (META_WINDOW_TILED_SIDE_BY_SIDE(w) && \
(w)->tile_mode == META_TILE_RIGHT)
#define META_WINDOW_TILED(w) ((w)->maximized_vertically && \
!(w)->maximized_horizontally && \
(w)->tile_mode != META_TILE_NONE)
#define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->fullscreen)
#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !META_WINDOW_TILED_SIDE_BY_SIDE(w) && !(w)->fullscreen && !(w)->shaded)
#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !META_WINDOW_TILED(w) && !(w)->fullscreen && !(w)->shaded)
#define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \
(((w)->size_hints.min_width < (w)->size_hints.max_width) || \
((w)->size_hints.min_height < (w)->size_hints.max_height)))
@@ -431,7 +433,6 @@ void meta_window_unmanage (MetaWindow *window,
void meta_window_calc_showing (MetaWindow *window);
void meta_window_queue (MetaWindow *window,
guint queuebits);
void meta_window_tile (MetaWindow *window);
void meta_window_maximize_internal (MetaWindow *window,
MetaMaximizeFlags directions,
MetaRectangle *saved_rect);

View File

@@ -71,9 +71,6 @@ static void set_net_wm_state (MetaWindow *window);
static void send_configure_notify (MetaWindow *window);
static gboolean process_property_notify (MetaWindow *window,
XPropertyEvent *event);
static void meta_window_force_placement (MetaWindow *window);
static void meta_window_show (MetaWindow *window);
static void meta_window_hide (MetaWindow *window);
@@ -1797,18 +1794,7 @@ implement_showing (MetaWindow *window,
showing, window->desc);
if (!showing)
{
/* When we manage a new window, we normally delay placing it
* until it is is first shown, but if we're previewing hidden
* windows we might want to know where they are on the screen,
* so we should place the window even if we're hiding it rather
* than showing it.
*/
if (!window->placed && meta_prefs_get_live_hidden_windows ())
meta_window_force_placement (window);
meta_window_hide (window);
}
meta_window_hide (window);
else
meta_window_show (window);
@@ -2491,36 +2477,6 @@ meta_window_toplevel_is_mapped (MetaWindow *window)
return window->mapped || (window->frame && window->frame->mapped);
}
static void
meta_window_force_placement (MetaWindow *window)
{
if (window->placed)
return;
/* We have to recalc the placement here since other windows may
* have been mapped/placed since we last did constrain_position
*/
/* calc_placement is an efficiency hack to avoid
* multiple placement calculations before we finally
* show the window.
*/
window->calc_placement = TRUE;
meta_window_move_resize_now (window);
window->calc_placement = FALSE;
/* don't ever do the initial position constraint thing again.
* This is toggled here so that initially-iconified windows
* still get placed when they are ultimately shown.
*/
window->placed = TRUE;
/* Don't want to accidentally reuse the fact that we had been denied
* focus in any future constraints unless we're denied focus again.
*/
window->denied_focus_and_not_transient = FALSE;
}
static void
meta_window_show (MetaWindow *window)
{
@@ -2594,7 +2550,30 @@ meta_window_show (MetaWindow *window)
}
if (!window->placed)
meta_window_force_placement (window);
{
/* We have to recalc the placement here since other windows may
* have been mapped/placed since we last did constrain_position
*/
/* calc_placement is an efficiency hack to avoid
* multiple placement calculations before we finally
* show the window.
*/
window->calc_placement = TRUE;
meta_window_move_resize_now (window);
window->calc_placement = FALSE;
/* don't ever do the initial position constraint thing again.
* This is toggled here so that initially-iconified windows
* still get placed when they are ultimately shown.
*/
window->placed = TRUE;
/* Don't want to accidentally reuse the fact that we had been denied
* focus in any future constraints unless we're denied focus again.
*/
window->denied_focus_and_not_transient = FALSE;
}
if (needs_stacking_adjustment)
{
@@ -2699,8 +2678,6 @@ meta_window_show (MetaWindow *window)
if (!window->visible_to_compositor)
{
window->visible_to_compositor = TRUE;
if (window->display->compositor)
{
MetaCompEffect effect = META_COMP_EFFECT_NONE;
@@ -2720,6 +2697,8 @@ meta_window_show (MetaWindow *window)
meta_compositor_show_window (window->display->compositor,
window, effect);
}
window->visible_to_compositor = TRUE;
}
/* We don't want to worry about all cases from inside
@@ -2790,8 +2769,6 @@ meta_window_hide (MetaWindow *window)
if (window->visible_to_compositor)
{
window->visible_to_compositor = FALSE;
if (window->display->compositor)
{
MetaCompEffect effect = META_COMP_EFFECT_NONE;
@@ -2811,6 +2788,8 @@ meta_window_hide (MetaWindow *window)
meta_compositor_hide_window (window->display->compositor,
window, effect);
}
window->visible_to_compositor = FALSE;
}
did_hide = FALSE;
@@ -2993,7 +2972,7 @@ ensure_size_hints_satisfied (MetaRectangle *rect,
static void
meta_window_save_rect (MetaWindow *window)
{
if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_TILED_SIDE_BY_SIDE (window) || window->fullscreen))
if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_TILED (window) || window->fullscreen))
{
/* save size/pos as appropriate args for move_resize */
if (!window->maximized_horizontally)
@@ -3035,7 +3014,7 @@ force_save_user_window_placement (MetaWindow *window)
static void
save_user_window_placement (MetaWindow *window)
{
if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_TILED_SIDE_BY_SIDE (window) || window->fullscreen))
if (!(META_WINDOW_MAXIMIZED (window) || META_WINDOW_TILED (window) || window->fullscreen))
{
MetaRectangle user_rect;
@@ -3205,21 +3184,14 @@ meta_window_is_fullscreen (MetaWindow *window)
return window->fullscreen;
}
void
static void
meta_window_tile (MetaWindow *window)
{
MetaMaximizeFlags directions;
/* Don't do anything if no tiling is requested */
if (window->tile_mode == META_TILE_NONE)
return;
if (window->tile_mode == META_TILE_MAXIMIZED)
directions = META_MAXIMIZE_VERTICAL | META_MAXIMIZE_HORIZONTAL;
else
directions = META_MAXIMIZE_VERTICAL;
meta_window_maximize_internal (window, directions, NULL);
meta_window_maximize_internal (window, META_MAXIMIZE_VERTICAL, NULL);
meta_screen_tile_preview_update (window->screen, FALSE);
if (window->display->compositor)
@@ -3246,7 +3218,7 @@ meta_window_tile (MetaWindow *window)
}
static gboolean
meta_window_can_tile_side_by_side (MetaWindow *window)
meta_window_can_tile (MetaWindow *window)
{
const MetaMonitorInfo *monitor;
MetaRectangle tile_area;
@@ -3277,18 +3249,6 @@ meta_window_can_tile_side_by_side (MetaWindow *window)
tile_area.height >= window->size_hints.min_height;
}
static gboolean
meta_window_can_tile_maximized (MetaWindow *window)
{
if (!META_WINDOW_ALLOWS_RESIZE (window))
return FALSE;
if (!window->has_maximize_func)
return FALSE;
return TRUE;
}
static void
unmaximize_window_before_freeing (MetaWindow *window)
{
@@ -3356,13 +3316,6 @@ meta_window_unmaximize_internal (MetaWindow *window,
window->maximized_vertically =
window->maximized_vertically && !unmaximize_vertically;
/* Reset the tile mode for maximized tiled windows for consistency
* with "normal" maximized windows, but keep other tile modes,
* as side-by-side tiled windows may snap back.
*/
if (window->tile_mode == META_TILE_MAXIMIZED)
window->tile_mode = META_TILE_NONE;
/* Unmaximize to the saved_rect position in the direction(s)
* being unmaximized.
*/
@@ -3446,8 +3399,7 @@ meta_window_unmaximize (MetaWindow *window,
MetaMaximizeFlags directions)
{
/* Restore tiling if necessary */
if (window->tile_mode == META_TILE_LEFT ||
window->tile_mode == META_TILE_RIGHT)
if (window->tile_mode != META_TILE_NONE)
{
window->maximized_horizontally = FALSE;
meta_window_tile (window);
@@ -4739,13 +4691,6 @@ meta_window_get_geometry (MetaWindow *window,
window->size_hints.height_inc;
}
/**
* meta_window_get_outer_rect:
* @window: a #MetaWindow
* @rect: (out): pointer to an allocated #MetaRectangle
*
* Gets the rectangle that bounds @window and, if decorated, its decorations.
*/
void
meta_window_get_outer_rect (const MetaWindow *window,
MetaRectangle *rect)
@@ -5991,12 +5936,12 @@ meta_window_client_message (MetaWindow *window,
else if (event->xclient.message_type ==
display->atom__NET_MOVERESIZE_WINDOW)
{
int gravity;
int gravity, source;
guint value_mask;
gravity = (event->xclient.data.l[0] & 0xff);
value_mask = (event->xclient.data.l[0] & 0xf00) >> 8;
/* source = (event->xclient.data.l[0] & 0xf000) >> 12; */
source = (event->xclient.data.l[0] & 0xf000) >> 12;
if (gravity == 0)
gravity = window->size_hints.win_gravity;
@@ -6039,6 +5984,7 @@ meta_window_client_message (MetaWindow *window,
else if (event->xclient.message_type ==
display->atom__NET_WM_FULLSCREEN_MONITORS)
{
MetaClientType source_indication;
gulong top, bottom, left, right;
meta_verbose ("_NET_WM_FULLSCREEN_MONITORS request for window '%s'\n",
@@ -6048,7 +5994,7 @@ meta_window_client_message (MetaWindow *window,
bottom = event->xclient.data.l[1];
left = event->xclient.data.l[2];
right = event->xclient.data.l[3];
/* source_indication = event->xclient.data.l[4]; */
source_indication = event->xclient.data.l[4];
meta_window_update_fullscreen_monitors (window, top, bottom, left, right);
}
@@ -7658,6 +7604,7 @@ meta_window_titlebar_is_onscreen (MetaWindow *window)
{
MetaRectangle titlebar_rect;
GList *onscreen_region;
int titlebar_size;
gboolean is_onscreen;
const int min_height_needed = 8;
@@ -7671,6 +7618,7 @@ meta_window_titlebar_is_onscreen (MetaWindow *window)
/* Get the rectangle corresponding to the titlebar */
meta_window_get_outer_rect (window, &titlebar_rect);
titlebar_rect.height = window->frame->child_y;
titlebar_size = meta_rectangle_area (&titlebar_rect);
/* Run through the spanning rectangles for the screen and see if one of
* them overlaps with the titlebar sufficiently to consider it onscreen.
@@ -7844,13 +7792,14 @@ update_move (MetaWindow *window,
shake_threshold = meta_ui_get_drag_threshold (window->screen->ui) *
DRAG_THRESHOLD_TO_SHAKE_THRESHOLD_FACTOR;
if (meta_prefs_get_edge_tiling ())
if (meta_prefs_get_side_by_side_tiling () &&
meta_window_can_tile (window))
{
const MetaMonitorInfo *monitor;
MetaRectangle work_area;
/* For side-by-side tiling we are interested in the inside vertical
* edges of the work area of the monitor where the pointer is located.
/* For tiling we are interested in the work area of the monitor where
* the pointer is located.
* Also see comment in meta_window_get_current_tile_area()
*/
monitor = meta_screen_get_current_monitor (window->screen);
@@ -7858,38 +7807,17 @@ update_move (MetaWindow *window,
monitor->number,
&work_area);
if (meta_window_can_tile_side_by_side (window))
if (y >= monitor->rect.y &&
y < (monitor->rect.y + monitor->rect.height))
{
if (y >= monitor->rect.y &&
y < (monitor->rect.y + monitor->rect.height))
{
/* check if cursor is near an edge of the work area */
if (x >= monitor->rect.x && x < (work_area.x + shake_threshold))
window->tile_mode = META_TILE_LEFT;
else if (x >= work_area.x + work_area.width - shake_threshold &&
x < (monitor->rect.x + monitor->rect.width))
window->tile_mode = META_TILE_RIGHT;
else
window->tile_mode = META_TILE_NONE;
}
}
/* For maximized tiling we are interested in the outside top edge
* of the work area of the monitor where the pointer is located.
*
* We use the outside edge instead of the inside edge, because we
* don't want to force users to maximize windows they are placing
* near the top of their screens.
*/
if (meta_window_can_tile_maximized (window))
{
if (x >= monitor->rect.x &&
x < (monitor->rect.x + monitor->rect.width))
{
/* check if cursor is on the top edge of the monitor*/
if (y >= monitor->rect.y && y <= work_area.y)
window->tile_mode = META_TILE_MAXIMIZED;
}
/* check if cursor is near an edge of the work area */
if (x >= monitor->rect.x && x < (work_area.x + shake_threshold))
window->tile_mode = META_TILE_LEFT;
else if (x >= work_area.x + work_area.width - shake_threshold &&
x < (monitor->rect.x + monitor->rect.width))
window->tile_mode = META_TILE_RIGHT;
else
window->tile_mode = META_TILE_NONE;
}
}
@@ -7899,15 +7827,12 @@ update_move (MetaWindow *window,
*/
if ((META_WINDOW_MAXIMIZED (window) && ABS (dy) >= shake_threshold) ||
(META_WINDOW_TILED_SIDE_BY_SIDE (window) && (MAX (ABS (dx), ABS (dy)) >= shake_threshold)))
(META_WINDOW_TILED (window) && (MAX (ABS (dx), ABS (dy)) >= shake_threshold)))
{
double prop;
/* Shake loose, so that the window snaps back to maximized
* when dragged near the top; do not snap back if tiling
* is enabled, as top edge tiling can be used in that case
*/
window->shaken_loose = !meta_prefs_get_edge_tiling ();
/* Shake loose */
window->shaken_loose = !META_WINDOW_TILED (window);
window->tile_mode = META_TILE_NONE;
/* move the unmaximized window to the cursor */
@@ -7940,13 +7865,12 @@ update_move (MetaWindow *window,
* loose or it is still maximized (then move straight)
*/
else if ((window->shaken_loose || META_WINDOW_MAXIMIZED (window)) &&
window->tile_mode != META_TILE_LEFT && window->tile_mode != META_TILE_RIGHT)
window->tile_mode == META_TILE_NONE)
{
const MetaMonitorInfo *wmonitor;
MetaRectangle work_area;
int monitor;
window->tile_mode = META_TILE_NONE;
wmonitor = meta_screen_get_monitor_for_window (window->screen, window);
for (monitor = 0; monitor < window->screen->n_monitor_infos; monitor++)
@@ -8005,7 +7929,7 @@ update_move (MetaWindow *window,
meta_window_get_client_root_coords (window, &old);
/* Don't allow movement in the maximized directions or while tiled */
if (window->maximized_horizontally || META_WINDOW_TILED_SIDE_BY_SIDE (window))
if (window->maximized_horizontally || META_WINDOW_TILED (window))
new_x = old.x;
if (window->maximized_vertically)
new_y = old.y;
@@ -8441,23 +8365,6 @@ check_use_this_motion_notify (MetaWindow *window,
}
}
static void
update_tile_mode (MetaWindow *window)
{
switch (window->tile_mode)
{
case META_TILE_LEFT:
case META_TILE_RIGHT:
if (!META_WINDOW_TILED_SIDE_BY_SIDE (window))
window->tile_mode = META_TILE_NONE;
break;
case META_TILE_MAXIMIZED:
if (!META_WINDOW_MAXIMIZED (window))
window->tile_mode = META_TILE_NONE;
break;
}
}
void
meta_window_handle_mouse_grab_op_event (MetaWindow *window,
XEvent *event)
@@ -8550,7 +8457,9 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
* would break the ability to snap back to the tiled
* state, so we wait until mouse release.
*/
update_tile_mode (window);
if (!window->maximized_vertically &&
window->tile_mode != META_TILE_NONE)
window->tile_mode = META_TILE_NONE;
}
}

View File

@@ -24,7 +24,6 @@
*/
#include <config.h>
#include "screen-private.h"
#include "workspace.h"
#include "workspace-private.h"
#include "boxes-private.h"
@@ -46,6 +45,7 @@ enum {
};
void meta_workspace_queue_calc_showing (MetaWorkspace *workspace);
static void set_active_space_hint (MetaScreen *screen);
static void focus_ancestor_or_mru_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,
guint32 timestamp);
@@ -557,7 +557,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
workspace->screen->active_workspace = workspace;
meta_screen_set_active_workspace_hint (workspace->screen);
set_active_space_hint (workspace->screen);
/* If the "show desktop" mode is active for either the old workspace
* or the new one *but not both*, then update the
@@ -618,20 +618,10 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
meta_screen_calc_workspace_layout (workspace->screen, num_workspaces,
new_space, &layout2);
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
{
if (layout1.current_col > layout2.current_col)
direction = META_MOTION_RIGHT;
else if (layout1.current_col < layout2.current_col)
direction = META_MOTION_LEFT;
}
else
{
if (layout1.current_col < layout2.current_col)
direction = META_MOTION_RIGHT;
else if (layout1.current_col > layout2.current_col)
direction = META_MOTION_LEFT;
}
if (layout1.current_col < layout2.current_col)
direction = META_MOTION_RIGHT;
if (layout1.current_col > layout2.current_col)
direction = META_MOTION_LEFT;
if (layout1.current_row < layout2.current_row)
{
@@ -752,6 +742,32 @@ meta_workspace_list_windows (MetaWorkspace *workspace)
return workspace_windows;
}
static void
set_active_space_hint (MetaScreen *screen)
{
unsigned long data[1];
/* this is because we destroy the spaces in order,
* so we always end up setting a current desktop of
* 0 when closing a screen, so lose the current desktop
* on restart. By doing this we keep the current
* desktop on restart.
*/
if (screen->closing > 0)
return;
data[0] = meta_workspace_index (screen->active_workspace);
meta_verbose ("Setting _NET_CURRENT_DESKTOP to %lu\n", data[0]);
meta_error_trap_push (screen->display);
XChangeProperty (screen->display->xdisplay, screen->xroot,
screen->display->atom__NET_CURRENT_DESKTOP,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 1);
meta_error_trap_pop (screen->display);
}
void
meta_workspace_invalidate_work_area (MetaWorkspace *workspace)
{

View File

@@ -146,7 +146,7 @@ keybind (switch_to_workspace_down, handle_switch_to_workspace,
*/
keybind (switch_group, handle_switch, META_TAB_LIST_GROUP,
BINDING_REVERSES, "<Alt>Above_Tab",
BINDING_REVERSES, NULL,
_("Move between windows of an application, using a popup window"))
keybind (switch_group_backward, handle_switch, META_TAB_LIST_GROUP,
REVERSES_AND_REVERSED, NULL,
@@ -167,7 +167,7 @@ keybind (switch_panels_backward, handle_switch, META_TAB_LIST_DOCKS,
"using a popup window"))
keybind (cycle_group, handle_cycle, META_TAB_LIST_GROUP,
BINDING_REVERSES, "<Alt>F6",
BINDING_REVERSES, "<Alt>grave",
_("Move between windows of an application immediately"))
keybind (cycle_group_backward, handle_cycle, META_TAB_LIST_GROUP,
REVERSES_AND_REVERSED, NULL,

View File

@@ -47,9 +47,7 @@ typedef enum
META_FRAME_ALLOWS_MOVE = 1 << 11,
META_FRAME_FULLSCREEN = 1 << 12,
META_FRAME_IS_FLASHING = 1 << 13,
META_FRAME_ABOVE = 1 << 14,
META_FRAME_TILED_LEFT = 1 << 15,
META_FRAME_TILED_RIGHT = 1 << 16
META_FRAME_ABOVE = 1 << 14
} MetaFrameFlags;
typedef enum

View File

@@ -39,6 +39,4 @@ Window meta_get_overlay_window (MetaScreen *screen);
GList *meta_get_window_actors (MetaScreen *screen);
ClutterActor *meta_get_window_group_for_screen (MetaScreen *screen);
ClutterActor *meta_get_background_actor_for_screen (MetaScreen *screen);
#endif

View File

@@ -249,9 +249,6 @@ meta_plugin_get_overlay_group (MetaPlugin *plugin);
ClutterActor *
meta_plugin_get_window_group (MetaPlugin *plugin);
ClutterActor *
meta_plugin_get_background_actor (MetaPlugin *plugin);
ClutterActor *
meta_plugin_get_stage (MetaPlugin *plugin);

View File

@@ -72,6 +72,8 @@ MetaShadowFactory *meta_shadow_factory_get_default (void);
GType meta_shadow_factory_get_type (void);
MetaShadowFactory *meta_shadow_factory_new (void);
void meta_shadow_factory_set_params (MetaShadowFactory *factory,
const char *class_name,
gboolean focused,

View File

@@ -65,6 +65,5 @@ ClutterActor * meta_window_actor_get_texture (MetaWindowActor *self
gboolean meta_window_actor_is_override_redirect (MetaWindowActor *self);
const char * meta_window_actor_get_description (MetaWindowActor *self);
gboolean meta_window_actor_showing_on_its_workspace (MetaWindowActor *self);
gboolean meta_window_actor_is_destroyed (MetaWindowActor *self);
#endif /* META_WINDOW_ACTOR_H */

View File

@@ -58,8 +58,9 @@ typedef enum
META_PREF_GNOME_ANIMATIONS,
META_PREF_CURSOR_THEME,
META_PREF_CURSOR_SIZE,
META_PREF_COMPOSITING_MANAGER,
META_PREF_RESIZE_WITH_RIGHT_BUTTON,
META_PREF_EDGE_TILING,
META_PREF_SIDE_BY_SIDE_TILING,
META_PREF_FORCE_FULLSCREEN,
META_PREF_CLUTTER_PLUGINS,
META_PREF_LIVE_HIDDEN_WINDOWS,
@@ -98,7 +99,7 @@ gboolean meta_prefs_get_auto_raise (void);
int meta_prefs_get_auto_raise_delay (void);
gboolean meta_prefs_get_gnome_accessibility (void);
gboolean meta_prefs_get_gnome_animations (void);
gboolean meta_prefs_get_edge_tiling (void);
gboolean meta_prefs_get_side_by_side_tiling (void);
const char* meta_prefs_get_command (int i);

View File

@@ -80,17 +80,4 @@ void meta_screen_get_monitor_geometry (MetaScreen *screen,
int monitor,
MetaRectangle *geometry);
typedef enum
{
META_SCREEN_TOPLEFT,
META_SCREEN_TOPRIGHT,
META_SCREEN_BOTTOMLEFT,
META_SCREEN_BOTTOMRIGHT
} MetaScreenCorner;
void meta_screen_override_workspace_layout (MetaScreen *screen,
MetaScreenCorner starting_corner,
gboolean vertical_layout,
int n_rows,
int n_columns);
#endif

View File

@@ -157,12 +157,6 @@ void meta_ui_set_current_theme (const char *name,
gboolean force_reload);
gboolean meta_ui_have_a_theme (void);
/* Not a real key symbol but means "key above the tab key"; this is
* used as the default keybinding for cycle_group.
* 0x2xxxxxxx is a range not used by GDK or X. the remaining digits are
* randomly chosen */
#define META_KEY_ABOVE_TAB 0x2f7259c9
gboolean meta_ui_parse_accelerator (const char *accel,
unsigned int *keysym,
unsigned int *keycode,

View File

@@ -51,7 +51,7 @@ set_gdk_window_struts (GdkWindow *window,
vals[11] = 800;
XChangeProperty (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XWINDOW (window),
XInternAtom (GDK_WINDOW_XDISPLAY (window),
"_NET_WM_STRUT_PARTIAL", False),
XA_CARDINAL, 32, PropModeReplace,
@@ -125,7 +125,7 @@ set_gdk_window_type (GdkWindow *window,
type, False);
XChangeProperty (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
GDK_WINDOW_XWINDOW (window),
XInternAtom (GDK_WINDOW_XDISPLAY (window), "_NET_WM_WINDOW_TYPE", False),
XA_ATOM, 32, PropModeReplace,
(guchar *)atoms,

View File

@@ -55,11 +55,13 @@ draw_handler (GtkWidget *tooltips,
cairo_t *cr,
gpointer user_data)
{
gtk_render_background (gtk_widget_get_style_context (tooltips),
cr,
0, 0,
gtk_widget_get_allocated_width (tooltips),
gtk_widget_get_allocated_height (tooltips));
gtk_paint_flat_box (gtk_widget_get_style (tip),
cr,
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
tip, "tooltip",
0, 0,
gtk_widget_get_allocated_width (tip),
gtk_widget_get_allocated_height (tip));
return FALSE;
}

View File

@@ -43,11 +43,12 @@
#define DEFAULT_INNER_BUTTON_BORDER 3
static void meta_frames_destroy (GtkWidget *object);
static void meta_frames_finalize (GObject *object);
static void meta_frames_style_updated (GtkWidget *widget);
static void meta_frames_map (GtkWidget *widget);
static void meta_frames_unmap (GtkWidget *widget);
static void meta_frames_destroy (GtkWidget *object);
static void meta_frames_finalize (GObject *object);
static void meta_frames_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void meta_frames_map (GtkWidget *widget);
static void meta_frames_unmap (GtkWidget *widget);
static void meta_frames_update_prelit_control (MetaFrames *frames,
MetaUIFrame *frame,
@@ -136,7 +137,7 @@ meta_frames_class_init (MetaFramesClass *class)
widget_class->destroy = meta_frames_destroy;
widget_class->style_updated = meta_frames_style_updated;
widget_class->style_set = meta_frames_style_set;
widget_class->map = meta_frames_map;
widget_class->unmap = meta_frames_unmap;
@@ -421,7 +422,8 @@ reattach_style_func (gpointer key, gpointer value, gpointer data)
}
static void
meta_frames_style_updated (GtkWidget *widget)
meta_frames_style_set (GtkWidget *widget,
GtkStyle *prev_style)
{
MetaFrames *frames;
@@ -432,7 +434,7 @@ meta_frames_style_updated (GtkWidget *widget)
g_hash_table_foreach (frames->frames,
reattach_style_func, frames);
GTK_WIDGET_CLASS (meta_frames_parent_class)->style_updated (widget);
GTK_WIDGET_CLASS (meta_frames_parent_class)->style_set (widget, prev_style);
}
static void
@@ -575,9 +577,12 @@ meta_frames_attach_style (MetaFrames *frames,
MetaUIFrame *frame)
{
if (frame->style != NULL)
g_object_unref (frame->style);
gtk_style_detach (frame->style);
frame->style = g_object_ref (gtk_widget_get_style_context (GTK_WIDGET (frames)));
/* Weirdly, gtk_style_attach() steals a reference count from the style passed in */
g_object_ref (gtk_widget_get_style (GTK_WIDGET (frames)));
frame->style = gtk_style_attach (gtk_widget_get_style (GTK_WIDGET (frames)),
frame->window);
}
void
@@ -648,7 +653,7 @@ meta_frames_unmanage_window (MetaFrames *frames,
g_hash_table_remove (frames->frames, &frame->xwindow);
g_object_unref (frame->style);
gtk_style_detach (frame->style);
gdk_window_destroy (frame->window);
@@ -2393,6 +2398,20 @@ meta_frames_paint (MetaFrames *frames,
default:
break;
}
/* Map button function states to button position states */
button_states[META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND] =
button_states[META_BUTTON_TYPE_MENU];
button_states[META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND] =
META_BUTTON_STATE_NORMAL;
button_states[META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND] =
META_BUTTON_STATE_NORMAL;
button_states[META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND] =
button_states[META_BUTTON_TYPE_MINIMIZE];
button_states[META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND] =
button_states[META_BUTTON_TYPE_MAXIMIZE];
button_states[META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND] =
button_states[META_BUTTON_TYPE_CLOSE];
meta_core_get (display, frame->xwindow,
META_CORE_GET_FRAME_FLAGS, &flags,
@@ -2464,7 +2483,8 @@ meta_frames_set_window_background (MetaFrames *frames,
}
else
{
gtk_style_context_set_background (frame->style, frame->window);
gtk_style_set_background (frame->style,
frame->window, GTK_STATE_NORMAL);
}
}

View File

@@ -75,7 +75,7 @@ struct _MetaUIFrame
{
Window xwindow;
GdkWindow *window;
GtkStyleContext *style;
GtkStyle *style;
MetaFrameStyle *cache_style;
PangoLayout *layout;
int text_height;

View File

@@ -401,10 +401,10 @@ meta_window_menu_new (MetaFrames *frames,
n_workspaces, active_workspace);
window = gtk_widget_get_window (GTK_WIDGET (frames));
display = GDK_WINDOW_XDISPLAY (window);
display = gdk_x11_drawable_get_xdisplay (window);
screen = gdk_window_get_screen (window);
xroot = GDK_WINDOW_XID (gdk_screen_get_root_window (screen));
xroot = GDK_DRAWABLE_XID (gdk_screen_get_root_window (screen));
submenu = gtk_menu_new ();

View File

@@ -255,7 +255,6 @@ meta_accel_label_draw (GtkWidget *widget,
if (allocation.width >= requisition.width + ac_width)
{
GtkStyleContext *style;
PangoLayout *label_layout;
PangoLayout *accel_layout;
GtkLabel *label = GTK_LABEL (widget);
@@ -303,15 +302,14 @@ meta_accel_label_draw (GtkWidget *widget,
y = (allocation.height - (requisition.height - ypad * 2)) * yalign + 1.5;
style = gtk_widget_get_style_context (widget);
gtk_style_context_save (style);
gtk_style_context_set_state (style,
gtk_widget_get_state_flags (widget));
gtk_render_layout (gtk_widget_get_style_context (widget),
cr,
x, y,
accel_layout);
gtk_style_context_restore (style);
gtk_paint_layout (gtk_widget_get_style (widget),
cr,
gtk_widget_get_state (widget),
FALSE,
widget,
"accellabel",
x, y,
accel_layout);
g_object_unref (accel_layout);
}

View File

@@ -78,6 +78,7 @@ outline_window_draw (GtkWidget *widget,
{
MetaTabPopup *popup;
TabEntry *te;
GtkStyle *style;
popup = data;
@@ -85,9 +86,10 @@ outline_window_draw (GtkWidget *widget,
return FALSE;
te = popup->current_selected_entry;
style = gtk_widget_get_style (widget);
cairo_set_line_width (cr, 1.0);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
gdk_cairo_set_source_color (cr, &style->white);
cairo_rectangle (cr,
0.5, 0.5,
@@ -477,7 +479,6 @@ display_entry (MetaTabPopup *popup,
{
cairo_region_t *region;
cairo_region_t *inner_region;
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
window = gtk_widget_get_window (popup->outline_window);
@@ -494,7 +495,9 @@ display_entry (MetaTabPopup *popup,
te->rect.x, te->rect.y,
te->rect.width, te->rect.height);
gdk_window_set_background_rgba (window, &black);
gdk_window_set_background (window,
&gtk_widget_get_style (popup->outline_window)->black);
region = cairo_region_create_rectangle (&rect);
@@ -706,8 +709,9 @@ meta_select_image_draw (GtkWidget *widget,
{
GtkMisc *misc;
GtkRequisition requisition;
GtkStyleContext *context;
GdkRGBA color;
GtkStyle *style;
GtkStateType state;
GdkWindow *window;
int x, y, w, h;
gint xpad, ypad;
gfloat xalign, yalign;
@@ -727,15 +731,12 @@ meta_select_image_draw (GtkWidget *widget,
w = requisition.width - OUTSIDE_SELECT_RECT * 2 - 1;
h = requisition.height - OUTSIDE_SELECT_RECT * 2 - 1;
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_state (context,
gtk_widget_get_state_flags (widget));
gtk_style_context_lookup_color (context, "color", &color);
window = gtk_widget_get_window (widget);
style = gtk_widget_get_style (widget);
state = gtk_widget_get_state (widget);
cairo_set_line_width (cr, 2.0);
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
gdk_cairo_set_source_color (cr, &style->fg[state]);
cairo_rectangle (cr, x, y, w + 1, h + 1);
cairo_stroke (cr);
@@ -890,6 +891,7 @@ meta_select_workspace_draw (GtkWidget *widget,
MetaWorkspace *workspace;
WnckWindowDisplayInfo *windows;
GtkAllocation allocation;
GtkStyle *style;
int i, n_windows;
GList *tmp, *list;
@@ -947,18 +949,11 @@ meta_select_workspace_draw (GtkWidget *widget,
if (META_SELECT_WORKSPACE (widget)->selected)
{
GtkStyleContext *context;
GdkRGBA color;
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_state (context,
gtk_widget_get_state_flags (widget));
gtk_style_context_lookup_color (context, "color", &color);
style = gtk_widget_get_style (widget);
gdk_cairo_set_source_color (cr,
&style->fg[gtk_widget_get_state (widget)]);
cairo_set_line_width (cr, SELECT_OUTLINE_WIDTH);
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
cairo_rectangle (cr,
SELECT_OUTLINE_WIDTH / 2.0, SELECT_OUTLINE_WIDTH / 2.0,

View File

@@ -23,17 +23,19 @@
#include "gradient.h"
#include <gtk/gtk.h>
typedef void (* RenderGradientFunc) (cairo_t *cr,
typedef void (* RenderGradientFunc) (GdkDrawable *drawable,
cairo_t *cr,
int width,
int height);
static void
draw_checkerboard (cairo_t *cr,
int width,
int height)
draw_checkerboard (GdkDrawable *drawable,
int width,
int height)
{
gint i, j, xcount, ycount;
GdkColor color1, color2;
cairo_t *cr;
#define CHECK_SIZE 10
#define SPACING 2
@@ -46,6 +48,8 @@ draw_checkerboard (cairo_t *cr,
color2.green = 50000;
color2.blue = 50000;
cr = gdk_cairo_create (drawable);
xcount = 0;
i = SPACING;
while (i < width)
@@ -73,10 +77,13 @@ draw_checkerboard (cairo_t *cr,
i += CHECK_SIZE + SPACING;
++xcount;
}
cairo_destroy (cr);
}
static void
render_simple (cairo_t *cr,
render_simple (GdkDrawable *drawable,
cairo_t *cr,
int width, int height,
MetaGradientType type,
gboolean with_alpha)
@@ -108,7 +115,7 @@ render_simple (cairo_t *cr,
alphas, G_N_ELEMENTS (alphas),
META_GRADIENT_HORIZONTAL);
draw_checkerboard (cr , width, height);
draw_checkerboard (drawable, width, height);
}
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
@@ -119,35 +126,40 @@ render_simple (cairo_t *cr,
}
static void
render_vertical_func (cairo_t *cr,
render_vertical_func (GdkDrawable *drawable,
cairo_t *cr,
int width, int height)
{
render_simple (cr, width, height, META_GRADIENT_VERTICAL, FALSE);
render_simple (drawable, cr, width, height, META_GRADIENT_VERTICAL, FALSE);
}
static void
render_horizontal_func (cairo_t *cr,
render_horizontal_func (GdkDrawable *drawable,
cairo_t *cr,
int width, int height)
{
render_simple (cr, width, height, META_GRADIENT_HORIZONTAL, FALSE);
render_simple (drawable, cr, width, height, META_GRADIENT_HORIZONTAL, FALSE);
}
static void
render_diagonal_func (cairo_t *cr,
render_diagonal_func (GdkDrawable *drawable,
cairo_t *cr,
int width, int height)
{
render_simple (cr, width, height, META_GRADIENT_DIAGONAL, FALSE);
render_simple (drawable, cr, width, height, META_GRADIENT_DIAGONAL, FALSE);
}
static void
render_diagonal_alpha_func (cairo_t *cr,
render_diagonal_alpha_func (GdkDrawable *drawable,
cairo_t *cr,
int width, int height)
{
render_simple (cr, width, height, META_GRADIENT_DIAGONAL, TRUE);
render_simple (drawable, cr, width, height, META_GRADIENT_DIAGONAL, TRUE);
}
static void
render_multi (cairo_t *cr,
render_multi (GdkDrawable *drawable,
cairo_t *cr,
int width, int height,
MetaGradientType type)
{
@@ -174,28 +186,32 @@ render_multi (cairo_t *cr,
}
static void
render_vertical_multi_func (cairo_t *cr,
render_vertical_multi_func (GdkDrawable *drawable,
cairo_t *cr,
int width, int height)
{
render_multi (cr, width, height, META_GRADIENT_VERTICAL);
render_multi (drawable, cr, width, height, META_GRADIENT_VERTICAL);
}
static void
render_horizontal_multi_func (cairo_t *cr,
render_horizontal_multi_func (GdkDrawable *drawable,
cairo_t *cr,
int width, int height)
{
render_multi (cr, width, height, META_GRADIENT_HORIZONTAL);
render_multi (drawable, cr, width, height, META_GRADIENT_HORIZONTAL);
}
static void
render_diagonal_multi_func (cairo_t *cr,
render_diagonal_multi_func (GdkDrawable *drawable,
cairo_t *cr,
int width, int height)
{
render_multi (cr, width, height, META_GRADIENT_DIAGONAL);
render_multi (drawable, cr, width, height, META_GRADIENT_DIAGONAL);
}
static void
render_interwoven_func (cairo_t *cr,
render_interwoven_func (GdkDrawable *drawable,
cairo_t *cr,
int width, int height)
{
GdkPixbuf *pixbuf;
@@ -219,28 +235,31 @@ render_interwoven_func (cairo_t *cr,
}
static gboolean
draw_callback (GtkWidget *widget,
cairo_t *cr,
gpointer data)
expose_callback (GtkWidget *widget,
GdkEventExpose *event,
gpointer data)
{
RenderGradientFunc func = data;
GtkStyleContext *style;
GdkRGBA color;
GdkWindow *window;
GtkAllocation allocation;
GtkStyle *style;
cairo_t *cr;
style = gtk_widget_get_style_context (widget);
style = gtk_widget_get_style (widget);
gtk_widget_get_allocation (widget, &allocation);
gtk_style_context_save (style);
gtk_style_context_set_state (style, gtk_widget_get_state_flags (widget));
gtk_style_context_lookup_color (style, "foreground-color", &color);
gtk_style_context_restore (style);
window = gtk_widget_get_window (widget);
cr = gdk_cairo_create (window);
gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
(* func) (gtk_widget_get_window (widget),
cr,
allocation.width,
allocation.height);
(* func) (cr,
gtk_widget_get_allocated_width (widget),
gtk_widget_get_allocated_height (widget));
cairo_destroy (cr);
return FALSE;
return TRUE;
}
static GtkWidget*
@@ -261,8 +280,8 @@ create_gradient_window (const char *title,
gtk_window_set_default_size (GTK_WINDOW (window), 175, 175);
g_signal_connect (G_OBJECT (drawing_area),
"draw",
G_CALLBACK (draw_callback),
"expose_event",
G_CALLBACK (expose_callback),
func);
gtk_container_add (GTK_CONTAINER (window), drawing_area);
@@ -275,29 +294,31 @@ create_gradient_window (const char *title,
static void
meta_gradient_test (void)
{
create_gradient_window ("Simple vertical",
render_vertical_func);
GtkWidget *window;
create_gradient_window ("Simple horizontal",
render_horizontal_func);
window = create_gradient_window ("Simple vertical",
render_vertical_func);
window = create_gradient_window ("Simple horizontal",
render_horizontal_func);
create_gradient_window ("Simple diagonal",
render_diagonal_func);
window = create_gradient_window ("Simple diagonal",
render_diagonal_func);
create_gradient_window ("Multi vertical",
render_vertical_multi_func);
window = create_gradient_window ("Multi vertical",
render_vertical_multi_func);
window = create_gradient_window ("Multi horizontal",
render_horizontal_multi_func);
create_gradient_window ("Multi horizontal",
render_horizontal_multi_func);
window = create_gradient_window ("Multi diagonal",
render_diagonal_multi_func);
create_gradient_window ("Multi diagonal",
render_diagonal_multi_func);
window = create_gradient_window ("Interwoven",
render_interwoven_func);
create_gradient_window ("Interwoven",
render_interwoven_func);
create_gradient_window ("Simple diagonal with horizontal multi alpha",
render_diagonal_alpha_func);
window = create_gradient_window ("Simple diagonal with horizontal multi alpha",
render_diagonal_alpha_func);
}

View File

@@ -38,7 +38,7 @@
* look out for.
*/
#define THEME_MAJOR_VERSION 3
#define THEME_MINOR_VERSION 3
#define THEME_MINOR_VERSION 2
#define THEME_VERSION (1000 * THEME_MAJOR_VERSION + THEME_MINOR_VERSION)
#define METACITY_THEME_FILENAME_FORMAT "metacity-theme-%d.xml"
@@ -2955,7 +2955,6 @@ parse_style_element (GMarkupParseContext *context,
const char *function = NULL;
const char *state = NULL;
const char *draw_ops = NULL;
gint required_version;
if (!locate_attributes (context, element_name, attribute_names, attribute_values,
error,
@@ -2974,14 +2973,13 @@ parse_style_element (GMarkupParseContext *context,
return;
}
required_version = peek_required_version (info);
if (meta_theme_earliest_version_with_button (info->button_type) >
(guint)required_version)
info->theme->format_version)
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
_("Button function \"%s\" does not exist in this version (%d, need %d)"),
function,
required_version,
info->theme->format_version,
meta_theme_earliest_version_with_button (info->button_type)
);
return;
@@ -3190,31 +3188,6 @@ parse_style_set_element (GMarkupParseContext *context,
meta_frame_style_ref (frame_style);
info->style_set->maximized_styles[frame_focus] = frame_style;
break;
case META_FRAME_STATE_TILED_LEFT:
if (info->style_set->tiled_left_styles[frame_focus])
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
_("Style has already been specified for state %s focus %s"),
state, focus);
return;
}
meta_frame_style_ref (frame_style);
info->style_set->tiled_left_styles[frame_focus] = frame_style;
break;
case META_FRAME_STATE_TILED_RIGHT:
if (info->style_set->tiled_right_styles[frame_focus])
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
_("Style has already been specified for state %s focus %s"),
state, focus);
return;
}
meta_frame_style_ref (frame_style);
info->style_set->tiled_right_styles[frame_focus] = frame_style;
break;
meta_frame_style_ref (frame_style);
info->style_set->tiled_right_styles[frame_focus] = frame_style;
break;
case META_FRAME_STATE_SHADED:
if (info->style_set->shaded_styles[frame_resize][frame_focus])
{
@@ -3237,28 +3210,6 @@ parse_style_set_element (GMarkupParseContext *context,
meta_frame_style_ref (frame_style);
info->style_set->maximized_and_shaded_styles[frame_focus] = frame_style;
break;
case META_FRAME_STATE_TILED_LEFT_AND_SHADED:
if (info->style_set->tiled_left_and_shaded_styles[frame_focus])
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
_("Style has already been specified for state %s focus %s"),
state, focus);
return;
}
meta_frame_style_ref (frame_style);
info->style_set->tiled_left_and_shaded_styles[frame_focus] = frame_style;
break;
case META_FRAME_STATE_TILED_RIGHT_AND_SHADED:
if (info->style_set->tiled_right_and_shaded_styles[frame_focus])
{
set_error (error, context, G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
_("Style has already been specified for state %s focus %s"),
state, focus);
return;
}
meta_frame_style_ref (frame_style);
info->style_set->tiled_right_and_shaded_styles[frame_focus] = frame_style;
break;
case META_FRAME_STATE_LAST:
g_assert_not_reached ();
break;
@@ -3877,7 +3828,7 @@ end_element_handler (GMarkupParseContext *context,
g_assert (info->style);
if (!meta_frame_style_validate (info->style,
peek_required_version (info),
info->theme->format_version,
error))
{
add_context_to_error (error, context);

View File

@@ -234,7 +234,7 @@ struct _MetaFrameGeometry
/* used for a memset hack */
#define ADDRESS_OF_BUTTON_RECTS(fgeom) (((char*)(fgeom)) + G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_single_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
#define LENGTH_OF_BUTTON_RECTS (G_STRUCT_OFFSET (MetaFrameGeometry, right_right_background) + sizeof (GdkRectangle) - G_STRUCT_OFFSET (MetaFrameGeometry, close_rect))
/* The button rects (if changed adjust memset hack) */
MetaButtonSpace close_rect;
@@ -252,17 +252,10 @@ struct _MetaFrameGeometry
GdkRectangle left_left_background;
GdkRectangle left_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
GdkRectangle left_right_background;
GdkRectangle left_single_background;
GdkRectangle right_left_background;
GdkRectangle right_middle_backgrounds[MAX_MIDDLE_BACKGROUNDS];
GdkRectangle right_right_background;
GdkRectangle right_single_background;
/* End of button rects (if changed adjust memset hack) */
/* Saved button layout */
MetaButtonLayout button_layout;
int n_left_buttons;
int n_right_buttons;
/* Round corners */
guint top_left_corner_rounded_radius;
@@ -649,11 +642,9 @@ typedef enum
META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND,
META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND,
META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND,
META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND,
META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND,
META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND,
META_BUTTON_TYPE_CLOSE,
META_BUTTON_TYPE_MAXIMIZE,
META_BUTTON_TYPE_MINIMIZE,
@@ -776,12 +767,8 @@ typedef enum
{
META_FRAME_STATE_NORMAL,
META_FRAME_STATE_MAXIMIZED,
META_FRAME_STATE_TILED_LEFT,
META_FRAME_STATE_TILED_RIGHT,
META_FRAME_STATE_SHADED,
META_FRAME_STATE_MAXIMIZED_AND_SHADED,
META_FRAME_STATE_TILED_LEFT_AND_SHADED,
META_FRAME_STATE_TILED_RIGHT_AND_SHADED,
META_FRAME_STATE_LAST
} MetaFrameState;
@@ -818,12 +805,8 @@ struct _MetaFrameStyleSet
MetaFrameStyleSet *parent;
MetaFrameStyle *normal_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
MetaFrameStyle *maximized_styles[META_FRAME_FOCUS_LAST];
MetaFrameStyle *tiled_left_styles[META_FRAME_FOCUS_LAST];
MetaFrameStyle *tiled_right_styles[META_FRAME_FOCUS_LAST];
MetaFrameStyle *shaded_styles[META_FRAME_RESIZE_LAST][META_FRAME_FOCUS_LAST];
MetaFrameStyle *maximized_and_shaded_styles[META_FRAME_FOCUS_LAST];
MetaFrameStyle *tiled_left_and_shaded_styles[META_FRAME_FOCUS_LAST];
MetaFrameStyle *tiled_right_and_shaded_styles[META_FRAME_FOCUS_LAST];
};
/**
@@ -975,7 +958,7 @@ void meta_draw_op_draw (const MetaDrawOp *op,
MetaRectangle logical_region);
void meta_draw_op_draw_with_style (const MetaDrawOp *op,
GtkStyleContext *style_gtk,
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaDrawInfo *info,
@@ -991,7 +974,7 @@ void meta_draw_op_list_draw (const MetaDrawOpList *op_list,
const MetaDrawInfo *info,
MetaRectangle rect);
void meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
GtkStyleContext *style_gtk,
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaDrawInfo *info,
@@ -1035,7 +1018,7 @@ void meta_frame_style_draw (MetaFrameStyle *style,
void meta_frame_style_draw_with_style (MetaFrameStyle *style,
GtkStyleContext *style_gtk,
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaFrameGeometry *fgeom,
@@ -1101,7 +1084,7 @@ void meta_theme_draw_frame_by_name (MetaTheme *theme,
GdkPixbuf *icon);
void meta_theme_draw_frame_with_style (MetaTheme *theme,
GtkStyleContext *style_gtk,
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
MetaFrameType type,

View File

@@ -234,7 +234,7 @@ dialog_contents (void)
vbox = gtk_vbox_new (FALSE, 0);
action_area = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
action_area = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area),
GTK_BUTTONBOX_END);
@@ -472,7 +472,7 @@ get_window_flags (MetaFrameType type)
static GtkWidget*
preview_collection (int font_size,
const PangoFontDescription *base_desc)
PangoFontDescription *base_desc)
{
GtkWidget *box;
GtkWidget *sw;
@@ -780,8 +780,7 @@ benchmark_summary (void)
int
main (int argc, char **argv)
{
GtkStyleContext *style;
const PangoFontDescription *font_desc;
GtkStyle *style;
GtkWidget *window;
GtkWidget *collection;
GError *err;
@@ -858,29 +857,28 @@ main (int argc, char **argv)
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_realize (window);
style = gtk_widget_get_style_context (window);
font_desc = gtk_style_context_get_font (style, 0);
style = gtk_widget_get_style (window);
g_assert (style);
g_assert (font_desc);
g_assert (style->font_desc);
notebook = gtk_notebook_new ();
gtk_container_add (GTK_CONTAINER (window), notebook);
collection = preview_collection (FONT_SIZE_NORMAL,
font_desc);
style->font_desc);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
collection,
gtk_label_new (_("Normal Title Font")));
collection = preview_collection (FONT_SIZE_SMALL,
font_desc);
style->font_desc);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
collection,
gtk_label_new (_("Small Title Font")));
collection = preview_collection (FONT_SIZE_LARGE,
font_desc);
style->font_desc);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
collection,
gtk_label_new (_("Large Title Font")));
@@ -931,12 +929,7 @@ get_flags (GtkWidget *widget)
static int
get_text_height (GtkWidget *widget)
{
GtkStyleContext *style;
const PangoFontDescription *font_desc;
style = gtk_widget_get_style_context (widget);
font_desc = gtk_style_context_get_font (style, 0);
return meta_pango_font_desc_get_text_height (font_desc,
return meta_pango_font_desc_get_text_height (gtk_widget_get_style (widget)->font_desc,
gtk_widget_get_pango_context (widget));
}

View File

@@ -452,38 +452,6 @@ meta_frame_layout_get_borders (const MetaFrameLayout *layout,
}
}
static MetaButtonType
map_button_function_to_type (MetaButtonFunction function)
{
switch (function)
{
case META_BUTTON_FUNCTION_SHADE:
return META_BUTTON_TYPE_SHADE;
case META_BUTTON_FUNCTION_ABOVE:
return META_BUTTON_TYPE_ABOVE;
case META_BUTTON_FUNCTION_STICK:
return META_BUTTON_TYPE_STICK;
case META_BUTTON_FUNCTION_UNSHADE:
return META_BUTTON_TYPE_UNSHADE;
case META_BUTTON_FUNCTION_UNABOVE:
return META_BUTTON_TYPE_UNABOVE;
case META_BUTTON_FUNCTION_UNSTICK:
return META_BUTTON_TYPE_UNSTICK;
case META_BUTTON_FUNCTION_MENU:
return META_BUTTON_TYPE_MENU;
case META_BUTTON_FUNCTION_MINIMIZE:
return META_BUTTON_TYPE_MINIMIZE;
case META_BUTTON_FUNCTION_MAXIMIZE:
return META_BUTTON_TYPE_MAXIMIZE;
case META_BUTTON_FUNCTION_CLOSE:
return META_BUTTON_TYPE_CLOSE;
case META_BUTTON_FUNCTION_LAST:
return META_BUTTON_TYPE_LAST;
}
return META_BUTTON_TYPE_LAST;
}
static MetaButtonSpace*
rect_for_function (MetaFrameGeometry *fgeom,
MetaFrameFlags flags,
@@ -734,9 +702,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
for (i = 0; i < n_left; i++)
{
if (n_left == 1)
left_bg_rects[i] = &fgeom->left_single_background;
else if (i == 0)
if (i == 0) /* prefer left background if only one button */
left_bg_rects[i] = &fgeom->left_left_background;
else if (i == (n_left - 1))
left_bg_rects[i] = &fgeom->left_right_background;
@@ -746,9 +712,8 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
for (i = 0; i < n_right; i++)
{
if (n_right == 1)
right_bg_rects[i] = &fgeom->right_single_background;
else if (i == (n_right - 1))
/* prefer right background if only one button */
if (i == (n_right - 1))
right_bg_rects[i] = &fgeom->right_right_background;
else if (i == 0)
right_bg_rects[i] = &fgeom->right_left_background;
@@ -843,11 +808,6 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
n_left, n_right);
}
}
/* Save the button layout */
fgeom->button_layout = *button_layout;
fgeom->n_left_buttons = n_left;
fgeom->n_right_buttons = n_right;
/* center buttons vertically */
button_y = (fgeom->top_height -
@@ -873,9 +833,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
rect->visible.width = button_width;
rect->visible.height = button_height;
if (flags & META_FRAME_MAXIMIZED ||
flags & META_FRAME_TILED_LEFT ||
flags & META_FRAME_TILED_RIGHT)
if (flags & META_FRAME_MAXIMIZED)
{
rect->clickable.x = rect->visible.x;
rect->clickable.y = 0;
@@ -3472,30 +3430,6 @@ fill_env (MetaPositionExprEnv *env,
env->theme = meta_current_theme;
}
static GtkStateFlags
state_flags_from_gtk_state (GtkStateType state)
{
switch (state)
{
case GTK_STATE_NORMAL:
return 0;
case GTK_STATE_PRELIGHT:
return GTK_STATE_FLAG_PRELIGHT;
case GTK_STATE_ACTIVE:
return GTK_STATE_FLAG_ACTIVE;
case GTK_STATE_SELECTED:
return GTK_STATE_FLAG_SELECTED;
case GTK_STATE_INSENSITIVE:
return GTK_STATE_FLAG_INSENSITIVE;
case GTK_STATE_INCONSISTENT:
return GTK_STATE_FLAG_INCONSISTENT;
case GTK_STATE_FOCUSED:
return GTK_STATE_FLAG_FOCUSED;
}
return 0;
}
/* This code was originally rendering anti-aliased using X primitives, and
* now has been switched to draw anti-aliased using cairo. In general, the
* closest correspondence between X rendering and cairo rendering is given
@@ -3509,7 +3443,7 @@ state_flags_from_gtk_state (GtkStateType state)
*/
static void
meta_draw_op_draw_with_env (const MetaDrawOp *op,
GtkStyleContext *style_gtk,
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaDrawInfo *info,
@@ -3519,7 +3453,6 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
GdkColor color;
cairo_save (cr);
gtk_style_context_save (style_gtk);
cairo_set_line_width (cr, 1.0);
@@ -3769,36 +3702,21 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_GTK_ARROW:
{
int rx, ry, rwidth, rheight;
double angle = 0, size;
rx = parse_x_position_unchecked (op->data.gtk_arrow.x, env);
ry = parse_y_position_unchecked (op->data.gtk_arrow.y, env);
rwidth = parse_size_unchecked (op->data.gtk_arrow.width, env);
rheight = parse_size_unchecked (op->data.gtk_arrow.height, env);
size = MAX(rwidth, rheight);
switch (op->data.gtk_arrow.arrow)
{
case GTK_ARROW_UP:
angle = 0;
break;
case GTK_ARROW_RIGHT:
angle = M_PI / 2;
break;
case GTK_ARROW_DOWN:
angle = M_PI;
break;
case GTK_ARROW_LEFT:
angle = 3 * M_PI / 2;
break;
case GTK_ARROW_NONE:
return;
}
gtk_style_context_set_state (style_gtk,
state_flags_from_gtk_state (op->data.gtk_arrow.state));
gtk_render_arrow (style_gtk, cr, angle, rx, ry, size);
gtk_paint_arrow (style_gtk,
cr,
op->data.gtk_arrow.state,
op->data.gtk_arrow.shadow,
widget,
"metacity",
op->data.gtk_arrow.arrow,
op->data.gtk_arrow.filled,
rx, ry, rwidth, rheight);
}
break;
@@ -3811,10 +3729,13 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
rwidth = parse_size_unchecked (op->data.gtk_box.width, env);
rheight = parse_size_unchecked (op->data.gtk_box.height, env);
gtk_style_context_set_state (style_gtk,
state_flags_from_gtk_state (op->data.gtk_box.state));
gtk_render_background (style_gtk, cr, rx, ry, rwidth, rheight);
gtk_render_frame (style_gtk, cr, rx, ry, rwidth, rheight);
gtk_paint_box (style_gtk,
cr,
op->data.gtk_box.state,
op->data.gtk_box.shadow,
widget,
"metacity",
rx, ry, rwidth, rheight);
}
break;
@@ -3826,9 +3747,12 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
ry1 = parse_y_position_unchecked (op->data.gtk_vline.y1, env);
ry2 = parse_y_position_unchecked (op->data.gtk_vline.y2, env);
gtk_style_context_set_state (style_gtk,
state_flags_from_gtk_state (op->data.gtk_vline.state));
gtk_render_line (style_gtk, cr, rx, ry1, rx, ry2);
gtk_paint_vline (style_gtk,
cr,
op->data.gtk_vline.state,
widget,
"metacity",
ry1, ry2, rx);
}
break;
@@ -3973,16 +3897,15 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
}
cairo_restore (cr);
gtk_style_context_restore (style_gtk);
}
void
meta_draw_op_draw_with_style (const MetaDrawOp *op,
GtkStyleContext *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaDrawInfo *info,
MetaRectangle logical_region)
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaDrawInfo *info,
MetaRectangle logical_region)
{
MetaPositionExprEnv env;
@@ -4001,8 +3924,8 @@ meta_draw_op_draw (const MetaDrawOp *op,
const MetaDrawInfo *info,
MetaRectangle logical_region)
{
meta_draw_op_draw_with_style (op, gtk_widget_get_style_context (widget),
widget, cr, info, logical_region);
meta_draw_op_draw_with_style (op, gtk_widget_get_style (widget), widget,
cr, info, logical_region);
}
/**
@@ -4058,11 +3981,11 @@ meta_draw_op_list_unref (MetaDrawOpList *op_list)
void
meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
GtkStyleContext *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaDrawInfo *info,
MetaRectangle rect)
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaDrawInfo *info,
MetaRectangle rect)
{
int i;
MetaPositionExprEnv env;
@@ -4123,7 +4046,7 @@ meta_draw_op_list_draw (const MetaDrawOpList *op_list,
MetaRectangle rect)
{
meta_draw_op_list_draw_with_style (op_list, gtk_widget_get_style_context (widget), widget,
meta_draw_op_list_draw_with_style (op_list, gtk_widget_get_style (widget), widget,
cr, info, rect);
}
@@ -4275,66 +4198,6 @@ meta_frame_style_unref (MetaFrameStyle *style)
}
}
static MetaButtonState
map_button_state (MetaButtonType button_type,
const MetaFrameGeometry *fgeom,
int middle_bg_offset,
MetaButtonState button_states[META_BUTTON_TYPE_LAST])
{
MetaButtonFunction function = META_BUTTON_FUNCTION_LAST;
switch (button_type)
{
/* First hande functions, which map directly */
case META_BUTTON_TYPE_SHADE:
case META_BUTTON_TYPE_ABOVE:
case META_BUTTON_TYPE_STICK:
case META_BUTTON_TYPE_UNSHADE:
case META_BUTTON_TYPE_UNABOVE:
case META_BUTTON_TYPE_UNSTICK:
case META_BUTTON_TYPE_MENU:
case META_BUTTON_TYPE_MINIMIZE:
case META_BUTTON_TYPE_MAXIMIZE:
case META_BUTTON_TYPE_CLOSE:
return button_states[button_type];
/* Map position buttons to the corresponding function */
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
if (fgeom->n_right_buttons > 0)
function = fgeom->button_layout.right_buttons[0];
break;
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
if (fgeom->n_right_buttons > 0)
function = fgeom->button_layout.right_buttons[fgeom->n_right_buttons - 1];
break;
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
if (middle_bg_offset + 1 < fgeom->n_right_buttons)
function = fgeom->button_layout.right_buttons[middle_bg_offset + 1];
break;
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
if (fgeom->n_left_buttons > 0)
function = fgeom->button_layout.left_buttons[0];
break;
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
if (fgeom->n_left_buttons > 0)
function = fgeom->button_layout.left_buttons[fgeom->n_left_buttons - 1];
break;
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
if (middle_bg_offset + 1 < fgeom->n_left_buttons)
function = fgeom->button_layout.left_buttons[middle_bg_offset + 1];
break;
case META_BUTTON_TYPE_LAST:
break;
}
if (function != META_BUTTON_FUNCTION_LAST)
return button_states[map_button_function_to_type (function)];
return META_BUTTON_STATE_LAST;
}
static MetaDrawOpList*
get_button (MetaFrameStyle *style,
MetaButtonType type,
@@ -4351,19 +4214,10 @@ get_button (MetaFrameStyle *style,
parent = parent->parent;
}
/* We fall back to the side buttons if we don't have
* single button backgrounds, and to middle button
* backgrounds if we don't have the ones on the sides
/* We fall back to middle button backgrounds if we don't
* have the ones on the sides
*/
if (op_list == NULL &&
type == META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND)
return get_button (style, META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND, state);
if (op_list == NULL &&
type == META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND)
return get_button (style, META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND, state);
if (op_list == NULL &&
(type == META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND ||
type == META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND))
@@ -4438,10 +4292,6 @@ button_rect (MetaButtonType type,
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
*rect = fgeom->left_right_background;
break;
case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
*rect = fgeom->left_single_background;
break;
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
*rect = fgeom->right_left_background;
@@ -4454,10 +4304,6 @@ button_rect (MetaButtonType type,
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
*rect = fgeom->right_right_background;
break;
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
*rect = fgeom->right_single_background;
break;
case META_BUTTON_TYPE_CLOSE:
*rect = fgeom->close_rect.visible;
@@ -4507,17 +4353,17 @@ button_rect (MetaButtonType type,
void
meta_frame_style_draw_with_style (MetaFrameStyle *style,
GtkStyleContext *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaFrameGeometry *fgeom,
int client_width,
int client_height,
PangoLayout *title_layout,
int text_height,
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
const MetaFrameGeometry *fgeom,
int client_width,
int client_height,
PangoLayout *title_layout,
int text_height,
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
{
int i, j;
GdkRectangle titlebar_rect;
@@ -4675,10 +4521,10 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
m_rect = meta_rect (rect.x, rect.y, rect.width, rect.height);
meta_draw_op_list_draw_with_style (op_list,
style_gtk,
widget,
cr,
&draw_info,
m_rect);
widget,
cr,
&draw_info,
m_rect);
}
}
@@ -4694,13 +4540,9 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
j = 0;
while (j < META_BUTTON_TYPE_LAST)
{
MetaButtonState button_state;
button_rect (j, fgeom, middle_bg_offset, &rect);
button_state = map_button_state (j, fgeom, middle_bg_offset, button_states);
op_list = get_button (style, j, button_state);
op_list = get_button (style, j, button_states[j]);
if (op_list)
{
@@ -4758,7 +4600,7 @@ meta_frame_style_draw (MetaFrameStyle *style,
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
{
meta_frame_style_draw_with_style (style, gtk_widget_get_style_context (widget), widget,
meta_frame_style_draw_with_style (style, gtk_widget_get_style (widget), widget,
cr, fgeom, client_width, client_height,
title_layout, text_height,
button_states, mini_icon, icon);
@@ -4817,11 +4659,7 @@ meta_frame_style_set_unref (MetaFrameStyleSet *style_set)
}
free_focus_styles (style_set->maximized_styles);
free_focus_styles (style_set->tiled_left_styles);
free_focus_styles (style_set->tiled_right_styles);
free_focus_styles (style_set->maximized_and_shaded_styles);
free_focus_styles (style_set->tiled_left_and_shaded_styles);
free_focus_styles (style_set->tiled_right_and_shaded_styles);
if (style_set->parent)
meta_frame_style_set_unref (style_set->parent);
@@ -4873,21 +4711,9 @@ get_style (MetaFrameStyleSet *style_set,
case META_FRAME_STATE_MAXIMIZED:
styles = style_set->maximized_styles;
break;
case META_FRAME_STATE_TILED_LEFT:
styles = style_set->tiled_left_styles;
break;
case META_FRAME_STATE_TILED_RIGHT:
styles = style_set->tiled_right_styles;
break;
case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
styles = style_set->maximized_and_shaded_styles;
break;
case META_FRAME_STATE_TILED_LEFT_AND_SHADED:
styles = style_set->tiled_left_and_shaded_styles;
break;
case META_FRAME_STATE_TILED_RIGHT_AND_SHADED:
styles = style_set->tiled_right_and_shaded_styles;
break;
case META_FRAME_STATE_NORMAL:
case META_FRAME_STATE_SHADED:
case META_FRAME_STATE_LAST:
@@ -4897,19 +4723,6 @@ get_style (MetaFrameStyleSet *style_set,
style = styles[focus];
/* Tiled states are optional, try falling back to non-tiled states */
if (style == NULL)
{
if (state == META_FRAME_STATE_TILED_LEFT ||
state == META_FRAME_STATE_TILED_RIGHT)
style = get_style (style_set, META_FRAME_STATE_NORMAL,
resize, focus);
else if (state == META_FRAME_STATE_TILED_LEFT_AND_SHADED ||
state == META_FRAME_STATE_TILED_RIGHT_AND_SHADED)
style = get_style (style_set, META_FRAME_STATE_SHADED,
resize, focus);
}
/* Try parent if we failed here */
if (style == NULL && style_set->parent)
style = get_style (style_set->parent, state, resize, focus);
@@ -5272,8 +5085,7 @@ theme_get_style (MetaTheme *theme,
if (style_set == NULL)
return NULL;
switch (flags & (META_FRAME_MAXIMIZED | META_FRAME_SHADED |
META_FRAME_TILED_LEFT | META_FRAME_TILED_RIGHT))
switch (flags & (META_FRAME_MAXIMIZED | META_FRAME_SHADED))
{
case 0:
state = META_FRAME_STATE_NORMAL;
@@ -5281,24 +5093,12 @@ theme_get_style (MetaTheme *theme,
case META_FRAME_MAXIMIZED:
state = META_FRAME_STATE_MAXIMIZED;
break;
case META_FRAME_TILED_LEFT:
state = META_FRAME_STATE_TILED_LEFT;
break;
case META_FRAME_TILED_RIGHT:
state = META_FRAME_STATE_TILED_RIGHT;
break;
case META_FRAME_SHADED:
state = META_FRAME_STATE_SHADED;
break;
case (META_FRAME_MAXIMIZED | META_FRAME_SHADED):
state = META_FRAME_STATE_MAXIMIZED_AND_SHADED;
break;
case (META_FRAME_TILED_LEFT | META_FRAME_SHADED):
state = META_FRAME_STATE_TILED_LEFT_AND_SHADED;
break;
case (META_FRAME_TILED_RIGHT | META_FRAME_SHADED):
state = META_FRAME_STATE_TILED_RIGHT_AND_SHADED;
break;
default:
g_assert_not_reached ();
state = META_FRAME_STATE_LAST; /* compiler */
@@ -5371,19 +5171,19 @@ meta_theme_get_title_scale (MetaTheme *theme,
void
meta_theme_draw_frame_with_style (MetaTheme *theme,
GtkStyleContext *style_gtk,
GtkWidget *widget,
cairo_t *cr,
MetaFrameType type,
MetaFrameFlags flags,
int client_width,
int client_height,
PangoLayout *title_layout,
int text_height,
const MetaButtonLayout *button_layout,
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
GtkStyle *style_gtk,
GtkWidget *widget,
cairo_t *cr,
MetaFrameType type,
MetaFrameFlags flags,
int client_width,
int client_height,
PangoLayout *title_layout,
int text_height,
const MetaButtonLayout *button_layout,
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
{
MetaFrameGeometry fgeom;
MetaFrameStyle *style;
@@ -5431,7 +5231,7 @@ meta_theme_draw_frame (MetaTheme *theme,
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
{
meta_theme_draw_frame_with_style (theme, gtk_widget_get_style_context (widget), widget,
meta_theme_draw_frame_with_style (theme, gtk_widget_get_style (widget), widget,
cr, type,flags,
client_width, client_height,
title_layout, text_height,
@@ -5818,13 +5618,11 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
double scale,
const PangoFontDescription *override)
{
GtkStyleContext *style;
PangoFontDescription *font_desc;
g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
style = gtk_widget_get_style_context (widget);
font_desc = pango_font_description_copy (gtk_style_context_get_font (style, 0));
font_desc = pango_font_description_copy (gtk_widget_get_style (widget)->font_desc);
if (override)
pango_font_description_merge (font_desc, override, TRUE);
@@ -5976,16 +5774,12 @@ meta_button_type_from_string (const char *str, MetaTheme *theme)
return META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND;
else if (strcmp ("left_right_background", str) == 0)
return META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND;
else if (strcmp ("left_single_background", str) == 0)
return META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND;
else if (strcmp ("right_left_background", str) == 0)
return META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND;
else if (strcmp ("right_middle_background", str) == 0)
return META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND;
else if (strcmp ("right_right_background", str) == 0)
return META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND;
else if (strcmp ("right_single_background", str) == 0)
return META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND;
else
return META_BUTTON_TYPE_LAST;
}
@@ -6021,16 +5815,12 @@ meta_button_type_to_string (MetaButtonType type)
return "left_middle_background";
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
return "left_right_background";
case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
return "left_single_background";
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
return "right_left_background";
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
return "right_middle_background";
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
return "right_right_background";
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
return "right_single_background";
case META_BUTTON_TYPE_LAST:
break;
}
@@ -6112,18 +5902,10 @@ meta_frame_state_from_string (const char *str)
return META_FRAME_STATE_NORMAL;
else if (strcmp ("maximized", str) == 0)
return META_FRAME_STATE_MAXIMIZED;
else if (strcmp ("tiled_left", str) == 0)
return META_FRAME_STATE_TILED_LEFT;
else if (strcmp ("tiled_right", str) == 0)
return META_FRAME_STATE_TILED_RIGHT;
else if (strcmp ("shaded", str) == 0)
return META_FRAME_STATE_SHADED;
else if (strcmp ("maximized_and_shaded", str) == 0)
return META_FRAME_STATE_MAXIMIZED_AND_SHADED;
else if (strcmp ("tiled_left_and_shaded", str) == 0)
return META_FRAME_STATE_TILED_LEFT_AND_SHADED;
else if (strcmp ("tiled_right_and_shaded", str) == 0)
return META_FRAME_STATE_TILED_RIGHT_AND_SHADED;
else
return META_FRAME_STATE_LAST;
}
@@ -6137,18 +5919,10 @@ meta_frame_state_to_string (MetaFrameState state)
return "normal";
case META_FRAME_STATE_MAXIMIZED:
return "maximized";
case META_FRAME_STATE_TILED_LEFT:
return "tiled_left";
case META_FRAME_STATE_TILED_RIGHT:
return "tiled_right";
case META_FRAME_STATE_SHADED:
return "shaded";
case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
return "maximized_and_shaded";
case META_FRAME_STATE_TILED_LEFT_AND_SHADED:
return "tiled_left_and_shaded";
case META_FRAME_STATE_TILED_RIGHT_AND_SHADED:
return "tiled_right_and_shaded";
case META_FRAME_STATE_LAST:
break;
}
@@ -6315,20 +6089,16 @@ meta_gradient_type_to_string (MetaGradientType type)
GtkStateType
meta_gtk_state_from_string (const char *str)
{
if (g_ascii_strcasecmp ("normal", str) == 0)
if (strcmp ("normal", str) == 0 || strcmp ("NORMAL", str) == 0)
return GTK_STATE_NORMAL;
else if (g_ascii_strcasecmp ("prelight", str) == 0)
else if (strcmp ("prelight", str) == 0 || strcmp ("PRELIGHT", str) == 0)
return GTK_STATE_PRELIGHT;
else if (g_ascii_strcasecmp ("active", str) == 0)
else if (strcmp ("active", str) == 0 || strcmp ("ACTIVE", str) == 0)
return GTK_STATE_ACTIVE;
else if (g_ascii_strcasecmp ("selected", str) == 0)
else if (strcmp ("selected", str) == 0 || strcmp ("SELECTED", str) == 0)
return GTK_STATE_SELECTED;
else if (g_ascii_strcasecmp ("insensitive", str) == 0)
else if (strcmp ("insensitive", str) == 0 || strcmp ("INSENSITIVE", str) == 0)
return GTK_STATE_INSENSITIVE;
else if (g_ascii_strcasecmp ("inconsistent", str) == 0)
return GTK_STATE_INCONSISTENT;
else if (g_ascii_strcasecmp ("focused", str) == 0)
return GTK_STATE_FOCUSED;
else
return -1; /* hack */
}
@@ -6348,10 +6118,6 @@ meta_gtk_state_to_string (GtkStateType state)
return "SELECTED";
case GTK_STATE_INSENSITIVE:
return "INSENSITIVE";
case GTK_STATE_INCONSISTENT:
return "INCONSISTENT";
case GTK_STATE_FOCUSED:
return "FOCUSED";
}
return "<unknown>";
@@ -6920,10 +6686,6 @@ meta_theme_earliest_version_with_button (MetaButtonType type)
case META_BUTTON_TYPE_UNSTICK:
return 2000;
case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
return 3003;
default:
meta_warning("Unknown button %d\n", type);
return 1000;

View File

@@ -36,7 +36,8 @@ struct _MetaTilePreview {
GtkWidget *preview_window;
gulong create_serial;
GdkRGBA *preview_color;
GdkColor *preview_color;
guchar preview_alpha;
MetaRectangle tile_rect;
@@ -56,23 +57,22 @@ meta_tile_preview_draw (GtkWidget *widget,
{
/* Fill the preview area with a transparent color */
cairo_set_source_rgba (cr,
preview->preview_color->red,
preview->preview_color->green,
preview->preview_color->blue,
preview->preview_color->alpha);
(double)preview->preview_color->red / 0xFFFF,
(double)preview->preview_color->green / 0xFFFF,
(double)preview->preview_color->blue / 0xFFFF,
(double)preview->preview_alpha / 0xFF);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
/* Use the opaque color for the border */
cairo_set_source_rgb (cr,
preview->preview_color->red,
preview->preview_color->green,
preview->preview_color->blue);
gdk_cairo_set_source_color (cr, preview->preview_color);
}
else
{
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
GtkStyle *style = gtk_widget_get_style (preview->preview_window);
gdk_cairo_set_source_color (cr, &style->white);
cairo_rectangle (cr,
OUTLINE_WIDTH - 0.5, OUTLINE_WIDTH - 0.5,
@@ -90,6 +90,37 @@ meta_tile_preview_draw (GtkWidget *widget,
return FALSE;
}
static void
on_preview_window_style_set (GtkWidget *widget,
GtkStyle *previous,
gpointer user_data)
{
MetaTilePreview *preview = user_data;
GtkStyle *style;
style = gtk_rc_get_style_by_paths (gtk_widget_get_settings (widget),
"GtkWindow.GtkIconView",
"GtkWindow.GtkIconView",
GTK_TYPE_ICON_VIEW);
if (style != NULL)
g_object_ref (style);
else
style = gtk_style_new ();
gtk_style_get (style, GTK_TYPE_ICON_VIEW,
"selection-box-color", &preview->preview_color,
"selection-box-alpha", &preview->preview_alpha,
NULL);
if (!preview->preview_color)
{
GdkColor selection = style->base[GTK_STATE_SELECTED];
preview->preview_color = gdk_color_copy (&selection);
}
g_object_unref (style);
}
MetaTilePreview *
meta_tile_preview_new (int screen_number,
gboolean composited)
@@ -107,6 +138,7 @@ meta_tile_preview_new (int screen_number,
gtk_widget_set_app_paintable (preview->preview_window, TRUE);
preview->preview_color = NULL;
preview->preview_alpha = 0xFF;
preview->tile_rect.x = preview->tile_rect.y = 0;
preview->tile_rect.width = preview->tile_rect.height = 0;
@@ -116,38 +148,11 @@ meta_tile_preview_new (int screen_number,
if (preview->has_alpha)
{
GtkStyleContext *context;
GtkWidgetPath *path;
guchar selection_alpha = 0xFF;
gtk_widget_set_visual (preview->preview_window,
gdk_screen_get_rgba_visual (screen));
path = gtk_widget_path_new ();
gtk_widget_path_append_type (path, GTK_TYPE_ICON_VIEW);
context = gtk_style_context_new ();
gtk_style_context_set_path (context, path);
gtk_style_context_add_class (context,
GTK_STYLE_CLASS_RUBBERBAND);
gtk_widget_path_free (path);
gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED,
"background-color", &preview->preview_color,
NULL);
/* The background-color for the .rubberband class should probably
* contain the correct alpha value - unfortunately, at least for now
* it doesn't. Hopefully the following workaround can be removed
* when GtkIconView gets ported to GtkStyleContext.
*/
gtk_style_context_get_style (context,
"selection-box-alpha", &selection_alpha,
NULL);
preview->preview_color->alpha = (double)selection_alpha / 0xFF;
g_object_unref (context);
g_signal_connect (preview->preview_window, "style-set",
G_CALLBACK (on_preview_window_style_set), preview);
}
/* We make an assumption that XCreateWindow will be the first operation
@@ -168,7 +173,7 @@ meta_tile_preview_free (MetaTilePreview *preview)
gtk_widget_destroy (preview->preview_window);
if (preview->preview_color)
gdk_rgba_free (preview->preview_color);
gdk_color_free (preview->preview_color);
g_free (preview);
}
@@ -190,7 +195,7 @@ meta_tile_preview_show (MetaTilePreview *preview,
gtk_widget_show (preview->preview_window);
window = gtk_widget_get_window (preview->preview_window);
meta_core_lower_beneath_focus_window (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
GDK_WINDOW_XID (window),
GDK_WINDOW_XWINDOW (window),
gtk_get_current_event_time ());
old_rect.x = old_rect.y = 0;
@@ -209,9 +214,10 @@ meta_tile_preview_show (MetaTilePreview *preview,
{
cairo_region_t *outer_region, *inner_region;
GdkRectangle outer_rect, inner_rect;
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
GdkColor black;
gdk_window_set_background_rgba (window, &black);
black = gtk_widget_get_style (preview->preview_window)->black;
gdk_window_set_background (window, &black);
outer_rect.x = outer_rect.y = 0;
outer_rect.width = preview->tile_rect.width;
@@ -248,5 +254,5 @@ meta_tile_preview_get_xwindow (MetaTilePreview *preview,
if (create_serial)
*create_serial = preview->create_serial;
return GDK_WINDOW_XID (window);
return GDK_WINDOW_XWINDOW (window);
}

View File

@@ -60,16 +60,6 @@ struct _MetaUI
void
meta_ui_init (int *argc, char ***argv)
{
/* As of 2.91.7, Gdk uses XI2 by default, which conflicts with the
* direct X calls we use - in particular, events caused by calls to
* XGrabPointer/XGrabKeyboard are no longer understood by GDK, while
* GDK will no longer generate the core XEvents we process.
* So at least for now, enforce the previous behavior.
*/
#if GTK_CHECK_VERSION(2, 91, 7)
gdk_disable_multidevice ();
#endif
if (!gtk_init_check (argc, argv))
meta_fatal ("Unable to open X display %s\n", XDisplayName (NULL));
@@ -101,7 +91,6 @@ static gboolean
maybe_redirect_mouse_event (XEvent *xevent)
{
GdkDisplay *gdisplay;
GdkDeviceManager *gmanager;
MetaUI *ui;
GdkEvent *gevent;
GdkWindow *gdk_window;
@@ -129,7 +118,7 @@ maybe_redirect_mouse_event (XEvent *xevent)
if (!ui)
return FALSE;
gdk_window = gdk_x11_window_lookup_for_display (gdisplay, window);
gdk_window = gdk_window_lookup_for_display (gdisplay, window);
if (gdk_window == NULL)
return FALSE;
@@ -207,8 +196,7 @@ maybe_redirect_mouse_event (XEvent *xevent)
}
/* If we've gotten here, we've created the gdk_event and should send it on */
gmanager = gdk_display_get_device_manager (gdisplay);
gdk_event_set_device (gevent, gdk_device_manager_get_client_pointer (gmanager));
gdk_event_set_device (gevent, gdk_display_get_core_pointer (gdisplay));
gtk_main_do_event (gevent);
gdk_event_free (gevent);
@@ -411,10 +399,8 @@ meta_ui_map_frame (MetaUI *ui,
Window xwindow)
{
GdkWindow *window;
GdkDisplay *display;
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
window = gdk_xid_table_lookup (xwindow);
if (window)
gdk_window_show_unraised (window);
@@ -425,10 +411,8 @@ meta_ui_unmap_frame (MetaUI *ui,
Window xwindow)
{
GdkWindow *window;
GdkDisplay *display;
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
window = gdk_xid_table_lookup (xwindow);
if (window)
gdk_window_hide (window);
@@ -657,10 +641,8 @@ meta_ui_window_should_not_cause_focus (Display *xdisplay,
Window xwindow)
{
GdkWindow *window;
GdkDisplay *display;
display = gdk_x11_lookup_xdisplay (xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
window = gdk_xid_table_lookup (xwindow);
/* we shouldn't cause focus if we're an override redirect
* toplevel which is not foreign
@@ -675,20 +657,17 @@ char*
meta_text_property_to_utf8 (Display *xdisplay,
const XTextProperty *prop)
{
GdkDisplay *display;
char **list;
int count;
char *retval;
list = NULL;
display = gdk_x11_lookup_xdisplay (xdisplay);
count = gdk_text_property_to_utf8_list_for_display (display,
gdk_x11_xatom_to_atom_for_display (display, prop->encoding),
prop->format,
prop->value,
prop->nitems,
&list);
count = gdk_text_property_to_utf8_list (gdk_x11_xatom_to_atom (prop->encoding),
prop->format,
prop->value,
prop->nitems,
&list);
if (count == 0)
retval = NULL;
@@ -713,9 +692,9 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
int *right_width)
{
int text_height;
GtkStyleContext *style = NULL;
PangoContext *context;
const PangoFontDescription *font_desc;
GtkStyle *default_style;
if (meta_ui_have_a_theme ())
{
@@ -724,8 +703,8 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
if (!font_desc)
{
style = gtk_style_context_new ();
font_desc = gtk_style_context_get_font (style, 0);
default_style = gtk_widget_get_default_style ();
font_desc = default_style->font_desc;
}
text_height = meta_pango_font_desc_get_text_height (font_desc, context);
@@ -739,9 +718,6 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
{
*top_height = *bottom_height = *left_width = *right_width = 0;
}
if (style != NULL)
g_object_unref (style);
}
void
@@ -764,50 +740,14 @@ meta_ui_accelerator_parse (const char *accel,
guint *keycode,
GdkModifierType *keymask)
{
const char *above_tab;
if (accel[0] == '0' && accel[1] == 'x')
{
*keysym = 0;
*keycode = (guint) strtoul (accel, NULL, 16);
*keymask = 0;
return;
}
/* The key name 'Above_Tab' is special - it's not an actual keysym name,
* but rather refers to the key above the tab key. In order to use
* the GDK parsing for modifiers in combination with it, we substitute
* it with 'Tab' temporarily before calling gtk_accelerator_parse().
*/
#define is_word_character(c) (g_ascii_isalnum(c) || ((c) == '_'))
#define ABOVE_TAB "Above_Tab"
#define ABOVE_TAB_LEN 9
above_tab = strstr (accel, ABOVE_TAB);
if (above_tab &&
(above_tab == accel || !is_word_character (above_tab[-1])) &&
!is_word_character (above_tab[ABOVE_TAB_LEN]))
{
char *before = g_strndup (accel, above_tab - accel);
char *after = g_strdup (above_tab + ABOVE_TAB_LEN);
char *replaced = g_strconcat (before, "Tab", after, NULL);
gtk_accelerator_parse (replaced, NULL, keymask);
g_free (before);
g_free (after);
g_free (replaced);
*keysym = META_KEY_ABOVE_TAB;
return;
}
#undef is_word_character
#undef ABOVE_TAB
#undef ABOVE_TAB_LEN
gtk_accelerator_parse (accel, keysym, keymask);
else
gtk_accelerator_parse (accel, keysym, keymask);
}
gboolean
@@ -952,11 +892,9 @@ gboolean
meta_ui_window_is_widget (MetaUI *ui,
Window xwindow)
{
GdkDisplay *display;
GdkWindow *window;
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
window = gdk_x11_window_lookup_for_display (display, xwindow);
window = gdk_xid_table_lookup (xwindow);
if (window)
{