summaryrefslogtreecommitdiff
diff options
-rw-r--r--HACKING49
-rw-r--r--Makefile.am34
-rw-r--r--NEWS0
-rw-r--r--README0
-rwxr-xr-xautogen.sh11
-rw-r--r--configure.ac209
-rw-r--r--data/Makefile.am41
-rw-r--r--targets/Makefile.am1
-rw-r--r--targets/mutter/Makefile.am98
-rw-r--r--targets/mutter/expose-manager.vala690
-rw-r--r--targets/mutter/main.c437
-rw-r--r--targets/mutter/maximus.vala104
-rw-r--r--targets/mutter/mutter-plugins.h30
-rw-r--r--targets/mutter/plugin.vala1436
-rw-r--r--targets/mutter/spaces-manager.vala511
-rw-r--r--targets/mutter/window-management.vala263
-rw-r--r--targets/unity/Makefile.am75
-rw-r--r--targets/unity/main.vala201
-rw-r--r--tools/Makefile.am3
-rwxr-xr-xtools/unity-xephyr.py66
-rw-r--r--unity-private/Makefile.am182
-rw-r--r--unity/Makefile.am105
-rw-r--r--vapi/Makefile.am19
23 files changed, 0 insertions, 4565 deletions
diff --git a/HACKING b/HACKING
deleted file mode 100644
index 491c1a56f..000000000
--- a/HACKING
+++ /dev/null
@@ -1,49 +0,0 @@
-Notes on unity development:
-
-Quicklist desktop file specification:
- Adding a new quicklist entry requires modifiying the desktop file of the
- application the quicklist belongs to. You will need to create a new group
- named Quicklist Entry UID, with UID being a unique id (in the scope of the
- desktop file).
- An example follows:
-
-[Desktop Entry]
-...
-...
-...
-
-[QuickList Entry 1]
-Name=FooBar Action
-Exec=foobar --thingone
-
-[QuickList Entry 2]
-Name=FooBar Second Action
-Exec=foobar --thingtwo
-
-[QuickList Entry 3]
-Name=FooBar Third Action
-Exec=foobar --thingthree
-
- Name and Exec follow standard Desktop file specifications and can be
- translated in the same mannar as standard desktop files.
-
-Bootperformance Logging:
- To enable boot performance logging, set the environment variable
- UNITY_BOOTLOG_FILENAME to a path to the log file and make sure unity is built
- with --enable-testing. eg:
- UNITY_BOOTLOG_FILENAME=/tmp/unity.log unity -p
-
- you can then produce a bootchart with this by running the tools/makebootchart.py
- script:
- ./tools/makebootchart.py --input=/tmp/unity.log --output=/tmp/unity.svg
-
-
-Webapp switching:
- Unity can use two webapp systems, prism and chromium, you can toggle between
- the two by setting the gconf key "/apps/unity/webapp_use_chromium" on or off
-
-Setting unmovable apps:
- To make a launcher unmovable set the desktop_file gconf key of the app to manditory
-
-setting bottom fixed apps:
- To make a launcher appear at the bottom of the launchers and fixed in place, set the key "fixed" (bool) to true in the launchers gconf directory
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 2612713a6..000000000
--- a/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-SUBDIRS = data unity unity-private targets tests tools vapi po
-
-# Test reports
-.PHONY: check-report
-check-report:
- $(MAKE) -C tests/ $(@)
-
-DISTCHECK_CONFIGURE_FLAGS = --enable-localinstall --enable-mutter
-
-# ChangeLog file created at distcheck time
-dist-hook:
- @if test -d "$(srcdir)/.bzr"; \
- then \
- echo Creating ChangeLog && \
- ( cd "$(top_srcdir)" && \
- echo '# Generated by Makefile. Do not edit.'; echo; \
- $(top_srcdir)/missing --run bzr log --gnu-changelog ) > ChangeLog.tmp \
- && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
- || (rm -f ChangeLog.tmp; \
- echo Failed to generate ChangeLog >&2 ); \
- else \
- echo Failed to generate ChangeLog: not a branch >&2; \
- fi
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = unity.pc
-
-EXTRA_DIST = \
- autogen.sh \
- COPYING \
- COPYING.LGPL \
- HACKING \
- unity.pc.in
-
diff --git a/NEWS b/NEWS
deleted file mode 100644
index e69de29bb..000000000
--- a/NEWS
+++ /dev/null
diff --git a/README b/README
deleted file mode 100644
index e69de29bb..000000000
--- a/README
+++ /dev/null
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 6781d9bae..000000000
--- a/autogen.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-PKG_NAME="unity"
-
-which gnome-autogen.sh || {
- echo "You need gnome-common from GNOME SVN"
- exit 1
-}
-
-USE_GNOME2_MACROS=1 \
-. gnome-autogen.sh
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 0e2670e51..000000000
--- a/configure.ac
+++ /dev/null
@@ -1,209 +0,0 @@
-m4_define([unity_major], [0])
-m4_define([unity_minor], [2])
-m4_define([unity_micro], [47])
-
-m4_define([unity_api],
- [unity_major.unity_minor])
-m4_define([unity_version],
- [unity_major.unity_minor.unity_micro])
-
-m4_define([unity_interface_age], [0])
-m4_define([unity_binary_age],
- [m4_eval(100 * unity_minor + unity_micro)])
-
-AC_INIT([unity],[unity_version],[https://launchpad.net/unity])
-AC_COPYRIGHT([Copyright 2009 Canonical])
-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
-
-AC_PREREQ(2.59)
-
-AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE(unity, unity_version)
-
-dnl Get version number into Autoconf
-DL_MAJOR_VERSION=unity_major
-DL_MINOR_VERSION=unity_minor
-DL_MICRO_VERSION=unity_micro
-DL_VERSION=unity_version
-AC_SUBST(DL_MAJOR_VERSION)
-AC_SUBST(DL_MINOR_VERSION)
-AC_SUBST(DL_MICRO_VERSION)
-AC_SUBST(DL_VERSION)
-
-dnl Init the other things we depend on
-AM_MAINTAINER_MODE
-AM_PROG_VALAC([0.7.8])
-AS_IF([test -z "$VALAC"], [AC_MSG_ERROR(["No valac compiler found."])])
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_HEADER_STDC
-
-LT_INIT
-AC_CONFIG_MACRO_DIR([m4])
-
-dnl Gettext
-GETTEXT_PACKAGE="$PACKAGE"
-AC_SUBST(GETTEXT_PACKAGE)
-AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [gettext domain])
-AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.17])
-IT_PROG_INTLTOOL([0.35.0])
-
-dnl Check for perceptualdiff
-AC_CHECK_PROG(HAVE_IMAGEDIFF, perceptualdiff, true, false)
-if test "x${HAVE_IMAGEDIFF}" = "xfalse"; then
- AC_MSG_WARN([*** `perceptualdiff` not found, required for UI tests])
-fi
-
-dnl Setup a few consts
-if test "x${prefix}" = "xNONE"; then
- PREFIX="${ac_default_prefix}"
-else
- PREFIX="${prefix}"
-fi
-
-dnl GConf schema installation
-AC_PATH_PROG(GCONFTOOL, gconftool-2)
-AM_GCONF_SOURCE_2
-
-AC_DEFINE_UNQUOTED(LOCALE_DIR, "${PREFIX}/${DATADIRNAME}/locale",[Locale directory])
-AC_DEFINE_UNQUOTED(DATADIR, "${PREFIX}/${DATADIRNAME}",[Data directory])
-AC_DEFINE_UNQUOTED(PREFIXDIR, "${PREFIX}",[Prefix directory])
-
-
-PWD=`pwd`
-AC_DEFINE_UNQUOTED(TESTUIDIR, "${PWD}/tests/ui", [Test UI directory])
-AC_DEFINE_UNQUOTED(TESTUNITDIR, "${PWD}/tests/unit", [Test unit directory])
-
-dnl Use strict compiler flags only on development releases
-m4_define([maintainer_flags_default],
- [m4_if(m4_eval(unity_micro % 2), [1], [yes], [no])])
-AC_ARG_ENABLE([maintainer-flags],
- [AS_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>:],[Use string compiler flags @<:@default=no@:>@])],
- [],
- [enable_maintainer_flags=maintainer_flags_default])
-MAINTAINER_CFLAGS=""
-MAINTAINER_VALAFLAGS=""
-AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"],
- [
- MAINTAINER_CFLAGS="-g -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self"
- MAINTAINER_VALAFLAGS="-g --save-temps"
- ]
-)
-AC_SUBST(MAINTAINER_CFLAGS)
-AC_SUBST(MAINTAINER_VALAFLAGS)
-
-dnl Check for module and library dependancies
-GLIB_REQUIRED=2.22
-GTK_REQUIRED=2.18
-PKG_CHECK_MODULES(BASE,
- clutter-1.0 >= 1.0
- clutter-gtk-0.10 >= 0.10
- clutk-0.3 >= 0.3.45
- dbus-glib-1
- dbusmenu-glib >= 0.3.6
- dee-1.0 >= 0.2.0
- glib-2.0 >= $GLIB_REQUIRED
- gobject-2.0 >= $GLIB_REQUIRED
- gtk+-2.0 >= $GTK_REQUIRED
- gdk-x11-2.0 >= $GTK_REQUIRED
- gio-2.0 >= $GTK_REQUIRED
- gee-1.0
- gconf-2.0
- gnome-desktop-2.0
- indicator >= 0.3.14
- libbamf >= 0.2
- libgnomeui-2.0
- pango >= 1.6.0
- unique-1.0
- unity-misc
- utouch-grail
- xcb-icccm
- x11)
-
-AC_SUBST(BASE_CFLAGS)
-AC_SUBST(BASE_LIBS)
-
-dnl testing for logging boot metrics and instrumenting
-with_testing="no"
-AC_ARG_ENABLE(testing,
- AS_HELP_STRING([--enable-testing],
- [Enables instrumenting and boot metric logging]),
- with_testing=$enableval,
- with_testing=no)
-AM_CONDITIONAL([HAVE_TESTING], [test "x$with_testing" = "xyes"])
-
-dnl local install for distcheck and stand-alone running
-with_localinstall="no"
-AC_ARG_ENABLE(localinstall,
- AS_HELP_STRING([--enable-localinstall],
- [Install all of the files locally instead of in system directories (for distcheck)]),
- with_localinstall=$enableval,
- with_localinstall=no)
-
-AM_CONDITIONAL([HAVE_LOCALINSTALL], [test "x$with_localinstall" = "xyes"])
-
-dnl Mutter support
-AC_ARG_ENABLE([mutter],
- [AS_HELP_STRING([--enable-mutter=@<:@no/yes@:>@],[Enable compiling mutter plugin.])],
- [enable_mutter=$enableval],
- [enable_mutter=yes])
-AS_IF([test "x$enable_mutter" = "xyes"],
- [
- AC_DEFINE([ENABLE_MUTTER], 1, [Enable Mutter plugin])
- PKG_CHECK_MODULES(MUTTER, mutter-plugins)
- AC_SUBST(MUTTER_CFLAGS)
- AC_SUBST(MUTTER_LIBS)
- MUTTER_PLUGIN_DIR=`$PKG_CONFIG --variable=plugindir mutter-plugins`
- AC_SUBST(MUTTER_PLUGIN_DIR)
- ]
-)
-AM_CONDITIONAL(ENABLE_MUTTER, [test "x$enable_mutter" = "xyes"])
-
-dnl Indicator support
-INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator`
-INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator`
-
-AC_SUBST(INDICATORDIR)
-AC_SUBST(INDICATORICONSDIR)
-
-AC_DEFINE_UNQUOTED(INDICATORDIR, "${INDICATORDIR}",[Indicators directory])
-AC_DEFINE_UNQUOTED(INDICATORICONSDIR, "${INDICATORICONSDIR}",[Indicator icons directory])
-
-dnl Create the Makefiles
-AC_CONFIG_FILES([
- Makefile
- unity.pc
- data/Makefile
- targets/Makefile
- targets/mutter/Makefile
- targets/unity/Makefile
- tests/Makefile
- tests/ui/Makefile
- tests/ui/data/Makefile
- tests/unit/Makefile
- tests/unit/data/Makefile
- tools/Makefile
- unity/Makefile
- unity-private/Makefile
- vapi/Makefile
- po/Makefile.in
-])
-AC_OUTPUT
-
-dnl Output the results
-AC_MSG_NOTICE([
-
- Unity $VERSION
- ----------------------
-
- Prefix : ${prefix}
-
- Localinstall : ${with_localinstall}
-
- Mutter plugin : ${enable_mutter}
-
- Extra CFlags : ${CPPFLAGS} $MAINTAINER_CFLAGS
- Extra ValaFlags: ${CPPFLAGS} $MAINTAINER_VALAFLAGS
-])
diff --git a/data/Makefile.am b/data/Makefile.am
deleted file mode 100644
index a05f9388a..000000000
--- a/data/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-# Please keep alphabetical :-)
-
-dist_default_DATA = \
- applications.png \
- bfb.png \
- dash_background.png \
- devices.png \
- favourites.png \
- files.png \
- gradient.png \
- home.png \
- honeycomb.png \
- honeycomb-mask.png \
- maximize_up.png \
- minimize_up.png \
- quicklauncher_focused_indicator.png \
- quicklauncher_running_indicator.png \
- scroller-fade.png \
- scroller-shadow.png \
- search_icon.png \
- software_centre.png \
- tight_check_4px.png \
- trash.png
-
-defaultdir = $(pkgdatadir)
-
-# Schemas
-schemadir = $(sysconfdir)/gconf/schemas
-dist_schema_DATA = unity.schemas
-
-if GCONF_SCHEMAS_INSTALL
-install-data-local:
- -GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
- $(GCONFTOOL) --makefile-install-rule $(dist_schema_DATA)
-endif
-
-if GCONF_SCHEMAS_INSTALL
-uninstall-local:
- -GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
- $(GCONFTOOL) --makefile-uninstall-rule $(dist_schema_DATA)
-endif
diff --git a/targets/Makefile.am b/targets/Makefile.am
deleted file mode 100644
index 1c17c722f..000000000
--- a/targets/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = unity mutter
diff --git a/targets/mutter/Makefile.am b/targets/mutter/Makefile.am
deleted file mode 100644
index 41ed39813..000000000
--- a/targets/mutter/Makefile.am
+++ /dev/null
@@ -1,98 +0,0 @@
-BUILT_SOURCES =
-CLEANFILES =
-EXTRA_DIST =
-
-if ENABLE_MUTTER
-
-if HAVE_TESTING
-BASE_CFLAGS+=-DTESTING
-endif
-
-if HAVE_LOCALINSTALL
-mutterlibdir = /tmp/mutter-plugin/
-else
-mutterlibdir = $(MUTTER_PLUGIN_DIR)
-endif
-
-mutterlib_LTLIBRARIES = \
- libunity-mutter.la
-
-# unity-quicklauncher static lib
-libunity_mutter_la_CPPFLAGS = \
- -I$(top_srcdir)/unity \
- -I$(top_srcdir)/unity-private \
- -I$(top_srcdir)/src \
- -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
- $(BASE_CFLAGS) \
- $(MUTTER_CFLAGS) \
- $(MAINTAINER_CFLAGS)
-
-libunity_mutter_la_VALAFLAGS = \
- -C \
- -H unity-mutter.h -d . \
- --library unity-mutter \
- --vapidir=$(top_srcdir)/vapi/ \
- --vapidir=$(top_srcdir)/src/ \
- --vapidir=$(top_srcdir)/unity \
- --vapidir=$(top_srcdir)/unity-private \
- --pkg Bamf-0.2 \
- --pkg clutter-1.0 \
- --pkg clutter-gtk-0.10 \
- --pkg clutk-0.3 \
- --pkg dbus-glib-1 \
- --pkg Dbusmenu-Glib-0.2 \
- --pkg dee-1.0 \
- --pkg gtk+-2.0 \
- --pkg gdk-x11-2.0 \
- --pkg gee-1.0 \
- --pkg indicator \
- --pkg mutter-2.28 \
- --pkg unique-1.0 \
- --pkg x11 \
- --pkg unity-const \
- --pkg unity \
- --pkg unity-private \
- --pkg gconf-2.0 \
- $(MAINTAINER_VALAFLAGS)
-
-libunity_mutter_la_LIBADD = \
- $(top_builddir)/unity/libunity.la \
- $(top_builddir)/unity-private/libunity-private.la \
- $(BASE_LIBS) \
- $(MUTTER_LIBS)
-
-libunity_mutter_la_SOURCES = \
- main.c \
- mutter-plugins.h \
- unity-mutter.h \
- $(libunity_mutter_la_VALASOURCES:.vala=.c)
-
-libunity_mutter_la_VALASOURCES = \
- expose-manager.vala \
- spaces-manager.vala \
- plugin.vala \
- maximus.vala \
- window-management.vala
-
-libunity_mutter_la_APIFILES = \
- unity-mutter.h \
- unity-mutter.vapi
-
-BUILT_SOURCES += libunity_mutter_la.vala.stamp
-EXTRA_DIST += \
- $(BUILT_SOURCES) \
- $(libunity_mutter_la_APIFILES) \
- $(libunity_mutter_la_VALASOURCES)
-
-$(BUILT_SOURCES) $(libunity_mutter_la_APIFILES): $(libunity_mutter_la_VALASOURCES)
- $(AM_V_GEN) $(VALAC) $(libunity_mutter_la_VALAFLAGS) $^
- touch libunity_mutter_la.vala.stamp
-
-CLEANFILES += \
- *.stamp \
- unity-mutter.vapi \
- $(libunity_mutter_la_VALASOURCES:.vala=.c) \
- $(libunity_mutter_la_APIFILES)
-
-else
-endif
diff --git a/targets/mutter/expose-manager.vala b/targets/mutter/expose-manager.vala
deleted file mode 100644
index d986f9426..000000000
--- a/targets/mutter/expose-manager.vala
+++ /dev/null
@@ -1,690 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
- *
- */
-using Unity;
-
-namespace Unity
-{
- public class ExposeClone : Clutter.Group
- {
- private Clutter.Clone clone;
- private Clutter.Actor darken_box;
- private Clutter.Actor original_parent;
- private bool hovered;
- private bool dragging;
- private float drag_start_x;
- private float drag_start_y;
- private bool drag_moved;
-
- public Clutter.Actor pre_drag_parent { get { return original_parent; } }
- public float pre_drag_scale_x { get; private set; }
- public float pre_drag_scale_y { get; private set; }
-
- public bool fade_on_close { get; set; }
- public bool dirty;
-
- public unowned Clutter.Actor source { get; private set; }
-
- public signal void drag_dropped (Clutter.Actor onto);
-
- public uint8 hovered_opacity { get; set; }
- public uint8 unhovered_opacity { get; set; }
-
- uint8 _darken;
- public uint8 darken {
- get { return _darken; }
- set {
- _darken = value;
- if (!hovered && darken_box is Clutter.Actor)
- darken_box.opacity = darken;
- }
- }
-
- public bool enable_dnd { get; set; }
-
- public ExposeClone (Clutter.Actor source)
- {
- darken = 0;
- hovered_opacity = 255;
- unhovered_opacity = 255;
- enable_dnd = false;
-
- this.source = source;
-
- if (source is Mutter.Window)
- clone = new Clutter.Clone ((source as Mutter.Window).get_texture ());
- else
- clone = new Clutter.Clone (source);
-
- source.destroy.connect (on_source_destroyed);
-
- add_actor (clone);
- clone.show ();
- clone.reactive = true;
- clone.set_position (0, 0);
-
- darken_box = new Clutter.Rectangle.with_color ({0, 0, 0, 255});
- add_actor (darken_box);
- darken_box.raise_top ();
-
- darken_box.set_position (0, 0);
- darken_box.set_size (source.width, source.height);
-
- darken_box.opacity = darken;
- }
-
- construct
- {
- this.enter_event.connect (this.on_mouse_enter);
- this.leave_event.connect (this.on_mouse_leave);
- this.button_press_event.connect (this.on_button_press);
- }
-
- private void on_source_destroyed ()
- {
- destroy ();
- }
-
- private bool on_button_press (Clutter.Event evnt)
- {
- if (!enable_dnd)
- return false;
-
- start_drag (evnt);
- return true;
- }
-
- private void start_drag (Clutter.Event evnt)
- {
- dragging = true;
- this.get_stage ().captured_event.connect (on_stage_captured_event);
- original_parent = get_parent ();
-
- float x, y;
- double scale_x, scale_y;
- evnt.get_coords (out x, out y);
- get_scale (out scale_x, out scale_y);
-
- drag_start_x = x;
- drag_start_y = y;
-
- pre_drag_scale_x = (float) scale_x;
- pre_drag_scale_y = (float) scale_y;
-
- drag_moved = false;
- }
-
- private void end_drag (int x, int y)
- {
- dragging = false;
- clone.reactive = true;
- reactive = true;
- this.get_stage ().captured_event.disconnect (on_stage_captured_event);
-
- if (!drag_moved)
- return;
-
- hide ();
- Clutter.Actor target = (get_stage () as Clutter.Stage).get_actor_at_pos (Clutter.PickMode.REACTIVE, x, y);
- show ();
-
- drag_dropped (target);
-
- on_mouse_leave (null);
- }
-
- private bool on_stage_captured_event (Clutter.Event event)
- {
- float x, y;
- event.get_coords (out x, out y);
-
- if (!dragging)
- {
- end_drag ((int) x, (int) y);
- return false;
- }
-
- if (event.type == Clutter.EventType.MOTION)
- {
- if (Math.fabs (event.motion.x - drag_start_x) > 30 || Math.fabs (event.motion.y - drag_start_y) > 30 || drag_moved)
- {
- if (!drag_moved)
- {
- float width, height;
-
- get_transformed_size (out width, out height);
-
- reparent (get_stage ());
-
- this.set_scale (width / this.width, height / this.height);
-
- raise_top ();
- drag_moved = true;
- reactive = false;
- clone.reactive = false;
- }
- set_position (event.motion.x - width / 2, event.motion.y - height / 2);
- }
- }
- else if (event.type == Clutter.EventType.BUTTON_RELEASE)
- {
- end_drag ((int) x, (int) y);
- return drag_moved;
- }
-
- return false;
- }
-
- private bool on_mouse_enter (Clutter.Event evnt)
- {
- hovered = true;
- opacity = hovered_opacity;
- darken_box.opacity = 0;
- return false;
- }
-
- private bool on_mouse_leave (Clutter.Event? evnt)
- {
- hovered = false;
- opacity = unhovered_opacity;
- darken_box.opacity = darken;
- return false;
- }
-
- public void restore_window_position (int active_workspace)
- {
- set_anchor_point_from_gravity (Clutter.Gravity.NORTH_WEST);
- Clutter.Actor window = source;
-
- uint8 opacity = 0;
- if (!fade_on_close || (window is Mutter.Window && (window as Mutter.Window).showing_on_its_workspace () &&
- (window as Mutter.Window).get_workspace () == active_workspace))
- opacity = 255;
-
-
- set ("scale-gravity", Clutter.Gravity.CENTER);
- Clutter.Animation anim = animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250,
- "scale-x", 1f,
- "scale-y", 1f,
- "opacity", opacity,
- "x", window.x,
- "y", window.y);
-
- window.opacity = 0;
-
- anim.completed.connect (() => {
- destroy ();
- window.opacity = 255;
- });
- }
- }
-
- public class ExposeManager : Object
- {
- public List<ExposeClone> exposed_windows;
-
- private Clutter.Group expose_group;
- private Plugin owner;
- private Clutter.Stage stage;
- private Launcher.Launcher launcher;
-
- public bool expose_showing { get; private set; }
- public bool coverflow { get; set; }
-
- public int left_buffer { get; set; }
- public int right_buffer { get; set; }
- public int top_buffer { get; set; }
- public int bottom_buffer { get; set; }
-
- public uint8 hovered_opacity { get; set; }
- public uint8 unhovered_opacity { get; set; }
-
- public uint8 darken { get; set; }
-
- private uint coverflow_index;
-
- private ExposeClone? last_selected_clone = null;
-
-
- public ExposeManager (Plugin owner, Launcher.Launcher launcher)
- {
- this.launcher = launcher;
- this.owner = owner;
- this.exposed_windows = new List<ExposeClone> ();
- this.stage = (Clutter.Stage)owner.get_stage ();
-
- hovered_opacity = 255;
- unhovered_opacity = 255;
- darken = 0;
- }
-
- construct
- {
- }
-
- public void start_expose (SList<Clutter.Actor> windows)
- {
- exposed_windows = new List<ExposeClone> ();
-
- if (!expose_showing)
- {
- if (expose_group != null)
- expose_group.destroy ();
- expose_group = new Clutter.Group ();
-
- Clutter.Actor window_group = owner.plugin.get_window_group ();
-
- (window_group as Clutter.Container).add_actor (expose_group);
- expose_group.raise_top ();
- expose_group.show ();
- }
-
- var children = expose_group.get_children ();
- foreach (Clutter.Actor c in children)
- {
- ExposeClone _clone = c as ExposeClone;
- _clone.dirty = true;
- }
-
- foreach (Clutter.Actor actor in windows)
- {
- if (!(actor is Mutter.Window) ||
- ((actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.NORMAL &&
- (actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.DIALOG &&
- (actor as Mutter.Window).get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG))
- continue;
-
- ExposeClone? clone = null;
- bool was_existing = false;
-
- foreach (Clutter.Actor c in children)
- {
- ExposeClone _clone = c as ExposeClone;
- if (_clone.source == actor)
- {
- clone = _clone;
- was_existing = true;
- _clone.dirty = false;
- break;
- }
- }
-
- if (clone == null)
- clone = new ExposeClone (actor);
-
- clone.fade_on_close = true;
- if (!was_existing)
- {
- clone.set_position (actor.x, actor.y);
- clone.set_size (actor.width, actor.height);
- }
- exposed_windows.append (clone);
- clone.reactive = true;
-
- expose_group.add_actor (clone);
-
- clone.destroy.connect (on_clone_destroyed);
-
- clone.hovered_opacity = hovered_opacity;
- clone.unhovered_opacity = unhovered_opacity;
- if (!was_existing)
- clone.opacity = expose_showing ? 0 : unhovered_opacity;
- clone.darken = darken;
- }
-
- foreach (Clutter.Actor c in children)
- {
- ExposeClone _clone = c as ExposeClone;
-
- if (_clone.dirty)
- {
- var anim = _clone.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250,
- "scale-x", 0.0f,
- "scale-y", 0.0f,
- "opacity", 0);
- anim.completed.connect (() => {_clone.destroy ();});
- }
- }
-
- unowned GLib.List<Mutter.Window> mutter_windows = owner.plugin.get_windows ();
- foreach (Mutter.Window w in mutter_windows)
- {
- if (w.get_window_type () == Mutter.MetaCompWindowType.DESKTOP)
- continue;
-
- (w as Clutter.Actor).reactive = false;
- (w as Clutter.Actor).opacity = 0;
- }
- coverflow_index = 0;
-
- if (coverflow)
- position_windows_coverflow (exposed_windows, exposed_windows.nth_data (coverflow_index));
- else
- position_windows_on_grid (exposed_windows, top_buffer, left_buffer, right_buffer, bottom_buffer);
-
- if (!expose_showing)
- {
- expose_showing = true;
-
- stage.captured_event.connect (on_stage_captured_event);
- owner.add_fullscreen_request (this);
- }
- }
-
- private void on_clone_destroyed ()
- {
- if (expose_group.get_children ().length () <= 1)
- end_expose ();
- }
-
- public void end_expose ()
- {
- if (!expose_showing)
- return;
-
- unowned GLib.List<Mutter.Window> mutter_windows = owner.plugin.get_windows ();
- foreach (Mutter.Window window in mutter_windows)
- {
- bool exposed = false;
- foreach (ExposeClone clone in exposed_windows)
- {
- if (clone.source == window)
- {
- exposed = true;
- break;
- }
- }
-
- if (!exposed)
- window.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250, "opacity", 255);
- window.reactive = true;
- }
-
- foreach (ExposeClone actor in exposed_windows)
- actor.restore_window_position (Mutter.MetaScreen.get_active_workspace_index (owner.plugin.get_screen ()));
-
- if (this.last_selected_clone is ExposeClone &&
- this.last_selected_clone.source is Mutter.Window)
- {
- ExposeClone clone = this.last_selected_clone;
- uint32 time_;
-
- clone.raise_top ();
- unowned Mutter.MetaWindow meta = (clone.source as Mutter.Window).get_meta_window ();
-
- time_ = Mutter.MetaDisplay.get_current_time (Mutter.MetaWindow.get_display (meta));
- Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace (meta), time_);
- Mutter.MetaWindow.activate (meta, time_);
-
- this.last_selected_clone = null;
- }
-
- expose_showing = false;
- owner.remove_fullscreen_request (this);
- stage.captured_event.disconnect (on_stage_captured_event);
- }
-
- void position_windows_coverflow (List<Clutter.Actor> windows, Clutter.Actor active)
- {
- Clutter.Actor last = null;
-
- int middle_size = (int) (owner.primary_monitor.width * 0.8f);
- int width = (int) owner.primary_monitor.width - left_buffer - right_buffer;
- int slice_width = width / 10;
-
- int middle_y = (int) owner.primary_monitor.height / 2;
- int middle_x = left_buffer + width / 2;
-
- int middle_index = windows.index (active);
-
- float scale = float.min (1f, (owner.primary_monitor.height / 2) / float.max (active.height, active.width));
- scale = 1f;
-
- active.set_anchor_point_from_gravity (Clutter.Gravity.CENTER);
- active.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250,
- "x", (float) middle_x,
- "y", (float) middle_y,
- "depth", owner.primary_monitor.width * -0.7,
- "scale-x", scale,
- "scale-y", scale,
- "rotation-angle-y", 0f);
- active.raise_top ();
-
- last = active;
- /* left side */
- int current_x = middle_x - middle_size;
- for (int i = middle_index - 1; i >= 0; i--)
- {
- Clutter.Actor actor = windows.nth_data (i);
- actor.set_anchor_point_from_gravity (Clutter.Gravity.CENTER);
- actor.lower (last);
-
- scale = float.min (1f, (owner.primary_monitor.height / 2) / float.max (actor.height, actor.width));
- scale = 1f;
-
- actor.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250,
- "x", (float) current_x,
- "y", (float) middle_y,
- "depth", owner.primary_monitor.width * -0.7,
- "scale-x", scale,
- "scale-y", scale,
- "rotation-angle-y", 60f);
- current_x -= slice_width;
- last = actor;
- }
-
- last = active;
- /* right side */
- current_x = middle_x + middle_size;
- for (int i = middle_index + 1; i < windows.length (); i++)
- {
- Clutter.Actor actor = windows.nth_data (i);
- actor.set_anchor_point_from_gravity (Clutter.Gravity.CENTER);
- actor.lower (last);
-
- scale = float.min (1f, (owner.primary_monitor.height / 2) / float.max (actor.height, actor.width));
- scale = 1f;
-
- actor.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250,
- "x", (float) current_x,
- "y", (float) middle_y,
- "depth", owner.primary_monitor.width * -0.7,
- "scale-x", scale,
- "scale-y", scale,
- "rotation-angle-y", -60f);
- current_x += slice_width;
- last = actor;
- }
- }
-
- int direct_comparison (void* a, void* b)
- {
- if (a > b)
- return 1;
- else if (a < b)
- return -1;
- return 0;
- }
-
- public void position_windows_on_grid (List<Clutter.Actor> _windows, int top_buffer, int left_buffer, int right_buffer, int bottom_buffer)
- {
- if (_windows.length () < 1)
- {
- warning ("There are no windows to position on grid");
- return;
- }
-
- List<Clutter.Actor> windows = _windows.copy ();
- windows.sort ((CompareFunc) direct_comparison);
-
- int count = (int) windows.length ();
- int cols = (int) Math.ceil (Math.sqrt (count));
- if (cols < 1) cols = 1;
- int rows = 1;
-
- while (cols * rows < count)
- rows++;
-
- int boxWidth = (int) ((owner.primary_monitor.width - left_buffer - right_buffer) / cols);
- int boxHeight = (int) ((owner.primary_monitor.height - top_buffer - bottom_buffer) / rows);
-
- for (int row = 0; row < rows; row++)
- {
- if (row == rows - 1)
- {
- /* Last row, time to perform centering as needed */
- boxWidth = (int) ((owner.primary_monitor.width - left_buffer - right_buffer) / windows.length ());
- }
-
- for (int col = 0; col < cols; col++)
- {
- if (windows.length () == 0)
- return;
-
- int centerX = (boxWidth / 2 + boxWidth * col + left_buffer);
- int centerY = (boxHeight / 2 + boxHeight * row + top_buffer);
-
- Clutter.Actor window = null;
- // greedy layout
- foreach (Clutter.Actor actor in windows)
- {
- if (window == null)
- {
- window = actor;
- continue;
- }
-
- double window_distance = Math.sqrt (
- Math.fabs (centerX - (window.x + window.width / 2)) +
- Math.fabs (centerY - (window.y + window.height / 2))
- );
- double actor_distance = Math.sqrt (
- Math.fabs (centerX - (actor.x + actor.width / 2)) +
- Math.fabs (centerY - (actor.y + actor.height / 2))
- );
-
- if (actor_distance < window_distance)
- window = actor;
- }
-
- windows.remove (window);
-
- int windowX = centerX - (int) window.width / 2;
- int windowY = centerY - (int) window.height / 2;
-
- float scale = float.min (float.min (1, (boxWidth - 20) / window.width), float.min (1, (boxHeight - 20) / window.height));
-
- window.set ("scale-gravity", Clutter.Gravity.CENTER);
- window.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250,
- "x", (float) windowX,
- "y", (float) windowY,
- "scale-x", scale,
- "scale-y", scale,
- "opacity", unhovered_opacity);
- }
- }
- }
-
-
- void handle_event_coverflow (Clutter.Event event)
- {
- if (event.type == Clutter.EventType.KEY_RELEASE)
- {
- uint16 keycode = event.get_key_code ();
-
- if (keycode == 113 && coverflow_index > 0)
- {
- coverflow_index--;
- }
- else if (keycode == 114 && coverflow_index < exposed_windows.length () - 1)
- {
- coverflow_index++;
- }
- else if (keycode == 36)
- {
- ExposeClone clone = exposed_windows.nth_data (coverflow_index);
- clone.raise_top ();
- unowned Mutter.MetaWindow meta = (clone.source as Mutter.Window).get_meta_window ();
- Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace (meta), event.get_time ());
- Mutter.MetaWindow.activate (meta, event.get_time ());
- this.end_expose ();
- }
-
- position_windows_coverflow (exposed_windows, exposed_windows.nth_data (coverflow_index));
- }
- }
-
- void handle_event_expose (Clutter.Event event, Clutter.Actor actor)
- {
- if (event.type == Clutter.EventType.BUTTON_RELEASE && event.get_button () == 1)
- {
- while (actor.get_parent () != null && !(actor is ExposeClone))
- actor = actor.get_parent ();
-
- ExposeClone clone = actor as ExposeClone;
- if (clone != null && clone.source is Mutter.Window)
- {
- clone.raise_top ();
- unowned Mutter.MetaWindow meta = (clone.source as Mutter.Window).get_meta_window ();
- Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace (meta), event.get_time ());
- Mutter.MetaWindow.activate (meta, event.get_time ());
- }
- this.stage.captured_event.disconnect (on_stage_captured_event);
- this.end_expose ();
- }
- }
-
- void pick_window (Clutter.Event event, Clutter.Actor actor)
- {
- while (actor.get_parent () != null && !(actor is ExposeClone))
- actor = actor.get_parent ();
-
- ExposeClone clone = actor as ExposeClone;
- if (clone != null && clone.source is Mutter.Window)
- {
- this.last_selected_clone= clone;
- }
- else
- {
- this.last_selected_clone = null;
- }
- }
-
- bool on_stage_captured_event (Clutter.Event event)
- {
- if (event.type == Clutter.EventType.ENTER || event.type == Clutter.EventType.LEAVE)
- return false;
-
-
- float x, y;
- event.get_coords (out x, out y);
-
- unowned Clutter.Actor actor = this.stage.get_actor_at_pos (Clutter.PickMode.REACTIVE, (int) x, (int) y);
-
- if (event.type == Clutter.EventType.BUTTON_PRESS)
- pick_window (event, actor);
-
- if (coverflow)
- handle_event_coverflow (event);
- else
- handle_event_expose (event, actor);
-
- return true;
- }
- }
-}
diff --git a/targets/mutter/main.c b/targets/mutter/main.c
deleted file mode 100644
index 9dd0539cd..000000000
--- a/targets/mutter/main.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
- *
- */
-
-#include <mutter-plugin.h>
-#include <mutter-window.h>
-#include <glib.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <dbus/dbus-glib.h>
-
-#include <GL/gl.h>
-#include <clutter/x11/clutter-x11.h>
-
-#include "unity-mutter.h"
-
-#define UNITY_TYPE_MUTTER (unity_mutter_get_type ())
-
-#define UNITY_MUTTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
- UNITY_TYPE_MUTTER, UnityMutter))
-
-#define UNITY_MUTTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
- UNITY_TYPE_MUTTER, UnityMutterClass))
-
-#define UNITY_IS_MUTTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
- UNITY_TYPE_MUTTER))
-
-#define UNITY_IS_MUTTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
- UNITY_TYPE_MUTTER))
-
-#define UNITY_MUTTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
- UNITY_TYPE_MUTTER, UnityMutterClass))
-
-typedef struct _UnityMutter UnityMutter;
-typedef struct _UnityMutterClass UnityMutterClass;
-
-struct _UnityMutter
-{
- MutterPlugin parent;
-
- UnityPlugin *plugin;
-};
-
-struct _UnityMutterClass
-{
- MutterPluginClass parent_class;
-};
-
-/* .c */
-MUTTER_PLUGIN_DECLARE(UnityMutter, unity_mutter);
-
-static void unity_mutter_constructed (GObject *object);
-
-static void change_user_session (const char *session_name);
-static gboolean session_logout_success (void);
-static gboolean rendering_available (void);
-
-static void unity_mutter_minimize (MutterPlugin *self,
- MutterWindow *window);
-static void unity_mutter_maximize (MutterPlugin *self,
- MutterWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-static void unity_mutter_unmaximize (MutterPlugin *self,
- MutterWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
-static void unity_mutter_map (MutterPlugin *self,
- MutterWindow *window);
-static void unity_mutter_destroy (MutterPlugin *self,
- MutterWindow *window);
-static void unity_mutter_switch_workspace (MutterPlugin *self,
- gint from,
- gint to,
- MetaMotionDirection direction);
-static void unity_mutter_kill_window_effects (MutterPlugin *self,
- MutterWindow *window);
-
-static void unity_mutter_kill_switch_workspace (MutterPlugin *self);
-
-static gboolean unity_mutter_xevent_filter (MutterPlugin *self,
- XEvent *event);
-
-static void on_restore_input_region (UnityPlugin *plugin, gboolean fullscreen);
-
-static const MutterPluginInfo * unity_mutter_plugin_info (MutterPlugin *self);
-
-static void
-unity_mutter_class_init (UnityMutterClass *klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS (klass);
- MutterPluginClass *mut_class = MUTTER_PLUGIN_CLASS (klass);
-
- obj_class->constructed = unity_mutter_constructed;
-
- mut_class->minimize = unity_mutter_minimize;
- mut_class->maximize = unity_mutter_maximize;
- mut_class->unmaximize = unity_mutter_unmaximize;
- mut_class->map = unity_mutter_map;
- mut_class->destroy = unity_mutter_destroy;
- mut_class->switch_workspace = unity_mutter_switch_workspace;
- mut_class->kill_window_effects = unity_mutter_kill_window_effects;
- mut_class->kill_switch_workspace = unity_mutter_kill_switch_workspace;
- mut_class->xevent_filter = unity_mutter_xevent_filter;
- mut_class->plugin_info = unity_mutter_plugin_info;
-}
-
-static void
-unity_mutter_init (UnityMutter *self)
-{
- ;
-}
-
-static void
-unity_mutter_constructed (GObject *object)
-{
- UnityMutter *self = UNITY_MUTTER (object);
-
- if (!rendering_available ())
- {
- g_warning ("No rendering avaible for unity, prompting for changing session");
- change_user_session ("gnome");
- // if we can't logout, fallback to trying to run unity...
- if (session_logout_success ())
- exit (0); // 0 or will be respawn as required_component
- }
-
- self->plugin = unity_plugin_new ();
- g_signal_connect (self->plugin, "restore-input-region",
- G_CALLBACK (on_restore_input_region), self);
-
- unity_plugin_set_plugin (self->plugin, MUTTER_PLUGIN (self));
-}
-
-static void
-change_user_session (const char *session_name)
-{
-
- GKeyFile *key_file;
- GError *error;
- char *filename;
- gsize length;
- gchar *contents;
-
- filename = g_build_filename (g_get_home_dir(), ".dmrc", NULL);
- error = NULL;
-
- key_file = g_key_file_new ();
- g_key_file_load_from_file (key_file, filename,
- G_KEY_FILE_KEEP_COMMENTS |
- G_KEY_FILE_KEEP_TRANSLATIONS,
- NULL);
- g_key_file_set_string (key_file, "Desktop", "Session",
- session_name);
-
- contents = g_key_file_to_data (key_file, &length, &error);
- if (contents == NULL)
- {
- g_debug ("Can't create content for .dmrc file: %s", error->message);
- g_key_file_free (key_file);
- g_free (filename);
- return;
- }
-
- if (!g_file_set_contents (filename, contents, length, &error))
- {
- g_debug ("Can't update .dmrc file: %s", error->message);
- g_error_free (error);
- }
-
- g_free (contents);
- g_key_file_free (key_file);
- g_free (filename);
-
-}
-
-static gboolean
-session_logout_success (void)
-{
- GtkWidget* dialog_warn_logout;
- gint response;
-
- dialog_warn_logout = gtk_message_dialog_new (NULL,
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_OK,
- _("No required driver detected for unity."),
- NULL);
- gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG(dialog_warn_logout),
- _("You will need to choose the Ubuntu Desktop session once you select your user name."));
- response = gtk_dialog_run (GTK_DIALOG(dialog_warn_logout));
- gtk_widget_destroy (dialog_warn_logout);
-
- if (response == GTK_RESPONSE_OK || response == GTK_RESPONSE_DELETE_EVENT)
- {
- DBusGConnection * sbus;
- DBusGProxy * sm_proxy;
- GError * error = NULL;
- gboolean res = FALSE;
-
- sbus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
- if (sbus == NULL)
- {
- g_warning ("Unable to get DBus session bus.");
- return FALSE;
- }
- sm_proxy = dbus_g_proxy_new_for_name_owner (sbus,
- "org.gnome.SessionManager",
- "/org/gnome/SessionManager",
- "org.gnome.SessionManager",
- &error);
- if (sm_proxy == NULL)
- {
- g_warning ("Unable to get DBus proxy to SessionManager interface: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
- g_clear_error (&error);
-
- res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error,
- G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID);
- if (!res)
- {
- if (error != NULL)
- g_warning ("SessionManager action failed: %s", error->message);
- else
- g_warning ("SessionManager action failed: unknown error");
-
- g_object_unref(sm_proxy);
- g_error_free(error);
- return FALSE;
- }
-
- g_object_unref(sm_proxy);
- g_warning ("logout");
- return TRUE;
- }
- g_warning ("Logout denied, trying to start unity");
- return FALSE;
-}
-
-/* take an optimistic approach: only return FALSE when we are sure it's FALSE */
-static gboolean
-rendering_available (void)
-{
- gchar *renderer = NULL;
- const char *glRenderer = (const char *) glGetString(GL_RENDERER);
- renderer = g_ascii_strdown (glRenderer, -1);
- g_debug ("OpenGL renderer string: %s\n", glRenderer);
-
- if (renderer && (strstr (renderer, "software") != NULL))
- return FALSE;
-
- return TRUE;
-}
-
-static void
-on_restore_input_region (UnityPlugin *plugin, gboolean fullscreen)
-{
- MutterPlugin *self;
- MetaScreen *screen;
- MetaDisplay *display;
- Display *xdisplay;
- XRectangle *rects;
- gint width=0, height=0;
- XserverRegion region;
-
- g_return_if_fail (UNITY_IS_PLUGIN (plugin));
-
- self = unity_plugin_get_plugin (plugin);
-
- screen = mutter_plugin_get_screen (self);
- display = meta_screen_get_display (screen);
- xdisplay = meta_display_get_xdisplay (display);
-
- mutter_plugin_query_screen_size (self, &width, &height);
-
- if (fullscreen)
- {
- rects = g_new (XRectangle, 1);
-
- /* Whole Screen */
- rects[0].x = 0;
- rects[0].y = 0;
- rects[0].width = width;
- rects[0].height = height;
-
- region = XFixesCreateRegion (xdisplay, rects, 1);
- mutter_plugin_set_stage_input_region (self, region);
- }
- else
- {
- rects = g_new (XRectangle, 2);
-
- /* Panel first */
- rects[0].x = plugin->primary_monitor.x;
- rects[0].y = plugin->primary_monitor.y;
- rects[0].width = plugin->primary_monitor.width;
- rects[0].height = unity_plugin_get_panel_height (plugin);
-
- /* Launcher */
- rects[1].x = plugin->primary_monitor.y;
- rects[1].y = rects[0].height;
- rects[1].width = unity_plugin_get_launcher_width (plugin) + 1;
- rects[1].height = plugin->primary_monitor.height - rects[0].height;
-
- /* Update region */
- region = XFixesCreateRegion (xdisplay, rects, 2);
- mutter_plugin_set_stage_input_region (self, region);
- }
-
- g_free (rects);
- XFixesDestroyRegion (xdisplay, region);
-}
-
-static void
-unity_mutter_minimize (MutterPlugin *self,
- MutterWindow *window)
-{
- unity_plugin_minimize (UNITY_MUTTER (self)->plugin, window);
-}
-
-static void
-unity_mutter_maximize (MutterPlugin *self,
- MutterWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- unity_plugin_maximize (UNITY_MUTTER(self)->plugin, window, x, y, width, height);
-}
-
-static void
-unity_mutter_unmaximize (MutterPlugin *self,
- MutterWindow *window,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- unity_plugin_unmaximize (UNITY_MUTTER(self)->plugin, window, x, y, width, height);
-}
-
-static void
-unity_mutter_map (MutterPlugin *self,
- MutterWindow *window)
-{
- unity_plugin_map (UNITY_MUTTER(self)->plugin, window);
-}
-
-static void
-unity_mutter_destroy (MutterPlugin *self,
- MutterWindow *window)
-{
- unity_plugin_destroy (UNITY_MUTTER(self)->plugin, window);
-}
-
-static void
-unity_mutter_switch_workspace (MutterPlugin *self,
- gint from,
- gint to,
- MetaMotionDirection direction)
-{
- unity_plugin_switch_workspace (UNITY_MUTTER(self)->plugin, from, to, direction);
-}
-
-static void
-unity_mutter_kill_window_effects (MutterPlugin *self,
- MutterWindow *window)
-{
- unity_plugin_on_kill_window_effects (UNITY_MUTTER (self)->plugin, window);
-}
-
-static void
-unity_mutter_kill_switch_workspace (MutterPlugin *self)
-{
- unity_plugin_on_kill_switch_workspace (UNITY_MUTTER (self)->plugin);
-}
-
-static gboolean
-unity_mutter_xevent_filter (MutterPlugin *self,
- XEvent *event)
-{
- return clutter_x11_handle_event (event) != CLUTTER_X11_FILTER_CONTINUE;
-}
-
-static const MutterPluginInfo *
-unity_mutter_plugin_info (MutterPlugin *self)
-{
- static const MutterPluginInfo info = {
- .name = "Unity",
- .version = "0.1.2",
- .author = "Various Artists",
- .license = "GPLv3",
- .description = "Copyright (C) Canonical Ltd 2009"
- };
-
- return &info;
-}
-
-#if 0
-#include "unity-mutter.h"
-
-G_MODULE_EXPORT MutterPluginVersion mutter_plugin_version =
- {
- MUTTER_MAJOR_VERSION,
- MUTTER_MINOR_VERSION,
- MUTTER_MICRO_VERSION,
- MUTTER_PLUGIN_API_VERSION
- };
-
-G_MODULE_EXPORT GType
-mutter_plugin_register_type (GTypeModule *type_module)
-{
- return unity_plugin_get_type ();
-}
-#endif
diff --git a/targets/mutter/maximus.vala b/targets/mutter/maximus.vala
deleted file mode 100644
index 8d36bc92e..000000000
--- a/targets/mutter/maximus.vala
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Jason Smith <jason.smith@canonical.com>
- *
- */
-
-namespace Unity
-{
- public class Maximus : Object
- {
- public static string user_unmaximize_hint = "maximus-user-unmaximize";
-
- static string[] default_exclude_classes =
- {
- "Apport-gtk",
- "Bluetooth-properties",
- "Bluetooth-wizard",
- "Download", /* Firefox Download Window */
- "Ekiga",
- "Extension", /* Firefox Add-Ons/Extension Window */
- "Gimp",
- "Global", /* Firefox Error Console Window */
- "Gnome-nettool",
- "Kiten",
- "Kmplot",
- "Nm-editor",
- "Pidgin",
- "Polkit-gnome-authorization",
- "Update-manager",
- "Skype",
- "Toplevel", /* Firefox "Clear Private Data" Window */
- "Transmission"
- };
-
- public Maximus ()
- {
- }
-
- construct
- {
- }
-
- bool window_is_excluded (Mutter.Window window)
- {
- Mutter.MetaCompWindowType type = window.get_window_type ();
-
- if (type != Mutter.MetaCompWindowType.NORMAL)
- return true;
-
- unowned Mutter.MetaWindow meta = window.get_meta_window ();
-
- if (Mutter.MetaWindow.is_maximized (meta) ||
- !Mutter.MetaWindow.allows_resize (meta))
- return true;
-
- unowned string res_class = Mutter.MetaWindow.get_wm_class (meta);
- foreach (string s in default_exclude_classes)
- if (res_class.contains (s))
- return true;
-
- void *hint = window.get_data (user_unmaximize_hint);
- if (hint != null)
- return true;
-
- {
- Clutter.Actor stage = Clutter.Stage.get_default ();
-
- if (window.width < stage.width * 0.6 || window.width > stage.width ||
- window.height < stage.height * 0.6 || window.height > stage.height ||
- window.width / window.height < 0.6 ||
- window.width / window.height > 2.0)
- {
- return true;
- }
-
- }
-
- return false;
- }
-
- public bool process_window (Mutter.Window window)
- {
- if (window_is_excluded (window))
- return true;
-
- Mutter.MetaWindow.maximize (window.get_meta_window (), Mutter.MetaMaximizeFlags.HORIZONTAL | Mutter.MetaMaximizeFlags.VERTICAL);
-
- return true;
- }
- }
-}
diff --git a/targets/mutter/mutter-plugins.h b/targets/mutter/mutter-plugins.h
deleted file mode 100644
index ced5fdf90..000000000
--- a/targets/mutter/mutter-plugins.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef MUTTER_PLUGINS
-#define MUTTER_PLUGINS
-
-#include <boxes.h>
-#include <common.h>
-#include <compositor.h>
-#include <compositor-mutter.h>
-#include <display.h>
-#include <errors.h>
-#include <gradient.h>
-#include <errors.h>
-#include <gradient.h>
-#include <group.h>
-#include <keybindings.h>
-#include <main.h>
-#include <mutter-plugin.h>
-#include <mutter-window.h>
-#include <prefs.h>
-#include <screen.h>
-#include <theme.h>
-#include <theme-parser.h>
-#include <types.h>
-#include <util.h>
-#include <window.h>
-#include <workspace.h>
-
-/* Stupid MUTTER_TYPE_WINDOW fix...who did the mutter GObject stuff? */
-#define MUTTER_TYPE_WINDOW MUTTER_TYPE_COMP_WINDOW
-
-#endif
diff --git a/targets/mutter/plugin.vala b/targets/mutter/plugin.vala
deleted file mode 100644
index 3609f3e77..000000000
--- a/targets/mutter/plugin.vala
+++ /dev/null
@@ -1,1436 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
- *
- */
-
-using GConf;
-using Unity;
-using Unity.Testing;
-
-static string? boot_logging_filename = null;
-
-namespace Unity
-{
- public class DragDest: Gtk.Window
- {
- public DragDest ()
- {
- Object (type:Gtk.WindowType.TOPLEVEL,
- type_hint:Gdk.WindowTypeHint.DOCK,
- opacity:0.0);
- }
-
- construct
- {
- this.set_accept_focus (false);
- }
- }
-
- public enum InputState
- {
- NONE,
- FULLSCREEN,
- UNITY,
- ZERO,
- }
-
- /*
- public class ActorBlur : Ctk.Bin
- {
- private Clutter.Clone clone;
- //private Ctk.EffectBlur blur;
-
- public ActorBlur (Clutter.Actor actor)
- {
- clone = new Clutter.Clone (actor);
-
- add_actor (clone);
- clone.show ();
-
- clone.set_position (0, 0);
- //blur = new Ctk.EffectBlur ();
- //blur.set_factor (9f);
- //add_effect (blur);
- }
-
- construct
- {
-
- }
- }
-
- */
- public class Plugin : Object, Shell
- {
- /* Signals */
- public signal void window_minimized (Plugin plugin, Mutter.Window window);
- public signal void window_maximized (Plugin plugin,
- Mutter.Window window,
- int x,
- int y,
- int width,
- int height);
- public signal void window_unmaximized (Plugin plugin,
- Mutter.Window window,
- int x,
- int y,
- int width,
- int height);
- public signal void window_mapped (Plugin plugin, Mutter.Window window);
- public signal void window_destroyed (Plugin plugin, Mutter.Window window);
- public signal void kill_window_effects (Plugin plugin, Mutter.Window window);
- public signal void kill_switch_workspace (Plugin plugin);
-
- public signal void workspace_switch_event (Plugin plugin,
- int from,
- int to,
- int direction);
-
- public signal void restore_input_region (bool fullscreen);
-
- /* Properties */
- private Mutter.Plugin? _plugin;
- public Mutter.Plugin? plugin {
- get { return _plugin; }
- set { _plugin = value; Idle.add (real_construct); }
- }
- private bool _super_key_enable=true;
- public bool super_key_enable {
- get { return _super_key_enable; }
- set { _super_key_enable = value; }
- }
-
- public ExposeManager expose_manager { get; private set; }
-
- public bool menus_swallow_events { get { return false; } }
-
- private bool _super_key_active = false;
- public bool super_key_active {
- get { return _super_key_active; }
- set { _super_key_active = value; }
- }
- public bool is_starting {get; set;}
-
- public bool expose_showing { get { return expose_manager.expose_showing; } }
-
- private static const int PANEL_HEIGHT = 24;
- private static const int QUICKLAUNCHER_WIDTH = 58;
- private static const string UNDECORATED_HINT = "UNDECORATED_HINT";
-
- public Gee.ArrayList<Background> backgrounds;
- public Gdk.Rectangle primary_monitor;
-
- private Clutter.Stage stage;
- private Application app;
- private WindowManagement wm;
- private Maximus maximus;
-
- /* Unity Components */
- private SpacesManager spaces_manager;
- private Launcher.Launcher launcher;
- private Places.Controller places_controller;
- private Places.View places;
- private Panel.View panel;
- private Clutter.Rectangle dark_box;
- private unowned Mutter.MetaWindow? focus_window = null;
- private unowned Mutter.MetaDisplay? display = null;
-
- private DragDest drag_dest;
- private bool places_showing;
- private bool _fullscreen_obstruction;
- private InputState last_input_state = InputState.NONE;
-
- private Gee.ArrayList<Object> fullscreen_requests;
-
- private bool fullscreen_obstruction
- {
- get {
- return _fullscreen_obstruction;
- }
- set {
- _fullscreen_obstruction = value;
- ensure_input_region ();
- }
- }
-
- private bool grab_enabled = false;
- private DBus.Connection screensaver_conn;
- private dynamic DBus.Object screensaver;
-
- public Gesture.Dispatcher gesture_dispatcher;
- private Gesture.Type active_gesture_type = Gesture.Type.NONE;
-
- /* Pinch info */
- /* private float start_pinch_radius = 0.0f; */
- private unowned Mutter.Window? resize_window = null;
- /*private float resize_last_x1 = 0.0f;
- private float resize_last_y1 = 0.0f;
- private float resize_last_x2 = 0.0f;
- private float resize_last_y2 = 0.0f;*/
-
- /* Pan info */
- private unowned Mutter.Window? start_pan_window = null;
- private unowned Clutter.Rectangle? start_frame_rect = null;
- private float last_pan_x_root = 0.0f;
- private float last_pan_maximised_x_root = 0.0f;
- private enum MaximizeType {
- NONE,
- FULL,
- LEFT,
- RIGHT
- }
- private MaximizeType maximize_type = MaximizeType.NONE;
-
- private enum ExposeType {
- NONE,
- APPLICATION,
- WINDOWS,
- WORKSPACE
- }
- private ExposeType expose_type = ExposeType.NONE;
- private unowned Mutter.Window? start_pinch_window = null;
-
- /* const */
- private const string GCONF_DIR = "/desktop/unity/launcher";
- private const string GCONF_SUPER_KEY_ENABLE_KEY = "super_key_enable";
-
- construct
- {
- is_starting = true;
- fullscreen_requests = new Gee.ArrayList<Object> ();
- Unity.global_shell = this;
- Unity.TimelineLogger.get_default(); // just inits the timer for logging
- // attempt to get a boot logging filename
- boot_logging_filename = Environment.get_variable ("UNITY_BOOTLOG_FILENAME");
- if (boot_logging_filename != null)
- {
- Unity.is_logging = true;
- }
- else
- {
- Unity.is_logging = false;
- }
- START_FUNCTION ();
- string[] args = { "mutter" };
-
- LOGGER_START_PROCESS ("ctk_init");
- Ctk.init_after (ref args);
- LOGGER_END_PROCESS ("ctk_init");
-
- Gtk.Settings.get_default ().gtk_icon_theme_name = "ubuntu-mono-dark";
-
- /* Unique instancing */
- LOGGER_START_PROCESS ("unity_application_constructor");
- this.app = new Unity.Application ();
- this.app.shell = this;
- LOGGER_END_PROCESS ("unity_application_constructor");
-
- try
- {
- this.screensaver_conn = DBus.Bus.get (DBus.BusType.SESSION);
- this.screensaver = this.screensaver_conn.get_object ("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver");
- this.screensaver.ActiveChanged.connect (got_screensaver_changed);
- }
- catch (GLib.Error e)
- {
- warning (e.message);
- }
-
- this.wm = new WindowManagement (this);
- this.maximus = new Maximus ();
-
- (Clutter.Stage.get_default () as Clutter.Stage).color = { 0, 0, 0, 255 };
-
- END_FUNCTION ();
- }
-
- private bool real_construct ()
- {
- START_FUNCTION ();
-
- Clutter.set_gl_picking_enabled (false);
-
- this.stage = (Clutter.Stage)this.plugin.get_stage ();
- this.stage.actor_added.connect ((a) => { ensure_input_region (); });
- this.stage.actor_removed.connect ((a) => { ensure_input_region (); });
-
- this.drag_dest = new DragDest ();
- this.drag_dest.show ();
- Gtk.TargetEntry[] target_list =
- {
- Gtk.TargetEntry () {target="STRING", flags=0,
- info=Unity.dnd_targets.TARGET_STRING },
- Gtk.TargetEntry () {target="text/plain", flags=0,
- info=Unity.dnd_targets.TARGET_STRING },
- Gtk.TargetEntry () {target="text/uri-list", flags=0,
- info=Unity.dnd_targets.TARGET_URL },
- Gtk.TargetEntry () {target="x-url/http",
- flags=0, info=Unity.dnd_targets.TARGET_URL },
- Gtk.TargetEntry () {target="x-url/ftp",
- flags=0, info=Unity.dnd_targets.TARGET_URL },
- Gtk.TargetEntry () {target="_NETSCAPE_URL", flags=0,
- info=Unity.dnd_targets.TARGET_URL }
- };
-
- Ctk.dnd_init ((Gtk.Widget)this.drag_dest, target_list);
-
- Clutter.Group window_group = (Clutter.Group) this.plugin.get_window_group ();
-
- /* we need to hook into the super key bound by mutter for g-shell.
- don't ask me why mutter binds things for g-shell explictly...
- */
- var gc = GConf.Client.get_default();
- Mutter.MetaDisplay display = Mutter.MetaScreen.get_display (plugin.get_screen ());
-
- try {
- super_key_enable = gc.get_bool(GCONF_DIR + "/" + GCONF_SUPER_KEY_ENABLE_KEY);
- } catch (GLib.Error e) {
- super_key_enable = true;
- warning("Cannot find super_key_enable gconf key");
- }
- try {
- gc.add_dir(GCONF_DIR, GConf.ClientPreloadType.ONELEVEL);
- gc.notify_add(GCONF_DIR + "/" + GCONF_SUPER_KEY_ENABLE_KEY, this.gconf_super_key_enable_cb);
- } catch (GLib.Error e) {
- warning("Cannot set gconf callback function of super_key_enable");
- }
-
- display.overlay_key_down.connect (() => {
- if (super_key_enable) {
- super_key_active = true;
- }
- });
-
- display.overlay_key.connect (() => {
- super_key_active = false;
- });
-
- display.overlay_key_with_modifier.connect ((keysym) => {
- super_key_modifier_release (keysym);
- });
-
- display.overlay_key_with_modifier_down.connect ((keysym) => {
- if (super_key_enable) {
- super_key_modifier_press (keysym);
- }
- });
-
- /* Setup the backgrounds */
- unowned Gdk.Screen screen = Gdk.Screen.get_default ();
- backgrounds = new Gee.ArrayList<Background> ();
-
- /* Connect to interestng signals */
- screen.monitors_changed.connect (relayout);
- screen.size_changed.connect (relayout);
-
- this.launcher = new Launcher.Launcher (this);
- this.launcher.get_view ().opacity = 0;
-
- this.spaces_manager = new SpacesManager (this);
- this.spaces_manager.set_padding (50, 50, get_launcher_width_foobar () + 50, 50);
- this.launcher.model.add (spaces_manager.button);
-
- this.expose_manager = new ExposeManager (this, launcher);
- this.expose_manager.hovered_opacity = 255;
- this.expose_manager.unhovered_opacity = 255;
- this.expose_manager.darken = 25;
- this.expose_manager.right_buffer = 10;
- this.expose_manager.top_buffer = this.expose_manager.bottom_buffer = 20;
-
- this.expose_manager.coverflow = false;
-
- window_group.add_actor (this.launcher.get_container ());
- (this.launcher.get_container () as Ctk.Bin).add_actor (this.launcher.get_view ());
- window_group.raise_child (this.launcher.get_container (),
- this.plugin.get_normal_window_group ());
- this.launcher.get_view ().animate (Clutter.AnimationMode.EASE_IN_SINE, 400,
- "opacity", 255);
-
- this.places_controller = new Places.Controller (this);
- this.places = this.places_controller.get_view ();
-
- window_group.add_actor (this.places);
- window_group.raise_child (this.places,
- this.launcher.get_container ());
- this.places.opacity = 0;
- this.places.reactive = false;
- this.places.hide ();
- this.places_showing = false;
-
- this.panel = new Panel.View (this);
- window_group.add_actor (this.panel);
- window_group.raise_child (this.panel,
- this.launcher.get_container ());
- this.panel.show ();
-
- this.stage.notify["width"].connect (this.relayout);
- this.stage.notify["height"].connect (this.relayout);
-
- this.relayout ();
- END_FUNCTION ();
-
- if (boot_logging_filename != null)
- {
- Timeout.add_seconds (5, () => {
- Unity.TimelineLogger.get_default().write_log (boot_logging_filename);
- return false;
- });
- }
-
- gesture_dispatcher = new Gesture.XCBDispatcher ();
- gesture_dispatcher.gesture.connect (on_gesture_received);
-
- this.ensure_input_region ();
- GLib.Idle.add (() => { is_starting = false; return false; });
- return false;
-
- }
-
- private void gconf_super_key_enable_cb(GConf.Client gc, uint cxnid, GConf.Entry entry) {
- bool new_value = true;
- try {
- new_value = gc.get_bool(GCONF_DIR + "/" + GCONF_SUPER_KEY_ENABLE_KEY);
- } catch (GLib.Error e) {
- new_value = true;
- }
- super_key_enable = new_value;
- }
-
- private void on_focus_window_changed ()
- {
- check_fullscreen_obstruction ();
-
- if (focus_window != null)
- {
- focus_window.notify["fullscreen"].disconnect (on_focus_window_fullscreen_changed);
- }
-
- display.get ("focus-window", ref focus_window);
- focus_window.notify["fullscreen"].connect (on_focus_window_fullscreen_changed);
- }
-
- private void on_focus_window_fullscreen_changed ()
- {
- check_fullscreen_obstruction ();
- }
-
- private void got_screensaver_changed (dynamic DBus.Object screensaver, bool changed)
- {
- if (changed)
- {
- this.launcher.get_container ().hide ();
- this.panel.hide ();
- var menu = Unity.Launcher.QuicklistController.get_current_menu ();
- if (menu.is_menu_open ())
- menu.state = Unity.Launcher.QuicklistControllerState.CLOSED;
-
- fullscreen_obstruction = true;
- }
- else
- {
- this.launcher.get_container ().show ();
- this.panel.show ();
- fullscreen_obstruction = false;
- }
- }
-
- public uint32 get_current_time ()
- {
- return Mutter.MetaDisplay.get_current_time (Mutter.MetaScreen.get_display (plugin.get_screen ()));
- }
-
- void check_fullscreen_obstruction ()
- {
- Mutter.Window focus = null;
- bool fullscreen = false;
-
- // prevent segfault when mutter beats us to the initialization punch
- if (!(launcher is Launcher.Launcher) || !(panel is Clutter.Actor))
- return;
-
- unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
- foreach (Mutter.Window w in mutter_windows)
- {
- unowned Mutter.MetaWindow meta = w.get_meta_window ();
-
- if (meta != null && Mutter.MetaWindow.has_focus (w.get_meta_window ()))
- {
- focus = w;
- break;
- }
- }
-
- if (focus == null)
- return;
-
- (focus.get_meta_window () as GLib.Object).get ("fullscreen", ref fullscreen);
- (this.launcher.get_container () as Launcher.LauncherContainer).cache.invalidate_texture_cache ();
- this.panel.cache.invalidate_texture_cache ();
-
- Clutter.Animation? anim;
- Clutter.Animation? panim;
- if (fullscreen)
- {
- anim = this.launcher.get_container ().animate (Clutter.AnimationMode.EASE_IN_SINE, 200, "x", -100f);
- panim = this.panel.animate (Clutter.AnimationMode.EASE_IN_SINE, 200, "opacity", 0);
- fullscreen_obstruction = true;
- }
- else
- {
- anim = this.launcher.get_container ().animate (Clutter.AnimationMode.EASE_IN_SINE, 200, "x", 0f);
- panim = this.panel.animate (Clutter.AnimationMode.EASE_IN_SINE, 200, "opacity", 255);
- fullscreen_obstruction = false;
- }
-
- if (anim is Clutter.Animation)
- {
- anim.completed.connect (()=> {
- (this.launcher.get_container () as Launcher.LauncherContainer).cache.update_texture_cache ();
- });
- }
-
- if (panim is Clutter.Animation)
- {
- panim.completed.connect (() => { this.panel.cache.update_texture_cache (); });
- }
- }
-
- private void refresh_n_backgrounds (int n_monitors)
- {
- int size = backgrounds.size;
-
- if (size == n_monitors)
- return;
- else if (size < n_monitors)
- {
- for (int i = 0; i < n_monitors - size; i++)
- {
- var bg = new Background ();
- backgrounds.add (bg);
- stage.add_actor (bg);
- bg.lower_bottom ();
- bg.opacity = 0;
- bg.show ();
- bg.animate (Clutter.AnimationMode.EASE_IN_QUAD, 2000,
- "opacity", 255);
- }
- }
- else
- {
- for (int i = 0; i < size - n_monitors; i++)
- {
- var bg = backgrounds.get (0);
- if (bg is Clutter.Actor)
- {
- backgrounds.remove (bg);
- stage.remove_actor (bg);
- }
- }
- }
- }
- private void relayout ()
- {
- START_FUNCTION ();
-
- unowned Gdk.Screen screen = Gdk.Screen.get_default ();
- int x, y, width, height;
-
- /* Figure out what should be the right size and location of Unity */
- /* FIXME: This needs to always be monitor 0 right now as it doesn't
- * seem possible to have panels on a vertical edge of a monitor unless
- * it's the first or last monitor :(
- */
- screen.get_monitor_geometry (0, // Should be screen.get_primary_monitor()
- out primary_monitor);
- x = primary_monitor.x;
- y = primary_monitor.y;
- width = primary_monitor.width;
- height = primary_monitor.height;
-
- /* The drag-n-drop region */
- drag_dest.resize (QUICKLAUNCHER_WIDTH,
- height - PANEL_HEIGHT);
- drag_dest.move (x, y + PANEL_HEIGHT);
-
- /* We're responsible for painting the backgrounds on all the monitors */
- refresh_n_backgrounds (screen.get_n_monitors ());
- for (int i = 0; i < screen.get_n_monitors (); i++)
- {
- var bg = backgrounds.get (i);
- if (bg is Background)
- {
- Gdk.Rectangle rect;
- screen.get_monitor_geometry (i, out rect);
-
- bg.set_position (rect.x, rect.y);
- bg.set_size (rect.width, rect.height);
- }
- }
-
- this.launcher.get_container ().set_size (this.QUICKLAUNCHER_WIDTH,
- (height-this.PANEL_HEIGHT));
- this.launcher.get_container ().set_position (x, y + this.PANEL_HEIGHT);
- this.launcher.get_container ().set_clip (0, 0,
- this.QUICKLAUNCHER_WIDTH,
- height-this.PANEL_HEIGHT);
-
- Utils.set_strut ((Gtk.Window)this.drag_dest,
- this.QUICKLAUNCHER_WIDTH, y, (uint32)height,
- PANEL_HEIGHT, x, (uint32)width);
-
- this.places.set_size (width - this.QUICKLAUNCHER_WIDTH, height);
- this.places.set_position (x + this.QUICKLAUNCHER_WIDTH, y);
-
- this.panel.set_size (width, PANEL_HEIGHT);
- this.panel.set_position (x, y);
-
- ensure_input_region ();
-
- END_FUNCTION ();
- }
-
- public void add_fullscreen_request (Object o)
- {
- fullscreen_requests.add (o);
- ensure_input_region ();
- }
-
- public bool remove_fullscreen_request (Object o)
- {
- bool result = fullscreen_requests.remove (o);
- ensure_input_region ();
- return result;
- }
-
- public void ensure_input_region ()
- {
- if (fullscreen_obstruction)
- {
- if (last_input_state == InputState.ZERO)
- return;
- last_input_state = InputState.ZERO;
- this.plugin.set_stage_input_area(0, 0, 0, 0);
-
- this.grab_keyboard (false, Clutter.get_current_event_time ());
- }
- else if (fullscreen_requests.size > 0 || places_showing)
- {
- // Fullscreen required
- if (last_input_state == InputState.FULLSCREEN)
- return;
-
- last_input_state = InputState.FULLSCREEN;
- this.restore_input_region (true);
-
- this.stage.set_key_focus (null as Clutter.Actor);
- this.grab_keyboard (true, Clutter.get_current_event_time ());
- }
- else
- {
- // Unity mode requred
- if (last_input_state == InputState.UNITY)
- return;
-
- last_input_state = InputState.UNITY;
- this.restore_input_region (false);
-
- this.grab_keyboard (false, Clutter.get_current_event_time ());
- }
- }
-
- /*
- * SHELL IMPLEMENTATION
- */
- public Clutter.Stage get_stage ()
- {
- return this.stage;
- }
-
- public void close_xids (Array<uint32> xids)
- {
- for (int i = 0; i < xids.length; i++)
- {
- uint32 xid = xids.index (i);
-
- unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
- foreach (Mutter.Window window in mutter_windows)
- {
- uint32 wxid = (uint32) Mutter.MetaWindow.get_xwindow (window.get_meta_window ());
- if (wxid == xid)
- {
- Mutter.MetaWindow.delete (window.get_meta_window (), Clutter.get_current_event_time ());
- }
- }
- }
- }
-
- public void expose_xids (Array<uint32> xids)
- {
- spaces_manager.hide_spaces_picker ();
- SList<Clutter.Actor> windows = new SList<Clutter.Actor> ();
- for (int i = 0; i < xids.length; i++)
- {
- uint32 xid = xids.index (i);
-
- unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
- foreach (Mutter.Window w in mutter_windows)
- {
- uint32 wxid = (uint32) Mutter.MetaWindow.get_xwindow (w.get_meta_window ());
- if (wxid == xid)
- {
- windows.append (w);
- break;
- }
- }
- }
-
- expose_windows (windows, get_launcher_width_foobar () + 10);
- }
-
- public void stop_expose ()
- {
- expose_manager.end_expose ();
- }
-
- public void show_window (uint32 xid)
- {
- unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
-
- foreach (Mutter.Window mutter_window in mutter_windows)
- {
- ulong window_xid = (ulong) Mutter.MetaWindow.get_xwindow (mutter_window.get_meta_window ());
- if (window_xid != xid)
- continue;
-
- int type = mutter_window.get_window_type ();
-
- if (type != Mutter.MetaWindowType.NORMAL &&
- type != Mutter.MetaWindowType.DIALOG &&
- type != Mutter.MetaWindowType.MODAL_DIALOG)
- continue;
-
- uint32 time_;
- unowned Mutter.MetaWindow meta = mutter_window.get_meta_window ();
-
- time_ = Mutter.MetaDisplay.get_current_time (Mutter.MetaWindow.get_display (meta));
- Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace (meta), time_);
- Mutter.MetaWindow.activate (meta, time_);
- }
- }
-
- public ShellMode get_mode ()
- {
- return places_showing ? ShellMode.DASH : ShellMode.MINIMIZED;
- }
-
- public int get_indicators_width ()
- {
- return this.panel.get_indicators_width ();
- }
-
- public void expose_windows (GLib.SList<Clutter.Actor> windows,
- int left_buffer = 75)
- {
- expose_manager.left_buffer = left_buffer;
- expose_manager.start_expose (windows);
- }
-
-
- public void hide_unity ()
- {
- if (places_showing == false)
- return;
-
- places_showing = false;
-
- var anim = dark_box.animate (Clutter.AnimationMode.EASE_IN_QUAD, 100, "opacity", 0);
- anim.completed.connect ((an) => {
- (an.get_object () as Clutter.Actor).destroy ();
- });
-
- plugin.get_normal_window_group ().animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, "opacity", 255);
-
- anim = places.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100,
- "opacity", 0);
- anim.completed.connect ((an) => {
- (an.get_object () as Clutter.Actor).hide ();
- });
-
- panel.set_indicator_mode (false);
- ensure_input_region ();
-
- while (Gtk.events_pending ())
- Gtk.main_iteration ();
-
- places.hidden ();
-
- mode_changed (ShellMode.MINIMIZED);
- }
-
- public void show_unity ()
- {
- if (this.places_showing)
- {
- hide_unity ();
- }
- else
- {
- this.places_showing = true;
-
- this.places.show ();
- this.places.opacity = 0;
- this.dark_box = new Clutter.Rectangle.with_color ({0, 0, 0, 255});
-
- (this.plugin.get_window_group () as Clutter.Container).add_actor (this.dark_box);
- this.dark_box.raise (plugin.get_normal_window_group ());
-
- this.dark_box.set_position (primary_monitor.x, primary_monitor.y);
- this.dark_box.set_size (primary_monitor.width, primary_monitor.height);
-
- this.dark_box.show ();
-
- this.panel.set_indicator_mode (true);
-
- this.ensure_input_region ();
-
- new X.Display (null).flush ();
-
- this.dark_box.opacity = 0;
-
- this.dark_box.animate (Clutter.AnimationMode.EASE_IN_QUAD, 100, "opacity", 180);
- plugin.get_normal_window_group ().animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100, "opacity", 0);
- places.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 100,
- "opacity", 255);
-
- places.shown ();
-
- mode_changed (ShellMode.DASH);
- }
- }
-
- public void about_to_show_places ()
- {
- places.about_to_show ();
- }
-
- public void grab_keyboard (bool grab, uint32 timestamp)
- {
- if (this.grab_enabled == grab)
- return;
-
- if (grab)
- {
- this.plugin.begin_modal (Utils.get_stage_window (this.stage),
- 0,
- 0,
- timestamp);
-
- }
- else
- {
- this.plugin.end_modal (timestamp);
- }
-
- this.grab_enabled = grab;
- }
-
- private unowned Mutter.MetaWindow? get_window_for_xid (uint32 xid)
- {
- unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows ();
- foreach (Mutter.Window window in mutter_windows)
- {
- uint32 wxid = (uint32) Mutter.MetaWindow.get_xwindow (window.get_meta_window ());
- if (wxid == xid)
- {
- unowned Mutter.MetaWindow win = window.get_meta_window ();
- return win;
- }
- }
-
- return null;
- }
-
- public void get_window_details (uint32 xid,
- out bool allows_resize,
- out bool is_maximised)
- {
- unowned Mutter.MetaWindow? win = get_window_for_xid (xid);
-
- if (win != null)
- {
- allows_resize = Mutter.MetaWindow.allows_resize (win);
- is_maximised = (Mutter.MetaWindow.is_maximized (win) ||
- Mutter.MetaWindow.is_maximized_horizontally (win) ||
- Mutter.MetaWindow.is_maximized_vertically (win));
-
- }
- }
-
- public void do_window_action (uint32 xid, WindowAction action)
- {
- unowned Mutter.MetaWindow? win = get_window_for_xid (xid);
-
- if (win != null)
- {
- switch (action)
- {
- case WindowAction.CLOSE:
- Mutter.MetaWindow.delete (win, get_current_time ());
- break;
-
- case WindowAction.MINIMIZE:
- Mutter.MetaWindow.minimize (win);
- break;
-
- case WindowAction.MAXIMIZE:
- Mutter.MetaWindow.maximize (win,
- Mutter.MetaMaximizeFlags.HORIZONTAL |
- Mutter.MetaMaximizeFlags.VERTICAL);
- break;
-
- case WindowAction.UNMAXIMIZE:
- Mutter.MetaWindow.unmaximize (win,
- Mutter.MetaMaximizeFlags.HORIZONTAL |
- Mutter.MetaMaximizeFlags.VERTICAL);
- break;
-
- default:
- warning (@"Window action type $action not supported");
- break;
- }
- }
- }
-
- private void on_gesture_received (Gesture.Event event)
- {
- if (active_gesture_type != Gesture.Type.NONE
- && active_gesture_type != event.type
- && event.state != Gesture.State.ENDED)
- {
- /* A new gesture is beginning */
- if (event.state == Gesture.State.BEGAN)
- {
- active_gesture_type = event.type;
- }
- else
- {
- /* We don't want to handle it */
- return;
- }
- }
-
- if (event.type == Gesture.Type.TAP)
- {
- if (event.fingers == 4
- && !expose_manager.expose_showing)
- {
- if (places_showing == true)
- hide_unity ();
- else
- show_unity ();
- }
- /*
- if (expose_manager.expose_showing == false)
- {
- }
- else
- expose_manager.end_expose ();
- */
- }
- else if (event.type == Gesture.Type.PINCH)
- {
- if (event.fingers == 3
- && places_showing == false)
- {
- if (event.state == Gesture.State.ENDED)
- {
- if (event.pinch_event.radius_delta < 0)
- {
- /* Pinch */
- if (expose_type == ExposeType.NONE || !expose_manager.expose_showing)
- {
- Mutter.Window? window = null;
-
- var actor = stage.get_actor_at_pos (Clutter.PickMode.ALL,
- (int)event.root_x,
- (int)event.root_y);
- if (actor is Mutter.Window == false)
- actor = actor.get_parent ();
-
- if (actor is Mutter.Window)
- {
- window = actor as Mutter.Window;
-
- if (window.get_window_type () != Mutter.MetaCompWindowType.NORMAL &&
- window.get_window_type () != Mutter.MetaCompWindowType.DIALOG &&
- window.get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG &&
- window.get_window_type () != Mutter.MetaCompWindowType.UTILITY)
- window = null;
- }
-
- start_pinch_window = null;
-
- if (window is Mutter.Window)
- {
- var matcher = Bamf.Matcher.get_default ();
- var xwin = (uint32)Mutter.MetaWindow.get_xwindow (window.get_meta_window ());
-
- foreach (Bamf.Application app in matcher.get_running_applications ())
- {
- Array<uint32> last_pinch_xids = app.get_xids ();
- for (int i = 0; i < last_pinch_xids.length; i++)
- {
- uint32 xid = last_pinch_xids.index (i);
- if (xwin == xid)
- {
- // Found the right application, so pick it
- expose_xids (last_pinch_xids);
- expose_type = ExposeType.APPLICATION;
- start_pinch_window = window;
- return;
- }
- }
- }
- }
-
- /* If we're here we didnt find window, so lets do window expose */
- SList<Clutter.Actor> windows = new SList<Clutter.Actor> ();
- unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
- foreach (Mutter.Window w in mutter_windows)
- {
- windows.append (w);
- }
- expose_windows (windows, get_launcher_width_foobar () + 10);
-
- expose_type = ExposeType.WINDOWS;
-
- }
- else if (expose_type == ExposeType.APPLICATION)
- {
- SList<Clutter.Actor> windows = new SList<Clutter.Actor> ();
- unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows ();
- foreach (Mutter.Window w in mutter_windows)
- {
- windows.append (w);
- }
- expose_windows (windows, get_launcher_width_foobar () + 10);
-
- expose_type = ExposeType.WINDOWS;
- }
- else if (expose_type == ExposeType.WINDOWS)
- {
- expose_type = ExposeType.WORKSPACE;
- }
- }
- else
- {
- /* Spread */
- if (expose_type == ExposeType.NONE || !expose_manager.expose_showing)
- {
- expose_manager.end_expose ();
- expose_type = ExposeType.NONE;
- }
- else if (expose_type == ExposeType.APPLICATION)
- {
- expose_manager.end_expose ();
- expose_type = ExposeType.NONE;
- }
- else if (expose_type == ExposeType.WINDOWS)
- {
- var matcher = Bamf.Matcher.get_default ();
- var xwin = (uint32)Mutter.MetaWindow.get_xwindow (start_pinch_window.get_meta_window ());
-
- foreach (Bamf.Application app in matcher.get_running_applications ())
- {
- Array<uint32> last_pinch_xids = app.get_xids ();
- for (int i = 0; i < last_pinch_xids.length; i++)
- {
- uint32 xid = last_pinch_xids.index (i);
- if (xwin == xid)
- {
- // Found the right application, so pick it
- expose_xids (last_pinch_xids);
- expose_type = ExposeType.APPLICATION;
- return;
- }
- }
- }
- expose_manager.end_expose ();
- expose_type = ExposeType.NONE;
- }
- else if (expose_type == ExposeType.WORKSPACE)
- {
- expose_type = ExposeType.WINDOWS;
- }
- }
- }
- }
- }
- else if (event.type == Gesture.Type.PAN)
- {
- if (resize_window is Mutter.Window)
- return;
-
- if (event.fingers == 3)
- {
- if (event.state == Gesture.State.BEGAN
- && event.pan_event.current_n_fingers == 2)
- {
- start_pan_window = null;
-
- var actor = stage.get_actor_at_pos (Clutter.PickMode.ALL,
- (int)event.root_x,
- (int)event.root_y);
- if (actor is Mutter.Window == false)
- actor = actor.get_parent ();
-
- if (actor is Mutter.Window)
- {
- start_pan_window = actor as Mutter.Window;
-
- if (start_pan_window.get_window_type () != Mutter.MetaCompWindowType.NORMAL &&
- start_pan_window.get_window_type () != Mutter.MetaCompWindowType.DIALOG &&
- start_pan_window.get_window_type () != Mutter.MetaCompWindowType.MODAL_DIALOG &&
- start_pan_window.get_window_type () != Mutter.MetaCompWindowType.UTILITY)
- start_pan_window = null;
- }
- }
- else if (event.state == Gesture.State.CONTINUED
- && event.pan_event.current_n_fingers == 2)
- {
- if (start_pan_window is Mutter.Window == false)
- return;
-
- last_pan_x_root = event.root_x;
-
- unowned Mutter.MetaWindow win = start_pan_window.get_meta_window ();
- bool fullscreen = false;
- win.get ("fullscreen", out fullscreen);
-
- if (!Mutter.MetaWindow.is_maximized (win) && fullscreen == false)
- {
- if (start_pan_window.y == PANEL_HEIGHT
- && event.pan_event.delta_y <= 0.0f)
- {
- if (start_frame_rect is Clutter.Rectangle == false)
- {
- Clutter.Rectangle frame = new Clutter.Rectangle.with_color ({ 0, 0, 0, 10 });
- frame.border_color = { 255, 255, 255, 255 };
- frame.border_width = 3;
-
- stage.add_actor (frame);
- frame.set_size (start_pan_window.width,
- start_pan_window.height);
- frame.set_position (start_pan_window.x,
- start_pan_window.y);
- frame.show ();
-
- start_frame_rect = frame;
-
- last_pan_maximised_x_root = start_pan_window.x;
- }
-
- maximize_type = MaximizeType.FULL;
- var MAX_DELTA = 50.0f;
- if (start_pan_window.x < last_pan_maximised_x_root - MAX_DELTA)
- {
- maximize_type = MaximizeType.LEFT;
- start_frame_rect.animate (Clutter.AnimationMode.EASE_OUT_QUAD,
- 150,
- "x", (float)QUICKLAUNCHER_WIDTH,
- "y", (float)PANEL_HEIGHT,
- "width", (stage.width - QUICKLAUNCHER_WIDTH)/2.0f,
- "height", stage.height - PANEL_HEIGHT);
-
- }
- else if (start_pan_window.x > last_pan_maximised_x_root + MAX_DELTA)
- {
- maximize_type = MaximizeType.RIGHT;
- start_frame_rect.animate (Clutter.AnimationMode.EASE_OUT_QUAD,
- 150,
- "x", (float)((stage.width - QUICKLAUNCHER_WIDTH)/2.0f) + QUICKLAUNCHER_WIDTH,
- "y", (float)PANEL_HEIGHT,
- "width", (stage.width - QUICKLAUNCHER_WIDTH)/2.0f,
- "height", stage.height - PANEL_HEIGHT);
- }
- else
- {
- start_frame_rect.animate (Clutter.AnimationMode.EASE_OUT_QUAD,
- 150,
- "x", (float)QUICKLAUNCHER_WIDTH,
- "y", (float)PANEL_HEIGHT,
- "width", stage.width - QUICKLAUNCHER_WIDTH,
- "height", stage.height - PANEL_HEIGHT);
-
- }
- }
- else
- {
- if (start_frame_rect is Clutter.Rectangle)
- {
- if (start_frame_rect.opacity == 0)
- {
- stage.remove_actor (start_frame_rect);
- start_frame_rect = null;
- }
- else if (start_pan_window.y > PANEL_HEIGHT + 5 &&
- (start_frame_rect.get_animation () is Clutter.Animation == false))
- {
- start_frame_rect.animate (Clutter.AnimationMode.EASE_IN_QUAD,
- 150,
- "x", start_pan_window.x,
- "y", start_pan_window.y,
- "width", start_pan_window.width,
- "height", start_pan_window.height,
- "opacity", 0);
- }
- }
- }
- start_pan_window.x += Math.floorf (event.pan_event.delta_x + 0.5f);
- start_pan_window.y += Math.floorf (event.pan_event.delta_y + 0.5f);
- start_pan_window.x = float.max (start_pan_window.x, QUICKLAUNCHER_WIDTH);
- start_pan_window.y = float.max (start_pan_window.y, PANEL_HEIGHT);
- }
- else
- {
- if (event.pan_event.delta_y >= 0.0f && fullscreen == false)
- {
- Mutter.MetaWindow.unmaximize (win,
- Mutter.MetaMaximizeFlags.HORIZONTAL | Mutter.MetaMaximizeFlags.VERTICAL);
- }
- }
- }
- else if (event.state == Gesture.State.ENDED)
- {
- if (start_pan_window is Mutter.Window)
- {
- unowned Mutter.MetaWindow win = start_pan_window.get_meta_window ();
- float nx = 0;
- float ny = 0;
- float nwidth = 0;
- float nheight = 0;
- bool move_resize = false;
- bool fullscreen = false;
- win.get ("fullscreen", out fullscreen);
-
- int wx, wy, ww, wh;
- Mutter.MetaWindow.get_geometry (win, out wx, out wy, out ww, out wh);
- Mutter.MetaRectangle rect = Mutter.MetaRectangle ();
- Mutter.MetaWindow.get_outer_rect (win, rect);
-
- if (Mutter.MetaWindow.is_maximized (win) || fullscreen)
- {
- }
- else if (start_pan_window.y == PANEL_HEIGHT && event.pan_event.delta_y < 0.0f)
- {
- if (maximize_type == MaximizeType.FULL)
- {
-
- Mutter.MetaWindow.maximize (win,
- Mutter.MetaMaximizeFlags.HORIZONTAL | Mutter.MetaMaximizeFlags.VERTICAL);
- move_resize = false;
- }
- else if (maximize_type == MaximizeType.RIGHT)
- {
- nx = (float)QUICKLAUNCHER_WIDTH + (stage.width-QUICKLAUNCHER_WIDTH)/2.0f;
- ny = (float)PANEL_HEIGHT;
- nwidth = (stage.width - QUICKLAUNCHER_WIDTH)/2.0f;
- nheight = stage.height - PANEL_HEIGHT;
-
- move_resize = true;
- }
- else if (maximize_type == MaximizeType.LEFT)
- {
- nx = (float)QUICKLAUNCHER_WIDTH;
- ny = (float)PANEL_HEIGHT;
- nwidth = (stage.width - QUICKLAUNCHER_WIDTH)/2.0f;
- nheight = stage.height - PANEL_HEIGHT;
-
- move_resize = true;
- }
- }
- else
- {
- nx = start_pan_window.x;
- ny = start_pan_window.y;
- nwidth = 0.0f;
- nheight = 0.0f;
- move_resize = true;
- }
-
- if (move_resize)
- {
- X.Window xwin = start_pan_window.get_x_window ();
- if (nwidth > 0.0f && nheight > 0.0f)
- {
- Mutter.MetaWindow.move_resize (win, false, ((int)nx),
- ((int)ny),
- (int)nwidth, (int)nheight);
- }
- else
- {
- /* We use gdk_window_move because we don't want
- * to send in the width and height if we dont
- * need to, as otherwise we'll cause a resize
- * for no reason, and most likely get it
- * wrong (you need to take into account frame
- * size inside Mutter
- */
- unowned Gdk.Window w = Gdk.Window.foreign_new ((Gdk.NativeWindow)xwin);
- w.move ((int)nx, (int)ny);
- }
- }
- }
-
- if (start_frame_rect is Clutter.Rectangle)
- stage.remove_actor (start_frame_rect);
- }
- }
- }
- }
-
- /*
- * MUTTER PLUGIN HOOKS
- */
- public void minimize (Mutter.Window window)
- {
- this.window_minimized (this, window);
- }
-
- public void maximize (Mutter.Window window,
- int x,
- int y,
- int width,
- int height)
- {
- if (window.get_data<string> (UNDECORATED_HINT) == null)
- {
- Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (window.get_meta_window ()), 0);
- }
-
- this.window_maximized (this, window, x, y, width, height);
-
- active_window_state_changed ();
- }
-
- public void unmaximize (Mutter.Window window,
- int x,
- int y,
- int width,
- int height)
- {
- if (window.get_data<string> (UNDECORATED_HINT) == null)
- {
- Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (window.get_meta_window ()), 1);
- }
-
- this.window_unmaximized (this, window, x, y, width, height);
-
- active_window_state_changed ();
- }
-
- public void map (Mutter.Window window)
- {
- unowned Mutter.MetaWindow win = window.get_meta_window ();
-
- if (window.get_window_type () == Mutter.MetaCompWindowType.NORMAL)
- {
- Idle.add (() => {
- if (win is Object)
- {
- bool decorated = Utils.window_is_decorated (Mutter.MetaWindow.get_xwindow (win));
- bool maximized = Mutter.MetaWindow.is_maximized (win);
-
- bool fullscreen;
- win.get ("fullscreen", out fullscreen);
-
- if (!decorated && !maximized)
- {
- window.set_data (UNDECORATED_HINT, "%s".printf ("true"));
- }
- else if (decorated && maximized && !fullscreen)
- {
- Utils.window_set_decorations (Mutter.MetaWindow.get_xwindow (win), 0);
- }
- }
-
- return false;
- });
- }
- else if (window.get_window_type () == Mutter.MetaCompWindowType.DOCK)
- {
- if (win.get_xwindow (win) == Gdk.x11_drawable_get_xid (drag_dest.window))
- {
- window.opacity = 0;
- }
- }
-
- this.maximus.process_window (window);
- this.window_mapped (this, window);
-
- if (display == null)
- {
- display = Mutter.MetaWindow.get_display (window.get_meta_window ());
- display.notify["focus-window"].connect (on_focus_window_changed);
- }
- }
-
- public void destroy (Mutter.Window window)
- {
- this.window_destroyed (this, window);
- }
-
- public void switch_workspace (int from,
- int to,
- int direction)
- {
- this.workspace_switch_event (this, from, to, direction);
- }
-
- public void on_kill_window_effects (Mutter.Window window)
- {
- this.kill_window_effects (this, window);
- }
-
- public void on_kill_switch_workspace ()
- {
- this.kill_switch_workspace (this);
- }
-
- public int get_panel_height ()
- {
- return this.PANEL_HEIGHT;
- }
-
- public int get_launcher_width ()
- {
- return this.QUICKLAUNCHER_WIDTH;
- }
-
- /* this is needed to avoid a symbol clash in unity/targets/mutter/main.c */
- public int get_panel_height_foobar ()
- {
- return this.get_panel_height ();
- }
-
- /* this is needed to avoid a symbol clash in unity/targets/mutter/main.c */
- public int get_launcher_width_foobar ()
- {
- return this.get_launcher_width ();
- }
- }
-}
diff --git a/targets/mutter/spaces-manager.vala b/targets/mutter/spaces-manager.vala
deleted file mode 100644
index 9aff2fd06..000000000
--- a/targets/mutter/spaces-manager.vala
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Jason Smith <jason.smith@canonical.com>
- *
- */
-
-using Unity.Launcher;
-
-namespace Unity {
-
- public class SpacesButtonController : ScrollerChildController
- {
- SpacesManager parent { get; set; }
-
- public SpacesButtonController (SpacesManager _parent, ScrollerChild _child)
- {
- Object (child: _child);
- this.parent = _parent;
- parent.notify["showing"].connect (on_notify_showing);
-
- name = _("Workspaces");
- load_icon_from_icon_name ("workspace-switcher");
- }
-
- construct
- {
- child.group_type = ScrollerChild.GroupType.PLACE;
- }
-
- private void on_notify_showing ()
- {
- child.active = parent.showing;
- }
-
- public override void activate ()
- {
- if (parent.showing == true)
- parent.hide_spaces_picker ();
- else
- parent.show_spaces_picker ();
- }
- public override QuicklistController? get_menu_controller ()
- {
- return new ApplicationQuicklistController (this);
- }
-
- public override void get_menu_actions (ScrollerChildController.menu_cb callback)
- {
- callback (null);
- }
-
- public override void get_menu_navigation (ScrollerChildController.menu_cb callback)
- {
- callback (null);
- }
-
- public override bool can_drag ()
- {
- return false;
- }
-
- }
-
- public class WorkspaceClone : Clutter.Group
- {
- bool gridded;
- Unity.Plugin plugin;
- public unowned Mutter.MetaWorkspace workspace { get; private set; }
-
- public WorkspaceClone (Mutter.MetaWorkspace wsp, Unity.Plugin plugin)
- {
- workspace = wsp;
- this.plugin = plugin;
-
- actor_added.connect (() => {
- if (gridded)
- grid ();
- });
-
- actor_removed.connect (() => {
- if (gridded)
- grid ();
- });
- }
-
- private List<Clutter.Actor> toplevel_windows ()
- {
- List<Clutter.Actor> windows = new List<Clutter.Actor> ();
-
- foreach (Clutter.Actor actor in get_children ())
- if (actor is ExposeClone && (actor as ExposeClone).source is Mutter.Window)
- windows.prepend (actor);
-
- return windows;
- }
-
- public void grid ()
- {
- gridded = true;
- plugin.expose_manager.position_windows_on_grid (toplevel_windows (), 50, 50, 50, 50);
- }
-
- public void ungrid ()
- {
- gridded = false;
- int active_workspace = Mutter.MetaScreen.get_active_workspace_index (plugin.plugin.get_screen ());
- foreach (Clutter.Actor actor in toplevel_windows ())
- if (actor is ExposeClone)
- (actor as ExposeClone).restore_window_position (active_workspace);
- }
- }
-
- public class SpacesManager : GLib.Object
- {
- Clutter.Group selector_group;
- Clutter.Actor background;
- List<Clutter.Actor> clones;
- Plugin plugin;
- ScrollerChild _button;
- SpacesButtonController controller;
-
- public ScrollerChild button {
- get {
- if (!(_button is ScrollerChild))
- {
- _button = new ScrollerChild ();
- controller = new SpacesButtonController (this, _button);
- }
- return _button;
- }
- }
-
- public uint top_padding { get; set; }
- public uint right_padding { get; set; }
- public uint bottom_padding { get; set; }
- public uint left_padding { get; set; }
-
- public uint spacing { get; set; }
- public bool showing { get; private set; }
-
- public SpacesManager (Plugin plugin) {
- this.plugin = plugin;
- this.plugin.workspace_switch_event.connect (this.workspace_switched);
-
- int num_workspaces = Mutter.meta_prefs_get_num_workspaces ();
-
- int width = (int) Math.ceil (Math.sqrt ((double) num_workspaces));
- int height = 1;
- while (width * height < num_workspaces)
- height++;
-
- set_desktop_layout (width, height, num_workspaces);
- }
-
- void set_desktop_layout (int columns, int rows, int num_workspace)
- {
- X.Display display;
- ulong data[4];
-
- if (columns < 1 || rows < 1 || num_workspace > columns * rows)
- return;
-
- display = plugin.plugin.get_xdisplay ();
-
- Mutter.meta_prefs_set_num_workspaces (num_workspace);
-
- data[0] = 0; // horizontal orientation
- data[1] = columns;
- data[2] = rows;
- data[3] = 0; //top left
- display.change_property(display.default_root_window (),
- display.intern_atom ("_NET_DESKTOP_LAYOUT", false),
- X.XA_CARDINAL,
- 32,
- X.PropMode.Replace,
- (uchar []) data,
- 4);
- }
-
- construct
- {
- set_padding (50, 50, 50, 50);
- spacing = 15;
- }
-
- private void workspace_switched (Plugin plugin,
- int from,
- int to,
- int direction)
- {
- this.plugin.plugin.switch_workspace_completed ();
- }
-
- public void set_padding (uint top, uint right, uint left, uint bottom) {
- top_padding = top;
- right_padding = right;
- left_padding = left;
- bottom_padding = bottom;
- }
-
- public void hide_spaces_picker () {
- select_workspace (null);
- }
-
- public void show_spaces_picker () {
- if (showing)
- return;
-
- showing = true;
- plugin.add_fullscreen_request (this);
-
- global_shell.get_stage ().captured_event.connect (on_stage_capture_event);
- global_shell.hide_unity ();
-
- if (background is Clutter.Actor)
- background.destroy ();
-
- if (selector_group is Clutter.Actor)
- selector_group.destroy ();
-
- background = new Clutter.Rectangle.with_color ({0, 0, 0, 255});
- selector_group = new Clutter.Group ();
-
- unowned Mutter.MetaScreen screen = plugin.plugin.get_screen ();
- unowned GLib.List<Mutter.MetaWorkspace> workspaces = Mutter.MetaScreen.get_workspaces (screen);
- unowned Clutter.Container window_group = plugin.plugin.get_normal_window_group() as Clutter.Container;
-
- Mutter.MetaRectangle rect = {0, 0, 0, 0};
- Mutter.MetaScreen.get_monitor_geometry (screen, 0, rect);
- background.set_size (rect.width, rect.height);
-
- selector_group.add_actor (background);
- background.raise_top ();
- background.reactive = true;
-
- foreach (unowned Mutter.MetaWorkspace workspace in workspaces)
- {
- Clutter.Actor clone = workspace_clone (workspace);
- clones.append (clone);
-
- selector_group.add_actor (clone);
- clone.reactive = true;
- clone.raise_top ();
- clone.show ();
- clone.opacity = 200;
-
- unowned Mutter.MetaWorkspace cpy = workspace;
- clone.button_release_event.connect (() => {
- select_workspace (cpy);
- return true;
- });
-
- clone.enter_event.connect (() => {
- clone.opacity = 255;
- clone.raise_top ();
- return true;
- });
-
- clone.leave_event.connect (() => {
- clone.opacity = 200;
- return true;
- });
- }
-
- window_group.add_actor (selector_group);
- selector_group.raise_top ();
-
- layout_workspaces (clones, screen);
-
- unowned GLib.List<Mutter.Window> windows = plugin.plugin.get_windows ();
- foreach (Mutter.Window w in windows)
- {
- (w as Clutter.Actor).opacity = 0;
- }
- }
-
- private bool on_stage_capture_event (Clutter.Event event)
- {
- if (event.type == Clutter.EventType.BUTTON_RELEASE)
- {
- if (event.button.y <= global_shell.get_panel_height_foobar () ||
- event.button.x <= global_shell.get_launcher_width_foobar ())
- {
- float x, y, w, h;
- button.get_transformed_position (out x, out y);
- button.get_transformed_size (out w, out h);
-
- if ((event.button.x < x || event.button.x > x + w) &&
- (event.button.y < y || event.button.y > y + h))
- select_workspace (null);
- }
- }
-
- return false;
- }
-
- private void select_workspace (Mutter.MetaWorkspace? workspace) {
- if (workspace == null)
- {
- workspace = Mutter.MetaScreen.get_active_workspace (plugin.plugin.get_screen ());
- }
-
- unlayout_workspaces (clones, plugin.plugin.get_screen (), Mutter.MetaWorkspace.index (workspace));
- clones = null;
-
- uint time_ = Mutter.MetaDisplay.get_current_time (Mutter.MetaScreen.get_display (Mutter.MetaWorkspace.get_screen (workspace)));
- Mutter.MetaWorkspace.activate (workspace, time_);
- plugin.remove_fullscreen_request (this);
- showing = false;
-
- global_shell.get_stage ().captured_event.disconnect (on_stage_capture_event);
- }
-
- private Clutter.Actor workspace_clone (Mutter.MetaWorkspace workspace) {
- WorkspaceClone wsp;
- unowned GLib.List<Mutter.Window> windows;
-
- windows = plugin.plugin.get_windows ();
- wsp = new WorkspaceClone (workspace, plugin);
-
- foreach (Mutter.Window window in windows)
- {
- if (Mutter.MetaWindow.is_on_all_workspaces (window.get_meta_window ()) ||
- window.get_workspace () == Mutter.MetaWorkspace.index (workspace))
- {
-
- if (!(window.get_window_type () == Mutter.MetaCompWindowType.NORMAL ||
- window.get_window_type () == Mutter.MetaCompWindowType.DIALOG ||
- window.get_window_type () == Mutter.MetaCompWindowType.MODAL_DIALOG ||
- window.get_window_type () == Mutter.MetaCompWindowType.UTILITY))
- continue;
-
- ExposeClone clone = new ExposeClone (window);
- clone.fade_on_close = false;
- clone.reactive = true;
- clone.darken = 25;
- clone.enable_dnd = true;
-
- clone.drag_dropped.connect ((t) => {
- WorkspaceClone new_parent = clone.pre_drag_parent as WorkspaceClone;
-
- while (!(t is Clutter.Stage))
- {
- if (t is WorkspaceClone)
- {
- new_parent = t as WorkspaceClone;
- break;
- }
- t = t.get_parent ();
- }
-
- float x, y;
-
- clone.move_anchor_point_from_gravity (Clutter.Gravity.CENTER);
- new_parent.transform_stage_point (clone.x, clone.y, out x, out y);
-
- clone.set_scale (clone.pre_drag_scale_x, clone.pre_drag_scale_y);
- clone.set_position (x, y);
-
- clone.move_anchor_point_from_gravity (Clutter.Gravity.NORTH_WEST);
-
- clone.reparent (new_parent);
-
- Mutter.MetaWindow.change_workspace_by_index ((clone.source as Mutter.Window).get_meta_window (),
- Mutter.MetaWorkspace.index (new_parent.workspace),
- true,
- plugin.get_current_time ());
- });
-
- wsp.add_actor (clone);
-
- clone.set_size (window.width, window.height);
- clone.set_position (window.x, window.y);
-
- clone.button_release_event.connect (() => {
- uint32 time_;
-
- clone.raise_top ();
- unowned Mutter.MetaWindow meta = (clone.source as Mutter.Window).get_meta_window ();
-
- time_ = Mutter.MetaDisplay.get_current_time (Mutter.MetaWindow.get_display (meta));
- Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace (meta), time_);
- Mutter.MetaWindow.activate (meta, time_);
-
- GLib.Timeout.add (250, () => { Mutter.MetaWindow.activate (meta, time_); return false; });
-
- return false;
- });
-
- clone.show ();
- }
- }
-
- ExposeClone background_clone = new ExposeClone (plugin.backgrounds.get (0));
- background_clone.fade_on_close = false;
-
- wsp.add_actor (background_clone);
- background_clone.lower_bottom ();
- background_clone.show ();
-
- wsp.grid ();
-
- wsp.set_size (background_clone.width, background_clone.height);
-
- return wsp;
- }
-
- private void unlayout_workspaces (List<Clutter.Actor> clones, Mutter.MetaScreen screen, int focus) {
- uint length = clones.length ();
-
- int width = (int) Math.ceil (Math.sqrt ((double) length));
- int height = 1;
- while (width * height < length)
- height++;
-
- Mutter.MetaRectangle rect = {0, 0, 0, 0};
- Mutter.MetaScreen.get_monitor_geometry (screen, 0, rect);
-
- for (int y = 0; y < height; y++)
- {
- for (int x = 0; x < width; x++)
- {
- int index = y * width + x;
-
- int xoffset = (x - (focus % width)) * rect.width;
- int yoffset = (y - (focus / width)) * rect.height;
-
- Clutter.Actor clone = (Clutter.Actor) clones.nth_data (index);
-
- Clutter.Animation anim = clone.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250,
- "x", (float) xoffset,
- "y", (float) yoffset,
- "scale-x", 1.0f,
- "scale-y", 1.0f);
-
- (clone as WorkspaceClone).ungrid ();
-
- anim.completed.connect (() => {
- clone.destroy ();
- if (background != null)
- {
- background.destroy ();
- background = null;
- }
- unowned GLib.List<Mutter.Window> windows = plugin.plugin.get_windows ();
- foreach (Mutter.Window w in windows)
- {
- (w as Clutter.Actor).opacity = 255;
- }
- });
- }
- }
- }
-
- private void layout_workspaces (List<Clutter.Actor> clones, Mutter.MetaScreen screen) {
- uint length = clones.length ();
-
- int width = (int) Math.ceil (Math.sqrt ((double) length));
- int height = 1;
- while (width * height < length)
- height++;
-
- Mutter.MetaRectangle rect = {0, 0, 0, 0};
- Mutter.MetaScreen.get_monitor_geometry (screen, 0, rect);
-
- int active = Mutter.MetaScreen.get_active_workspace_index (screen);
-
- int xoffset = -(active % width) * rect.width;
- int yoffset = -(active / width) * rect.height;
-
- uint item_width = (rect.width - left_padding - right_padding - (width - 1) * spacing) / width;
- float item_scale = (float) item_width / (float) rect.width;
- uint item_height = (uint) (rect.height * item_scale);
-
- for (int y = 0; y < height; y++)
- {
- for (int x = 0; x < width; x++)
- {
- int index = y * width + x;
- Clutter.Actor clone = (Clutter.Actor) clones.nth_data (index);
-
- clone.set_scale (1.0f, 1.0f);
-
- clone.x = (float) rect.width * x + xoffset;
- clone.y = (float) rect.height * y + yoffset;
-
- clone.animate (Clutter.AnimationMode.EASE_IN_OUT_SINE, 250,
- "x", (float) left_padding + ((item_width + spacing) * x),
- "y", (float) top_padding + ((item_height + spacing) * y),
- "scale-x", item_scale,
- "scale-y", item_scale);
- }
- }
- }
- }
-
-}
-
diff --git a/targets/mutter/window-management.vala b/targets/mutter/window-management.vala
deleted file mode 100644
index a7a94f1fe..000000000
--- a/targets/mutter/window-management.vala
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
- *
- */
-
-namespace Unity
-{
- public class WindowManagement : Object
- {
- private Plugin plugin;
-
- private unowned Mutter.Window last_mapped;
-
- public WindowManagement (Plugin p)
- {
- this.plugin = p;
- this.plugin.window_minimized.connect (this.window_minimized);
- this.plugin.window_maximized.connect (this.window_maximized);
- this.plugin.window_unmaximized.connect (this.window_unmaximized);
- this.plugin.window_mapped.connect (this.window_mapped);
- this.plugin.window_destroyed.connect (this.window_destroyed);
- this.plugin.kill_window_effects.connect (this.kill_window_effects);
- }
-
- construct
- {
- }
-
- private int get_animation_speed (Mutter.Window window)
- {
- int type = window.get_window_type ();
- if (type == Mutter.MetaCompWindowType.NORMAL
- || type == Mutter.MetaCompWindowType.DIALOG
- || type == Mutter.MetaCompWindowType.MODAL_DIALOG)
- return 200;
- return 80;
- }
-
- private void window_maximized (Plugin plugin,
- Mutter.Window window,
- int x,
- int y,
- int width,
- int height)
- {
- /*
- * If the user purposly maximised a window, we want to unset any hint
- * that we put on it asking maximus to avoid the window
- */
- window.set_data (Maximus.user_unmaximize_hint, null);
-
- plugin.plugin.maximize_completed (window);
- }
-
- private void window_unmaximized (Plugin plugin,
- Mutter.Window window,
- int x,
- int y,
- int width,
- int height)
- {
- /* If the user has purposly unmaxmised a window, we want to let the
- * maximus plugin know of this, so it doesn't try and maximize it when
- * the user wants to unminimise the window
- */
-
- int i = 1;
- window.set_data (Maximus.user_unmaximize_hint, i.to_pointer ());
-
- plugin.plugin.unmaximize_completed (window);
- }
-
- private void window_minimized (Plugin plugin, Mutter.Window window)
- {
- int type = window.get_window_type ();
-
- if (type != Mutter.MetaWindowType.NORMAL &&
- type != Mutter.MetaWindowType.DIALOG &&
- type != Mutter.MetaWindowType.MODAL_DIALOG &&
- type != Mutter.MetaWindowType.MENU
- )
- {
- this.plugin.plugin.minimize_completed (window);
- return;
- }
-
- Mutter.MetaRectangle rect = {0, 0, 0, 0};
-
- int speed = get_animation_speed (window);
- Clutter.Animation anim = null;
- Clutter.Actor actor = window as Clutter.Actor;
- if (Mutter.MetaWindow.get_icon_geometry (window.get_meta_window (), rect))
- {
- float scale = float.min (float.min (1, rect.width / actor.width), float.min (1, rect.height / actor.height));
-
- actor.set ("scale-gravity", Clutter.Gravity.CENTER);
- anim = actor.animate (Clutter.AnimationMode.EASE_IN_SINE, speed,
- "opacity", 0,
- "x", (float) ((rect.x + rect.width / 2) - (actor.width / 2)),
- "y", (float) ((rect.y + rect.height / 2) - (actor.height / 2)),
- "scale-x", scale,
- "scale-y", scale);
- }
- else
- {
- anim = actor.animate (Clutter.AnimationMode.EASE_IN_SINE, speed, "opacity", 0);
- }
-
- anim.completed.connect (this.window_minimized_completed);
- }
-
- private void window_minimized_completed (Clutter.Animation anim)
- {
- unowned Mutter.Window window = anim.get_object () as Mutter.Window;
-
- if (window == null)
- return;
-
- window.hide ();
- this.plugin.plugin.minimize_completed (window);
- }
-
- private bool force_activate ()
- {
- if (this.last_mapped is Mutter.Window)
- {
- unowned Mutter.MetaWindow w = this.last_mapped.get_meta_window ();
- unowned Mutter.MetaDisplay d = Mutter.MetaWindow.get_display (w);
-
- Mutter.MetaWindow.activate (this.last_mapped.get_meta_window (),
- Mutter.MetaDisplay.get_current_time (d));
- }
-
- return false;
- }
-
-
- private void window_mapped (Plugin plugin, Mutter.Window window)
- {
- int type = window.get_window_type ();
-
- if (type != Mutter.MetaWindowType.NORMAL &&
- type != Mutter.MetaWindowType.DIALOG &&
- type != Mutter.MetaWindowType.MODAL_DIALOG &&
- type != Mutter.MetaWindowType.MENU
- )
- {
- this.plugin.plugin.map_completed (window);
- return;
- }
-
- if (plugin.expose_manager.expose_showing)
- {
- window.opacity = 0;
- this.plugin.plugin.map_completed (window);
- return;
- }
-
- if (type == Mutter.MetaWindowType.NORMAL ||
- type == Mutter.MetaWindowType.DIALOG)
- {
- Mutter.MetaWindow.activate (window.get_meta_window (),
- Mutter.MetaWindow.get_user_time (
- window.get_meta_window ()));
- this.last_mapped = window;
- Timeout.add (0, this.force_activate);
- }
-
- Clutter.Animation anim = null;
- Clutter.Actor actor = window as Clutter.Actor;
- actor.opacity = 0;
- window.show ();
-
- int speed = get_animation_speed (window);
-
- Mutter.MetaRectangle rect = {0, 0, 0, 0};
- if (Mutter.MetaWindow.get_icon_geometry (window.get_meta_window (), rect))
- {
- rect = {0, 0, 0, 0};
- Mutter.MetaWindow.get_outer_rect (window.get_meta_window (), rect);
- actor.set ("scale-gravity", Clutter.Gravity.CENTER);
- anim = actor.animate (Clutter.AnimationMode.EASE_IN_SINE, speed,
- "opacity", 255,
- "x", (float) rect.x,
- "y", (float) rect.y,
- "scale-x", 1f,
- "scale-y", 1f);
- }
- else
- {
- anim = actor.animate (Clutter.AnimationMode.EASE_IN_SINE, speed, "opacity", 255);
- }
-
- anim.completed.connect (this.window_mapped_completed);
- }
-
- private void window_mapped_completed (Clutter.Animation anim)
- {
- unowned Mutter.Window window = anim.get_object () as Mutter.Window;
-
- if (window == null)
- return;
-
- (window as Clutter.Actor).opacity = 255;
- this.plugin.plugin.map_completed (window);
- }
-
- private void window_destroyed (Plugin plugin, Mutter.Window window)
- {
- int type = window.get_window_type ();
-
- if (type != Mutter.MetaWindowType.NORMAL &&
- type != Mutter.MetaWindowType.DIALOG &&
- type != Mutter.MetaWindowType.MODAL_DIALOG &&
- type != Mutter.MetaWindowType.MENU
- )
- {
- this.plugin.plugin.destroy_completed (window);
- return;
- }
-
- Clutter.Animation anim = null;
-
- int speed = get_animation_speed (window);
-
- anim = window.animate (Clutter.AnimationMode.EASE_IN_SINE, speed,
- "opacity", 0);
-
- anim.completed.connect (this.window_destroyed_completed);
- }
-
- private void window_destroyed_completed (Clutter.Animation anim)
- {
- unowned Mutter.Window window = (Mutter.Window)anim.get_object ();
-
- this.plugin.plugin.destroy_completed (window);
- }
-
- private void kill_window_effects (Plugin plugin,
- Mutter.Window window)
- {
- /* var anim = window.get_animation ();
-
- if (anim is Clutter.Animation)
- anim.completed ();
- */
- }
- }
-}
diff --git a/targets/unity/Makefile.am b/targets/unity/Makefile.am
deleted file mode 100644
index a36d6720a..000000000
--- a/targets/unity/Makefile.am
+++ /dev/null
@@ -1,75 +0,0 @@
-BUILT_SOURCES =
-CLEANFILES =
-EXTRA_DIST =
-
-DATADIR = $(datadir)
-if HAVE_TESTING
-BASE_CFLAGS+=-DTESTING
-endif
-
-if HAVE_LOCALINSTALL
-PKGDATADIR=$(top_srcdir)/data
-else
-PKGDATADIR=$(datadir)/unity
-endif
-bin_PROGRAMS = \
- unity
-
-unity_CPPFLAGS = \
- $(BASE_CFLAGS) \
- $(MAINTAINER_CFLAGS) \
- -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
- -I$(top_srcdir)/unity/ \
- -I$(top_srcdir)/unity-private/
-
-unity_VALAFLAGS = \
- -C \
- --vapidir=./ \
- --vapidir=$(top_srcdir)/unity/ \
- --vapidir=$(top_srcdir)/unity-private/ \
- --vapidir=$(top_srcdir)/vapi/ \
- --thread \
- --pkg Bamf-0.2 \
- --pkg clutk-0.3 \
- --pkg clutter-1.0 \
- --pkg clutter-gtk-0.10 \
- --pkg cogl-1.0 \
- --pkg config \
- --pkg dee-1.0 \
- --pkg dbus-glib-1 \
- --pkg Dbusmenu-Glib-0.2 \
- --pkg gtk+-2.0 \
- --pkg gdk-2.0 \
- --pkg gee-1.0 \
- --pkg indicator \
- --pkg x11 \
- --pkg gtk+-2.0 \
- --pkg gee-1.0 \
- --pkg unique-1.0 \
- --pkg unity \
- --pkg unity-const \
- --pkg unity-private \
- $(MAINTAINER_VALAFLAGS)
-
-unity_LDADD = \
- $(BASE_LIBS) \
- $(top_builddir)/unity/libunity.la \
- $(top_builddir)/unity-private/libunity-private.la
-
-unity_VALASOURCES = \
- main.vala
-
-unity_SOURCES = \
- $(unity_VALASOURCES:.vala=.c)
-
-BUILT_SOURCES += unity.vala.stamp
-EXTRA_DIST += unity.vala.stamp $(unity_VALASOURCES)
-
-unity.vala.stamp: $(unity_VALASOURCES)
- $(AM_V_GEN) $(VALAC) $(unity_VALAFLAGS) $^
- touch unity.vala.stamp
-
-CLEANFILES += \
- *.stamp \
- *.vapi \
- $(unity_VALASOURCES:.vala=.c)
diff --git a/targets/unity/main.vala b/targets/unity/main.vala
deleted file mode 100644
index 49a0afd26..000000000
--- a/targets/unity/main.vala
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * 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, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
- *
- */
-using Unity;
-
-static bool show_unity = false;
-static bool popup_mode = false;
-static int popup_width = 1024;
-static int popup_height = 600;
-static bool show_version = false;
-static string? webapp_uri = null;
-static string? boot_logging_filename = null;
-
-const OptionEntry[] options = {
- {
- "show",
- 's',
- 0,
- OptionArg.NONE,
- ref show_unity,
- "Show Unity to the user",
- null
- },
- {
- "popup",
- 'p',
- 0,
- OptionArg.NONE,
- ref popup_mode,
- "Popup the Unity window (for debugging)",
- null
- },
- {
- "width",
- 'w',
- 0,
- OptionArg.INT,
- ref popup_width,
- "Width of Unity window (use with --popup/-p). Default: 1024",
- null
- },
- {
- "height",
- 'h',
- 0,
- OptionArg.INT,
- ref popup_height,
- "Height of Unity window (use with --popup/-p). Default: 600",
- null
- },
- {
- "version",
- 'v',
- 0,
- OptionArg.NONE,
- ref show_version,
- "Show the version and exit",
- null
- },
- {
- "webapp",
- 'b',
- 0,
- OptionArg.STRING,
- ref webapp_uri,
- "Supply a webapp url to have unity load the webapp into your favorites",
- null
- },
- {
- null
- }
-};
-
-public class Main
-{
- public static int main (string[] args)
- {
- Unity.Application app;
- Unity.Testing.Window window;
- Unity.TimelineLogger.get_default(); // just inits the timer for logging
-
- GLib.Intl.textdomain (Config.GETTEXT_PACKAGE);
- GLib.Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALE_DIR);
- GLib.Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
-
- try
- {
- var opt_context = new OptionContext ("-- Unity");
- opt_context.set_help_enabled (true);
- opt_context.add_main_entries (options, null);
- opt_context.parse (ref args);
- }
- catch (OptionError e)
- {
- warning ("Unable to parse arguments: %s", e.message);
- warning ("Run '%s --help' to see a full list of available command line options",
- args[0]);
- return 1;
- }
-
- if (show_version)
- {
- print ("\nUnity %s\n", Config.VERSION);
- return 0;
- }
- // attempt to get a boot logging filename
- boot_logging_filename = Environment.get_variable ("UNITY_BOOTLOG_FILENAME");
- if (boot_logging_filename != null)
- {
- Unity.is_logging = true;
- }
- else
- {
- Unity.is_logging = false;
- }
- START_FUNCTION ();
-
- /* Parse options */
- LOGGER_START_PROCESS ("gtk_init");
- Gtk.init (ref args);
- LOGGER_END_PROCESS ("gtk_init");
- LOGGER_START_PROCESS ("ctk_init");
- Ctk.init (ref args);
- LOGGER_END_PROCESS ("ctk_init");
-
- Gtk.Settings.get_default ().gtk_icon_theme_name = "ubuntu-mono-dark";
-
- /* Unique instancing */
- LOGGER_START_PROCESS ("unity_application_constructor");
- app = new Unity.Application ();
- LOGGER_END_PROCESS ("unity_application_constructor");
-
- string? disable_unique = Environment.get_variable ("UNITY_NO_UNIQUE");
- if (app.is_running && disable_unique == null)
- {
- Unique.Response response = Unique.Response.OK;
-
- if (show_unity)
- {
- print ("Showing Unity window\n");
- response = app.send_message (Unity.ApplicationCommands.SHOW, null);
- }
- else if (webapp_uri != null)
- {
- print ("building webapp\n");
- var message = new Unique.MessageData ();
- message.set_text (webapp_uri, (ssize_t)webapp_uri.len);
- response = app.send_message (Unity.ApplicationCommands.MAKE_WEBAPP, message);
- }
- else
- {
- print ("There already another instance of Unity running\n");
- }
-
- return response == Unique.Response.OK ? 0 : 1;
- }
-
- /* Make sure we don't load the tray */
- var cur_tray_envvar = Environment.get_variable ("UNITY_DISABLE_TRAY");
- Environment.set_variable ("UNITY_DISABLE_TRAY", "1", true);
-
- /* Things seem to be okay, load the main window */
- window = new Unity.Testing.Window (popup_mode, popup_width, popup_height);
- app.shell = window;
- LOGGER_START_PROCESS ("unity_underlay_window_show");
- window.show ();
- LOGGER_END_PROCESS ("unity_underlay_window_show");
-
- END_FUNCTION ();
-
- if (boot_logging_filename != null)
- {
- Timeout.add_seconds (1, () => {
- Unity.TimelineLogger.get_default().write_log (boot_logging_filename);
- return false;
- });
- }
-
- Gtk.main ();
-
- /* Restore envvar */
- Environment.set_variable ("UNITY_DISABLE_TRAY", cur_tray_envvar, true);
-
- return 0;
- }
-}
diff --git a/tools/Makefile.am b/tools/Makefile.am
deleted file mode 100644
index a19c05042..000000000
--- a/tools/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-EXTRA_DIST = makebootchart.py unity-xephyr.py
-
-dist_libexec_SCRIPTS = migrate_favorites.py
diff --git a/tools/unity-xephyr.py b/tools/unity-xephyr.py
deleted file mode 100755
index 0a3a299cf..000000000
--- a/tools/unity-xephyr.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/python
-
-import os
-import sys
-import subprocess
-import time
-import signal
-
-start_display = os.environ["DISPLAY"]
-
-DISPLAY=":12"
-
-# Start Xephyr
-try:
- xephyr = subprocess.Popen (["Xephyr", DISPLAY, "-screen", "1024x600", "-host-cursor"])
-except OSError, e:
- if e.errno == errno.ENOENT:
- print "Could not find Xephyr"
- sys.exit (1)
- else:
- raise
-
-time.sleep (3)
-
-f=os.popen("dbus-launch")
-f=os.popen("export %s" % f.read())
-
-os.environ["DISPLAY"] = DISPLAY
-
-time.sleep (2)
-subprocess.Popen(["gcalctool"])
-subprocess.Popen(["gnome-panel"])
-subprocess.Popen(["nautilus"])
-
-time.sleep (1)
-# Start Mutter
-if os.path.exists(os.path.join(os.getcwd(), "mutter-plugin")):
- print ""
- print "Using locally built libunity-mutter.la"
- print ""
- plugin = os.path.join(os.getcwd(), "mutter-plugin", "libunity-mutter.la")
-else:
- print ""
- print "Using system libunity-mutter.so"
- print ""
- plugin = "libunity-mutter"
-
-args = []
-args.extend(["mutter", "--mutter-plugins="+plugin])
-
-mutter = subprocess.Popen(args)
-
-try:
- mutter.wait ()
-except KeyboardInterrupt, e:
- try:
- os.kill(mutter.pid, signal.SIGKILL)
- except:
- pass
- mutter.wait ()
-finally:
- try:
- os.kill(xephyr.pid, signal.SIGKILL)
- except OSError:
- pass
- os.environ['DISPLAY'] = start_display
diff --git a/unity-private/Makefile.am b/unity-private/Makefile.am
deleted file mode 100644
index 89805b4f2..000000000
--- a/unity-private/Makefile.am
+++ /dev/null
@@ -1,182 +0,0 @@
-BUILT_SOURCES =
-CLEANFILES =
-EXTRA_DIST =
-
-DATADIR = $(datadir)
-if HAVE_TESTING
-BASE_CFLAGS+=-DTESTING
-endif
-
-if HAVE_LOCALINSTALL
-PKGDATADIR=$(top_srcdir)/data
-else
-PKGDATADIR=$(datadir)/unity
-endif
-lib_LTLIBRARIES = \
- libunity-private.la
-
-libunity_private_la_CPPFLAGS = \
- -DDATADIR=\"$(DATADIR)\" \
- -DPKGDATADIR=\"$(PKGDATADIR)\" \
- -DINDICATORDIR=\""$(INDICATORDIR)"\" \
- -DINDICATORICONSDIR=\""$(INDICATORICONSDIR)"\" \
- -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
- -DG_LOG_DOMAIN=\"libunity-private\" \
- -DGNOME_DESKTOP_USE_UNSTABLE_API \
- $(BASE_CFLAGS) \
- $(MAINTAINER_CFLAGS) \
- -I$(top_srcdir)/unity/ \
- -I$(top_srcdir)/src/ \
- -I$(top_srcdir)/places/ \
- -I$(top_srcdir)/launcher/ \
- -I$(top_srcdir)/testing/
-
-libunity_private_la_VALAFLAGS = \
- -C \
- -H unity-private.h -d . \
- --thread \
- --library unity-private \
- --vapidir=$(top_srcdir)/vapi/ \
- --vapidir=$(top_srcdir)/unity/ \
- --pkg Bamf-0.2 \
- --pkg clutk-0.3 \
- --pkg clutter-1.0 \
- --pkg clutter-gtk-0.10 \
- --pkg config \
- --pkg cogl-1.0 \
- --pkg dbus-glib-1 \
- --pkg Dbusmenu-Glib-0.2\
- --pkg dee-1.0 \
- --pkg gconf-2.0 \
- --pkg gdk-2.0 \
- --pkg gdk-x11-2.0 \
- --pkg gee-1.0 \
- --pkg gio-unix-2.0 \
- --pkg gtk+-2.0 \
- --pkg gnome-bg-2.0 \
- --pkg indicator \
- --pkg libwnck-1.0 \
- --pkg pango \
- --pkg unity \
- --pkg unity-const \
- --pkg unity-misc \
- --pkg unique-1.0 \
- --pkg x11 \
- $(MAINTAINER_VALAFLAGS)
-
-libunity_private_la_LIBADD = \
- $(BASE_LIBS) \
- $(top_builddir)/unity/libunity.la
-
-# Vala Sources
-private_sources = \
- application.vala \
- unity.vala \
- unity-quirks.vala \
- utils.vala
-
-panel_sources = \
- panel/panel-background.vala \
- panel/panel-divider.vala \
- panel/panel-home-button.vala \
- panel/panel-indicator-background.vala \
- panel/panel-indicator-bar.vala \
- panel/panel-indicator-model.vala \
- panel/panel-indicator-object-entry-view.vala \
- panel/panel-indicator-object-view.vala \
- panel/panel-menu-manager.vala \
- panel/panel-menubar.vala \
- panel/panel-tray.vala \
- panel/panel-view.vala \
- panel/panel-window-buttons.vala
-
-places_sources = \
- places/places-button.vala \
- places/places-controller.vala \
- places/places-default-renderer-group.vala \
- places/places-default-renderer-tiles.vala \
- places/places-default-renderer.vala \
- places/places-folder-browser-renderer.vala \
- places/places-place-bar.vala \
- places/places-place-entry-scroller-child.vala \
- places/places-place-entry-view.vala \
- places/places-place-entry.vala \
- places/places-place-home.vala \
- places/places-place-home-renderer.vala \
- places/places-place-model.vala \
- places/places-place-view.vala \
- places/places-place.vala \
- places/places-place-search-bar.vala \
- places/places-place-search-entry.vala \
- places/places-place-search-extra-action.vala \
- places/places-place-search-navigation.vala \
- places/places-place-search-sections-bar.vala \
- places/places-trash-controller.vala \
- places/places-view.vala \
- places/places-volume-controller.vala \
- places/places-volume-child-controller.vala
-
-launcher_sources = \
- launcher/application-controller.vala \
- launcher/launcher.vala \
- launcher/quicklist-check-menu-item.vala \
- launcher/quicklist-controller.vala \
- launcher/quicklist-image-menu-item.vala \
- launcher/quicklist-menu-item.vala \
- launcher/quicklist-radio-menu-item.vala \
- launcher/quicklist-seperator-menu-item.vala \
- launcher/quicklist-view.vala \
- launcher/scrollerchild-controller.vala \
- launcher/scrollerchild.vala \
- launcher/scroller-controller.vala \
- launcher/scroller-model.vala \
- launcher/scroller-view.vala
-
-gesture_sources = \
- gesture/gesture-dispatcher.vala \
- gesture/gesture-dispatcher-xcb.vala \
- gesture/gesture-dispatcher-xcb-glu.vala \
- gesture/gesture-event.vala
-
-
-testing_sources = \
- testing/background.vala \
- testing/object-registry.vala \
- testing/perf-logger.vala \
- testing/test-director.vala \
- testing/test-utils.vala \
- testing/test-window.vala
-
-libunity_private_la_VALASOURCES = \
- $(gesture_sources) \
- $(private_sources) \
- $(panel_sources) \
- $(places_sources) \
- $(launcher_sources) \
- $(testing_sources)
-
-libunity_private_la_SOURCES = \
- gesture/gesture.c \
- gesture/gesture.h \
- gesture/gesture-dispatcher-xcb-glue.c \
- unity-utils.c \
- unity-utils.h \
- $(libunity_private_la_VALASOURCES:.vala=.c)
-
-libunity_private_la_APIFILES = unity-private.vapi unity-private.h unity-utils.h
-
-BUILT_SOURCES += libunity_private_la.vala.stamp
-EXTRA_DIST += \
- libunity_private_la.vala.stamp \
- $(libunity_private_la_APIFILES) \
- $(libunity_private_la_VALASOURCES)
-
-libunity_private_la.vala.stamp $(libunity_private_la_APIFILES): $(libunity_private_la_VALASOURCES)
- $(AM_V_GEN) $(VALAC) $(libunity_private_la_VALAFLAGS) $^
- touch libunity_private_la.vala.stamp
-
-CLEANFILES += \
- *.stamp \
- *.vapi \
- $(libunity_private_la_VALASOURCES:.vala=.c) \
- unity-private.h
diff --git a/unity/Makefile.am b/unity/Makefile.am
deleted file mode 100644
index 679dd83fe..000000000
--- a/unity/Makefile.am
+++ /dev/null
@@ -1,105 +0,0 @@
-BUILT_SOURCES =
-CLEANFILES =
-EXTRA_DIST =
-
-lib_LTLIBRARIES = \
- libunity.la
-
-##
-# Headers and vapi
-##
-unityincludedir = $(includedir)/unity/unity
-unityinclude_HEADERS = \
- unity.h
-
-unityvapidir = $(datadir)/vala/vapi
-unityvapi_DATA = unity.vapi
-
-
-##
-# libunity
-##
-if HAVE_LOCALINSTALL
-PKGDATADIR=$(top_srcdir)/data
-else
-PKGDATADIR=$(datadir)/unity
-endif
-
-libunity_la_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"libunity\" \
- -DPKGDATADIR=\"$(PKGDATADIR)\" \
- $(BASE_CFLAGS) \
- $(MAINTAINER_CFLAGS)
-
-libunity_la_LIBADD = \
- $(BASE_LIBS)
-
-libunity_la_VALAFLAGS = \
- -C \
- -H unity.h -d . \
- --library unity \
- --vapidir=$(top_srcdir)/vapi/ \
- --thread \
- --pkg config \
- --pkg clutter-1.0 \
- --pkg clutk-0.3 \
- --pkg dbus-glib-1 \
- --pkg Dbusmenu-Glib-0.2 \
- --pkg dee-1.0 \
- --pkg gconf-2.0 \
- --pkg gtk+-2.0 \
- --pkg gio-2.0 \
- --pkg gio-unix-2.0 \
- --pkg gee-1.0 \
- --pkg Bamf-0.2 \
- --pkg unique-1.0 \
- --pkg unity-const \
- $(MAINTAINER_VALAFLAGS)
-
-libunity_la_SOURCES = \
- $(libunity_la_VALASOURCES:.vala=.c)
-
-libunity_la_VALASOURCES = \
- chrome-handler.vala \
- drag-controller.vala \
- drag-view.vala \
- entry.vala \
- icon-postprocessor.vala \
- prism-handler.vala \
- quicklist-rendering.vala \
- shell.vala \
- theme.vala \
- unity-appinfo-manager.vala \
- unity-cairo-canvas.vala \
- unity-expanding-bin.vala \
- unity-favorites.vala \
- unity-io.vala \
- unity-layered-bin.vala \
- unity-pixbuf-cache.vala \
- unity-place.vala \
- unity-place-activation.vala \
- unity-place-browser.vala \
- unity-place-renderer.vala \
- unity-stripe-texture.vala \
- webapp-fetcher.vala
-
-
-libunity_la_APIFILES = \
- unity.h \
- unity.vapi
-
-BUILT_SOURCES += libunity_la_vala.stamp
-EXTRA_DIST += \
- $(BUILT_SOURCES) \
- $(libunity_la_APIFILES) \
- $(libunity_la_VALASOURCES)
-
-libunity_la_vala.stamp $(libunity_la_APIFILES): $(libunity_la_VALASOURCES)
- $(AM_V_GEN) $(VALAC) $(libunity_la_VALAFLAGS) $^
- touch libunity_la_vala.stamp
-
-CLEANFILES += \
- *.stamp \
- $(libunity_la_APIFILES) \
- $(libunity_la_VALASOURCES:.vala=.c) \
- *.vapi
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
deleted file mode 100644
index 16ad30c8b..000000000
--- a/vapi/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-EXTRA_DIST = \
- Bamf-0.2.vapi \
- clutk-0.3.vapi \
- clutter-1.0.vapi \
- clutter-1.0.deps \
- cogl-1.0.vapi \
- config.vapi \
- Dbusmenu-Glib-0.2.vapi \
- dee-1.0.deps \
- dee-1.0.vapi \
- indicator.deps \
- indicator.vapi \
- launcher-0.3.vapi \
- launcher-0.3.deps \
- mutter-2.28.vapi \
- mutter-2.28.deps \
- unity-const.vapi \
- unity-misc.vapi \
- gnome-bg-2.0.vapi