Browse Source

Imported Upstream version 2.6.0

tags/upstream/2.6.0^0
Maximiliano Curia 6 years ago
parent
commit
95872cb5f1
63 changed files with 3443 additions and 4450 deletions
  1. +3
    -1
      Makefile.am
  2. +22
    -13
      configure.ac
  3. +3
    -0
      data/Makefile.am
  4. +1723
    -0
      data/theme/metacity-theme-3.xml
  5. +1
    -1
      doc/Makefile.am
  6. +165
    -0
      doc/reference/Makefile.am
  7. +55
    -0
      doc/reference/muffin-docs.sgml.in
  8. +15
    -0
      doc/reference/muffin-overview.xml
  9. +100
    -0
      doc/reference/running-muffin.xml
  10. +0
    -6
      src/Makefile.am
  11. +135
    -0
      src/compositor/cogl-utils.c
  12. +21
    -0
      src/compositor/cogl-utils.h
  13. +117
    -31
      src/compositor/compositor.c
  14. +6
    -0
      src/compositor/meta-background-actor.c
  15. +201
    -299
      src/compositor/meta-plugin-manager.c
  16. +17
    -7
      src/compositor/meta-plugin-manager.h
  17. +6
    -120
      src/compositor/meta-plugin.c
  18. +16
    -9
      src/compositor/meta-shadow-factory.c
  19. +13
    -6
      src/compositor/meta-shaped-texture.c
  20. +4
    -3
      src/compositor/meta-texture-tower.c
  21. +54
    -0
      src/compositor/meta-window-actor.c
  22. +0
    -1
      src/compositor/meta-window-group.c
  23. +7
    -29
      src/compositor/plugins/default.c
  24. +5
    -2
      src/core/boxes.c
  25. +47
    -5
      src/core/constraints.c
  26. +3
    -0
      src/core/display-private.h
  27. +69
    -11
      src/core/display.c
  28. +1
    -4
      src/core/edge-resistance.c
  29. +6
    -0
      src/core/errors.c
  30. +0
    -13
      src/core/frame.c
  31. +8
    -2
      src/core/group.c
  32. +124
    -1152
      src/core/keybindings.c
  33. +6
    -30
      src/core/main.c
  34. +8
    -18
      src/core/muffin.c
  35. +35
    -0
      src/core/place.c
  36. +89
    -40
      src/core/prefs.c
  37. +2
    -22
      src/core/screen-private.h
  38. +135
    -440
      src/core/screen.c
  39. +0
    -2
      src/core/session.c
  40. +6
    -0
      src/core/util.c
  41. +2
    -9
      src/core/window-private.h
  42. +64
    -73
      src/core/window.c
  43. +13
    -28
      src/core/workspace.c
  44. +8
    -1
      src/meta/common.h
  45. +19
    -2
      src/meta/compositor.h
  46. +0
    -6
      src/meta/keybindings.h
  47. +18
    -7
      src/meta/meta-plugin.h
  48. +9
    -5
      src/meta/prefs.h
  49. +0
    -1
      src/meta/workspace.h
  50. +5
    -12
      src/org.cinnamon.muffin.gschema.xml.in
  51. +0
    -102
      src/ui/frames.c
  52. +0
    -7
      src/ui/frames.h
  53. +0
    -965
      src/ui/tabpopup.c
  54. +0
    -67
      src/ui/tabpopup.h
  55. +13
    -0
      src/ui/theme-parser.c
  56. +20
    -12
      src/ui/theme-viewer.c
  57. +24
    -5
      src/ui/theme.c
  58. +0
    -516
      src/ui/tile-hud.c
  59. +0
    -52
      src/ui/tile-hud.h
  60. +0
    -243
      src/ui/tile-preview.c
  61. +0
    -40
      src/ui/tile-preview.h
  62. +20
    -20
      src/ui/ui.c
  63. +0
    -10
      src/ui/ui.h

+ 3
- 1
Makefile.am View File

@@ -1,8 +1,10 @@

SUBDIRS=src po doc
SUBDIRS=src po doc data

ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}

EXTRA_DIST = HACKING MAINTAINERS rationales.txt

DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc

DISTCLEANFILES = intltool-extract intltool-merge intltool-update po/stamp-it po/.intltool-merge-cache

+ 22
- 13
configure.ac View File

@@ -1,8 +1,8 @@
AC_PREREQ(2.50)

m4_define([muffin_major_version], [2])
m4_define([muffin_minor_version], [4])
m4_define([muffin_micro_version], [5])
m4_define([muffin_minor_version], [6])
m4_define([muffin_micro_version], [0])

m4_define([muffin_version],
[muffin_major_version.muffin_minor_version.muffin_micro_version])
@@ -10,11 +10,12 @@ m4_define([muffin_version],
m4_define([muffin_plugin_api_version], [3])

AC_INIT([muffin], [muffin_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=muffin])
[https://github.com/linuxmint/muffin/issues])

AC_CONFIG_SRCDIR(src/core/display.c)
AC_CONFIG_HEADERS(config.h)

AC_CONFIG_MACRO_DIR(m4)
AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz tar-ustar subdir-objects])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
AM_MAINTAINER_MODE([enable])
@@ -78,13 +79,13 @@ CANBERRA_GTK_VERSION=0.26
CLUTTER_PACKAGE=clutter-1.0

MUFFIN_PC_MODULES="
gtk+-3.0 >= 3.3.7
gtk+-3.0 >= 3.9.12
gio-2.0 >= 2.25.10
pango >= 1.2.0
pango >= 1.14.0
cairo >= 1.10.0
cinnamon-desktop >= 2.3.0
xcomposite >= 0.2 xfixes xrender xdamage
$CLUTTER_PACKAGE >= 1.9.10
cinnamon-desktop >= 2.4.0
xcomposite >= 0.3 xfixes xrender xdamage
$CLUTTER_PACKAGE >= 1.10.0
cogl-1.0 >= 1.9.6
gl
"
@@ -100,6 +101,11 @@ if test x$enable_verbose_mode = xyes; then
AC_DEFINE(WITH_VERBOSE_MODE,1,[Build with verbose mode support])
fi

AC_ARG_ENABLE([gtk-doc],
AC_HELP_STRING([--enable-gtk-doc],
[use gtk-doc to build documentation [[default=yes]]]),,
enable_gtk_doc=yes)

AC_ARG_ENABLE(sm,
AC_HELP_STRING([--disable-sm],
[disable muffin's session management support, for embedded/size-sensitive custom non-GNOME builds]),,
@@ -131,9 +137,7 @@ AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
AM_GLIB_GNU_GETTEXT

## here we get the flags we'll actually use
# GRegex requires Glib-2.14.0
PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.14.0)
# gtk_window_set_icon_name requires gtk2+-2.6.0
PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.37.3)
PKG_CHECK_MODULES(MUFFIN_MESSAGE, gtk+-3.0)
PKG_CHECK_MODULES(MUFFIN_WINDOW_DEMO, gtk+-3.0)

@@ -185,7 +189,7 @@ else
fi
fi

INTROSPECTION_VERSION=0.9.5
INTROSPECTION_VERSION=0.9.2
GOBJECT_INTROSPECTION_CHECK([$INTROSPECTION_VERSION])

if test x$found_introspection != xno; then
@@ -415,13 +419,15 @@ AM_PATH_PYTHON([2.5])
# Use gnome-doc-utils:
GNOME_DOC_INIT([0.8.0])

GTK_DOC_CHECK([1.15], [--flavour no-tmpl])

#### 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)
enable_compile_warnings=yes)

changequote(,)dnl
if test "$enable_compile_warnings" != no ; then
@@ -478,8 +484,11 @@ changequote([,])dnl

AC_CONFIG_FILES([
Makefile
data/Makefile
doc/Makefile
doc/man/Makefile
doc/reference/Makefile
doc/reference/muffin-docs.sgml
src/Makefile
src/wm-tester/Makefile
src/libmuffin.pc


+ 3
- 0
data/Makefile.am View File

@@ -0,0 +1,3 @@
themedir = $(pkgdatadir)/theme
dist_theme_DATA = \
theme/metacity-theme-3.xml

+ 1723
- 0
data/theme/metacity-theme-3.xml
File diff suppressed because it is too large
View File


+ 1
- 1
doc/Makefile.am View File

@@ -1,4 +1,4 @@
SUBDIRS = man
SUBDIRS = man reference

EXTRA_DIST=theme-format.txt dialogs.txt code-overview.txt \
how-to-get-focus-right.txt

+ 165
- 0
doc/reference/Makefile.am View File

@@ -0,0 +1,165 @@
## Process this file with automake to produce Makefile.in

# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6

# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.

# The name of the module, e.g. 'glib'.
DOC_MODULE=muffin

# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
#DOC_MODULE_VERSION=2


# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml

# Directories containing the source code, relative to $(srcdir).
# gtk-doc will search all .c and .h files beneath these paths
# for inline comments documenting functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk ../../../gdk
DOC_SOURCE_DIR=../../src

# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=

# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=--rebuild-types --rebuild-sections

# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml
MKDB_OPTIONS=--xml-mode --output-format=xml

# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=

# Extra options to supply to gtkdoc-mkhtml
MKHTML_OPTIONS=

# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=

# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=$(top_srcdir)/src/*/*.h
CFILE_GLOB=$(top_srcdir)/src/*/*.c

# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
EXTRA_HFILES=

# Header files or dirs to ignore when scanning. Use base file/dir names
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code
IGNORE_HFILES= \
async-getprop.h \
atoms.h \
bell.h \
boxes-private.h \
clutter-utils.h \
cogl-utils.h \
compositor-private.h \
constraints.h \
core.h \
display-private.h \
draw-workspace.h \
edge-resistance.h \
eventqueue.h \
frame.h \
frames.h \
group-private.h \
group-props.h \
iconcache.h \
inlinepixbufs.h \
keybindings-private.h \
meta-background-actor-private.h \
meta-background-group-private.h \
meta-dbus-login1.h \
meta-module.h \
meta-plugin-manager.h \
meta-shadow-factory-private.h \
meta-texture-rectangle.h \
meta-texture-tower.h \
meta-window-actor-private.h \
meta-window-group.h \
meta-window-shape.h \
muffin-enum-types.h \
muffin-Xatomtype.h \
place.h \
preview-widget.h \
region-utils.h \
resizepopup.h \
screen-private.h \
session.h \
stack.h \
stack-tracker.h \
stamp-muffin-enum-types.h \
tabpopup.h \
theme.h \
theme-private.h \
tile-preview.h \
ui.h \
window-private.h \
window-props.h \
workspace-private.h \
xprops.h \
$(NULL)

MKDB_OPTIONS+=--ignore-files="$(IGNORE_HFILES)"

# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=

# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files= \
muffin-overview.xml \
running-muffin.xml \
$(NULL)

# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files= \
muffin-overview.xml \
running-muffin.xml \
$(NULL)

# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS=$(MUFFIN_CFLAGS)
GTKDOC_LIBS=$(MUFFIN_LIBS) $(top_builddir)/src/libmuffin.la

# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make

# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST +=

# Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
DISTCLEANFILES = $(DOC_MODULES).types $(DOC_MODULES)-sections.txt

# Comment this out if you want 'make check' to test you doc status
# and run some sanity checks
if ENABLE_GTK_DOC
TESTS_ENVIRONMENT = cd $(srcdir) && \
DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \
SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir)
#TESTS = $(GTKDOC_CHECK)
endif

-include $(top_srcdir)/git.mk

+ 55
- 0
doc/reference/muffin-docs.sgml.in View File

@@ -0,0 +1,55 @@
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version "@VERSION@">
]>
<book id="index">
<bookinfo>
<title>Muffin Reference Manual</title>
<releaseinfo>
This document is for Muffin &version;.
</releaseinfo>
</bookinfo>

<xi:include href="xml/muffin-overview.xml"/>
<xi:include href="xml/running-muffin.xml"/>

<part id="core-reference">
<title>Muffin Core Reference</title>
<xi:include href="xml/main.xml"/>
<xi:include href="xml/common.xml"/>
<xi:include href="xml/prefs.xml"/>
<xi:include href="xml/util.xml"/>
<xi:include href="xml/errors.xml"/>
<xi:include href="xml/meta-plugin.xml"/>
<xi:include href="xml/boxes.xml"/>
<xi:include href="xml/compositor.xml"/>
<xi:include href="xml/display.xml"/>
<xi:include href="xml/group.xml"/>
<xi:include href="xml/keybindings.xml"/>
<xi:include href="xml/meta-background-actor.xml"/>
<xi:include href="xml/meta-shadow-factory.xml"/>
<xi:include href="xml/meta-shaped-texture.xml"/>
<xi:include href="xml/meta-window-actor.xml"/>
<xi:include href="xml/screen.xml"/>
<xi:include href="xml/window.xml"/>
<xi:include href="xml/workspace.xml"/>
</part>

<chapter id="object-tree">
<title>Object Hierarchy</title>
<xi:include href="xml/tree_index.sgml"/>
</chapter>
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
</index>
<index id="deprecated-api-index" role="deprecated">
<title>Index of deprecated API</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>

<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</book>

+ 15
- 0
doc/reference/muffin-overview.xml View File

@@ -0,0 +1,15 @@
<part id="muffin-overview">

<title>Overview</title>

<partintro>

<para>Muffin is a GObject-based library for creating compositing window managers.</para>

<para>Compositors that wish to use Mutter must implement a subclass of #MetaPlugin and register it with meta_plugin_manager_set_plugin_type() before calling meta_init() but after g_type_init().</para>

<para>#MetaPlugin provides virtual functions that allow to override default behavior in the window management code, such as the effect to perform when a window is created or when switching workspaces.</para>

</partintro>

</part>

+ 100
- 0
doc/reference/running-muffin.xml View File

@@ -0,0 +1,100 @@
<part id="running-muffin">

<title>Running Muffin</title>

<partintro>

<section id="environment-variables">
<title>Environment Variables</title>

<para>
Muffin automatically checks environment variables during
its initialization. These environment variables are meant
as debug tools or overrides for default behaviours:
</para>

<variablelist>
<varlistentry>
<term>MUFFIN_VERBOSE</term>
<listitem>
<para>Enable verbose mode, in which more information is printed to the console. Muffin needs to be built with the --enable-verbose-mode option (enabled by default). For more fine-grained control of the output, see meta_add_verbose_topic().</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_DEBUG</term>
<listitem>
<para>Traps and prints X errors to the console.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_G_FATAL_WARNINGS</term>
<listitem>
<para>Causes any logging from the domains Muffin, Gtk, Gdk, Pango or GLib to terminate the process (only when using the log functions in GLib).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_USE_LOGFILE</term>
<listitem>
<para>Log all messages to a temporary file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_DEBUG_XINERAMA</term>
<listitem>
<para>Log extra information about support of the XINERAMA extension.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_DEBUG_SM</term>
<listitem>
<para>Log extra information about session management.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_DEBUG_BUTTON_GRABS</term>
<listitem>
<para>Log extra information about button grabs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_SYNC</term>
<listitem>
<para>Call XSync after each X call.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_DISPLAY</term>
<listitem>
<para>Name of the X11 display to use.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>META_DISABLE_MIPMAPS</term>
<listitem>
<para>Disable use of mipmaps for the textures that back window pixmaps.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_USE_STATIC_GRAVITY</term>
<listitem>
<para>Enable support for clients with static bit-gravity.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_WM_CLASS_FILTER</term>
<listitem>
<para>Comma-separated list of WM_CLASS names to which to restrict Muffin to.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>MUFFIN_DISABLE_FALLBACK_COLOR</term>
<listitem>
<para>Disable fallback for themed colors, for easier detection of typographical errors.</para>
</listitem>
</varlistentry>
</variablelist>

</section>

</partintro>
</part>

+ 0
- 6
src/Makefile.am View File

@@ -132,18 +132,12 @@ libmuffin_la_SOURCES = \
inlinepixbufs.h \
ui/frames.c \
ui/frames.h \
ui/tile-hud.c \
ui/tile-hud.h \
ui/menu.c \
ui/menu.h \
ui/metaaccellabel.c \
ui/metaaccellabel.h \
ui/resizepopup.c \
ui/resizepopup.h \
ui/tabpopup.c \
ui/tabpopup.h \
ui/tile-preview.c \
ui/tile-preview.h \
ui/theme-parser.c \
ui/theme.c \
meta/theme.h \


+ 135
- 0
src/compositor/cogl-utils.c View File

@@ -111,3 +111,138 @@ meta_create_texture_material (CoglHandle src_texture)

return material;
}

/********************************************************************************************/
/********************************* CoglTexture2d wrapper ************************************/

static CoglContext *cogl_context = NULL;
static gboolean supports_npot = FALSE;

inline static gboolean
hardware_supports_npot_sizes (void)
{
if (cogl_context != NULL)
return supports_npot;

ClutterBackend *backend = clutter_get_default_backend ();
cogl_context = clutter_backend_get_cogl_context (backend);
supports_npot = cogl_has_feature (cogl_context, COGL_FEATURE_ID_TEXTURE_NPOT);

return supports_npot;
}

/**
* meta_cogl_texture_new_from_data_wrapper: (skip)
*
* Decides whether to use the newer (apparently safer)
* cogl_texture_2d_new_from_data or the older cogl_texture_new_from_data
* depending on if the GPU supports it.
*/

CoglTexture *
meta_cogl_texture_new_from_data_wrapper (int width,
int height,
CoglTextureFlags flags,
CoglPixelFormat format,
CoglPixelFormat internal_format,
int rowstride,
const uint8_t *data)
{
CoglTexture *texture = NULL;

if (hardware_supports_npot_sizes ())
{
texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (cogl_context, width, height,
format,
#if COGL_VERSION < COGL_VERSION_ENCODE (1, 18, 0)
COGL_PIXEL_FORMAT_ANY,
#endif
rowstride,
data,
NULL));
}
else
{
texture = cogl_texture_new_from_data (width,
height,
flags,
format,
internal_format,
rowstride,
data);
}

return texture;
}

/**
* meta_cogl_texture_new_from_file_wrapper: (skip)
*
* Decides whether to use the newer (apparently safer)
* cogl_texture_2d_new_from_file or the older cogl_texture_new_from_file
* depending on if the GPU supports it.
*/

CoglTexture *
meta_cogl_texture_new_from_file_wrapper (const char *filename,
CoglTextureFlags flags,
CoglPixelFormat internal_format)
{
CoglTexture *texture = NULL;

if (hardware_supports_npot_sizes ())
{
texture = COGL_TEXTURE (cogl_texture_2d_new_from_file (cogl_context,
filename,
#if COGL_VERSION < COGL_VERSION_ENCODE (1, 18, 0)
COGL_PIXEL_FORMAT_ANY,
#endif
NULL));
}
else
{
texture = cogl_texture_new_from_file (filename,
flags,
internal_format,
NULL);
}

return texture;
}

/**
* meta_cogl_texture_new_with_size_wrapper: (skip)
*
* Decides whether to use the newer (apparently safer)
* cogl_texture_2d_new_with_size or the older cogl_texture_new_with_size
* depending on if the GPU supports it.
*/

CoglTexture *
meta_cogl_texture_new_with_size_wrapper (int width,
int height,
CoglTextureFlags flags,
CoglPixelFormat internal_format)
{
CoglTexture *texture = NULL;

if (hardware_supports_npot_sizes ())
{
texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (cogl_context,
width,
height
#if COGL_VERSION < COGL_VERSION_ENCODE (1, 18, 0)
,CLUTTER_CAIRO_FORMAT_ARGB32
#endif
));
}
else
{
texture = cogl_texture_new_with_size (width, height,
flags,
internal_format);
}

return texture;
}


+ 21
- 0
src/compositor/cogl-utils.h View File

@@ -23,7 +23,11 @@
#ifndef __META_COGL_UTILS_H__
#define __META_COGL_UTILS_H__

#define COGL_ENABLE_EXPERIMENTAL_API
#define CLUTTER_ENABLE_EXPERIMENTAL_API

#include <cogl/cogl.h>
#include <clutter/clutter.h>

CoglHandle meta_create_color_texture_4ub (guint8 red,
guint8 green,
@@ -32,4 +36,21 @@ CoglHandle meta_create_color_texture_4ub (guint8 red,
CoglTextureFlags flags);
CoglHandle meta_create_texture_material (CoglHandle src_texture);

CoglTexture * meta_cogl_texture_new_from_data_wrapper (int width,
int height,
CoglTextureFlags flags,
CoglPixelFormat format,
CoglPixelFormat internal_format,
int rowstride,
const uint8_t *data);

CoglTexture * meta_cogl_texture_new_from_file_wrapper (const char *filename,
CoglTextureFlags flags,
CoglPixelFormat internal_format);

CoglTexture * meta_cogl_texture_new_with_size_wrapper (int width,
int height,
CoglTextureFlags flags,
CoglPixelFormat internal_format);

#endif /* __META_COGL_UTILS_H__ */

+ 117
- 31
src/compositor/compositor.c View File

@@ -1,5 +1,61 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

/**
* SECTION:compositor
* @title: MetaCompositor
* @short_Description: Compositor API
*
* At a high-level, a window is not-visible or visible. When a
* window is added (with meta_compositor_add_window()) it is not visible.
* meta_compositor_show_window() indicates a transition from not-visible to
* visible. Some of the reasons for this:
*
* - Window newly created
* - Window is unminimized
* - Window is moved to the current desktop
* - Window was made sticky
*
* meta_compositor_hide_window() indicates that the window has transitioned from
* visible to not-visible. Some reasons include:
*
* - Window was destroyed
* - Window is minimized
* - Window is moved to a different desktop
* - Window no longer sticky.
*
* Note that combinations are possible - a window might have first
* been minimized and then moved to a different desktop. The 'effect' parameter
* to meta_compositor_show_window() and meta_compositor_hide_window() is a hint
* as to the appropriate effect to show the user and should not
* be considered to be indicative of a state change.
*
* When the active workspace is changed, meta_compositor_switch_workspace() is
* called first, then meta_compositor_show_window() and
* meta_compositor_hide_window() are called individually for each window
* affected, with an effect of META_COMP_EFFECT_NONE.
* If hiding windows will affect the switch workspace animation, the
* compositor needs to delay hiding the windows until the switch
* workspace animation completes.
*
* meta_compositor_maximize_window() and meta_compositor_unmaximize_window()
* are transitions within the visible state. The window is resized __before__
* the call, so it may be necessary to readjust the display based on the
* old_rect to start the animation.
*
* # Containers #
*
* There's two containers in the stage that are used to place window actors, here
* are listed in the order in which they are painted:
*
* - window group, accessible with meta_get_window_group_for_screen()
* - top window group, accessible with meta_get_top_window_group_for_screen()
*
* Muffin will place actors representing windows in the window group, except for
* override-redirect windows (ie. popups and menus) which will be placed in the
* top window group.
*/


#include <config.h>

#include <clutter/x11/clutter-x11.h>
@@ -385,7 +441,6 @@ meta_begin_modal_for_plugin (MetaScreen *screen,
Display *xdpy = meta_display_get_xdisplay (display);
MetaCompositor *compositor = display->compositor;
gboolean pointer_grabbed = FALSE;
gboolean keyboard_grabbed = FALSE;
int result;

if (compositor->modal_plugin != NULL || display->grab_op != META_GRAB_OP_NONE)
@@ -416,8 +471,6 @@ meta_begin_modal_for_plugin (MetaScreen *screen,

if (result != Success)
goto fail;

keyboard_grabbed = TRUE;
}

display->grab_op = META_GRAB_OP_COMPOSITOR;
@@ -433,8 +486,6 @@ meta_begin_modal_for_plugin (MetaScreen *screen,
fail:
if (pointer_grabbed)
XUngrabPointer (xdpy, timestamp);
if (keyboard_grabbed)
XUngrabKeyboard (xdpy, timestamp);

return FALSE;
}
@@ -594,9 +645,7 @@ meta_compositor_manage_screen (MetaCompositor *compositor,

clutter_actor_hide (info->hidden_group);

info->plugin_mgr =
meta_plugin_manager_get (screen);
meta_plugin_manager_initialize (info->plugin_mgr);
info->plugin_mgr = meta_plugin_manager_new (screen);

/*
* Delay the creation of the overlay window as long as we can, to avoid
@@ -908,29 +957,6 @@ meta_compositor_unmaximize_window (MetaCompositor *compositor,
meta_window_actor_unmaximize (window_actor, old_rect, new_rect);
}

void
meta_compositor_update_workspace_geometry (MetaCompositor *compositor,
MetaWorkspace *workspace)
{
#if 0
/* FIXME -- should do away with this function in favour of MetaWorkspace
* signal.
*/
MetaScreen *screen = meta_workspace_get_screen (workspace);
MetaCompScreen *info;
MetaPluginManager *mgr;

DEBUG_TRACE ("meta_compositor_update_workspace_geometry\n");
info = meta_screen_get_compositor_data (screen);
mgr = info->plugin_mgr;

if (!mgr || !workspace)
return;

meta_plugin_manager_update_workspace (mgr, workspace);
#endif
}

void
meta_compositor_switch_workspace (MetaCompositor *compositor,
MetaScreen *screen,
@@ -1425,3 +1451,63 @@ meta_compositor_flash_screen (MetaCompositor *compositor,
"signal-after::completed", flash_in_completed, flash,
NULL);
}

void
meta_compositor_show_tile_preview (MetaCompositor *compositor,
MetaScreen *screen,
MetaWindow *window,
MetaRectangle *tile_rect,
int tile_monitor_number,
guint snap_queued)
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);

if (!info->plugin_mgr)
return;

meta_plugin_manager_show_tile_preview (info->plugin_mgr,
window, tile_rect, tile_monitor_number,
snap_queued);
}

void
meta_compositor_hide_tile_preview (MetaCompositor *compositor,
MetaScreen *screen)
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);

if (!info->plugin_mgr)
return;

meta_plugin_manager_hide_tile_preview (info->plugin_mgr);
}

void
meta_compositor_show_hud_preview (MetaCompositor *compositor,
MetaScreen *screen,
guint current_proximity_zone,
MetaRectangle *work_area,
guint snap_queued)
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);

if (!info->plugin_mgr)
return;

meta_plugin_manager_show_hud_preview (info->plugin_mgr,
current_proximity_zone,
work_area,
snap_queued);
}

void
meta_compositor_hide_hud_preview (MetaCompositor *compositor,
MetaScreen *screen)
{
MetaCompScreen *info = meta_screen_get_compositor_data (screen);

if (!info->plugin_mgr)
return;

meta_plugin_manager_hide_hud_preview (info->plugin_mgr);
}

+ 6
- 0
src/compositor/meta-background-actor.c View File

@@ -23,6 +23,12 @@
* Portions adapted from gnome-shell/src/shell-global.c
*/

/**
* SECTION:meta-background-actor
* @title: MetaBackgroundActor
* @short_description: Actor for painting the root window background
*/

#include <config.h>

#define COGL_ENABLE_EXPERIMENTAL_API


+ 201
- 299
src/compositor/meta-plugin-manager.c View File

@@ -35,34 +35,32 @@

#include <clutter/x11/clutter-x11.h>

static GSList *plugin_types;

/*
* We have one "default plugin manager" that acts for the first screen,
* but also can be used before we open any screens, and additional
* plugin managers for each screen. (This is ugly. Probably we should
* have one plugin manager and only make the plugins per-screen.)
*/
static MetaPluginManager *default_plugin_manager;
static GType plugin_type = G_TYPE_NONE;

struct MetaPluginManager
{
MetaScreen *screen;

GList /* MetaPlugin */ *plugins; /* TODO -- maybe use hash table */
MetaPlugin *plugin;
};

void
meta_plugin_manager_set_plugin_type (GType gtype)
{
if (plugin_type != G_TYPE_NONE)
meta_fatal ("Muffin plugin already set: %s", g_type_name (plugin_type));

plugin_type = gtype;
}

/*
* Loads the given plugin.
*/
void
meta_plugin_manager_load (MetaPluginManager *plugin_mgr,
const gchar *plugin_name)
meta_plugin_manager_load (const gchar *plugin_name)
{
const gchar *dpath = MUFFIN_PLUGIN_DIR "/";
gchar *path;
MetaModule *module;
GType plugin_type;

if (g_path_is_absolute (plugin_name))
path = g_strdup (plugin_name);
@@ -81,162 +79,47 @@ meta_plugin_manager_load (MetaPluginManager *plugin_mgr,
exit (1);
}

plugin_type = meta_module_get_plugin_type (module);
meta_plugin_manager_register (plugin_mgr, plugin_type);
meta_plugin_manager_set_plugin_type (meta_module_get_plugin_type (module));

g_type_module_unuse (G_TYPE_MODULE (module));
g_free (path);
}

/*
* Registers the given plugin type
*/
LOCAL_SYMBOL void
meta_plugin_manager_register (MetaPluginManager *plugin_mgr,
GType plugin_type)
{
MetaPlugin *plugin;

plugin_types = g_slist_prepend (plugin_types, GSIZE_TO_POINTER (plugin_type));

plugin = g_object_new (plugin_type, NULL);
plugin_mgr->plugins = g_list_prepend (plugin_mgr->plugins, plugin);
}

LOCAL_SYMBOL void
meta_plugin_manager_initialize (MetaPluginManager *plugin_mgr)
{
GList *iter;

if (!plugin_mgr->plugins)
{
/*
* If no plugins are specified, load the default plugin.
*/
meta_plugin_manager_load (plugin_mgr, "default");
}

for (iter = plugin_mgr->plugins; iter; iter = iter->next)
{
MetaPlugin *plugin = (MetaPlugin*) iter->data;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);

g_object_set (plugin,
"screen", plugin_mgr->screen,
NULL);

if (klass->start)
klass->start (plugin);
}
}

static MetaPluginManager *
MetaPluginManager *
meta_plugin_manager_new (MetaScreen *screen)
{
MetaPluginManager *plugin_mgr;
MetaPluginClass *klass;
MetaPlugin *plugin;

plugin_mgr = g_new0 (MetaPluginManager, 1);
plugin_mgr->screen = screen;
plugin_mgr->plugin = plugin = g_object_new (plugin_type, "screen", screen, NULL);

if (screen)
g_object_set_data (G_OBJECT (screen), "meta-plugin-manager", plugin_mgr);
klass = META_PLUGIN_GET_CLASS (plugin);

return plugin_mgr;
}
if (klass->start)
klass->start(plugin);

MetaPluginManager *
meta_plugin_manager_get_default (void)
{
if (!default_plugin_manager)
{
default_plugin_manager = meta_plugin_manager_new (NULL);
}

return default_plugin_manager;
}

LOCAL_SYMBOL MetaPluginManager *
meta_plugin_manager_get (MetaScreen *screen)
{
MetaPluginManager *plugin_mgr;

plugin_mgr = g_object_get_data (G_OBJECT (screen), "meta-plugin-manager");
if (plugin_mgr)
return plugin_mgr;

if (!default_plugin_manager)
meta_plugin_manager_get_default ();

if (!default_plugin_manager->screen)
{
/* The default plugin manager is so far unused, we can recycle it */
default_plugin_manager->screen = screen;
g_object_set_data (G_OBJECT (screen), "meta-plugin-manager", default_plugin_manager);

return default_plugin_manager;
}
else
{
GSList *iter;
GType plugin_type;
MetaPlugin *plugin;

plugin_mgr = meta_plugin_manager_new (screen);

for (iter = plugin_types; iter; iter = iter->next)
{
plugin_type = (GType)GPOINTER_TO_SIZE (iter->data);
plugin = g_object_new (plugin_type, "screen", screen, NULL);
plugin_mgr->plugins = g_list_prepend (plugin_mgr->plugins, plugin);
}

return plugin_mgr;
}
return plugin_mgr;
}

static void
meta_plugin_manager_kill_window_effects (MetaPluginManager *plugin_mgr,
MetaWindowActor *actor)
{
GList *l = plugin_mgr->plugins;
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);

while (l)
{
MetaPlugin *plugin = l->data;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);

if (!meta_plugin_disabled (plugin)
&& klass->kill_window_effects)
if (klass->kill_window_effects)
klass->kill_window_effects (plugin, actor);

l = l->next;
}
}

static void
meta_plugin_manager_kill_switch_workspace (MetaPluginManager *plugin_mgr)
{
GList *l = plugin_mgr->plugins;

while (l)
{
MetaPlugin *plugin = l->data;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);

if (!meta_plugin_disabled (plugin)
&& (meta_plugin_features (plugin) & META_PLUGIN_SWITCH_WORKSPACE)
&& klass->kill_switch_workspace)
klass->kill_switch_workspace (plugin);

l = l->next;
}
}

/*
* Public method that the compositor hooks into for events that require
* no additional parameters.
*
* Returns TRUE if at least one of the plugins handled the event type (i.e.,
* Returns TRUE if the plugin handled the event type (i.e.,
* if the return value is FALSE, there will be no subsequent call to the
* manager completed() callback, and the compositor must ensure that any
* appropriate post-effect cleanup is carried out.
@@ -246,70 +129,56 @@ meta_plugin_manager_event_simple (MetaPluginManager *plugin_mgr,
MetaWindowActor *actor,
unsigned long event)
{
GList *l = plugin_mgr->plugins;
gboolean retval = FALSE;
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
gboolean retval = FALSE;

if (display->display_opening)
return FALSE;
if (display->display_opening)
return FALSE;

while (l)
switch (event)
{
MetaPlugin *plugin = l->data;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
case META_PLUGIN_MINIMIZE:
if (klass->minimize)
{
retval = TRUE;
meta_plugin_manager_kill_window_effects (plugin_mgr, actor);

if (!meta_plugin_disabled (plugin) &&
(meta_plugin_features (plugin) & event))
{
retval = TRUE;
_meta_plugin_effect_started (plugin);
klass->minimize (plugin, actor);
}
break;
case META_PLUGIN_MAP:
if (klass->map)
{
retval = TRUE;
meta_plugin_manager_kill_window_effects (plugin_mgr, actor);

switch (event)
_meta_plugin_effect_started (plugin);
klass->map (plugin, actor);
}
break;
case META_PLUGIN_DESTROY:
if (klass->destroy)
{
case META_PLUGIN_MINIMIZE:
if (klass->minimize)
{
meta_plugin_manager_kill_window_effects (
plugin_mgr,
actor);

_meta_plugin_effect_started (plugin);
klass->minimize (plugin, actor);
}
break;
case META_PLUGIN_MAP:
if (klass->map)
{
meta_plugin_manager_kill_window_effects (
plugin_mgr,
actor);

_meta_plugin_effect_started (plugin);
klass->map (plugin, actor);
}
break;
case META_PLUGIN_DESTROY:
if (klass->destroy)
{
_meta_plugin_effect_started (plugin);
klass->destroy (plugin, actor);
}
break;
default:
g_warning ("Incorrect handler called for event %lu", event);
retval = TRUE;
_meta_plugin_effect_started (plugin);
klass->destroy (plugin, actor);
}
}
l = l->next;
break;
default:
g_warning ("Incorrect handler called for event %lu", event);
}

return retval;
return retval;
}

/*
* The public method that the compositor hooks into for maximize and unmaximize
* events.
*
* Returns TRUE if at least one of the plugins handled the event type (i.e.,
* Returns TRUE if the plugin handled the event type (i.e.,
* if the return value is FALSE, there will be no subsequent call to the
* manager completed() callback, and the compositor must ensure that any
* appropriate post-effect cleanup is carried out.
@@ -323,77 +192,67 @@ meta_plugin_manager_event_maximize (MetaPluginManager *plugin_mgr,
gint target_width,
gint target_height)
{
GList *l = plugin_mgr->plugins;
gboolean retval = FALSE;
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
gboolean retval = FALSE;

if (display->display_opening)
return FALSE;
if (display->display_opening)
return FALSE;

while (l)
switch (event)
{
MetaPlugin *plugin = l->data;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);

if (!meta_plugin_disabled (plugin) &&
(meta_plugin_features (plugin) & event))
{
retval = TRUE;

switch (event)
case META_PLUGIN_MAXIMIZE:
if (klass->maximize)
{
case META_PLUGIN_MAXIMIZE:
if (klass->maximize)
{
meta_plugin_manager_kill_window_effects (
plugin_mgr,
actor);

_meta_plugin_effect_started (plugin);
klass->maximize (plugin, actor,
target_x, target_y,
target_width, target_height);
}
break;
case META_PLUGIN_UNMAXIMIZE:
if (klass->unmaximize)
{
meta_plugin_manager_kill_window_effects (
plugin_mgr,
actor);

_meta_plugin_effect_started (plugin);
klass->unmaximize (plugin, actor,
target_x, target_y,
target_width, target_height);
}
break;
case META_PLUGIN_TILE:
if (klass->tile)
{
meta_plugin_manager_kill_window_effects (plugin_mgr,
actor);
_meta_plugin_effect_started (plugin);
klass->tile (plugin, actor,
retval = TRUE;
meta_plugin_manager_kill_window_effects (
plugin_mgr,
actor);

_meta_plugin_effect_started (plugin);
klass->maximize (plugin, actor,
target_x, target_y,
target_width, target_height);
}
break;
default:
g_warning ("Incorrect handler called for event %lu", event);
}
}
break;
case META_PLUGIN_UNMAXIMIZE:
if (klass->unmaximize)
{
retval = TRUE;
meta_plugin_manager_kill_window_effects (
plugin_mgr,
actor);

l = l->next;
_meta_plugin_effect_started (plugin);
klass->unmaximize (plugin, actor,
target_x, target_y,
target_width, target_height);
}
break;
case META_PLUGIN_TILE:
if (klass->tile)
{
retval = TRUE;
meta_plugin_manager_kill_window_effects (plugin_mgr,
actor);
_meta_plugin_effect_started (plugin);
klass->tile (plugin, actor,
target_x, target_y,
target_width, target_height);
}
break;
default:
g_warning ("Incorrect handler called for event %lu", event);
}

return retval;
return retval;
}

/*
* The public method that the compositor hooks into for desktop switching.
*
* Returns TRUE if at least one of the plugins handled the event type (i.e.,
* Returns TRUE if the plugin handled the event type (i.e.,
* if the return value is FALSE, there will be no subsequent call to the
* manager completed() callback, and the compositor must ensure that any
* appropriate post-effect cleanup is carried out.
@@ -404,41 +263,29 @@ meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr,
gint to,
MetaMotionDirection direction)
{
GList *l = plugin_mgr->plugins;
gboolean retval = FALSE;
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);
gboolean retval = FALSE;

if (display->display_opening)
return FALSE;
if (display->display_opening)
return FALSE;

while (l)
if (klass->switch_workspace)
{
MetaPlugin *plugin = l->data;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);

if (!meta_plugin_disabled (plugin) &&
(meta_plugin_features (plugin) & META_PLUGIN_SWITCH_WORKSPACE))
{
if (klass->switch_workspace)
{
retval = TRUE;
meta_plugin_manager_kill_switch_workspace (plugin_mgr);
retval = TRUE;

_meta_plugin_effect_started (plugin);
klass->switch_workspace (plugin, from, to, direction);
}
}

l = l->next;
_meta_plugin_effect_started (plugin);
klass->switch_workspace (plugin, from, to, direction);
}

return retval;
return retval;
}

/*
* The public method that the compositor hooks into for desktop switching.
*
* Returns TRUE if at least one of the plugins handled the event type (i.e.,
* Returns TRUE if the plugin handled the event type (i.e.,
* if the return value is FALSE, there will be no subsequent call to the
* manager completed() callback, and the compositor must ensure that any
* appropriate post-effect cleanup is carried out.
@@ -447,49 +294,104 @@ LOCAL_SYMBOL gboolean
meta_plugin_manager_xevent_filter (MetaPluginManager *plugin_mgr,
XEvent *xev)
{
GList *l;
gboolean have_plugin_xevent_func;
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);

if (!plugin_mgr)
return FALSE;

l = plugin_mgr->plugins;

/* We need to make sure that clutter gets certain events, like
* ConfigureNotify on the stage window. If there is a plugin that
* provides an xevent_filter function, then it's the responsibility
* of that plugin to pass events to Clutter. Otherwise, we send the
* event directly to Clutter ourselves.
*
* What happens if there are two plugins with xevent_filter functions
* is undefined; in general, multiple competing plugins are something
* we don't support well or care much about.
*
* FIXME: Really, we should just always handle sending the event to
* clutter if a plugin doesn't report the event as handled by
* returning TRUE, but it doesn't seem worth breaking compatibility
* of the plugin interface right now to achieve this; the way it is
* now works fine in practice.
*/
have_plugin_xevent_func = FALSE;
if (klass->xevent_filter)
return klass->xevent_filter (plugin, xev);
else
return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
}

gboolean
meta_plugin_manager_show_tile_preview (MetaPluginManager *plugin_mgr,
MetaWindow *window,
MetaRectangle *tile_rect,
int tile_monitor_number,
guint snap_queued)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);

if (display->display_opening)
return FALSE;

while (l)
if (klass->show_tile_preview)
{
MetaPlugin *plugin = l->data;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
klass->show_tile_preview (plugin, window, tile_rect, tile_monitor_number, snap_queued);
return TRUE;
}

if (klass->xevent_filter)
{
have_plugin_xevent_func = TRUE;
if (klass->xevent_filter (plugin, xev) == TRUE)
return TRUE;
}
return FALSE;
}

l = l->next;
gboolean
meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);

if (display->display_opening)
return FALSE;

if (klass->hide_tile_preview)
{
klass->hide_tile_preview (plugin);
return TRUE;
}

if (!have_plugin_xevent_func)
return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
return FALSE;
}

gboolean
meta_plugin_manager_show_hud_preview (MetaPluginManager *plugin_mgr,
guint current_proximity_zone,
MetaRectangle *work_area,
guint snap_queued)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);

if (display->display_opening)
return FALSE;

if (klass->show_hud_preview)
{
klass->show_hud_preview (plugin, current_proximity_zone,
work_area, snap_queued);
return TRUE;
}

return FALSE;
}

return FALSE;
gboolean
meta_plugin_manager_hide_hud_preview (MetaPluginManager *plugin_mgr)
{
MetaPlugin *plugin = plugin_mgr->plugin;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
MetaDisplay *display = meta_screen_get_display (plugin_mgr->screen);

if (display->display_opening)
return FALSE;

if (klass->hide_hud_preview)
{
klass->hide_hud_preview (plugin);
return TRUE;
}

return FALSE;
}

+ 17
- 7
src/compositor/meta-plugin-manager.h View File

@@ -47,14 +47,9 @@
*/
typedef struct MetaPluginManager MetaPluginManager;

MetaPluginManager * meta_plugin_manager_get (MetaScreen *screen);
MetaPluginManager * meta_plugin_manager_get_default (void);
MetaPluginManager * meta_plugin_manager_new (MetaScreen *screen);

void meta_plugin_manager_load (MetaPluginManager *mgr,
const gchar *plugin_name);
void meta_plugin_manager_register (MetaPluginManager *mgr,
GType plugin_type);
void meta_plugin_manager_initialize (MetaPluginManager *mgr);
void meta_plugin_manager_load (const gchar *plugin_name);

gboolean meta_plugin_manager_event_simple (MetaPluginManager *mgr,
MetaWindowActor *actor,
@@ -80,4 +75,19 @@ gboolean meta_plugin_manager_switch_workspace (MetaPluginManager *mgr,
gboolean meta_plugin_manager_xevent_filter (MetaPluginManager *mgr,
XEvent *xev);

gboolean meta_plugin_manager_show_tile_preview (MetaPluginManager *plugin_mgr,
MetaWindow *window,
MetaRectangle *tile_rect,
int tile_monitor_number,
guint snap_queued);

gboolean meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr);

gboolean meta_plugin_manager_show_hud_preview (MetaPluginManager *plugin_mgr,
guint current_proximity_zone,
MetaRectangle *work_area,
guint snap_queued);

gboolean meta_plugin_manager_hide_hud_preview (MetaPluginManager *plugin_mgr);

#endif

+ 6
- 120
src/compositor/meta-plugin.c View File

@@ -21,6 +21,12 @@
* 02110-1335, USA.
*/

/**
* SECTION:meta-plugin
* @title: MetaPlugin
* @short_description: Entry point for plugins
*/

#include <meta/meta-plugin.h>
#include "meta-plugin-manager.h"
#include <meta/screen.h>
@@ -44,77 +50,17 @@ enum
{
PROP_0,
PROP_SCREEN,
PROP_FEATURES,
PROP_DISABLED,
PROP_DEBUG_MODE,
};

struct _MetaPluginPrivate
{
MetaScreen *screen;
gulong features;

gint running;

gboolean disabled : 1;
gboolean debug : 1;
};

static void
meta_plugin_set_features (MetaPlugin *plugin)
{
MetaPluginPrivate *priv = plugin->priv;
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);

priv->features = 0;

/*
* Feature flags: identify events that the plugin can handle; a plugin can
* handle one or more events.
*/
if (klass->minimize)
priv->features |= META_PLUGIN_MINIMIZE;

if (klass->maximize)
priv->features |= META_PLUGIN_MAXIMIZE;

if (klass->unmaximize)
priv->features |= META_PLUGIN_UNMAXIMIZE;

if (klass->map)
priv->features |= META_PLUGIN_MAP;

if (klass->destroy)
priv->features |= META_PLUGIN_DESTROY;

if (klass->switch_workspace)
priv->features |= META_PLUGIN_SWITCH_WORKSPACE;

if (klass->tile)
priv->features |= META_PLUGIN_TILE;
}

static void
meta_plugin_constructed (GObject *object)
{
meta_plugin_set_features (META_PLUGIN (object));

if (G_OBJECT_CLASS (meta_plugin_parent_class)->constructed)
G_OBJECT_CLASS (meta_plugin_parent_class)->constructed (object);
}

static void
meta_plugin_dispose (GObject *object)
{
G_OBJECT_CLASS (meta_plugin_parent_class)->dispose (object);
}

static void
meta_plugin_finalize (GObject *object)
{
G_OBJECT_CLASS (meta_plugin_parent_class)->finalize (object);
}

static void
meta_plugin_set_property (GObject *object,
guint prop_id,
@@ -128,9 +74,6 @@ meta_plugin_set_property (GObject *object,
case PROP_SCREEN:
priv->screen = g_value_get_object (value);
break;
case PROP_DISABLED:
priv->disabled = g_value_get_boolean (value);
break;
case PROP_DEBUG_MODE:
priv->debug = g_value_get_boolean (value);
break;
@@ -153,15 +96,9 @@ meta_plugin_get_property (GObject *object,
case PROP_SCREEN:
g_value_set_object (value, priv->screen);
break;
case PROP_DISABLED:
g_value_set_boolean (value, priv->disabled);
break;
case PROP_DEBUG_MODE:
g_value_set_boolean (value, priv->debug);
break;
case PROP_FEATURES:
g_value_set_ulong (value, priv->features);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -174,9 +111,6 @@ meta_plugin_class_init (MetaPluginClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);

gobject_class->constructed = meta_plugin_constructed;
gobject_class->finalize = meta_plugin_finalize;
gobject_class->dispose = meta_plugin_dispose;
gobject_class->set_property = meta_plugin_set_property;
gobject_class->get_property = meta_plugin_get_property;

@@ -188,22 +122,6 @@ meta_plugin_class_init (MetaPluginClass *klass)
META_TYPE_SCREEN,
G_PARAM_READWRITE));

g_object_class_install_property (gobject_class,
PROP_FEATURES,
g_param_spec_ulong ("features",
"Features",
"Plugin Features",
0 , G_MAXULONG, 0,
G_PARAM_READABLE));

g_object_class_install_property (gobject_class,
PROP_DISABLED,
g_param_spec_boolean ("disabled",
"Plugin disabled",
"Plugin disabled",
FALSE,
G_PARAM_READWRITE));

g_object_class_install_property (gobject_class,
PROP_DEBUG_MODE,
g_param_spec_boolean ("debug-mode",
@@ -223,22 +141,6 @@ meta_plugin_init (MetaPlugin *self)
self->priv = priv = META_PLUGIN_GET_PRIVATE (self);
}

gulong
meta_plugin_features (MetaPlugin *plugin)
{
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;

return priv->features;
}

gboolean
meta_plugin_disabled (MetaPlugin *plugin)
{
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;

return priv->disabled;
}

gboolean
meta_plugin_running (MetaPlugin *plugin)
{
@@ -442,19 +344,3 @@ meta_plugin_get_screen (MetaPlugin *plugin)

return priv->screen;
}

/**
* meta_plugin_type_register:
* @plugin_type: a #MetaPlugin type
*
* Register @plugin_type as a compositor plugin type to be used.
* You must call this before calling meta_init().
*/
void
meta_plugin_type_register (GType plugin_type)
{
MetaPluginManager *plugin_manager;

plugin_manager = meta_plugin_manager_get_default ();
meta_plugin_manager_register (plugin_manager, plugin_type);
}

+ 16
- 9
src/compositor/meta-shadow-factory.c View File

@@ -21,6 +21,13 @@
* Foundation, Inc., 51 Franklin Street - Suite 500, Boston, MA
* 02110-1335, USA.
*/

/**
* SECTION:meta-shadow-factory
* @title: MetaShadowFactory
* @short_description: Create and cache shadow textures for arbitrary window shapes
*/

#include <config.h>
#include <math.h>
#include <string.h>
@@ -787,15 +794,15 @@ make_shadow (MetaShadow *shadow,
* in the case of top_fade >= 0. We also account for padding at the left for symmetry
* though that doesn't currently 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,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_A_8,
COGL_PIXEL_FORMAT_ANY,
buffer_width,
(buffer +
(y_offset - shadow->outer_border_top) * buffer_width +
(x_offset - shadow->outer_border_left)));
shadow->texture = meta_cogl_texture_new_from_data_wrapper (shadow->outer_border_left + extents.width + shadow->outer_border_right,
shadow->outer_border_top + extents.height + shadow->outer_border_bottom,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_A_8,
COGL_PIXEL_FORMAT_ANY,
buffer_width,
(buffer +
(y_offset - shadow->outer_border_top) * buffer_width +
(x_offset - shadow->outer_border_left)));

cairo_region_destroy (row_convolve_region);
cairo_region_destroy (column_convolve_region);


+ 13
- 6
src/compositor/meta-shaped-texture.c View File

@@ -23,6 +23,12 @@
* 02110-1335, USA.
*/

/**
* SECTION:meta-shaped-texture
* @title: MetaShapedTexture
* @short_description: An actor to draw a masked texture.
*/

#include <config.h>

#define CLUTTER_ENABLE_EXPERIMENTAL_API
@@ -31,6 +37,7 @@
#include <meta/meta-shaped-texture.h>
#include "meta-texture-tower.h"
#include "meta-texture-rectangle.h"
#include "cogl-utils.h"

#include <clutter/clutter.h>
#include <cogl/cogl.h>
@@ -299,12 +306,12 @@ meta_shaped_texture_ensure_mask (MetaShapedTexture *stex)
stride,
mask_data);
else
priv->mask_texture = cogl_texture_new_from_data (tex_width, tex_height,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_A_8,
COGL_PIXEL_FORMAT_ANY,
stride,
mask_data);
priv->mask_texture = meta_cogl_texture_new_from_data_wrapper (tex_width, tex_height,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_A_8,
COGL_PIXEL_FORMAT_ANY,
stride,
mask_data);

g_free (mask_data);



+ 4
- 3
src/compositor/meta-texture-tower.c View File

@@ -31,6 +31,7 @@

#include "meta-texture-tower.h"
#include "meta-texture-rectangle.h"
#include "cogl-utils.h"

#ifndef M_LOG2E
#define M_LOG2E 1.4426950408889634074
@@ -374,9 +375,9 @@ texture_tower_create_texture (MetaTextureTower *tower,
}
else
{
tower->textures[level] = cogl_texture_new_with_size (width, height,
COGL_TEXTURE_NO_AUTO_MIPMAP,
TEXTURE_FORMAT);
tower->textures[level] = meta_cogl_texture_new_with_size_wrapper (width, height,
COGL_TEXTURE_NO_AUTO_MIPMAP,
TEXTURE_FORMAT);
}

tower->invalid[level].x1 = 0;


+ 54
- 0
src/compositor/meta-window-actor.c View File

@@ -1,5 +1,11 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */

/**
* SECTION:meta-window-actor
* @title: MetaWindowActor
* @short_description: An actor representing a top-level window in the scene graph
*/

#include <config.h>

#include <math.h>
@@ -121,6 +127,8 @@ struct _MetaWindowActorPrivate
/* This is used to detect fullscreen windows that need to be unredirected */
guint full_damage_frames_count;
guint does_full_damage : 1;

guint has_desat_effect : 1;
};

enum
@@ -259,6 +267,41 @@ meta_window_actor_init (MetaWindowActor *self)
MetaWindowActorPrivate);
priv->opacity = 0xff;
priv->shadow_class = NULL;
priv->has_desat_effect = FALSE;
}

static void
maybe_desaturate_window (ClutterActor *actor)
{
MetaWindowActor *window = META_WINDOW_ACTOR (actor);
MetaWindowActorPrivate *priv = window->priv;

guint8 opacity = clutter_actor_get_opacity (actor);

if (opacity < 255)
{
if (priv->has_desat_effect)
{
return;
}
else
{
ClutterEffect *effect = clutter_desaturate_effect_new (0.0);
clutter_actor_add_effect_with_name (actor, "desaturate-for-transparency", effect);
priv->has_desat_effect = TRUE;
}
}
else
{
/* This is will tend to get called fairly often - opening new windows, various
events on the window, like minimizing... but it's inexpensive - if the ClutterActor
priv->effects is NULL, it simply returns. By default cinnamon and muffin add no
other effects except the special case of dimmed windows (attached modal dialogs), which
isn't a frequent occurrence. */

clutter_actor_remove_effect_by_name (actor, "desaturate-for-transparency");
priv->has_desat_effect = FALSE;
}
}

static void
@@ -318,6 +361,14 @@ window_appears_focused_notify (MetaWindow *mw,
clutter_actor_queue_redraw (CLUTTER_ACTOR (data));
}

static void
clutter_actor_opacity_notify (ClutterActor *actor,
GParamSpec *arg1m,
gpointer data)
{
maybe_desaturate_window (actor);
}

static void
meta_window_actor_constructed (GObject *object)
{
@@ -357,6 +408,8 @@ meta_window_actor_constructed (GObject *object)
G_CALLBACK (window_decorated_notify), self);
g_signal_connect (window, "notify::appears-focused",
G_CALLBACK (window_appears_focused_notify), self);
g_signal_connect (self, "notify::opacity",
G_CALLBACK (clutter_actor_opacity_notify), NULL);
}
else
{
@@ -368,6 +421,7 @@ meta_window_actor_constructed (GObject *object)
}

meta_window_actor_update_opacity (self);
maybe_desaturate_window (CLUTTER_ACTOR (self));

priv->shape_region = cairo_region_create();
}


+ 0
- 1
src/compositor/meta-window-group.c View File

@@ -208,7 +208,6 @@ meta_window_group_paint (ClutterActor *actor)
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))


+ 7
- 29
src/compositor/plugins/default.c View File

@@ -94,7 +94,6 @@ static void switch_workspace (MetaPlugin *plugin,

static void kill_window_effects (MetaPlugin *plugin,
MetaWindowActor *actor);
static void kill_switch_workspace (MetaPlugin *plugin);

static const MetaPluginInfo * plugin_info (MetaPlugin *plugin);

@@ -187,26 +186,12 @@ start (MetaPlugin *plugin)
{
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;

guint destroy_timeout = DESTROY_TIMEOUT;
guint minimize_timeout = MINIMIZE_TIMEOUT;
guint maximize_timeout = MAXIMIZE_TIMEOUT;
guint map_timeout = MAP_TIMEOUT;
guint switch_timeout = SWITCH_TIMEOUT;

if (meta_plugin_debug_mode (plugin))
{
g_debug ("Plugin %s: Entering debug mode.", priv->info.name);

priv->debug_mode = TRUE;