Compare commits
15 Commits
2.91.93
...
configurab
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a4cfde4e2 | ||
|
|
c853d197e3 | ||
|
|
bf7ae3e4d3 | ||
|
|
2b21f1d48c | ||
|
|
4c91e05b86 | ||
|
|
bc91c328f3 | ||
|
|
5bbbac65d6 | ||
|
|
a0a0fc14d7 | ||
|
|
cc9efe1289 | ||
|
|
8825ded1ca | ||
|
|
b823ef0007 | ||
|
|
a846434bcf | ||
|
|
825fc2c0c8 | ||
|
|
4fbe547f16 | ||
|
|
fc2ba0afbe |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -43,7 +43,7 @@ POTFILES
|
||||
50-metacity-desktop-key.xml
|
||||
50-metacity-key.xml
|
||||
inlinepixbufs.h
|
||||
libmutter.pc
|
||||
libmutter-private.pc
|
||||
mutter
|
||||
mutter-theme-viewer
|
||||
mutter.desktop
|
||||
|
||||
172
configure.in
172
configure.in
@@ -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], [93])
|
||||
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
|
||||
|
||||
@@ -96,6 +162,11 @@ AC_ARG_ENABLE(startup-notification,
|
||||
[disable mutter's startup notification support, for embedded/size-sensitive custom non-GNOME builds]),,
|
||||
enable_startup_notification=auto)
|
||||
|
||||
AC_ARG_WITH(introspection,
|
||||
AC_HELP_STRING([--without-introspection],
|
||||
[disable the use of GObject introspection]),,
|
||||
with_introspection=auto)
|
||||
|
||||
AC_ARG_WITH(libcanberra,
|
||||
AC_HELP_STRING([--without-libcanberra],
|
||||
[disable the use of libcanberra for playing sounds]),,
|
||||
@@ -209,15 +280,24 @@ else
|
||||
AC_MSG_ERROR([no. Mutter requires Clutter version $CLUTTER_VERSION.])
|
||||
fi
|
||||
|
||||
INTROSPECTION_VERSION=0.9.5
|
||||
GOBJECT_INTROSPECTION_CHECK([$INTROSPECTION_VERSION])
|
||||
|
||||
if test x$found_introspection != xno; then
|
||||
AC_DEFINE(HAVE_INTROSPECTION, 1, [Define if GObject introspection is available])
|
||||
MUTTER_PC_MODULES="$MUTTER_PC_MODULES gobject-introspection-1.0"
|
||||
META_GIR=[Meta_]mutter_major_version[_]mutter_minor_version[_gir]
|
||||
AC_SUBST(META_GIR)
|
||||
if test x$with_introspection != xno; then
|
||||
PKG_CHECK_MODULES(INTROSPECTION, gobject-introspection-1.0 >= 0.9.5, have_introspection=yes, have_introspection=no)
|
||||
if test x$have_introspection=xyes; then
|
||||
MUTTER_PC_MODULES="$MUTTER_PC_MODULES gobject-introspection-1.0"
|
||||
AC_DEFINE(HAVE_INTROSPECTION, 1, [Define if GObject introspection is available])
|
||||
G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
|
||||
AC_SUBST(G_IR_SCANNER)
|
||||
G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
|
||||
AC_SUBST(G_IR_COMPILER)
|
||||
G_IR_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
|
||||
AC_SUBST(G_IR_GENERATE)
|
||||
GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
|
||||
AC_SUBST(GIRDIR)
|
||||
TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
|
||||
AC_SUBST(TYPELIBDIR)
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_INTROSPECTION, test "$have_introspection" = "yes")
|
||||
|
||||
AC_MSG_CHECKING([Xcursor])
|
||||
if $PKG_CONFIG xcursor; then
|
||||
@@ -438,79 +518,13 @@ 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
|
||||
doc/man/Makefile
|
||||
src/Makefile
|
||||
src/wm-tester/Makefile
|
||||
src/libmutter.pc
|
||||
src/libmutter-private.pc
|
||||
src/mutter-plugins.pc
|
||||
src/tools/Makefile
|
||||
src/compositor/plugins/Makefile
|
||||
@@ -547,7 +561,7 @@ mutter-$VERSION
|
||||
Solaris Xinerama: ${use_solaris_xinerama}
|
||||
Startup notification: ${have_startup_notification}
|
||||
libcanberra: ${have_libcanberra}
|
||||
Introspection: ${found_introspection}
|
||||
Introspection: ${have_introspection}
|
||||
Session management: ${found_sm}
|
||||
Shape extension: ${found_shape}
|
||||
Xsync: ${found_xsync}
|
||||
@@ -560,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
|
||||
|
||||
@@ -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
|
||||
========================================
|
||||
|
||||
|
||||
10
mutter.doap
10
mutter.doap
@@ -6,16 +6,6 @@
|
||||
|
||||
<name xml:lang="en">mutter</name>
|
||||
<shortdesc xml:lang="en">Window and compositing manager based on Clutter</shortdesc>
|
||||
<description>Mutter is a window and compositing manager that displays and
|
||||
manages your desktop via OpenGL. Mutter combines a sophisticated display engine
|
||||
using the Clutter toolkit with solid window-management logic inherited from the
|
||||
Metacity window manager.
|
||||
|
||||
While Mutter can be used stand-alone, it is primarily intended to be used as
|
||||
the display core of a larger system such as GNOME Shell. For this reason,
|
||||
Mutter is very extensible via plugins, which are used both to add fancy visual
|
||||
effects and to rework the window management behaviors to meet the needs of the
|
||||
environment.</description>
|
||||
<!--
|
||||
<homepage rdf:resource="http://www.gnome.org/" />
|
||||
-->
|
||||
|
||||
@@ -82,7 +82,6 @@ te
|
||||
th
|
||||
tk
|
||||
tr
|
||||
ug
|
||||
uk
|
||||
vi
|
||||
wa
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# List of source files containing translatable strings.
|
||||
# Please keep this file sorted alphabetically.
|
||||
src/core/all-keybindings.h
|
||||
src/core/bell.c
|
||||
src/core/core.c
|
||||
src/core/delete.c
|
||||
@@ -8,7 +7,6 @@ src/core/display.c
|
||||
src/core/errors.c
|
||||
src/core/keybindings.c
|
||||
src/core/main.c
|
||||
src/core/mutter.c
|
||||
src/core/prefs.c
|
||||
src/core/screen.c
|
||||
src/core/session.c
|
||||
@@ -16,6 +14,7 @@ src/core/util.c
|
||||
src/core/window.c
|
||||
src/core/window-props.c
|
||||
src/core/xprops.c
|
||||
src/include/all-keybindings.h
|
||||
src/mutter.desktop.in
|
||||
src/mutter-wm.desktop.in
|
||||
src/mutter.schemas.in
|
||||
|
||||
1248
po/en_GB.po
1248
po/en_GB.po
File diff suppressed because it is too large
Load Diff
1300
po/zh_CN.po
1300
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
551
po/zh_HK.po
551
po/zh_HK.po
File diff suppressed because it is too large
Load Diff
553
po/zh_TW.po
553
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
220
src/Makefile.am
220
src/Makefile.am
@@ -1,30 +1,11 @@
|
||||
# Flag build for parallelism; see https://savannah.gnu.org/patch/?6905
|
||||
.AUTOPARALLEL:
|
||||
|
||||
lib_LTLIBRARIES = libmutter.la
|
||||
lib_LTLIBRARIES = libmutter-private.la
|
||||
|
||||
SUBDIRS=wm-tester tools compositor/plugins
|
||||
|
||||
INCLUDES= \
|
||||
$(MUTTER_CFLAGS) \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/core \
|
||||
-I$(srcdir)/ui \
|
||||
-I$(srcdir)/compositor \
|
||||
-DMUTTER_LIBEXECDIR=\"$(libexecdir)\" \
|
||||
-DHOST_ALIAS=\"@HOST_ALIAS@\" \
|
||||
-DMUTTER_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" \
|
||||
-DMUTTER_PKGDATADIR=\"$(pkgdatadir)\" \
|
||||
-DMUTTER_DATADIR=\"$(datadir)\" \
|
||||
-DG_LOG_DOMAIN=\"mutter\" \
|
||||
-DSN_API_NOT_YET_FROZEN=1 \
|
||||
-DMUTTER_MAJOR_VERSION=$(MUTTER_MAJOR_VERSION) \
|
||||
-DMUTTER_MINOR_VERSION=$(MUTTER_MINOR_VERSION) \
|
||||
-DMUTTER_MICRO_VERSION=$(MUTTER_MICRO_VERSION) \
|
||||
-DMUTTER_PLUGIN_API_VERSION=$(MUTTER_PLUGIN_API_VERSION) \
|
||||
-DMUTTER_PKGLIBDIR=\"$(pkglibdir)\" \
|
||||
-DMUTTER_PLUGIN_DIR=\"@MUTTER_PLUGIN_DIR@\" \
|
||||
-DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\"
|
||||
INCLUDES=@MUTTER_CFLAGS@ -I $(srcdir)/include -I$(srcdir)/compositor -DMUTTER_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMUTTER_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMUTTER_PKGDATADIR=\"$(pkgdatadir)\" -DMUTTER_DATADIR=\"$(datadir)\" -DG_LOG_DOMAIN=\"mutter\" -DSN_API_NOT_YET_FROZEN=1 -DMUTTER_MAJOR_VERSION=$(MUTTER_MAJOR_VERSION) -DMUTTER_MINOR_VERSION=$(MUTTER_MINOR_VERSION) -DMUTTER_MICRO_VERSION=$(MUTTER_MICRO_VERSION) -DMUTTER_PLUGIN_API_VERSION=$(MUTTER_PLUGIN_API_VERSION) -DMUTTER_PKGLIBDIR=\"$(pkglibdir)\" -DMUTTER_PLUGIN_DIR=\"@MUTTER_PLUGIN_DIR@\"
|
||||
|
||||
mutter_built_sources = \
|
||||
mutter-marshal.h \
|
||||
@@ -32,20 +13,16 @@ mutter_built_sources = \
|
||||
mutter-enum-types.h \
|
||||
mutter-enum-types.c
|
||||
|
||||
libmutter_la_SOURCES = \
|
||||
mutter_SOURCES= \
|
||||
core/async-getprop.c \
|
||||
core/async-getprop.h \
|
||||
core/bell.c \
|
||||
core/bell.h \
|
||||
core/boxes.c \
|
||||
core/boxes-private.h \
|
||||
meta/boxes.h \
|
||||
compositor/cogl-utils.c \
|
||||
compositor/cogl-utils.h \
|
||||
include/boxes.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 \
|
||||
@@ -65,36 +42,36 @@ libmutter_la_SOURCES = \
|
||||
compositor/meta-window-shape.h \
|
||||
compositor/region-utils.c \
|
||||
compositor/region-utils.h \
|
||||
meta/compositor.h \
|
||||
meta/meta-plugin.h \
|
||||
meta/meta-shadow-factory.h \
|
||||
meta/meta-window-actor.h \
|
||||
meta/compositor-mutter.h \
|
||||
core/above-tab-keycode.c \
|
||||
include/compositor.h \
|
||||
include/meta-plugin.h \
|
||||
include/meta-shadow-factory.h \
|
||||
include/meta-window-actor.h \
|
||||
include/compositor-mutter.h \
|
||||
core/constraints.c \
|
||||
core/constraints.h \
|
||||
core/core.c \
|
||||
core/delete.c \
|
||||
core/display.c \
|
||||
core/display-private.h \
|
||||
meta/display.h \
|
||||
include/display.h \
|
||||
ui/draw-workspace.c \
|
||||
ui/draw-workspace.h \
|
||||
core/edge-resistance.c \
|
||||
core/edge-resistance.h \
|
||||
core/errors.c \
|
||||
meta/errors.h \
|
||||
include/errors.h \
|
||||
core/eventqueue.c \
|
||||
core/eventqueue.h \
|
||||
core/frame.c \
|
||||
core/frame.h \
|
||||
core/frame-private.h \
|
||||
include/frame.h \
|
||||
ui/gradient.c \
|
||||
meta/gradient.h \
|
||||
ui/gradient.h \
|
||||
core/group-private.h \
|
||||
core/group-props.c \
|
||||
core/group-props.h \
|
||||
core/group.c \
|
||||
meta/group.h \
|
||||
include/group.h \
|
||||
core/iconcache.c \
|
||||
core/iconcache.h \
|
||||
core/keybindings.c \
|
||||
@@ -104,11 +81,11 @@ libmutter_la_SOURCES = \
|
||||
core/place.c \
|
||||
core/place.h \
|
||||
core/prefs.c \
|
||||
meta/prefs.h \
|
||||
include/prefs.h \
|
||||
core/screen.c \
|
||||
core/screen-private.h \
|
||||
meta/screen.h \
|
||||
meta/types.h \
|
||||
include/screen.h \
|
||||
include/types.h \
|
||||
core/session.c \
|
||||
core/session.h \
|
||||
core/stack.c \
|
||||
@@ -116,19 +93,19 @@ libmutter_la_SOURCES = \
|
||||
core/stack-tracker.c \
|
||||
core/stack-tracker.h \
|
||||
core/util.c \
|
||||
meta/util.h \
|
||||
include/util.h \
|
||||
core/window-props.c \
|
||||
core/window-props.h \
|
||||
core/window.c \
|
||||
core/window-private.h \
|
||||
meta/window.h \
|
||||
include/window.h \
|
||||
core/workspace.c \
|
||||
core/workspace-private.h \
|
||||
core/xprops.c \
|
||||
core/xprops.h \
|
||||
meta/common.h \
|
||||
core/core.h \
|
||||
ui/ui.h \
|
||||
include/xprops.h \
|
||||
include/common.h \
|
||||
include/core.h \
|
||||
include/ui.h \
|
||||
inlinepixbufs.h \
|
||||
ui/fixedtip.c \
|
||||
ui/fixedtip.h \
|
||||
@@ -139,55 +116,71 @@ libmutter_la_SOURCES = \
|
||||
ui/metaaccellabel.c \
|
||||
ui/metaaccellabel.h \
|
||||
ui/resizepopup.c \
|
||||
ui/resizepopup.h \
|
||||
include/resizepopup.h \
|
||||
ui/tabpopup.c \
|
||||
ui/tabpopup.h \
|
||||
include/tabpopup.h \
|
||||
ui/tile-preview.c \
|
||||
ui/tile-preview.h \
|
||||
include/tile-preview.h \
|
||||
ui/theme-parser.c \
|
||||
ui/theme.c \
|
||||
meta/theme.h \
|
||||
ui/theme.h \
|
||||
ui/theme-private.h \
|
||||
ui/ui.c \
|
||||
core/all-keybindings.h \
|
||||
meta/preview-widget.h \
|
||||
ui/preview-widget.c \
|
||||
include/all-keybindings.h \
|
||||
$(mutter_built_sources)
|
||||
|
||||
libmutter_la_LDFLAGS = -no-undefined
|
||||
libmutter_la_LIBADD = $(MUTTER_LIBS)
|
||||
# by setting libmutter_private_la_CFLAGS, the files shared with
|
||||
# mutter proper will be compiled with different names.
|
||||
libmutter_private_la_CFLAGS =
|
||||
libmutter_private_la_SOURCES= \
|
||||
core/boxes.c \
|
||||
include/boxes.h \
|
||||
ui/gradient.c \
|
||||
ui/gradient.h \
|
||||
core/util.c \
|
||||
include/util.h \
|
||||
include/common.h \
|
||||
ui/preview-widget.c \
|
||||
ui/preview-widget.h \
|
||||
ui/theme-parser.c \
|
||||
ui/theme.c \
|
||||
ui/theme.h
|
||||
|
||||
libmutter_private_la_LDFLAGS = -no-undefined
|
||||
libmutter_private_la_LIBADD = @MUTTER_LIBS@
|
||||
|
||||
# Headers installed for plugins; introspected information will
|
||||
# be extracted into Mutter-<version>.gir
|
||||
libmutterinclude_base_headers = \
|
||||
meta/boxes.h \
|
||||
meta/common.h \
|
||||
meta/compositor-mutter.h \
|
||||
meta/compositor.h \
|
||||
meta/display.h \
|
||||
meta/errors.h \
|
||||
meta/gradient.h \
|
||||
meta/group.h \
|
||||
meta/keybindings.h \
|
||||
meta/main.h \
|
||||
meta/meta-plugin.h \
|
||||
meta/meta-shadow-factory.h \
|
||||
meta/meta-window-actor.h \
|
||||
meta/prefs.h \
|
||||
meta/screen.h \
|
||||
meta/theme.h \
|
||||
meta/types.h \
|
||||
meta/util.h \
|
||||
meta/window.h \
|
||||
meta/workspace.h
|
||||
include/boxes.h \
|
||||
ui/gradient.h \
|
||||
include/main.h \
|
||||
include/util.h \
|
||||
include/common.h \
|
||||
ui/theme.h \
|
||||
include/prefs.h \
|
||||
include/window.h \
|
||||
include/workspace.h \
|
||||
include/compositor.h \
|
||||
include/compositor-mutter.h \
|
||||
include/types.h \
|
||||
include/errors.h \
|
||||
include/screen.h \
|
||||
include/display.h \
|
||||
include/group.h \
|
||||
include/keybindings.h \
|
||||
include/meta-plugin.h \
|
||||
include/meta-shadow-factory.h \
|
||||
include/meta-window-actor.h
|
||||
|
||||
# Excluded from scanning for introspection but installed
|
||||
# preview-widget.h: only part of libmutter-private
|
||||
# atomnames.h: macros cause problems for scanning process
|
||||
libmutterinclude_extra_headers = \
|
||||
meta/preview-widget.h \
|
||||
meta/atomnames.h
|
||||
ui/preview-widget.h \
|
||||
include/atomnames.h
|
||||
|
||||
libmutterincludedir = $(includedir)/mutter/meta
|
||||
libmutterincludedir = $(includedir)/mutter/mutter-private
|
||||
|
||||
libmutterinclude_HEADERS = \
|
||||
$(libmutterinclude_base_headers) \
|
||||
@@ -198,14 +191,9 @@ mutter_theme_viewer_SOURCES= \
|
||||
|
||||
bin_PROGRAMS=mutter mutter-theme-viewer
|
||||
|
||||
mutter_SOURCES = core/mutter.c
|
||||
mutter_LDADD = $(MUTTER_LIBS) libmutter.la
|
||||
|
||||
if HAVE_INTROSPECTION
|
||||
include $(INTROSPECTION_MAKEFILE)
|
||||
|
||||
api_version = $(MUTTER_MAJOR_VERSION).$(MUTTER_MINOR_VERSION)
|
||||
|
||||
if WITH_INTROSPECTION
|
||||
# These files are in package-private directories, even though they may be used
|
||||
# by plugins. If you're writing a plugin, use g-ir-compiler --add-include-path
|
||||
# and g-ir-compiler --includedir.
|
||||
@@ -215,32 +203,50 @@ gir_DATA = Meta-$(api_version).gir
|
||||
typelibdir = $(pkglibdir)
|
||||
typelib_DATA = Meta-$(api_version).typelib
|
||||
|
||||
INTROSPECTION_GIRS = Meta-$(api_version).gir
|
||||
|
||||
Meta-$(api_version).gir: libmutter.la
|
||||
@META_GIR@_INCLUDES = GObject-2.0 Gdk-3.0 Gtk-3.0 Clutter-1.0 xlib-2.0 xfixes-4.0
|
||||
@META_GIR@_PACKAGES = clutter-1.0 gtk+-3.0
|
||||
@META_GIR@_CFLAGS = $(INCLUDES)
|
||||
@META_GIR@_LIBS = libmutter.la
|
||||
@META_GIR@_FILES = \
|
||||
mutter-enum-types.h \
|
||||
$(libmutterinclude_base_headers) \
|
||||
$(filter %.c,$(libmutter_la_SOURCES))
|
||||
@META_GIR@_SCANNERFLAGS = --warn-all --warn-error
|
||||
# We need to strip out the attribute that would point back to libmutter-introspect
|
||||
# so that libgirepository looks for symbols in the executable instead
|
||||
Meta-$(api_version).gir: $(G_IR_SCANNER) mutter $(libmutterinclude_HEADERS) $(mutter_SOURCES) Makefile
|
||||
$(AM_V_GEN) pwd=`pwd` ; \
|
||||
cd $(srcdir) && \
|
||||
$(G_IR_SCANNER) \
|
||||
--namespace=Meta \
|
||||
--nsversion=$(api_version) \
|
||||
--warn-all \
|
||||
--warn-error \
|
||||
--include=GObject-2.0 \
|
||||
--include=Gdk-3.0 \
|
||||
--include=Gtk-3.0 \
|
||||
--include=Clutter-1.0 \
|
||||
--pkg=clutter-1.0 \
|
||||
--pkg=gtk+-3.0 \
|
||||
--include=xlib-2.0 \
|
||||
--include=xfixes-4.0 \
|
||||
--program=$$pwd/mutter \
|
||||
mutter-enum-types.h \
|
||||
$(filter %.c,$(mutter_SOURCES)) \
|
||||
$(libmutterinclude_base_headers) \
|
||||
$(INCLUDES) \
|
||||
-o $$pwd/$@
|
||||
|
||||
Meta-$(api_version).typelib: $(G_IR_COMPILER) Meta-$(api_version).gir
|
||||
$(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(G_IR_COMPILER) Meta-$(api_version).gir -o $@
|
||||
endif
|
||||
|
||||
mutter_theme_viewer_LDADD= $(MUTTER_LIBS) libmutter.la
|
||||
EFENCE=
|
||||
mutter_LDADD=@MUTTER_LIBS@ $(EFENCE)
|
||||
mutter_LDFLAGS=-export-dynamic
|
||||
|
||||
testboxes_SOURCES = core/testboxes.c
|
||||
testgradient_SOURCES = ui/testgradient.c
|
||||
testasyncgetprop_SOURCES = core/testasyncgetprop.c
|
||||
mutter_theme_viewer_LDADD= @MUTTER_LIBS@ libmutter-private.la
|
||||
|
||||
testboxes_SOURCES=include/util.h core/util.c include/boxes.h core/boxes.c core/testboxes.c
|
||||
testgradient_SOURCES=ui/gradient.h ui/gradient.c ui/testgradient.c
|
||||
testasyncgetprop_SOURCES=core/async-getprop.h core/async-getprop.c core/testasyncgetprop.c
|
||||
|
||||
noinst_PROGRAMS=testboxes testgradient testasyncgetprop
|
||||
|
||||
testboxes_LDADD = $(MUTTER_LIBS) libmutter.la
|
||||
testgradient_LDADD = $(MUTTER_LIBS) libmutter.la
|
||||
testasyncgetprop_LDADD = $(MUTTER_LIBS) libmutter.la
|
||||
testboxes_LDADD= @MUTTER_LIBS@
|
||||
testgradient_LDADD= @MUTTER_LIBS@
|
||||
testasyncgetprop_LDADD= @MUTTER_LIBS@
|
||||
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
@@ -254,7 +260,7 @@ wmproperties_in_files=mutter-wm.desktop.in
|
||||
wmproperties_files=$(wmproperties_in_files:.desktop.in=.desktop)
|
||||
wmproperties_DATA = $(wmproperties_files)
|
||||
|
||||
schemadir = $(GCONF_SCHEMA_FILE_DIR)
|
||||
schemadir = @GCONF_SCHEMA_FILE_DIR@
|
||||
schema_in_files = mutter.schemas.in
|
||||
schema_DATA = $(schema_in_files:.schemas.in=.schemas)
|
||||
|
||||
@@ -289,7 +295,7 @@ inlinepixbufs.h: $(IMAGES)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
|
||||
pkgconfig_DATA = libmutter.pc mutter-plugins.pc
|
||||
pkgconfig_DATA = libmutter-private.pc mutter-plugins.pc
|
||||
|
||||
EXTRA_DIST=$(desktopfiles_files) \
|
||||
$(wmproperties_files) \
|
||||
@@ -297,7 +303,7 @@ EXTRA_DIST=$(desktopfiles_files) \
|
||||
$(desktopfiles_in_files) \
|
||||
$(wmproperties_in_files) \
|
||||
$(schema_in_files) \
|
||||
libmutter.pc.in \
|
||||
libmutter-private.pc.in \
|
||||
mutter-plugins.pc.in \
|
||||
mutter-enum-types.h.in \
|
||||
mutter-enum-types.c.in \
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
|
||||
#include <meta/compositor.h>
|
||||
#include <meta/display.h>
|
||||
#include "compositor.h"
|
||||
#include "display.h"
|
||||
#include "meta-plugin-manager.h"
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -4,19 +4,18 @@
|
||||
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
|
||||
#include <meta/screen.h>
|
||||
#include <meta/errors.h>
|
||||
#include <meta/window.h>
|
||||
#include "screen.h"
|
||||
#include "errors.h"
|
||||
#include "window.h"
|
||||
#include "compositor-private.h"
|
||||
#include <meta/compositor-mutter.h>
|
||||
#include "compositor-mutter.h"
|
||||
#include "xprops.h"
|
||||
#include <meta/prefs.h>
|
||||
#include <meta/meta-shadow-factory.h>
|
||||
#include "prefs.h"
|
||||
#include "meta-shadow-factory.h"
|
||||
#include "meta-window-actor-private.h"
|
||||
#include "meta-window-group.h"
|
||||
#include "meta-background-actor.h"
|
||||
#include "window-private.h" /* to check window->hidden */
|
||||
#include "display-private.h" /* for meta_display_lookup_x_window() */
|
||||
#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>
|
||||
#include <X11/extensions/Xcomposite.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,
|
||||
@@ -550,7 +507,18 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
|
||||
|
||||
info->plugin_mgr =
|
||||
meta_plugin_manager_get (screen);
|
||||
meta_plugin_manager_initialize (info->plugin_mgr);
|
||||
|
||||
if (info->plugin_mgr != meta_plugin_manager_get_default ())
|
||||
{
|
||||
/* The default plugin manager has been initialized during
|
||||
* global preferences load.
|
||||
*/
|
||||
if (!meta_plugin_manager_load (info->plugin_mgr))
|
||||
g_critical ("failed to load plugins");
|
||||
}
|
||||
|
||||
if (!meta_plugin_manager_initialize (info->plugin_mgr))
|
||||
g_critical ("failed to initialize plugins");
|
||||
|
||||
/*
|
||||
* Delay the creation of the overlay window as long as we can, to avoid
|
||||
@@ -859,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
|
||||
@@ -963,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;
|
||||
}
|
||||
@@ -1017,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
|
||||
@@ -1074,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);
|
||||
@@ -1187,47 +1095,3 @@ meta_get_overlay_window (MetaScreen *screen)
|
||||
|
||||
return info->output;
|
||||
}
|
||||
|
||||
#define FLASH_TIME_MS 50
|
||||
|
||||
static void
|
||||
flash_out_completed (ClutterAnimation *animation,
|
||||
ClutterActor *flash)
|
||||
{
|
||||
clutter_actor_destroy (flash);
|
||||
}
|
||||
|
||||
static void
|
||||
flash_in_completed (ClutterAnimation *animation,
|
||||
ClutterActor *flash)
|
||||
{
|
||||
clutter_actor_animate (flash, CLUTTER_EASE_IN_QUAD,
|
||||
FLASH_TIME_MS,
|
||||
"opacity", 0,
|
||||
"signal-after::completed", flash_out_completed, flash,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_flash_screen (MetaCompositor *compositor,
|
||||
MetaScreen *screen)
|
||||
{
|
||||
ClutterActor *stage;
|
||||
ClutterActor *flash;
|
||||
ClutterColor black = { 0, 0, 0, 255 };
|
||||
gfloat width, height;
|
||||
|
||||
stage = meta_get_stage_for_screen (screen);
|
||||
clutter_actor_get_size (stage, &width, &height);
|
||||
|
||||
flash = clutter_rectangle_new_with_color (&black);
|
||||
clutter_actor_set_size (flash, width, height);
|
||||
clutter_actor_set_opacity (flash, 0);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), flash);
|
||||
|
||||
clutter_actor_animate (flash, CLUTTER_EASE_OUT_QUAD,
|
||||
FLASH_TIME_MS,
|
||||
"opacity", 192,
|
||||
"signal-after::completed", flash_in_completed, flash,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -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 <meta/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));
|
||||
}
|
||||
@@ -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 <meta/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 */
|
||||
@@ -21,7 +21,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <meta/meta-plugin.h>
|
||||
#include "meta-plugin.h"
|
||||
#include "meta-module.h"
|
||||
|
||||
#include <gmodule.h>
|
||||
|
||||
@@ -24,18 +24,20 @@
|
||||
#include "config.h"
|
||||
#include "compositor-private.h"
|
||||
#include "meta-plugin-manager.h"
|
||||
#include <meta/prefs.h>
|
||||
#include <meta/errors.h>
|
||||
#include <meta/workspace.h>
|
||||
#include "prefs.h"
|
||||
#include "errors.h"
|
||||
#include "workspace.h"
|
||||
#include "meta-module.h"
|
||||
#include "window-private.h"
|
||||
#include "../core/window-private.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
|
||||
static GSList *plugin_types;
|
||||
/*
|
||||
* There is only one instace of each module per the process.
|
||||
*/
|
||||
static GHashTable *plugin_modules = NULL;
|
||||
|
||||
/*
|
||||
* We have one "default plugin manager" that acts for the first screen,
|
||||
@@ -43,79 +45,270 @@ static GSList *plugin_types;
|
||||
* 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 gboolean meta_plugin_manager_reload (MetaPluginManager *plugin_mgr);
|
||||
|
||||
struct MetaPluginManager
|
||||
{
|
||||
MetaScreen *screen;
|
||||
|
||||
GList /* MetaPlugin */ *plugins; /* TODO -- maybe use hash table */
|
||||
GList /* MetaPlugin */ *plugins; /* TODO -- maybe use hash table */
|
||||
GList *unload; /* Plugins that are disabled and pending unload */
|
||||
|
||||
guint idle_unload_id;
|
||||
};
|
||||
|
||||
/*
|
||||
* Loads the given plugin.
|
||||
* Checks that the plugin is compatible with the WM and sets up the plugin
|
||||
* struct.
|
||||
*/
|
||||
void
|
||||
meta_plugin_manager_load (MetaPluginManager *plugin_mgr,
|
||||
const gchar *plugin_name)
|
||||
static MetaPlugin *
|
||||
meta_plugin_load (MetaPluginManager *mgr,
|
||||
MetaModule *module,
|
||||
const gchar *params)
|
||||
{
|
||||
const gchar *dpath = MUTTER_PLUGIN_DIR "/";
|
||||
gchar *path;
|
||||
MetaModule *module;
|
||||
GType plugin_type;
|
||||
MetaPlugin *plugin = NULL;
|
||||
GType plugin_type = meta_module_get_plugin_type (module);
|
||||
|
||||
if (g_path_is_absolute (plugin_name))
|
||||
path = g_strdup (plugin_name);
|
||||
else
|
||||
path = g_strconcat (dpath, plugin_name, ".so", NULL);
|
||||
|
||||
module = g_object_new (META_TYPE_MODULE, "path", path, NULL);
|
||||
if (!module || !g_type_module_use (G_TYPE_MODULE (module)))
|
||||
if (!plugin_type)
|
||||
{
|
||||
/* 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 ("Plugin type not registered !!!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
plugin_type = meta_module_get_plugin_type (module);
|
||||
meta_plugin_manager_register (plugin_mgr, plugin_type);
|
||||
plugin = g_object_new (plugin_type,
|
||||
"params", params,
|
||||
NULL);
|
||||
|
||||
g_type_module_unuse (G_TYPE_MODULE (module));
|
||||
g_free (path);
|
||||
return plugin;
|
||||
}
|
||||
|
||||
/*
|
||||
* Registers the given plugin type
|
||||
* Attempst to unload a plugin; returns FALSE if plugin cannot be unloaded at
|
||||
* present (e.g., and effect is in progress) and should be scheduled for
|
||||
* removal later.
|
||||
*/
|
||||
void
|
||||
meta_plugin_manager_register (MetaPluginManager *plugin_mgr,
|
||||
GType plugin_type)
|
||||
static gboolean
|
||||
meta_plugin_unload (MetaPlugin *plugin)
|
||||
{
|
||||
MetaPlugin *plugin;
|
||||
if (meta_plugin_running (plugin))
|
||||
{
|
||||
g_object_set (plugin, "disabled", TRUE, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
plugin_types = g_slist_prepend (plugin_types, GSIZE_TO_POINTER (plugin_type));
|
||||
g_object_unref (plugin);
|
||||
|
||||
plugin = g_object_new (plugin_type, NULL);
|
||||
plugin_mgr->plugins = g_list_prepend (plugin_mgr->plugins, plugin);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
/*
|
||||
* Iddle callback to remove plugins that could not be removed directly and are
|
||||
* pending for removal.
|
||||
*/
|
||||
static gboolean
|
||||
meta_plugin_manager_idle_unload (MetaPluginManager *plugin_mgr)
|
||||
{
|
||||
GList *l = plugin_mgr->unload;
|
||||
gboolean dont_remove = TRUE;
|
||||
|
||||
while (l)
|
||||
{
|
||||
MetaPlugin *plugin = l->data;
|
||||
|
||||
if (meta_plugin_unload (plugin))
|
||||
{
|
||||
/* Remove from list */
|
||||
GList *p = l->prev;
|
||||
GList *n = l->next;
|
||||
|
||||
if (!p)
|
||||
plugin_mgr->unload = n;
|
||||
else
|
||||
p->next = n;
|
||||
|
||||
if (n)
|
||||
n->prev = p;
|
||||
|
||||
g_list_free_1 (l);
|
||||
|
||||
l = n;
|
||||
}
|
||||
else
|
||||
l = l->next;
|
||||
}
|
||||
|
||||
if (!plugin_mgr->unload)
|
||||
{
|
||||
/* If no more unloads are pending, remove the handler as well */
|
||||
dont_remove = FALSE;
|
||||
plugin_mgr->idle_unload_id = 0;
|
||||
}
|
||||
|
||||
return dont_remove;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unloads all plugins
|
||||
*/
|
||||
static void
|
||||
meta_plugin_manager_unload (MetaPluginManager *plugin_mgr)
|
||||
{
|
||||
GList *plugins = plugin_mgr->plugins;
|
||||
|
||||
while (plugins)
|
||||
{
|
||||
MetaPlugin *plugin = plugins->data;
|
||||
|
||||
/* If the plugin could not be removed, move it to the unload list */
|
||||
if (!meta_plugin_unload (plugin))
|
||||
{
|
||||
plugin_mgr->unload = g_list_prepend (plugin_mgr->unload, plugin);
|
||||
|
||||
if (!plugin_mgr->idle_unload_id)
|
||||
{
|
||||
plugin_mgr->idle_unload_id = g_idle_add ((GSourceFunc)
|
||||
meta_plugin_manager_idle_unload,
|
||||
plugin_mgr);
|
||||
}
|
||||
}
|
||||
|
||||
plugins = plugins->next;
|
||||
}
|
||||
|
||||
g_list_free (plugin_mgr->plugins);
|
||||
plugin_mgr->plugins = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
prefs_changed_callback (MetaPreference pref,
|
||||
void *data)
|
||||
{
|
||||
MetaPluginManager *plugin_mgr = data;
|
||||
|
||||
if (pref == META_PREF_CLUTTER_PLUGINS)
|
||||
{
|
||||
meta_plugin_manager_reload (plugin_mgr);
|
||||
}
|
||||
}
|
||||
|
||||
static MetaModule *
|
||||
meta_plugin_manager_get_module (const gchar *path)
|
||||
{
|
||||
MetaModule *module = g_hash_table_lookup (plugin_modules, path);
|
||||
|
||||
if (!module &&
|
||||
(module = g_object_new (META_TYPE_MODULE, "path", path, NULL)))
|
||||
{
|
||||
g_hash_table_insert (plugin_modules, g_strdup (path), module);
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loads all plugins listed in gconf registry.
|
||||
*/
|
||||
gboolean
|
||||
meta_plugin_manager_load (MetaPluginManager *plugin_mgr)
|
||||
{
|
||||
const gchar *dpath = MUTTER_PLUGIN_DIR "/";
|
||||
GSList *plugins, *fallback = NULL;
|
||||
|
||||
plugins = meta_prefs_get_clutter_plugins ();
|
||||
|
||||
if (!plugins)
|
||||
{
|
||||
/*
|
||||
* If no plugins are specified, try to load the default plugin.
|
||||
*/
|
||||
fallback = g_slist_append (fallback, "default");
|
||||
plugins = fallback;
|
||||
}
|
||||
|
||||
while (plugins)
|
||||
{
|
||||
gchar *plugin_string;
|
||||
gchar *params;
|
||||
|
||||
plugin_string = g_strdup (plugins->data);
|
||||
|
||||
if (plugin_string)
|
||||
{
|
||||
MetaModule *module;
|
||||
gchar *path;
|
||||
|
||||
params = strchr (plugin_string, ':');
|
||||
|
||||
if (params)
|
||||
{
|
||||
*params = 0;
|
||||
++params;
|
||||
}
|
||||
|
||||
if (g_path_is_absolute (plugin_string))
|
||||
path = g_strdup (plugin_string);
|
||||
else
|
||||
path = g_strconcat (dpath, plugin_string, ".so", NULL);
|
||||
|
||||
module = meta_plugin_manager_get_module (path);
|
||||
|
||||
if (module)
|
||||
{
|
||||
gboolean use_succeeded;
|
||||
|
||||
/*
|
||||
* This dlopens the module and registers the plugin type with the
|
||||
* GType system, if the module is not already loaded. When we
|
||||
* create a plugin, the type system also calls g_type_module_use()
|
||||
* to guarantee the module will not be unloaded during the plugin
|
||||
* life time. Consequently we can unuse() the module again.
|
||||
*/
|
||||
use_succeeded = g_type_module_use (G_TYPE_MODULE (module));
|
||||
|
||||
if (use_succeeded)
|
||||
{
|
||||
MetaPlugin *plugin = meta_plugin_load (plugin_mgr, module, params);
|
||||
|
||||
if (plugin)
|
||||
plugin_mgr->plugins = g_list_prepend (plugin_mgr->plugins, plugin);
|
||||
else
|
||||
g_warning ("Plugin load for [%s] failed", path);
|
||||
|
||||
g_type_module_unuse (G_TYPE_MODULE (module));
|
||||
}
|
||||
}
|
||||
else
|
||||
g_warning ("Unable to load plugin module [%s]: %s",
|
||||
path, g_module_error());
|
||||
|
||||
g_free (path);
|
||||
g_free (plugin_string);
|
||||
}
|
||||
|
||||
plugins = plugins->next;
|
||||
}
|
||||
|
||||
|
||||
if (fallback)
|
||||
g_slist_free (fallback);
|
||||
|
||||
if (plugin_mgr->plugins != NULL)
|
||||
{
|
||||
meta_prefs_add_listener (prefs_changed_callback, plugin_mgr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
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;
|
||||
@@ -128,6 +321,26 @@ meta_plugin_manager_initialize (MetaPluginManager *plugin_mgr)
|
||||
if (klass->start)
|
||||
klass->start (plugin);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reloads all plugins
|
||||
*/
|
||||
static gboolean
|
||||
meta_plugin_manager_reload (MetaPluginManager *plugin_mgr)
|
||||
{
|
||||
/* TODO -- brute force; should we build a list of plugins to load and list of
|
||||
* plugins to unload? We are probably not going to have large numbers of
|
||||
* plugins loaded at the same time, so it might not be worth it.
|
||||
*/
|
||||
|
||||
/* Prevent stale grabs on unloaded plugins */
|
||||
meta_check_end_modal (plugin_mgr->screen);
|
||||
|
||||
meta_plugin_manager_unload (plugin_mgr);
|
||||
return meta_plugin_manager_load (plugin_mgr);
|
||||
}
|
||||
|
||||
static MetaPluginManager *
|
||||
@@ -135,8 +348,15 @@ meta_plugin_manager_new (MetaScreen *screen)
|
||||
{
|
||||
MetaPluginManager *plugin_mgr;
|
||||
|
||||
if (!plugin_modules)
|
||||
{
|
||||
plugin_modules = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
||||
NULL);
|
||||
}
|
||||
|
||||
plugin_mgr = g_new0 (MetaPluginManager, 1);
|
||||
plugin_mgr->screen = screen;
|
||||
|
||||
plugin_mgr->screen = screen;
|
||||
|
||||
if (screen)
|
||||
g_object_set_data (G_OBJECT (screen), "meta-plugin-manager", plugin_mgr);
|
||||
@@ -177,20 +397,7 @@ meta_plugin_manager_get (MetaScreen *screen)
|
||||
}
|
||||
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 meta_plugin_manager_new (screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#ifndef META_PLUGIN_MANAGER_H_
|
||||
#define META_PLUGIN_MANAGER_H_
|
||||
|
||||
#include <meta/types.h>
|
||||
#include <meta/screen.h>
|
||||
#include "types.h"
|
||||
#include "screen.h"
|
||||
|
||||
#define META_PLUGIN_FROM_MANAGER_
|
||||
#include <meta/meta-plugin.h>
|
||||
#include "meta-plugin.h"
|
||||
#undef META_PLUGIN_FROM_MANAGER_
|
||||
|
||||
#define META_PLUGIN_MINIMIZE (1<<0)
|
||||
@@ -49,12 +49,8 @@ typedef struct MetaPluginManager MetaPluginManager;
|
||||
MetaPluginManager * meta_plugin_manager_get (MetaScreen *screen);
|
||||
MetaPluginManager * meta_plugin_manager_get_default (void);
|
||||
|
||||
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);
|
||||
|
||||
gboolean meta_plugin_manager_load (MetaPluginManager *mgr);
|
||||
gboolean meta_plugin_manager_initialize (MetaPluginManager *plugin_mgr);
|
||||
gboolean meta_plugin_manager_event_simple (MetaPluginManager *mgr,
|
||||
MetaWindowActor *actor,
|
||||
unsigned long event);
|
||||
|
||||
@@ -21,10 +21,9 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <meta/meta-plugin.h>
|
||||
#include "meta-plugin-manager.h"
|
||||
#include <meta/screen.h>
|
||||
#include <meta/display.h>
|
||||
#include "meta-plugin.h"
|
||||
#include "screen.h"
|
||||
#include "display.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
@@ -44,6 +43,7 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_SCREEN,
|
||||
PROP_PARAMS,
|
||||
PROP_FEATURES,
|
||||
PROP_DISABLED,
|
||||
PROP_DEBUG_MODE,
|
||||
@@ -52,6 +52,7 @@ enum
|
||||
struct _MetaPluginPrivate
|
||||
{
|
||||
MetaScreen *screen;
|
||||
gchar *params;
|
||||
gulong features;
|
||||
|
||||
gint running;
|
||||
@@ -60,46 +61,6 @@ struct _MetaPluginPrivate
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -109,9 +70,97 @@ meta_plugin_dispose (GObject *object)
|
||||
static void
|
||||
meta_plugin_finalize (GObject *object)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (object)->priv;
|
||||
|
||||
g_free (priv->params);
|
||||
priv->params = NULL;
|
||||
|
||||
G_OBJECT_CLASS (meta_plugin_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_plugin_parse_params (MetaPlugin *plugin)
|
||||
{
|
||||
char *p;
|
||||
gulong features = 0;
|
||||
MetaPluginPrivate *priv = plugin->priv;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
|
||||
/*
|
||||
* Feature flags: identify events that the plugin can handle; a plugin can
|
||||
* handle one or more events.
|
||||
*/
|
||||
if (klass->minimize)
|
||||
features |= META_PLUGIN_MINIMIZE;
|
||||
|
||||
if (klass->maximize)
|
||||
features |= META_PLUGIN_MAXIMIZE;
|
||||
|
||||
if (klass->unmaximize)
|
||||
features |= META_PLUGIN_UNMAXIMIZE;
|
||||
|
||||
if (klass->map)
|
||||
features |= META_PLUGIN_MAP;
|
||||
|
||||
if (klass->destroy)
|
||||
features |= META_PLUGIN_DESTROY;
|
||||
|
||||
if (klass->switch_workspace)
|
||||
features |= META_PLUGIN_SWITCH_WORKSPACE;
|
||||
|
||||
if (priv->params)
|
||||
{
|
||||
gboolean debug = FALSE;
|
||||
|
||||
if ((p = strstr (priv->params, "disable:")))
|
||||
{
|
||||
gchar *d = g_strdup (p+8);
|
||||
|
||||
p = strchr (d, ';');
|
||||
|
||||
if (p)
|
||||
*p = 0;
|
||||
|
||||
if (strstr (d, "minimize"))
|
||||
features &= ~ META_PLUGIN_MINIMIZE;
|
||||
|
||||
if (strstr (d, "maximize"))
|
||||
features &= ~ META_PLUGIN_MAXIMIZE;
|
||||
|
||||
if (strstr (d, "unmaximize"))
|
||||
features &= ~ META_PLUGIN_UNMAXIMIZE;
|
||||
|
||||
if (strstr (d, "map"))
|
||||
features &= ~ META_PLUGIN_MAP;
|
||||
|
||||
if (strstr (d, "destroy"))
|
||||
features &= ~ META_PLUGIN_DESTROY;
|
||||
|
||||
if (strstr (d, "switch-workspace"))
|
||||
features &= ~META_PLUGIN_SWITCH_WORKSPACE;
|
||||
|
||||
g_free (d);
|
||||
}
|
||||
|
||||
if (strstr (priv->params, "debug"))
|
||||
debug = TRUE;
|
||||
|
||||
if (debug != priv->debug)
|
||||
{
|
||||
priv->debug = debug;
|
||||
|
||||
g_object_notify (G_OBJECT (plugin), "debug-mode");
|
||||
}
|
||||
}
|
||||
|
||||
if (features != priv->features)
|
||||
{
|
||||
priv->features = features;
|
||||
|
||||
g_object_notify (G_OBJECT (plugin), "features");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_plugin_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@@ -125,6 +174,10 @@ meta_plugin_set_property (GObject *object,
|
||||
case PROP_SCREEN:
|
||||
priv->screen = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_PARAMS:
|
||||
priv->params = g_value_dup_string (value);
|
||||
meta_plugin_parse_params (META_PLUGIN (object));
|
||||
break;
|
||||
case PROP_DISABLED:
|
||||
priv->disabled = g_value_get_boolean (value);
|
||||
break;
|
||||
@@ -150,6 +203,9 @@ meta_plugin_get_property (GObject *object,
|
||||
case PROP_SCREEN:
|
||||
g_value_set_object (value, priv->screen);
|
||||
break;
|
||||
case PROP_PARAMS:
|
||||
g_value_set_string (value, priv->params);
|
||||
break;
|
||||
case PROP_DISABLED:
|
||||
g_value_set_boolean (value, priv->disabled);
|
||||
break;
|
||||
@@ -171,7 +227,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;
|
||||
@@ -185,6 +240,15 @@ meta_plugin_class_init (MetaPluginClass *klass)
|
||||
META_TYPE_SCREEN,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PARAMS,
|
||||
g_param_spec_string ("params",
|
||||
"Parameters",
|
||||
"Plugin Parameters",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_FEATURES,
|
||||
g_param_spec_ulong ("features",
|
||||
@@ -287,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
|
||||
@@ -549,18 +605,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);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <cairo.h>
|
||||
#include <clutter/clutter.h>
|
||||
#include "meta-window-shape.h"
|
||||
#include <meta/meta-shadow-factory.h>
|
||||
#include "meta-shadow-factory.h"
|
||||
|
||||
/**
|
||||
* MetaShadow:
|
||||
@@ -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,
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <clutter/clutter.h>
|
||||
#ifdef HAVE_GLX_TEXTURE_PIXMAP
|
||||
#include <clutter/glx/clutter-glx.h>
|
||||
#else
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
#endif /* HAVE_GLX_TEXTURE_PIXMAP */
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#include <meta/compositor-mutter.h>
|
||||
#include "compositor-mutter.h"
|
||||
|
||||
MetaWindowActor *meta_window_actor_new (MetaWindow *window);
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -13,10 +11,10 @@
|
||||
#include <clutter/x11/clutter-x11.h>
|
||||
#include <gdk/gdk.h> /* for gdk_rectangle_union() */
|
||||
|
||||
#include <meta/display.h>
|
||||
#include <meta/errors.h>
|
||||
#include "display.h"
|
||||
#include "errors.h"
|
||||
#include "frame.h"
|
||||
#include <meta/window.h>
|
||||
#include "window.h"
|
||||
#include "xprops.h"
|
||||
|
||||
#include "compositor-private.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.
|
||||
@@ -373,14 +350,6 @@ window_decorated_notify (MetaWindow *mw,
|
||||
meta_window_actor_constructed (G_OBJECT (self));
|
||||
}
|
||||
|
||||
static void
|
||||
window_appears_focused_notify (MetaWindow *mw,
|
||||
GParamSpec *arg1,
|
||||
gpointer data)
|
||||
{
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (data));
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_actor_constructed (GObject *object)
|
||||
{
|
||||
@@ -391,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 */
|
||||
@@ -430,8 +402,6 @@ meta_window_actor_constructed (GObject *object)
|
||||
|
||||
g_signal_connect (priv->window, "notify::decorated",
|
||||
G_CALLBACK (window_decorated_notify), self);
|
||||
g_signal_connect (priv->window, "notify::appears-focused",
|
||||
G_CALLBACK (window_appears_focused_notify), self);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -507,12 +477,6 @@ meta_window_actor_dispose (GObject *object)
|
||||
|
||||
info->windows = g_list_remove (info->windows, (gconstpointer) self);
|
||||
|
||||
if (priv->window)
|
||||
{
|
||||
g_object_unref (priv->window);
|
||||
priv->window = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Release the extra reference we took on the actor.
|
||||
*/
|
||||
@@ -545,11 +509,7 @@ meta_window_actor_set_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_META_WINDOW:
|
||||
{
|
||||
if (priv->window)
|
||||
g_object_unref (priv->window);
|
||||
priv->window = g_value_dup_object (value);
|
||||
}
|
||||
priv->window = g_value_get_object (value);
|
||||
break;
|
||||
case PROP_META_SCREEN:
|
||||
priv->screen = g_value_get_pointer (value);
|
||||
@@ -681,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,
|
||||
@@ -702,7 +661,6 @@ meta_window_actor_get_shadow_bounds (MetaWindowActor *self,
|
||||
shape_bounds.height,
|
||||
bounds);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
meta_window_actor_paint (ClutterActor *actor)
|
||||
@@ -921,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)
|
||||
{
|
||||
@@ -1360,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
|
||||
@@ -1653,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
|
||||
@@ -1819,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;
|
||||
@@ -1879,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,
|
||||
@@ -1891,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);
|
||||
@@ -1945,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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
#include <meta/screen.h>
|
||||
#include "screen.h"
|
||||
|
||||
/**
|
||||
* MetaWindowGroup:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
pkglibdir=@MUTTER_PLUGIN_DIR@
|
||||
|
||||
INCLUDES=@MUTTER_CFLAGS@ -I $(top_srcdir)/src -DMUTTER_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMUTTER_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMUTTER_PKGDATADIR=\"$(pkgdatadir)\" -DMUTTER_DATADIR=\"$(datadir)\" -DG_LOG_DOMAIN=\"mutter\" -DSN_API_NOT_YET_FROZEN=1 -DMUTTER_MAJOR_VERSION=$(MUTTER_MAJOR_VERSION) -DMUTTER_MINOR_VERSION=$(MUTTER_MINOR_VERSION) -DMUTTER_MICRO_VERSION=$(MUTTER_MICRO_VERSION) -DMUTTER_PLUGIN_API_VERSION=$(MUTTER_PLUGIN_API_VERSION) -DMUTTER_PLUGIN_DIR=\"@MUTTER_PLUGIN_DIR@\"
|
||||
INCLUDES=@MUTTER_CFLAGS@ -I $(top_srcdir)/src/include -DMUTTER_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMUTTER_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMUTTER_PKGDATADIR=\"$(pkgdatadir)\" -DMUTTER_DATADIR=\"$(datadir)\" -DG_LOG_DOMAIN=\"mutter\" -DSN_API_NOT_YET_FROZEN=1 -DMUTTER_MAJOR_VERSION=$(MUTTER_MAJOR_VERSION) -DMUTTER_MINOR_VERSION=$(MUTTER_MINOR_VERSION) -DMUTTER_MICRO_VERSION=$(MUTTER_MICRO_VERSION) -DMUTTER_PLUGIN_API_VERSION=$(MUTTER_PLUGIN_API_VERSION) -DMUTTER_PLUGIN_DIR=\"@MUTTER_PLUGIN_DIR@\"
|
||||
|
||||
default_la_CFLAGS = -fPIC
|
||||
default_la_SOURCES = default.c
|
||||
|
||||
41
src/compositor/plugins/README
Normal file
41
src/compositor/plugins/README
Normal file
@@ -0,0 +1,41 @@
|
||||
|
||||
Plugins implement effects associated with WM events, such as window map,
|
||||
minimizing, maximizing, unmaximizing, destruction and workspace switching. The
|
||||
plugin API is documented in src/include/compositor-clutter-plugin.h; in
|
||||
addition the simple plugin can be used as a reference implementation.
|
||||
|
||||
The API is intended to be generic, exposing no implementation details of the WM
|
||||
to the plugins; this will facilitate reuse without modification with another WM
|
||||
(there are plans to use the same plugin API with Matchbox 2).
|
||||
|
||||
Multiple plugins can implement the same effect and be loaded at the same time;
|
||||
however, stacking arbitrary effects in this way might not work as expected;
|
||||
this is particularly true of more complex effects, such as those for workspace
|
||||
switching.
|
||||
|
||||
Plugins are installed in ${prefix}/lib/metacity/plugins/clutter; from there the
|
||||
WM will load plugins listed in the clutter_plugins key in the Metacity gconf
|
||||
general preferences group. Each entry in preferences has the format
|
||||
|
||||
'name: optional parameters'
|
||||
|
||||
where 'name' is the name of the library without the .so suffix.
|
||||
|
||||
As noted above, additional parameters can be passed to the plugin via the
|
||||
preference key. In such case, the plugin name is immediately followed by a
|
||||
colon, separating it from the parameters. Two common parameters should be
|
||||
handled by all plugins:
|
||||
|
||||
'debug' indicates that the plugin is run in a debug mode (what exactly that
|
||||
means is left to the plugin to determine).
|
||||
|
||||
'disable' parameter indicates which effects within the plugin should be
|
||||
disabled; the format of the disable parameter is
|
||||
|
||||
'disable: effect1[, effect2];'
|
||||
|
||||
where effect1, etc., matches the effects listed in the
|
||||
compositor-clutter-plugin.h file (currently one of 'map', 'destroy',
|
||||
'maximize', 'unmaximize', 'switch-workspace'). Example 'disable:
|
||||
minimize, maximize;'.
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <meta/meta-plugin.h>
|
||||
#include <meta/window.h>
|
||||
#include "meta-plugin.h"
|
||||
#include "window.h"
|
||||
|
||||
#include <libintl.h>
|
||||
#define _(x) dgettext (GETTEXT_PACKAGE, x)
|
||||
@@ -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)
|
||||
|
||||
@@ -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 *
|
||||
|
||||
@@ -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 = §ion->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;
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
#include <config.h>
|
||||
#include "bell.h"
|
||||
#include "screen-private.h"
|
||||
#include <meta/prefs.h>
|
||||
#include "prefs.h"
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
#include <canberra-gtk.h>
|
||||
#endif
|
||||
@@ -149,7 +149,7 @@ bell_flash_screen (MetaDisplay *display,
|
||||
#ifdef HAVE_XKB
|
||||
static void
|
||||
bell_flash_fullscreen (MetaDisplay *display,
|
||||
XkbAnyEvent *xkb_ev)
|
||||
XkbAnyEvent *xkb_ev)
|
||||
{
|
||||
XkbBellNotifyEvent *xkb_bell_ev = (XkbBellNotifyEvent *) xkb_ev;
|
||||
MetaScreen *screen;
|
||||
@@ -159,12 +159,7 @@ bell_flash_fullscreen (MetaDisplay *display,
|
||||
{
|
||||
screen = meta_display_screen_for_xwindow (display, xkb_bell_ev->window);
|
||||
if (screen)
|
||||
{
|
||||
if (display->compositor)
|
||||
meta_compositor_flash_screen (display->compositor, screen);
|
||||
else
|
||||
bell_flash_screen (display, screen);
|
||||
}
|
||||
bell_flash_screen (display, screen);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -172,10 +167,7 @@ bell_flash_fullscreen (MetaDisplay *display,
|
||||
while (screen_list)
|
||||
{
|
||||
screen = (MetaScreen *) screen_list->data;
|
||||
if (display->compositor)
|
||||
meta_compositor_flash_screen (display->compositor, screen);
|
||||
else
|
||||
bell_flash_screen (display, screen);
|
||||
bell_flash_screen (display, screen);
|
||||
screen_list = screen_list->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <X11/XKBlib.h>
|
||||
#endif
|
||||
#include "display-private.h"
|
||||
#include "frame.h"
|
||||
#include "frame-private.h"
|
||||
|
||||
#ifdef HAVE_XKB
|
||||
/**
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
#define META_BOXES_PRIVATE_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <meta/common.h>
|
||||
#include <meta/boxes.h>
|
||||
#include "common.h"
|
||||
#include "boxes.h"
|
||||
|
||||
#define BOX_LEFT(box) ((box).x) /* Leftmost pixel of rect */
|
||||
#define BOX_RIGHT(box) ((box).x + (box).width) /* One pixel past right */
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include "boxes-private.h"
|
||||
#include <meta/util.h>
|
||||
#include "util.h"
|
||||
#include <X11/Xutil.h> /* Just for the definition of the various gravities */
|
||||
|
||||
/* It would make sense to use GSlice here, but until we clean up the
|
||||
@@ -179,16 +179,6 @@ meta_rectangle_area (const MetaRectangle *rect)
|
||||
return rect->width * rect->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_rectangle_intersect:
|
||||
* @src1: a #MetaRectangle
|
||||
* @src2: another #MetaRectangle
|
||||
* @dest: (out caller-allocates): an empty #MetaRectangle, to be filled
|
||||
* with the coordinates of the intersection.
|
||||
*
|
||||
* Returns: TRUE is some intersection exists and is not degenerate, FALSE
|
||||
* otherwise.
|
||||
*/
|
||||
gboolean
|
||||
meta_rectangle_intersect (const MetaRectangle *src1,
|
||||
const MetaRectangle *src2,
|
||||
@@ -236,13 +226,6 @@ meta_rectangle_equal (const MetaRectangle *src1,
|
||||
(src1->height == src2->height));
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_rectangle_union:
|
||||
* @rect1: a #MetaRectangle
|
||||
* @rect2: another #MetaRectangle
|
||||
* @dest: (out caller-allocates): an empty #MetaRectangle, to be filled
|
||||
* with the coordinates of the bounding box.
|
||||
*/
|
||||
void
|
||||
meta_rectangle_union (const MetaRectangle *rect1,
|
||||
const MetaRectangle *rect2,
|
||||
@@ -357,6 +340,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
||||
*/
|
||||
|
||||
/* First, the x direction */
|
||||
int adjust = 0;
|
||||
switch (gravity)
|
||||
{
|
||||
case NorthWestGravity:
|
||||
@@ -389,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:
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "constraints.h"
|
||||
#include "workspace-private.h"
|
||||
#include "place.h"
|
||||
#include <meta/prefs.h>
|
||||
#include "prefs.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@@ -142,11 +142,6 @@ typedef struct
|
||||
GList *usable_screen_region;
|
||||
GList *usable_monitor_region;
|
||||
} ConstraintInfo;
|
||||
|
||||
static gboolean do_screen_and_monitor_relative_constraints (MetaWindow *window,
|
||||
GList *region_spanning_rectangles,
|
||||
ConstraintInfo *info,
|
||||
gboolean check_only);
|
||||
static gboolean constrain_modal_dialog (MetaWindow *window,
|
||||
ConstraintInfo *info,
|
||||
ConstraintPriority priority,
|
||||
@@ -781,12 +776,7 @@ constrain_modal_dialog (MetaWindow *window,
|
||||
|
||||
info->current.y = y;
|
||||
info->current.x = x;
|
||||
/* The calculated position above may need adjustment to make sure the
|
||||
* dialog does not end up partially off-screen */
|
||||
return do_screen_and_monitor_relative_constraints (window,
|
||||
info->usable_screen_region,
|
||||
info,
|
||||
check_only);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -806,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) */
|
||||
@@ -890,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
|
||||
@@ -978,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 */
|
||||
@@ -1110,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
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
#ifndef META_CONSTRAINTS_H
|
||||
#define META_CONSTRAINTS_H
|
||||
|
||||
#include <meta/util.h>
|
||||
#include "util.h"
|
||||
#include "window-private.h"
|
||||
#include "frame.h"
|
||||
#include "frame-private.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "core.h"
|
||||
#include "frame.h"
|
||||
#include "frame-private.h"
|
||||
#include "workspace-private.h"
|
||||
#include <meta/prefs.h>
|
||||
#include <meta/errors.h>
|
||||
#include "prefs.h"
|
||||
#include "errors.h"
|
||||
|
||||
/* Looks up the MetaWindow representing the frame of the given X window.
|
||||
* Used as a helper function by a bunch of the functions below.
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#define _XOPEN_SOURCE /* for kill() */
|
||||
|
||||
#include <config.h>
|
||||
#include <meta/util.h>
|
||||
#include "util.h"
|
||||
#include "window-private.h"
|
||||
#include <meta/errors.h>
|
||||
#include <meta/workspace.h>
|
||||
#include "errors.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -103,8 +103,8 @@ delete_ping_timeout_func (MetaDisplay *display,
|
||||
|
||||
dialog_pid =
|
||||
meta_show_dialog ("--question",
|
||||
window_content, NULL,
|
||||
window->screen->screen_name,
|
||||
window_content, 0,
|
||||
window->screen->number,
|
||||
_("_Wait"), _("_Force Quit"), window->xwindow,
|
||||
NULL, NULL);
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
#include <glib.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "eventqueue.h"
|
||||
#include <meta/common.h>
|
||||
#include <meta/boxes.h>
|
||||
#include <meta/display.h>
|
||||
#include "common.h"
|
||||
#include "boxes.h"
|
||||
#include "display.h"
|
||||
#include "keybindings-private.h"
|
||||
#include <meta/prefs.h>
|
||||
#include "prefs.h"
|
||||
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
#include <libsn/sn.h>
|
||||
@@ -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;
|
||||
@@ -99,7 +92,7 @@ struct _MetaDisplay
|
||||
* class is constructed.
|
||||
*/
|
||||
#define item(x) Atom atom_##x;
|
||||
#include <meta/atomnames.h>
|
||||
#include "atomnames.h"
|
||||
#undef item
|
||||
|
||||
/* This is the actual window from focus events,
|
||||
@@ -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
|
||||
|
||||
@@ -34,21 +34,21 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "display-private.h"
|
||||
#include <meta/util.h>
|
||||
#include <meta/main.h>
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
#include "screen-private.h"
|
||||
#include "window-private.h"
|
||||
#include "window-props.h"
|
||||
#include "group-props.h"
|
||||
#include "frame.h"
|
||||
#include <meta/errors.h>
|
||||
#include "frame-private.h"
|
||||
#include "errors.h"
|
||||
#include "keybindings-private.h"
|
||||
#include <meta/prefs.h>
|
||||
#include "prefs.h"
|
||||
#include "resizepopup.h"
|
||||
#include "xprops.h"
|
||||
#include "workspace-private.h"
|
||||
#include "bell.h"
|
||||
#include <meta/compositor.h>
|
||||
#include "compositor.h"
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#ifdef HAVE_SOLARIS_XINERAMA
|
||||
@@ -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)
|
||||
{
|
||||
@@ -417,7 +437,7 @@ meta_display_open (void)
|
||||
/* A list of all atom names, so that we can intern them in one go. */
|
||||
char *atom_names[] = {
|
||||
#define item(x) #x,
|
||||
#include <meta/atomnames.h>
|
||||
#include "atomnames.h"
|
||||
#undef item
|
||||
};
|
||||
Atom atoms[G_N_ELEMENTS(atom_names)];
|
||||
@@ -490,7 +510,7 @@ meta_display_open (void)
|
||||
{
|
||||
int i = 0;
|
||||
#define item(x) the_display->atom_##x = atoms[i++];
|
||||
#include <meta/atomnames.h>
|
||||
#include "atomnames.h"
|
||||
#undef item
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -2524,6 +2543,12 @@ event_callback (XEvent *event,
|
||||
meta_workspace_focus_default_window (screen->active_workspace, NULL, timestamp);
|
||||
}
|
||||
}
|
||||
else if (event->xclient.message_type ==
|
||||
display->atom__MUTTER_RESTART_MESSAGE)
|
||||
{
|
||||
meta_verbose ("Received restart request\n");
|
||||
meta_restart ();
|
||||
}
|
||||
else if (event->xclient.message_type ==
|
||||
display->atom__MUTTER_RELOAD_THEME_MESSAGE)
|
||||
{
|
||||
@@ -2617,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
|
||||
@@ -3494,7 +3515,6 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
int root_x,
|
||||
int root_y)
|
||||
{
|
||||
MetaWindow *grab_window = NULL;
|
||||
Window grab_xwindow;
|
||||
|
||||
meta_topic (META_DEBUG_WINDOW_OPS,
|
||||
@@ -3524,25 +3544,14 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
/* If window is a modal dialog attached to its parent,
|
||||
* grab the parent instead for moving.
|
||||
*/
|
||||
if (meta_prefs_get_attach_modal_dialogs () &&
|
||||
window && window->type == META_WINDOW_MODAL_DIALOG &&
|
||||
meta_grab_op_is_moving (op))
|
||||
grab_window = meta_window_get_transient_for (window);
|
||||
|
||||
if (grab_window == NULL)
|
||||
grab_window = window;
|
||||
|
||||
/* FIXME:
|
||||
* If we have no MetaWindow we do our best
|
||||
* and try to do the grab on the RootWindow.
|
||||
* This will fail if anyone else has any
|
||||
* key grab on the RootWindow.
|
||||
*/
|
||||
if (grab_window)
|
||||
grab_xwindow = grab_window->frame ? grab_window->frame->xwindow : grab_window->xwindow;
|
||||
if (window)
|
||||
grab_xwindow = window->frame ? window->frame->xwindow : window->xwindow;
|
||||
else
|
||||
grab_xwindow = screen->xroot;
|
||||
|
||||
@@ -3564,9 +3573,9 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
/* Grab keys for keyboard ops and mouse move/resizes; see #126497 */
|
||||
if (grab_op_is_keyboard (op) || grab_op_is_mouse_only (op))
|
||||
{
|
||||
if (grab_window)
|
||||
if (window)
|
||||
display->grab_have_keyboard =
|
||||
meta_window_grab_all_keys (grab_window, timestamp);
|
||||
meta_window_grab_all_keys (window, timestamp);
|
||||
|
||||
else
|
||||
display->grab_have_keyboard =
|
||||
@@ -3583,15 +3592,11 @@ meta_display_begin_grab_op (MetaDisplay *display,
|
||||
}
|
||||
|
||||
display->grab_op = op;
|
||||
display->grab_window = grab_window;
|
||||
display->grab_window = window;
|
||||
display->grab_screen = screen;
|
||||
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;
|
||||
@@ -3788,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)
|
||||
@@ -5180,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;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <meta/errors.h>
|
||||
#include "errors.h"
|
||||
#include "display-private.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#ifndef META_FRAME_PRIVATE_H
|
||||
#define META_FRAME_PRIVATE_H
|
||||
|
||||
#include "frame.h"
|
||||
#include "window-private.h"
|
||||
|
||||
typedef struct _MetaFrameGeometry MetaFrameGeometry;
|
||||
@@ -67,8 +68,7 @@ void meta_window_ensure_frame (MetaWindow *window);
|
||||
void meta_window_destroy_frame (MetaWindow *window);
|
||||
void meta_frame_queue_draw (MetaFrame *frame);
|
||||
|
||||
MetaFrameFlags meta_frame_get_flags (MetaFrame *frame);
|
||||
Window meta_frame_get_xwindow (MetaFrame *frame);
|
||||
MetaFrameFlags meta_frame_get_flags (MetaFrame *frame);
|
||||
|
||||
/* These should ONLY be called from meta_window_move_resize_internal */
|
||||
void meta_frame_calc_geometry (MetaFrame *frame,
|
||||
@@ -24,9 +24,9 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "frame.h"
|
||||
#include "frame-private.h"
|
||||
#include "bell.h"
|
||||
#include <meta/errors.h>
|
||||
#include "errors.h"
|
||||
#include "keybindings-private.h"
|
||||
|
||||
#include <X11/extensions/Xrender.h>
|
||||
@@ -282,7 +282,7 @@ meta_frame_get_flags (MetaFrame *frame)
|
||||
if (frame->window->shaded)
|
||||
flags |= META_FRAME_SHADED;
|
||||
|
||||
if (frame->window->on_all_workspaces_requested)
|
||||
if (frame->window->on_all_workspaces)
|
||||
flags |= META_FRAME_STUCK;
|
||||
|
||||
/* FIXME: Should we have some kind of UI for windows that are just vertically
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#ifndef META_GROUP_PRIVATE_H
|
||||
#define META_GROUP_PRIVATE_H
|
||||
|
||||
#include <meta/group.h>
|
||||
#include "group.h"
|
||||
|
||||
struct _MetaGroup
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#ifndef META_GROUP_PROPS_H
|
||||
#define META_GROUP_PROPS_H
|
||||
|
||||
#include <meta/group.h>
|
||||
#include "group.h"
|
||||
#include "window-private.h"
|
||||
|
||||
void meta_group_reload_property (MetaGroup *group,
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <meta/util.h>
|
||||
#include "util.h"
|
||||
#include "group-private.h"
|
||||
#include "group-props.h"
|
||||
#include "window-private.h"
|
||||
#include <meta/window.h>
|
||||
#include "window.h"
|
||||
|
||||
static MetaGroup*
|
||||
meta_group_new (MetaDisplay *display,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <config.h>
|
||||
#include "iconcache.h"
|
||||
#include "ui.h"
|
||||
#include <meta/errors.h>
|
||||
#include "errors.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
@@ -323,40 +323,6 @@ get_pixmap_geometry (MetaDisplay *display,
|
||||
*d = depth;
|
||||
}
|
||||
|
||||
static void
|
||||
apply_foreground_background (GdkPixbuf *pixbuf)
|
||||
{
|
||||
int w, h;
|
||||
int i, j;
|
||||
guchar *pixels;
|
||||
int stride;
|
||||
|
||||
w = gdk_pixbuf_get_width (pixbuf);
|
||||
h = gdk_pixbuf_get_height (pixbuf);
|
||||
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
stride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
|
||||
i = 0;
|
||||
while (i < h)
|
||||
{
|
||||
j = 0;
|
||||
while (j < w)
|
||||
{
|
||||
guchar *p = pixels + i * stride + j * 4;
|
||||
if (p[3] == 0)
|
||||
p[0] = p[1] = p[2] = 0xff; /* white background */
|
||||
else
|
||||
p[0] = p[1] = p[2] = 0x00; /* black foreground */
|
||||
|
||||
p[3] = 0xff;
|
||||
|
||||
++j;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
static GdkPixbuf*
|
||||
apply_mask (GdkPixbuf *pixbuf,
|
||||
GdkPixbuf *mask)
|
||||
@@ -386,10 +352,16 @@ apply_mask (GdkPixbuf *pixbuf,
|
||||
j = 0;
|
||||
while (j < w)
|
||||
{
|
||||
guchar *s = src + i * src_stride + j * 4;
|
||||
guchar *s = src + i * src_stride + j * 3;
|
||||
guchar *d = dest + i * dest_stride + j * 4;
|
||||
|
||||
d[3] = s[3];
|
||||
/* s[0] == s[1] == s[2], they are 255 if the bit was set, 0
|
||||
* otherwise
|
||||
*/
|
||||
if (s[0] == 0)
|
||||
d[3] = 0; /* transparent */
|
||||
else
|
||||
d[3] = 255; /* opaque */
|
||||
|
||||
++j;
|
||||
}
|
||||
@@ -413,32 +385,25 @@ try_pixmap_and_mask (MetaDisplay *display,
|
||||
{
|
||||
GdkPixbuf *unscaled = NULL;
|
||||
GdkPixbuf *mask = NULL;
|
||||
int w, h, d;
|
||||
int w, h;
|
||||
|
||||
if (src_pixmap == None)
|
||||
return FALSE;
|
||||
|
||||
meta_error_trap_push (display);
|
||||
|
||||
get_pixmap_geometry (display, src_pixmap, &w, &h, &d);
|
||||
get_pixmap_geometry (display, src_pixmap, &w, &h, NULL);
|
||||
|
||||
unscaled = meta_gdk_pixbuf_get_from_pixmap (src_pixmap,
|
||||
0, 0,
|
||||
w, h);
|
||||
|
||||
/* A depth 1 pixmap has 0 background, and 1 foreground, but
|
||||
* cairo and meta_gdk_pixbuf_get_from_pixmap consider it
|
||||
* to be 0 transparent, 1 opaque */
|
||||
if (d == 1)
|
||||
apply_foreground_background (unscaled);
|
||||
|
||||
if (unscaled && src_mask != None)
|
||||
{
|
||||
get_pixmap_geometry (display, src_mask, &w, &h, &d);
|
||||
if (d == 1)
|
||||
mask = meta_gdk_pixbuf_get_from_pixmap (src_mask,
|
||||
0, 0,
|
||||
w, h);
|
||||
get_pixmap_geometry (display, src_mask, &w, &h, NULL);
|
||||
mask = meta_gdk_pixbuf_get_from_pixmap (src_mask,
|
||||
0, 0,
|
||||
w, h);
|
||||
}
|
||||
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#ifndef META_KEYBINDINGS_PRIVATE_H
|
||||
#define META_KEYBINDINGS_PRIVATE_H
|
||||
|
||||
#include <meta/keybindings.h>
|
||||
#include "keybindings.h"
|
||||
|
||||
void meta_display_init_keys (MetaDisplay *display);
|
||||
void meta_display_shutdown_keys (MetaDisplay *display);
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
#include <config.h>
|
||||
#include "keybindings-private.h"
|
||||
#include "workspace-private.h"
|
||||
#include <meta/errors.h>
|
||||
#include "errors.h"
|
||||
#include "edge-resistance.h"
|
||||
#include "ui.h"
|
||||
#include "frame.h"
|
||||
#include "frame-private.h"
|
||||
#include "place.h"
|
||||
#include <meta/prefs.h>
|
||||
#include <meta/util.h>
|
||||
#include "prefs.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include <string.h>
|
||||
@@ -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,
|
||||
@@ -2444,7 +2384,7 @@ static void
|
||||
error_on_command (int command_index,
|
||||
const char *command,
|
||||
const char *message,
|
||||
MetaScreen *screen,
|
||||
int screen_number,
|
||||
guint32 timestamp)
|
||||
{
|
||||
if (command_index < 0)
|
||||
@@ -2473,7 +2413,7 @@ error_on_command (int command_index,
|
||||
meta_show_dialog ("--error",
|
||||
text,
|
||||
NULL,
|
||||
screen->screen_name,
|
||||
screen_number,
|
||||
NULL, NULL, 0,
|
||||
NULL, NULL);
|
||||
|
||||
@@ -2485,7 +2425,7 @@ error_on_command (int command_index,
|
||||
meta_show_dialog ("--error",
|
||||
message,
|
||||
NULL,
|
||||
screen->screen_name,
|
||||
screen_number,
|
||||
NULL, NULL, 0,
|
||||
NULL, NULL);
|
||||
}
|
||||
@@ -2557,7 +2497,7 @@ handle_run_command (MetaDisplay *display,
|
||||
|
||||
s = g_strdup_printf (_("No command %d has been defined.\n"),
|
||||
which + 1);
|
||||
error_on_command (which, NULL, s, screen, event->xkey.time);
|
||||
error_on_command (which, NULL, s, screen->number, event->xkey.time);
|
||||
g_free (s);
|
||||
|
||||
return;
|
||||
@@ -2566,7 +2506,7 @@ handle_run_command (MetaDisplay *display,
|
||||
err = NULL;
|
||||
if (!meta_spawn_command_line_async_on_screen (command, screen, &err))
|
||||
{
|
||||
error_on_command (which, command, err->message, screen, event->xkey.time);
|
||||
error_on_command (which, command, err->message, screen->number, event->xkey.time);
|
||||
|
||||
g_error_free (err);
|
||||
}
|
||||
@@ -3341,7 +3281,7 @@ handle_toggle_on_all_workspaces (MetaDisplay *display,
|
||||
MetaKeyBinding *binding,
|
||||
gpointer dummy)
|
||||
{
|
||||
if (window->on_all_workspaces_requested)
|
||||
if (window->on_all_workspaces)
|
||||
meta_window_unstick (window);
|
||||
else
|
||||
meta_window_stick (window);
|
||||
@@ -3568,7 +3508,7 @@ handle_run_terminal (MetaDisplay *display,
|
||||
"keybinding press\n");
|
||||
|
||||
s = g_strdup_printf (_("No terminal command has been defined.\n"));
|
||||
error_on_command (-1, NULL, s, screen, event->xkey.time);
|
||||
error_on_command (-1, NULL, s, screen->number, event->xkey.time);
|
||||
g_free (s);
|
||||
|
||||
return;
|
||||
@@ -3577,7 +3517,7 @@ handle_run_terminal (MetaDisplay *display,
|
||||
err = NULL;
|
||||
if (!meta_spawn_command_line_async_on_screen (command, screen, &err))
|
||||
{
|
||||
error_on_command (-1, command, err->message, screen,
|
||||
error_on_command (-1, command, err->message, screen->number,
|
||||
event->xkey.time);
|
||||
|
||||
g_error_free (err);
|
||||
|
||||
399
src/core/main.c
399
src/core/main.c
@@ -45,14 +45,14 @@
|
||||
#define _SVID_SOURCE /* for putenv() and some signal-related functions */
|
||||
|
||||
#include <config.h>
|
||||
#include <meta/main.h>
|
||||
#include <meta/util.h>
|
||||
#include "main.h"
|
||||
#include "util.h"
|
||||
#include "display-private.h"
|
||||
#include <meta/errors.h>
|
||||
#include "errors.h"
|
||||
#include "ui.h"
|
||||
#include "session.h"
|
||||
#include <meta/prefs.h>
|
||||
#include <meta/compositor.h>
|
||||
#include "prefs.h"
|
||||
#include "compositor.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gdk/gdkx.h>
|
||||
@@ -75,6 +75,7 @@
|
||||
|
||||
#ifdef HAVE_INTROSPECTION
|
||||
#include <girepository.h>
|
||||
#include "compositor/meta-plugin-manager.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -88,6 +89,12 @@ static MetaExitCode meta_exit_code = META_EXIT_SUCCESS;
|
||||
*/
|
||||
static GMainLoop *meta_main_loop = NULL;
|
||||
|
||||
/**
|
||||
* If set, Mutter will spawn an identical copy of itself immediately
|
||||
* before quitting.
|
||||
*/
|
||||
static gboolean meta_restart_after_quit = FALSE;
|
||||
|
||||
static void prefs_changed_callback (MetaPreference pref,
|
||||
gpointer data);
|
||||
|
||||
@@ -111,6 +118,23 @@ log_handler (const gchar *log_domain,
|
||||
meta_print_backtrace ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints the version notice. This is shown when Mutter is called
|
||||
* with the --version switch.
|
||||
*/
|
||||
static void
|
||||
version (void)
|
||||
{
|
||||
const int latest_year = 2010;
|
||||
|
||||
g_print (_("mutter %s\n"
|
||||
"Copyright (C) 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
|
||||
"This is free software; see the source for copying conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"),
|
||||
VERSION, latest_year);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a list of which configure script options were used to
|
||||
* build this copy of Mutter. This is actually always called
|
||||
@@ -190,72 +214,143 @@ meta_print_self_identity (void)
|
||||
|
||||
/**
|
||||
* The set of possible options that can be set on Mutter's
|
||||
* command line.
|
||||
* command line. This type exists so that meta_parse_options() can
|
||||
* write to an instance of it.
|
||||
*/
|
||||
static gchar *opt_save_file;
|
||||
static gchar *opt_display_name;
|
||||
static gchar *opt_client_id;
|
||||
static gboolean opt_replace_wm;
|
||||
static gboolean opt_disable_sm;
|
||||
static gboolean opt_sync;
|
||||
typedef struct
|
||||
{
|
||||
gchar *save_file;
|
||||
gchar *display_name;
|
||||
gchar *client_id;
|
||||
gchar *mutter_plugins;
|
||||
gboolean replace_wm;
|
||||
gboolean disable_sm;
|
||||
gboolean print_version;
|
||||
gboolean sync;
|
||||
gboolean composite;
|
||||
gboolean no_composite;
|
||||
gboolean no_force_fullscreen;
|
||||
gboolean no_tab_popup;
|
||||
gchar *introspect;
|
||||
} MetaArguments;
|
||||
|
||||
static GOptionEntry meta_options[] = {
|
||||
{
|
||||
"sm-disable", 0, 0, G_OPTION_ARG_NONE,
|
||||
&opt_disable_sm,
|
||||
N_("Disable connection to session manager"),
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"replace", 0, 0, G_OPTION_ARG_NONE,
|
||||
&opt_replace_wm,
|
||||
N_("Replace the running window manager"),
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"sm-client-id", 0, 0, G_OPTION_ARG_STRING,
|
||||
&opt_client_id,
|
||||
N_("Specify session management ID"),
|
||||
"ID"
|
||||
},
|
||||
{
|
||||
"display", 'd', 0, G_OPTION_ARG_STRING,
|
||||
&opt_display_name, N_("X Display to use"),
|
||||
"DISPLAY"
|
||||
},
|
||||
{
|
||||
"sm-save-file", 0, 0, G_OPTION_ARG_FILENAME,
|
||||
&opt_save_file,
|
||||
N_("Initialize session from savefile"),
|
||||
"FILE"
|
||||
},
|
||||
{
|
||||
"sync", 0, 0, G_OPTION_ARG_NONE,
|
||||
&opt_sync,
|
||||
N_("Make X calls synchronous"),
|
||||
NULL
|
||||
},
|
||||
{NULL}
|
||||
};
|
||||
#define COMPOSITE_OPTS_FLAGS 0
|
||||
|
||||
/**
|
||||
* meta_get_option_context: (skip)
|
||||
* Parses argc and argv and returns the
|
||||
* arguments that Mutter understands in meta_args.
|
||||
*
|
||||
* Returns a #GOptionContext initialized with mutter-related options.
|
||||
* Parse the command-line args with this before calling meta_init().
|
||||
* The strange call signature has to be written like it is so
|
||||
* that g_option_context_parse() gets a chance to modify argc and
|
||||
* argv.
|
||||
*
|
||||
* Return value: the #GOptionContext
|
||||
*/
|
||||
GOptionContext *
|
||||
meta_get_option_context (void)
|
||||
* \param argc Pointer to the number of arguments Mutter was given
|
||||
* \param argv Pointer to the array of arguments Mutter was given
|
||||
* \param meta_args The result of parsing the arguments.
|
||||
**/
|
||||
static GOptionContext *
|
||||
meta_parse_options (int *argc, char ***argv,
|
||||
MetaArguments *meta_args)
|
||||
{
|
||||
MetaArguments my_args = {NULL, NULL, NULL, NULL,
|
||||
FALSE, FALSE, FALSE, FALSE, FALSE};
|
||||
GOptionEntry options[] = {
|
||||
{
|
||||
"sm-disable", 0, 0, G_OPTION_ARG_NONE,
|
||||
&my_args.disable_sm,
|
||||
N_("Disable connection to session manager"),
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"replace", 0, 0, G_OPTION_ARG_NONE,
|
||||
&my_args.replace_wm,
|
||||
N_("Replace the running window manager with Mutter"),
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"sm-client-id", 0, 0, G_OPTION_ARG_STRING,
|
||||
&my_args.client_id,
|
||||
N_("Specify session management ID"),
|
||||
"ID"
|
||||
},
|
||||
{
|
||||
"display", 'd', 0, G_OPTION_ARG_STRING,
|
||||
&my_args.display_name, N_("X Display to use"),
|
||||
"DISPLAY"
|
||||
},
|
||||
{
|
||||
"sm-save-file", 0, 0, G_OPTION_ARG_FILENAME,
|
||||
&my_args.save_file,
|
||||
N_("Initialize session from savefile"),
|
||||
"FILE"
|
||||
},
|
||||
{
|
||||
"version", 0, 0, G_OPTION_ARG_NONE,
|
||||
&my_args.print_version,
|
||||
N_("Print version"),
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"sync", 0, 0, G_OPTION_ARG_NONE,
|
||||
&my_args.sync,
|
||||
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,
|
||||
N_("Don't make fullscreen windows that are maximized and have no decorations"),
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"mutter-plugins", 0, 0, G_OPTION_ARG_STRING,
|
||||
&my_args.mutter_plugins,
|
||||
N_("Comma-separated list of compositor plugins"),
|
||||
"PLUGINS"
|
||||
},
|
||||
{
|
||||
"no-tab-popup", 0, 0, G_OPTION_ARG_NONE,
|
||||
&my_args.no_tab_popup,
|
||||
N_("Whether window popup/frame should be shown when cycling windows."),
|
||||
NULL
|
||||
},
|
||||
#ifdef HAVE_INTROSPECTION
|
||||
{
|
||||
"introspect-dump", 0, 0, G_OPTION_ARG_STRING,
|
||||
&my_args.introspect,
|
||||
N_("Internal argument for GObject introspection"), "INTROSPECT"
|
||||
},
|
||||
#endif
|
||||
{NULL}
|
||||
};
|
||||
GOptionContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = g_option_context_new (NULL);
|
||||
g_option_context_add_main_entries (ctx, meta_options, GETTEXT_PACKAGE);
|
||||
g_option_context_add_main_entries (ctx, options, "mutter");
|
||||
g_option_context_add_group (ctx, clutter_get_option_group_without_init ());
|
||||
g_option_context_add_group (ctx, cogl_get_option_group ());
|
||||
|
||||
if (!g_option_context_parse (ctx, argc, argv, &error))
|
||||
{
|
||||
g_print ("mutter: %s\n", error->message);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Return the parsed options through the meta_args param. */
|
||||
*meta_args = my_args;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@@ -304,12 +399,12 @@ static GSourceFuncs event_funcs = {
|
||||
};
|
||||
|
||||
static void
|
||||
meta_clutter_init (void)
|
||||
meta_clutter_init (GOptionContext *ctx, int *argc, char ***argv)
|
||||
{
|
||||
clutter_x11_set_display (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()));
|
||||
clutter_x11_disable_event_retrieval ();
|
||||
|
||||
if (CLUTTER_INIT_SUCCESS == clutter_init (NULL, NULL))
|
||||
if (CLUTTER_INIT_SUCCESS == clutter_init (argc, argv))
|
||||
{
|
||||
GSource *source = g_source_new (&event_funcs, sizeof (GSource));
|
||||
g_source_attach (source, NULL);
|
||||
@@ -348,6 +443,8 @@ meta_finalize (void)
|
||||
if (display)
|
||||
meta_display_close (display,
|
||||
CurrentTime); /* I doubt correct timestamps matter here */
|
||||
|
||||
meta_session_shutdown ();
|
||||
}
|
||||
|
||||
static int sigterm_pipe_fds[2] = { -1, -1 };
|
||||
@@ -357,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]);
|
||||
@@ -373,18 +470,33 @@ on_sigterm (void)
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_init: (skip)
|
||||
* This is where the story begins. It parses commandline options and
|
||||
* environment variables, sets up the screen, hands control off to
|
||||
* GTK, and cleans up afterwards.
|
||||
*
|
||||
* Initialize mutter. Call this after meta_get_option_context() and
|
||||
* meta_plugin_type_register(), and before meta_run().
|
||||
* \param argc Number of arguments (as usual)
|
||||
* \param argv Array of arguments (as usual)
|
||||
*
|
||||
* \bug It's a bit long. It would be good to split it out into separate
|
||||
* functions.
|
||||
*/
|
||||
void
|
||||
meta_init (void)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct sigaction act;
|
||||
sigset_t empty_mask;
|
||||
MetaArguments meta_args;
|
||||
const gchar *log_domains[] = {
|
||||
NULL, G_LOG_DOMAIN, "Gtk", "Gdk", "GLib",
|
||||
"Pango", "GLib-GObject", "GThread"
|
||||
};
|
||||
guint i;
|
||||
GIOChannel *channel;
|
||||
GOptionContext *ctx;
|
||||
|
||||
if (!g_thread_supported ())
|
||||
g_thread_init (NULL);
|
||||
|
||||
if (setlocale (LC_ALL, "") == NULL)
|
||||
meta_warning ("Locale not understood by C library, internationalization will not work\n");
|
||||
|
||||
@@ -428,61 +540,103 @@ meta_init (void)
|
||||
meta_warning ("Could not change to home directory %s.\n",
|
||||
g_get_home_dir ());
|
||||
|
||||
g_type_init ();
|
||||
|
||||
meta_print_self_identity ();
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, MUTTER_LOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
/* Parse command line arguments.*/
|
||||
ctx = meta_parse_options (&argc, &argv, &meta_args);
|
||||
|
||||
/* This must come before the introspect below, so we load all the plugins
|
||||
* in order to get their get_type functions.
|
||||
*/
|
||||
if (meta_args.mutter_plugins)
|
||||
{
|
||||
char **plugins = g_strsplit (meta_args.mutter_plugins, ",", -1);
|
||||
char **plugin;
|
||||
GSList *plugins_list = NULL;
|
||||
|
||||
for (plugin = plugins; *plugin; plugin++)
|
||||
{
|
||||
g_strstrip (*plugin);
|
||||
plugins_list = g_slist_prepend (plugins_list, *plugin);
|
||||
}
|
||||
|
||||
plugins_list = g_slist_reverse (plugins_list);
|
||||
meta_prefs_override_clutter_plugins (plugins_list);
|
||||
|
||||
g_slist_free(plugins_list);
|
||||
g_strfreev (plugins);
|
||||
}
|
||||
|
||||
#ifdef HAVE_INTROSPECTION
|
||||
g_irepository_prepend_search_path (MUTTER_PKGLIBDIR);
|
||||
if (meta_args.introspect)
|
||||
{
|
||||
GError *error = NULL;
|
||||
if (meta_args.mutter_plugins)
|
||||
{
|
||||
/* We need to load all plugins so that we can call their
|
||||
* get_type functions. We do not call
|
||||
* mutter_plugin_manager_initialize because almost nothing else
|
||||
* is initialized at this point, and we don't plan to run any real
|
||||
* plugin code.
|
||||
*/
|
||||
MetaPluginManager *mgr = meta_plugin_manager_get_default ();
|
||||
if (!meta_plugin_manager_load (mgr))
|
||||
g_critical ("failed to load plugins");
|
||||
}
|
||||
if (!g_irepository_dump (meta_args.introspect, &error))
|
||||
{
|
||||
g_printerr ("failed to dump: %s\n", error->message);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
meta_set_syncing (opt_sync || (g_getenv ("MUTTER_SYNC") != NULL));
|
||||
meta_set_syncing (meta_args.sync || (g_getenv ("MUTTER_SYNC") != NULL));
|
||||
|
||||
meta_select_display (opt_display_name);
|
||||
if (meta_args.print_version)
|
||||
version ();
|
||||
|
||||
meta_select_display (meta_args.display_name);
|
||||
|
||||
if (opt_replace_wm)
|
||||
if (meta_args.replace_wm)
|
||||
meta_set_replace_current_wm (TRUE);
|
||||
|
||||
if (opt_save_file && opt_client_id)
|
||||
if (meta_args.save_file && meta_args.client_id)
|
||||
meta_fatal ("Can't specify both SM save file and SM client id\n");
|
||||
|
||||
meta_main_loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
meta_ui_init ();
|
||||
meta_ui_init (&argc, &argv);
|
||||
|
||||
/*
|
||||
* Clutter can only be initialized after the UI.
|
||||
*/
|
||||
meta_clutter_init ();
|
||||
}
|
||||
meta_clutter_init (ctx, &argc, &argv);
|
||||
|
||||
/**
|
||||
* meta_run: (skip)
|
||||
*
|
||||
* Runs mutter. Call this after completing your own initialization.
|
||||
*
|
||||
* Return value: mutter's exit status
|
||||
*/
|
||||
int
|
||||
meta_run (void)
|
||||
{
|
||||
const gchar *log_domains[] = {
|
||||
NULL, G_LOG_DOMAIN, "Gtk", "Gdk", "GLib",
|
||||
"Pango", "GLib-GObject", "GThread"
|
||||
};
|
||||
guint i;
|
||||
g_option_context_free (ctx);
|
||||
|
||||
/* Load prefs */
|
||||
meta_prefs_init ();
|
||||
meta_prefs_add_listener (prefs_changed_callback, NULL);
|
||||
|
||||
|
||||
#if 1
|
||||
|
||||
for (i=0; i<G_N_ELEMENTS(log_domains); i++)
|
||||
g_log_set_handler (log_domains[i],
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
|
||||
log_handler, NULL);
|
||||
|
||||
#endif
|
||||
|
||||
if (g_getenv ("MUTTER_G_FATAL_WARNINGS") != NULL)
|
||||
g_log_set_always_fatal (G_LOG_LEVEL_MASK);
|
||||
|
||||
@@ -526,30 +680,41 @@ meta_run (void)
|
||||
* or we might try to manage a window before we have the session
|
||||
* info
|
||||
*/
|
||||
if (!opt_disable_sm)
|
||||
if (!meta_args.disable_sm)
|
||||
{
|
||||
if (opt_client_id == NULL)
|
||||
if (meta_args.client_id == NULL)
|
||||
{
|
||||
const gchar *desktop_autostart_id;
|
||||
|
||||
desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID");
|
||||
|
||||
if (desktop_autostart_id != NULL)
|
||||
opt_client_id = g_strdup (desktop_autostart_id);
|
||||
meta_args.client_id = g_strdup (desktop_autostart_id);
|
||||
}
|
||||
|
||||
/* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes to
|
||||
* use the same client id. */
|
||||
g_unsetenv ("DESKTOP_AUTOSTART_ID");
|
||||
|
||||
meta_session_init (opt_client_id, opt_save_file);
|
||||
meta_session_init (meta_args.client_id, meta_args.save_file);
|
||||
}
|
||||
/* Free memory possibly allocated by the argument parsing which are
|
||||
* no longer needed.
|
||||
*/
|
||||
g_free (opt_save_file);
|
||||
g_free (opt_display_name);
|
||||
g_free (opt_client_id);
|
||||
g_free (meta_args.save_file);
|
||||
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);
|
||||
|
||||
if (meta_args.no_tab_popup)
|
||||
{
|
||||
meta_prefs_override_no_tab_popup (TRUE);
|
||||
}
|
||||
|
||||
if (!meta_display_open ())
|
||||
meta_exit (META_EXIT_ERROR);
|
||||
@@ -558,15 +723,36 @@ meta_run (void)
|
||||
|
||||
meta_finalize ();
|
||||
|
||||
if (meta_restart_after_quit)
|
||||
{
|
||||
GError *err;
|
||||
|
||||
err = NULL;
|
||||
if (!g_spawn_async (NULL,
|
||||
argv,
|
||||
NULL,
|
||||
G_SPAWN_SEARCH_PATH,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&err))
|
||||
{
|
||||
meta_fatal (_("Failed to restart: %s\n"),
|
||||
err->message);
|
||||
g_error_free (err); /* not reached anyhow */
|
||||
meta_exit_code = META_EXIT_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return meta_exit_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops Mutter. This tells the event loop to stop processing; it is
|
||||
* rather dangerous to use this because this will leave the user with
|
||||
* no window manager. We generally do this only if, for example, the
|
||||
* session manager asks us to; we assume the session manager knows
|
||||
* what it's talking about.
|
||||
* Stops Mutter. This tells the event loop to stop processing; it is rather
|
||||
* dangerous to use this rather than meta_restart() because this will leave
|
||||
* the user with no window manager. We generally do this only if, for example,
|
||||
* the session manager asks us to; we assume the session manager knows what
|
||||
* it's talking about.
|
||||
*
|
||||
* \param code The success or failure code to return to the calling process.
|
||||
*/
|
||||
@@ -579,6 +765,19 @@ meta_quit (MetaExitCode code)
|
||||
g_main_loop_quit (meta_main_loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restarts Mutter. In practice, this tells the event loop to stop
|
||||
* processing, having first set the meta_restart_after_quit flag which
|
||||
* tells Mutter to spawn an identical copy of itself before quitting.
|
||||
* This happens on receipt of a _MUTTER_RESTART_MESSAGE client event.
|
||||
*/
|
||||
void
|
||||
meta_restart (void)
|
||||
{
|
||||
meta_restart_after_quit = TRUE;
|
||||
meta_quit (META_EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on pref changes. (One of several functions of its kind and purpose.)
|
||||
*
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
/*
|
||||
* Copyright 2011 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <meta/main.h>
|
||||
#include <meta/util.h>
|
||||
#ifdef HAVE_INTROSPECTION
|
||||
#include "meta-plugin-manager.h"
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
static gboolean
|
||||
print_version (const gchar *option_name,
|
||||
const gchar *value,
|
||||
gpointer data,
|
||||
GError **error)
|
||||
{
|
||||
const int latest_year = 2011;
|
||||
|
||||
g_print (_("mutter %s\n"
|
||||
"Copyright (C) 2001-%d Havoc Pennington, Red Hat, Inc., and others\n"
|
||||
"This is free software; see the source for copying conditions.\n"
|
||||
"There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"),
|
||||
VERSION, latest_year);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static gchar *mutter_plugins;
|
||||
|
||||
GOptionEntry mutter_options[] = {
|
||||
{
|
||||
"version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
|
||||
print_version,
|
||||
N_("Print version"),
|
||||
NULL
|
||||
},
|
||||
{
|
||||
"mutter-plugins", 0, 0, G_OPTION_ARG_STRING,
|
||||
&mutter_plugins,
|
||||
N_("Comma-separated list of compositor plugins"),
|
||||
"PLUGINS"
|
||||
},
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GOptionContext *ctx;
|
||||
GError *error = NULL;
|
||||
|
||||
ctx = meta_get_option_context ();
|
||||
g_option_context_add_main_entries (ctx, mutter_options, GETTEXT_PACKAGE);
|
||||
if (!g_option_context_parse (ctx, &argc, &argv, &error))
|
||||
{
|
||||
g_printerr ("mutter: %s\n", error->message);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (mutter_plugins)
|
||||
{
|
||||
MetaPluginManager *mgr;
|
||||
char **plugins = g_strsplit (mutter_plugins, ",", -1);
|
||||
char **plugin;
|
||||
|
||||
mgr = meta_plugin_manager_get_default ();
|
||||
for (plugin = plugins; *plugin; plugin++)
|
||||
{
|
||||
g_strstrip (*plugin);
|
||||
meta_plugin_manager_load (mgr, *plugin);
|
||||
}
|
||||
g_strfreev (plugins);
|
||||
}
|
||||
|
||||
meta_init ();
|
||||
return meta_run ();
|
||||
}
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
#include "boxes-private.h"
|
||||
#include "place.h"
|
||||
#include <meta/workspace.h>
|
||||
#include <meta/prefs.h>
|
||||
#include "workspace.h"
|
||||
#include "prefs.h"
|
||||
#include <gdk/gdk.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#define META_PLACE_H
|
||||
|
||||
#include "window-private.h"
|
||||
#include "frame.h"
|
||||
#include "frame-private.h"
|
||||
|
||||
void meta_window_place (MetaWindow *window,
|
||||
MetaFrameGeometry *fgeom,
|
||||
|
||||
168
src/core/prefs.c
168
src/core/prefs.c
@@ -24,10 +24,10 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <meta/prefs.h>
|
||||
#include "prefs.h"
|
||||
#include "ui.h"
|
||||
#include <meta/util.h>
|
||||
#include "meta-plugin-manager.h"
|
||||
#include "util.h"
|
||||
#include "compositor/meta-plugin-manager.h"
|
||||
#ifdef HAVE_GCONF
|
||||
#include <gconf/gconf-client.h>
|
||||
#endif
|
||||
@@ -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"
|
||||
@@ -66,8 +67,9 @@
|
||||
#define KEY_WORKSPACE_NAME_DIRECTORY "/apps/metacity/workspace_names"
|
||||
#define KEY_WORKSPACE_NAME_PREFIX "/apps/metacity/workspace_names/name_"
|
||||
|
||||
#define KEY_CLUTTER_PLUGINS "/apps/mutter/general/clutter_plugins"
|
||||
|
||||
#define KEY_LIVE_HIDDEN_WINDOWS "/apps/mutter/general/live_hidden_windows"
|
||||
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "/apps/mutter/general/workspaces_only_on_primary"
|
||||
|
||||
#define KEY_NO_TAB_POPUP "/apps/metacity/general/no_tab_popup"
|
||||
|
||||
@@ -100,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;
|
||||
@@ -114,8 +117,10 @@ static char *terminal_command = NULL;
|
||||
|
||||
static char *workspace_names[MAX_REASONABLE_WORKSPACES] = { NULL, };
|
||||
|
||||
static gboolean clutter_plugins_overridden = FALSE;
|
||||
static GSList *clutter_plugins = NULL;
|
||||
|
||||
static gboolean live_hidden_windows = FALSE;
|
||||
static gboolean workspaces_only_on_primary = FALSE;
|
||||
|
||||
static gboolean no_tab_popup = FALSE;
|
||||
|
||||
@@ -408,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",
|
||||
@@ -423,11 +433,6 @@ static MetaBoolPreference preferences_bool[] =
|
||||
&live_hidden_windows,
|
||||
FALSE,
|
||||
},
|
||||
{ "/apps/mutter/general/workspaces_only_on_primary",
|
||||
META_PREF_WORKSPACES_ONLY_ON_PRIMARY,
|
||||
&workspaces_only_on_primary,
|
||||
FALSE,
|
||||
},
|
||||
{ "/apps/metacity/general/no_tab_popup",
|
||||
META_PREF_NO_TAB_POPUP,
|
||||
&no_tab_popup,
|
||||
@@ -1053,6 +1058,7 @@ meta_prefs_init (void)
|
||||
#ifdef HAVE_GCONF
|
||||
GError *err = NULL;
|
||||
gchar **gconf_dir_cursor;
|
||||
MetaPluginManager *plugin_manager;
|
||||
|
||||
if (default_client != NULL)
|
||||
return;
|
||||
@@ -1071,6 +1077,19 @@ meta_prefs_init (void)
|
||||
cleanup_error (&err);
|
||||
}
|
||||
|
||||
/* The plugin list is special and needs to be handled first */
|
||||
|
||||
if (!clutter_plugins_overridden)
|
||||
clutter_plugins = gconf_client_get_list (default_client, KEY_CLUTTER_PLUGINS,
|
||||
GCONF_VALUE_STRING, &err);
|
||||
|
||||
cleanup_error (&err);
|
||||
|
||||
/* We now initialize plugins so that they can override any preference locations */
|
||||
|
||||
plugin_manager = meta_plugin_manager_get_default ();
|
||||
meta_plugin_manager_load (plugin_manager);
|
||||
|
||||
/* Pick up initial values. */
|
||||
|
||||
handle_preference_init_enum ();
|
||||
@@ -1384,6 +1403,23 @@ change_notify (GConfClient *client,
|
||||
{
|
||||
queue_changed (META_PREF_KEYBINDINGS);
|
||||
}
|
||||
else if (g_str_equal (key, KEY_CLUTTER_PLUGINS) && !clutter_plugins_overridden)
|
||||
{
|
||||
GError *err = NULL;
|
||||
GSList *l;
|
||||
|
||||
l = gconf_client_get_list (default_client, KEY_CLUTTER_PLUGINS,
|
||||
GCONF_VALUE_STRING, &err);
|
||||
|
||||
if (!l)
|
||||
{
|
||||
cleanup_error (&err);
|
||||
goto out;
|
||||
}
|
||||
|
||||
clutter_plugins = l;
|
||||
queue_changed (META_PREF_CLUTTER_PLUGINS);
|
||||
}
|
||||
else
|
||||
{
|
||||
meta_topic (META_DEBUG_PREFS, "Key %s doesn't mean anything to Mutter\n",
|
||||
@@ -1968,21 +2004,24 @@ 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";
|
||||
|
||||
case META_PREF_CLUTTER_PLUGINS:
|
||||
return "CLUTTER_PLUGINS";
|
||||
|
||||
case META_PREF_LIVE_HIDDEN_WINDOWS:
|
||||
return "LIVE_HIDDEN_WINDOWS";
|
||||
|
||||
case META_PREF_WORKSPACES_ONLY_ON_PRIMARY:
|
||||
return "WORKSPACES_ONLY_ON_PRIMARY";
|
||||
|
||||
case META_PREF_NO_TAB_POPUP:
|
||||
return "NO_TAB_POPUP";
|
||||
}
|
||||
@@ -2887,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
|
||||
@@ -2953,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)
|
||||
{
|
||||
@@ -2971,6 +3016,74 @@ 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:
|
||||
*
|
||||
* Returns: (transfer none) (element-type utf8): Plugin names to load
|
||||
*/
|
||||
GSList *
|
||||
meta_prefs_get_clutter_plugins (void)
|
||||
{
|
||||
return clutter_plugins;
|
||||
}
|
||||
|
||||
void
|
||||
meta_prefs_set_clutter_plugins (GSList *list)
|
||||
{
|
||||
#ifdef HAVE_GCONF
|
||||
GError *err = NULL;
|
||||
|
||||
gconf_client_set_list (default_client,
|
||||
KEY_CLUTTER_PLUGINS,
|
||||
GCONF_VALUE_STRING,
|
||||
list,
|
||||
&err);
|
||||
|
||||
if (err)
|
||||
{
|
||||
meta_warning (_("Error setting clutter plugin list: %s\n"),
|
||||
err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
meta_prefs_override_clutter_plugins (GSList *list)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
clutter_plugins_overridden = TRUE;
|
||||
clutter_plugins = NULL;
|
||||
|
||||
for (l = list; l; l = l->next)
|
||||
clutter_plugins = g_slist_prepend (clutter_plugins, g_strdup(l->data));
|
||||
|
||||
clutter_plugins = g_slist_reverse (clutter_plugins);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_prefs_get_live_hidden_windows (void)
|
||||
{
|
||||
@@ -3003,13 +3116,6 @@ meta_prefs_set_live_hidden_windows (gboolean whether)
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_prefs_get_workspaces_only_on_primary (void)
|
||||
{
|
||||
return workspaces_only_on_primary;
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
meta_prefs_get_no_tab_popup (void)
|
||||
{
|
||||
@@ -3038,6 +3144,12 @@ meta_prefs_set_no_tab_popup (gboolean whether)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
meta_prefs_override_no_tab_popup (gboolean whether)
|
||||
{
|
||||
no_tab_popup = whether;
|
||||
}
|
||||
|
||||
#ifndef HAVE_GCONF
|
||||
static void
|
||||
init_button_layout(void)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#define META_SCREEN_PRIVATE_H
|
||||
|
||||
#include "display-private.h"
|
||||
#include <meta/screen.h>
|
||||
#include "screen.h"
|
||||
#include <X11/Xutil.h>
|
||||
#include "stack-tracker.h"
|
||||
#include "ui.h"
|
||||
@@ -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,
|
||||
@@ -99,7 +107,6 @@ struct _MetaScreen
|
||||
guint32 wm_sn_timestamp;
|
||||
|
||||
MetaMonitorInfo *monitor_infos;
|
||||
int primary_monitor_index;
|
||||
int n_monitor_infos;
|
||||
|
||||
/* Cache the current monitor */
|
||||
@@ -120,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;
|
||||
@@ -142,7 +148,6 @@ struct _MetaScreenClass
|
||||
|
||||
void (*restacked) (MetaScreen *);
|
||||
void (*workareas_changed) (MetaScreen *);
|
||||
void (*monitors_changed) (MetaScreen *);
|
||||
};
|
||||
|
||||
MetaScreen* meta_screen_new (MetaDisplay *display,
|
||||
@@ -179,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);
|
||||
@@ -250,6 +254,4 @@ void meta_screen_workspace_switched (MetaScreen *screen,
|
||||
int to,
|
||||
MetaMotionDirection direction);
|
||||
|
||||
void meta_screen_set_active_workspace_hint (MetaScreen *screen);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,17 +28,16 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "screen-private.h"
|
||||
#include <meta/main.h>
|
||||
#include <meta/util.h>
|
||||
#include <meta/errors.h>
|
||||
#include "util.h"
|
||||
#include "errors.h"
|
||||
#include "window-private.h"
|
||||
#include "frame.h"
|
||||
#include <meta/prefs.h>
|
||||
#include "frame-private.h"
|
||||
#include "prefs.h"
|
||||
#include "workspace-private.h"
|
||||
#include "keybindings-private.h"
|
||||
#include "stack.h"
|
||||
#include "xprops.h"
|
||||
#include <meta/compositor.h>
|
||||
#include "compositor.h"
|
||||
#include "mutter-marshal.h"
|
||||
#include "mutter-enum-types.h"
|
||||
|
||||
@@ -85,11 +84,8 @@ enum
|
||||
WORKSPACE_ADDED,
|
||||
WORKSPACE_REMOVED,
|
||||
WORKSPACE_SWITCHED,
|
||||
WINDOW_ENTERED_MONITOR,
|
||||
WINDOW_LEFT_MONITOR,
|
||||
STARTUP_SEQUENCE_CHANGED,
|
||||
WORKAREAS_CHANGED,
|
||||
MONITORS_CHANGED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
@@ -204,28 +200,6 @@ meta_screen_class_init (MetaScreenClass *klass)
|
||||
G_TYPE_INT,
|
||||
MUTTER_TYPE_MOTION_DIRECTION);
|
||||
|
||||
screen_signals[WINDOW_ENTERED_MONITOR] =
|
||||
g_signal_new ("window-entered-monitor",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
_mutter_marshal_VOID__INT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_INT,
|
||||
META_TYPE_WINDOW);
|
||||
|
||||
screen_signals[WINDOW_LEFT_MONITOR] =
|
||||
g_signal_new ("window-left-monitor",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
_mutter_marshal_VOID__INT_OBJECT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_INT,
|
||||
META_TYPE_WINDOW);
|
||||
|
||||
screen_signals[STARTUP_SEQUENCE_CHANGED] =
|
||||
g_signal_new ("startup-sequence-changed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
@@ -253,15 +227,6 @@ meta_screen_class_init (MetaScreenClass *klass)
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
screen_signals[MONITORS_CHANGED] =
|
||||
g_signal_new ("monitors-changed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (MetaScreenClass, monitors_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_N_WORKSPACES,
|
||||
pspec);
|
||||
@@ -312,7 +277,7 @@ set_supported_hint (MetaScreen *screen)
|
||||
Atom atoms[] = {
|
||||
#define EWMH_ATOMS_ONLY
|
||||
#define item(x) screen->display->atom_##x,
|
||||
#include <meta/atomnames.h>
|
||||
#include "atomnames.h"
|
||||
#undef item
|
||||
#undef EWMH_ATOMS_ONLY
|
||||
};
|
||||
@@ -377,18 +342,6 @@ reload_monitor_infos (MetaScreen *screen)
|
||||
screen->n_monitor_infos = 0;
|
||||
screen->last_monitor_index = 0;
|
||||
|
||||
/* Xinerama doesn't have a concept of primary monitor, however XRandR
|
||||
* does. However, the XRandR xinerama compat code always sorts the
|
||||
* primary output first, so we rely on that here. We could use the
|
||||
* native XRandR calls instead of xinerama, but that would be
|
||||
* slightly problematic for _NET_WM_FULLSCREEN_MONITORS support, as
|
||||
* that is defined in terms of xinerama monitor indexes.
|
||||
* So, since we don't need anything in xrandr except the primary
|
||||
* we can keep using xinerama and use the first monitor as the
|
||||
* primary.
|
||||
*/
|
||||
screen->primary_monitor_index = 0;
|
||||
|
||||
screen->display->monitor_cache_invalidated = TRUE;
|
||||
|
||||
if (g_getenv ("MUTTER_DEBUG_XINERAMA"))
|
||||
@@ -998,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);
|
||||
|
||||
@@ -1024,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 */
|
||||
@@ -1330,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;
|
||||
@@ -1369,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);
|
||||
@@ -1379,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)
|
||||
{
|
||||
@@ -1819,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;
|
||||
|
||||
@@ -1837,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;
|
||||
|
||||
@@ -1896,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)
|
||||
@@ -2177,22 +2086,6 @@ meta_screen_get_n_monitors (MetaScreen *screen)
|
||||
return screen->n_monitor_infos;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_screen_get_primary_monitor:
|
||||
* @screen: a #MetaScreen
|
||||
*
|
||||
* Gets the index of the primary monitor on this @screen.
|
||||
*
|
||||
* Return value: a monitor index
|
||||
*/
|
||||
int
|
||||
meta_screen_get_primary_monitor (MetaScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (META_IS_SCREEN (screen), 0);
|
||||
|
||||
return screen->primary_monitor_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_screen_get_monitor_geometry:
|
||||
* @screen: a #MetaScreen
|
||||
@@ -2226,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;
|
||||
@@ -2315,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)
|
||||
{
|
||||
@@ -2841,27 +2694,10 @@ void
|
||||
meta_screen_resize (MetaScreen *screen,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
GSList *windows, *tmp;
|
||||
|
||||
{
|
||||
screen->rect.width = width;
|
||||
screen->rect.height = height;
|
||||
|
||||
/* Clear monitor for all windows on this screen, as it will become
|
||||
* invalid. */
|
||||
windows = meta_display_list_windows (screen->display,
|
||||
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
|
||||
for (tmp = windows; tmp != NULL; tmp = tmp->next)
|
||||
{
|
||||
MetaWindow *window = tmp->data;
|
||||
|
||||
if (window->screen == screen)
|
||||
{
|
||||
g_signal_emit_by_name (screen, "window-left-monitor", window->monitor->number, window);
|
||||
window->monitor = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
reload_monitor_infos (screen);
|
||||
set_desktop_geometry_hint (screen);
|
||||
|
||||
@@ -2871,21 +2707,6 @@ meta_screen_resize (MetaScreen *screen,
|
||||
|
||||
/* Queue a resize on all the windows */
|
||||
meta_screen_foreach_window (screen, meta_screen_resize_func, 0);
|
||||
|
||||
/* Fix up monitor for all windows on this screen */
|
||||
windows = meta_display_list_windows (screen->display,
|
||||
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
|
||||
for (tmp = windows; tmp != NULL; tmp = tmp->next)
|
||||
{
|
||||
MetaWindow *window = tmp->data;
|
||||
|
||||
if (window->screen == screen)
|
||||
meta_window_update_monitor (window);
|
||||
}
|
||||
|
||||
g_slist_free (windows);
|
||||
|
||||
g_signal_emit (screen, screen_signals[MONITORS_CHANGED], 0, index);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3487,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,12 @@ meta_session_init (const char *client_id,
|
||||
meta_topic (META_DEBUG_SM, "Compiled without session management support\n");
|
||||
}
|
||||
|
||||
void
|
||||
meta_session_shutdown (void)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
const MetaWindowSessionInfo*
|
||||
meta_window_lookup_saved_state (MetaWindow *window)
|
||||
{
|
||||
@@ -63,10 +69,10 @@ meta_window_release_saved_state (const MetaWindowSessionInfo *info)
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <meta/main.h>
|
||||
#include <meta/util.h>
|
||||
#include "main.h"
|
||||
#include "util.h"
|
||||
#include "display-private.h"
|
||||
#include <meta/workspace.h>
|
||||
#include "workspace.h"
|
||||
|
||||
static void ice_io_error_handler (IceConn connection);
|
||||
|
||||
@@ -301,12 +307,7 @@ meta_session_init (const char *previous_client_id,
|
||||
SmProp prop1, prop2, prop3, prop4, prop5, prop6, *props[6];
|
||||
SmPropValue prop1val, prop2val, prop3val, prop4val, prop5val, prop6val;
|
||||
char pid[32];
|
||||
/* Historically, this was SmRestartImmediately, which made sense
|
||||
* for a stateless window manager, but we don't really control
|
||||
* what embedders do, and it's all around better if gnome-session
|
||||
* handles this.
|
||||
*/
|
||||
char hint = SmRestartIfRunning;
|
||||
char hint = SmRestartImmediately;
|
||||
char priority = 20; /* low to run before other apps */
|
||||
|
||||
prop1.name = SmProgram;
|
||||
@@ -370,6 +371,31 @@ meta_session_init (const char *previous_client_id,
|
||||
g_free (saved_client_id);
|
||||
}
|
||||
|
||||
void
|
||||
meta_session_shutdown (void)
|
||||
{
|
||||
/* Change our restart mode to IfRunning */
|
||||
|
||||
SmProp prop1;
|
||||
SmPropValue prop1val;
|
||||
SmProp *props[1];
|
||||
char hint = SmRestartIfRunning;
|
||||
|
||||
if (session_connection == NULL)
|
||||
return;
|
||||
|
||||
prop1.name = SmRestartStyleHint;
|
||||
prop1.type = SmCARD8;
|
||||
prop1.num_vals = 1;
|
||||
prop1.vals = &prop1val;
|
||||
prop1val.value = &hint;
|
||||
prop1val.length = 1;
|
||||
|
||||
props[0] = &prop1;
|
||||
|
||||
SmcSetProperties (session_connection, 1, props);
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect (void)
|
||||
{
|
||||
@@ -518,16 +544,9 @@ save_yourself_callback (SmcConn smc_conn,
|
||||
static void
|
||||
die_callback (SmcConn smc_conn, SmPointer client_data)
|
||||
{
|
||||
meta_topic (META_DEBUG_SM, "Disconnecting from session manager");
|
||||
meta_topic (META_DEBUG_SM, "Exiting at request of session manager\n");
|
||||
disconnect ();
|
||||
/* We don't actually exit here - we will simply go away with the X
|
||||
* server on logout, when we lose the X connection and libx11 kills
|
||||
* us. It looks like *crap* on logout if the user sees their
|
||||
* windows lose the decorations, etc.
|
||||
*
|
||||
* Anything that wants us to go away outside of session management
|
||||
* can use kill().
|
||||
*/
|
||||
meta_quit (META_EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -933,7 +952,7 @@ save_state (void)
|
||||
g_free (title);
|
||||
|
||||
/* Sticky */
|
||||
if (window->on_all_workspaces_requested)
|
||||
if (window->on_all_workspaces)
|
||||
fputs (" <sticky/>\n", outfile);
|
||||
|
||||
/* Minimized */
|
||||
@@ -1804,7 +1823,7 @@ warn_about_lame_clients_and_finish_interact (gboolean shutdown)
|
||||
"and will have to be restarted manually next time "
|
||||
"you log in."),
|
||||
"240",
|
||||
meta_get_display()->active_screen->screen_name,
|
||||
meta_screen_get_screen_number (meta_get_display()->active_screen),
|
||||
NULL, NULL,
|
||||
None,
|
||||
columns,
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "frame.h"
|
||||
#include "frame-private.h"
|
||||
#include "screen-private.h"
|
||||
#include "stack-tracker.h"
|
||||
#include <meta/util.h>
|
||||
#include "util.h"
|
||||
|
||||
#include <meta/compositor.h>
|
||||
#include "compositor.h"
|
||||
|
||||
/* The complexity here comes from resolving two competing factors:
|
||||
*
|
||||
@@ -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
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#ifndef META_STACK_TRACKER_H
|
||||
#define META_STACK_TRACKER_H
|
||||
|
||||
#include <meta/screen.h>
|
||||
#include "screen.h"
|
||||
|
||||
typedef struct _MetaStackTracker MetaStackTracker;
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
#include <config.h>
|
||||
#include "stack.h"
|
||||
#include "window-private.h"
|
||||
#include <meta/errors.h>
|
||||
#include "frame.h"
|
||||
#include <meta/group.h>
|
||||
#include <meta/prefs.h>
|
||||
#include <meta/workspace.h>
|
||||
#include "errors.h"
|
||||
#include "frame-private.h"
|
||||
#include "group.h"
|
||||
#include "prefs.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -26,9 +26,9 @@
|
||||
#define _POSIX_C_SOURCE 200112L /* for fdopen() */
|
||||
|
||||
#include <config.h>
|
||||
#include <meta/common.h>
|
||||
#include <meta/util.h>
|
||||
#include <meta/main.h>
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
#include "main.h"
|
||||
|
||||
#include <clutter/clutter.h> /* For clutter_threads_add_repaint_func() */
|
||||
|
||||
@@ -588,7 +588,7 @@ GPid
|
||||
meta_show_dialog (const char *type,
|
||||
const char *message,
|
||||
const char *timeout,
|
||||
const char *display,
|
||||
const gint screen_number,
|
||||
const char *ok_text,
|
||||
const char *cancel_text,
|
||||
const int transient_for,
|
||||
@@ -596,6 +596,7 @@ meta_show_dialog (const char *type,
|
||||
GSList *entries)
|
||||
{
|
||||
GError *error = NULL;
|
||||
char *screen_number_text = g_strdup_printf("%d", screen_number);
|
||||
GSList *tmp;
|
||||
int i=0;
|
||||
GPid child_pid;
|
||||
@@ -606,8 +607,8 @@ meta_show_dialog (const char *type,
|
||||
|
||||
argvl[i++] = "zenity";
|
||||
argvl[i++] = type;
|
||||
argvl[i++] = "--display";
|
||||
argvl[i++] = display;
|
||||
argvl[i++] = "--screen";
|
||||
argvl[i++] = screen_number_text;
|
||||
argvl[i++] = "--class";
|
||||
argvl[i++] = "mutter-dialog";
|
||||
argvl[i++] = "--title";
|
||||
@@ -672,6 +673,7 @@ meta_show_dialog (const char *type,
|
||||
unsetenv ("WINDOWID");
|
||||
|
||||
g_free (argvl);
|
||||
g_free (screen_number_text);
|
||||
|
||||
if (error)
|
||||
{
|
||||
|
||||
@@ -35,10 +35,10 @@
|
||||
#define META_WINDOW_PRIVATE_H
|
||||
|
||||
#include <config.h>
|
||||
#include <meta/compositor.h>
|
||||
#include <meta/window.h>
|
||||
#include "compositor.h"
|
||||
#include "window.h"
|
||||
#include "screen-private.h"
|
||||
#include <meta/util.h>
|
||||
#include "util.h"
|
||||
#include "stack.h"
|
||||
#include "iconcache.h"
|
||||
#include <X11/Xutil.h>
|
||||
@@ -61,13 +61,18 @@ typedef enum {
|
||||
|
||||
#define NUMBER_OF_QUEUES 3
|
||||
|
||||
typedef enum {
|
||||
META_TILE_NONE,
|
||||
META_TILE_LEFT,
|
||||
META_TILE_RIGHT
|
||||
} MetaTileMode;
|
||||
|
||||
struct _MetaWindow
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
MetaDisplay *display;
|
||||
MetaScreen *screen;
|
||||
const MetaMonitorInfo *monitor;
|
||||
MetaWorkspace *workspace;
|
||||
Window xwindow;
|
||||
/* may be NULL! not all windows get decorated */
|
||||
@@ -161,11 +166,6 @@ struct _MetaWindow
|
||||
*/
|
||||
guint on_all_workspaces : 1;
|
||||
|
||||
/* This is true if the client requested sticky, and implies on_all_workspaces == TRUE,
|
||||
* however on_all_workspaces can be set TRUE for other internal reasons too, such as
|
||||
* being override_redirect or being on the non-primary monitor. */
|
||||
guint on_all_workspaces_requested : 1;
|
||||
|
||||
/* Minimize is the state controlled by the minimize button */
|
||||
guint minimized : 1;
|
||||
guint tab_unminimized : 1;
|
||||
@@ -253,9 +253,11 @@ struct _MetaWindow
|
||||
/* EWHH demands attention flag */
|
||||
guint wm_state_demands_attention : 1;
|
||||
|
||||
/* this flag tracks receipt of focus_in focus_out */
|
||||
/* this flag tracks receipt of focus_in focus_out and
|
||||
* determines whether we draw the focus
|
||||
*/
|
||||
guint has_focus : 1;
|
||||
|
||||
|
||||
/* Have we placed this window? */
|
||||
guint placed : 1;
|
||||
|
||||
@@ -387,9 +389,6 @@ struct _MetaWindow
|
||||
MetaGroup *group;
|
||||
|
||||
GObject *compositor_private;
|
||||
|
||||
/* Focused window that is (directly or indirectly) attached to this one */
|
||||
MetaWindow *attached_focus_window;
|
||||
};
|
||||
|
||||
struct _MetaWindowClass
|
||||
@@ -410,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)))
|
||||
@@ -438,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);
|
||||
@@ -632,10 +626,5 @@ void meta_window_update_icon_now (MetaWindow *window);
|
||||
|
||||
void meta_window_update_role (MetaWindow *window);
|
||||
void meta_window_update_net_wm_type (MetaWindow *window);
|
||||
void meta_window_update_monitor (MetaWindow *window);
|
||||
void meta_window_update_on_all_workspaces (MetaWindow *window);
|
||||
|
||||
void meta_window_propagate_focus_appearance (MetaWindow *window,
|
||||
gboolean focused);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,10 +40,10 @@
|
||||
|
||||
#include <config.h>
|
||||
#include "window-props.h"
|
||||
#include <meta/errors.h>
|
||||
#include "errors.h"
|
||||
#include "xprops.h"
|
||||
#include "frame.h"
|
||||
#include <meta/group.h>
|
||||
#include "frame-private.h"
|
||||
#include "group.h"
|
||||
#include <X11/Xatom.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
@@ -684,7 +684,7 @@ reload_net_wm_state (MetaWindow *window,
|
||||
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_DEMANDS_ATTENTION)
|
||||
window->wm_state_demands_attention = TRUE;
|
||||
else if (value->v.atom_list.atoms[i] == window->display->atom__NET_WM_STATE_STICKY)
|
||||
window->on_all_workspaces_requested = TRUE;
|
||||
window->on_all_workspaces = TRUE;
|
||||
|
||||
++i;
|
||||
}
|
||||
@@ -693,7 +693,6 @@ reload_net_wm_state (MetaWindow *window,
|
||||
window->desc);
|
||||
|
||||
meta_window_recalc_window_type (window);
|
||||
meta_window_recalc_features (window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1466,9 +1465,6 @@ reload_transient_for (MetaWindow *window,
|
||||
MetaPropValue *value,
|
||||
gboolean initial)
|
||||
{
|
||||
if (window->has_focus && window->xtransient_for != None)
|
||||
meta_window_propagate_focus_appearance (window, FALSE);
|
||||
|
||||
window->xtransient_for = None;
|
||||
|
||||
if (value->type != META_PROP_VALUE_INVALID)
|
||||
@@ -1512,9 +1508,6 @@ reload_transient_for (MetaWindow *window,
|
||||
|
||||
if (!window->constructing && !window->override_redirect)
|
||||
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
|
||||
|
||||
if (window->has_focus && window->xtransient_for != None)
|
||||
meta_window_propagate_focus_appearance (window, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user