summaryrefslogtreecommitdiff
path: root/mutter-plugin
diff options
authorGordon Allott <gord@zazu>2010-01-27 15:08:40 +0000
committerGordon Allott <gord@zazu>2010-01-27 15:08:40 +0000
commitaace61743d85887045009c553acdb2bab6378d15 (patch)
tree65e150b34a049be7f8b6a46bd9ba23d935d52996 /mutter-plugin
parentc0a129ef91c31af007064676579db0d076d43b4a (diff)
parent1ab3dad14c2d5578c337d7dcc3412405df76ce21 (diff)
merged with latest unity
(bzr r70.1.2)
Diffstat (limited to 'mutter-plugin')
-rw-r--r--mutter-plugin/Makefile.am10
-rw-r--r--mutter-plugin/main.c49
-rw-r--r--mutter-plugin/plugin.vala125
3 files changed, 125 insertions, 59 deletions
diff --git a/mutter-plugin/Makefile.am b/mutter-plugin/Makefile.am
index bb1c822c6..7fc4448c6 100644
--- a/mutter-plugin/Makefile.am
+++ b/mutter-plugin/Makefile.am
@@ -1,6 +1,6 @@
-BUILT_SOURCES =
-CLEANFILES =
-EXTRA_DIST =
+BUILT_SOURCES =
+CLEANFILES =
+EXTRA_DIST =
if ENABLE_MUTTER
@@ -13,6 +13,7 @@ mutterlibdir = /tmp/mutter-plugin/
else
mutterlibdir = $(MUTTER_PLUGIN_DIR)
endif
+
mutterlib_LTLIBRARIES = \
libunity-mutter.la
@@ -35,6 +36,7 @@ libunity_mutter_la_VALAFLAGS = \
--pkg clutk-0.3 \
--pkg gtk+-2.0 \
--pkg gee-1.0 \
+ --pkg indicator \
--pkg mutter-2.28 \
--pkg launcher-0.3 \
--pkg libwnck-1.0 \
@@ -72,7 +74,7 @@ EXTRA_DIST += \
$(BUILT_SOURCES) $(libunity_mutter_la_APIFILES): $(libunity_mutter_la_VALASOURCES)
$(AM_V_GEN) $(VALAC) $(libunity_mutter_la_VALAFLAGS) $^
- touch libunity_mutter_la.vala.stamp
+ touch libunity_mutter_la.vala.stamp
CLEANFILES += \
*.stamp \
diff --git a/mutter-plugin/main.c b/mutter-plugin/main.c
index 186323310..d6890e12b 100644
--- a/mutter-plugin/main.c
+++ b/mutter-plugin/main.c
@@ -92,6 +92,8 @@ static void unity_mutter_kill_effect (MutterPlugin *self,
static gboolean unity_mutter_xevent_filter (MutterPlugin *self,
XEvent *event);
+static void on_restore_input_region (UnityPlugin *plugin, MutterPlugin *self);
+
static const MutterPluginInfo * unity_mutter_plugin_info (MutterPlugin *self);
static void
@@ -127,7 +129,7 @@ unity_mutter_constructed (GObject *object)
cairo_font_options_t *font_options;
clutter_set_font_flags (clutter_get_font_flags () & ~CLUTTER_FONT_MIPMAPPING);
-
+
backend = clutter_get_default_backend ();
font_options = cairo_font_options_create ();
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
@@ -135,10 +137,53 @@ unity_mutter_constructed (GObject *object)
cairo_font_options_destroy (font_options);
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
+on_restore_input_region (UnityPlugin *plugin, MutterPlugin *self)
+{
+ MetaScreen *screen;
+ MetaDisplay *display;
+ Display *xdisplay;
+ XRectangle *rects;
+ gint width=0, height=0;
+ XserverRegion region;
+
+ g_return_if_fail (MUTTER_IS_PLUGIN (self));
+
+ 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);
+
+ rects = g_new (XRectangle, 2);
+
+ /* Panel first */
+ rects[0].x = 0;
+ rects[0].y = 0;
+ rects[0].width = width;
+ rects[0].height = unity_plugin_get_panel_height (plugin);
+
+ /* Launcher */
+ rects[1].x = 0;
+ rects[1].y = rects[0].height;
+ rects[1].width = unity_plugin_get_launcher_width (plugin);
+ rects[1].height = 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)
{
@@ -167,7 +212,7 @@ unity_mutter_unmaximize (MutterPlugin *self,
unity_plugin_unmaximize (UNITY_MUTTER(self)->plugin, window, x, y, width, height);
}
-static void
+static void
unity_mutter_map (MutterPlugin *self,
MutterWindow *window)
{
diff --git a/mutter-plugin/plugin.vala b/mutter-plugin/plugin.vala
index a1694f617..5a1a0782e 100644
--- a/mutter-plugin/plugin.vala
+++ b/mutter-plugin/plugin.vala
@@ -58,6 +58,8 @@ namespace Unity
Mutter.Window window,
ulong events);
+ public signal void restore_input_region ();
+
/* Properties */
private Mutter.Plugin? _plugin;
public Mutter.Plugin? plugin {
@@ -77,6 +79,7 @@ namespace Unity
private Quicklauncher.View quicklauncher;
private Places.Controller places_controller;
private Places.View places;
+ private Panel.View panel;
private DragDest drag_dest;
private bool places_showing;
@@ -120,20 +123,21 @@ namespace Unity
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 }
- };
+ 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);
@@ -142,11 +146,13 @@ namespace Unity
this.stage.add_actor (this.background);
this.background.lower_bottom ();
+ Clutter.Group window_group = (Clutter.Group) this.plugin.get_window_group ();
+
this.quicklauncher = new Quicklauncher.View (this);
this.quicklauncher.opacity = 0;
- this.stage.add_actor (this.quicklauncher);
- this.stage.raise_child (this.quicklauncher,
- this.plugin.get_window_group());
+ window_group.add_actor (this.quicklauncher);
+ window_group.raise_child (this.quicklauncher,
+ this.plugin.get_normal_window_group ());
this.quicklauncher.animate (Clutter.AnimationMode.EASE_IN_SINE, 400,
"opacity", 255);
@@ -154,9 +160,14 @@ namespace Unity
this.places = this.places_controller.get_view ();
this.places.opacity = 0;
this.stage.add_actor (this.places);
- this.stage.raise_child (this.places, this.quicklauncher);
+ this.stage.raise_child (this.places, window_group);
this.places_showing = false;
+ this.panel = new Panel.View (this);
+ this.stage.add_actor (this.panel);
+ this.stage.raise_child (this.panel, this.places);
+ this.panel.show ();
+
this.relayout ();
END_FUNCTION ();
@@ -167,6 +178,8 @@ namespace Unity
return false;
});
}
+
+ this.restore_input_region ();
}
private void relayout ()
@@ -189,21 +202,22 @@ namespace Unity
this.quicklauncher.set_clip (0, 0,
this.QUICKLAUNCHER_WIDTH,
height-this.PANEL_HEIGHT);
- Utils.set_strut ((Gtk.Window)this.drag_dest, 58, 0, (uint32)height);
+ Utils.set_strut ((Gtk.Window)this.drag_dest,
+ 58, 0, (uint32)height,
+ PANEL_HEIGHT, 0, (uint32)width);
this.places.set_size (width, height);
this.places.set_position (0, 0);
- this.plugin.set_stage_input_area (0,
- this.PANEL_HEIGHT,
- this.QUICKLAUNCHER_WIDTH,
- (int)(height - this.PANEL_HEIGHT));
- END_FUNCTION ();
+ this.panel.set_size (width, 24);
+ this.panel.set_position (0, 0);
+
/* Leaving this here to remind me that we need to use these when
* there are fullscreen windows etc
* this.plugin.set_stage_input_region (uint region);
- * this.plugin.set_stage_reactive (true);
+ * this.plugin.set_stage_reactive (true);
*/
+ END_FUNCTION ();
}
public void set_in_menu (bool is_in_menu)
@@ -219,10 +233,7 @@ namespace Unity
}
else
{
- this.plugin.set_stage_input_area (0,
- this.PANEL_HEIGHT,
- this.QUICKLAUNCHER_WIDTH,
- (int)(height - this.PANEL_HEIGHT));
+ this.restore_input_region ();
}
}
@@ -232,11 +243,7 @@ namespace Unity
{
actor.destroy.connect (() =>
{
- this.plugin.set_stage_input_area (0,
- this.PANEL_HEIGHT,
- this.QUICKLAUNCHER_WIDTH,
- (int)(this.stage.height
- -this.PANEL_HEIGHT));
+ this.restore_input_region ();
});
this.plugin.set_stage_input_area (0, 0,
(int)this.stage.width,
@@ -257,38 +264,41 @@ namespace Unity
return ShellMode.UNDERLAY;
}
+ public int get_indicators_width ()
+ {
+ return this.panel.get_indicators_width ();
+ }
+
public void show_unity ()
{
if (this.places_showing)
{
this.places_showing = false;
- this.places.animate (Clutter.AnimationMode.EASE_OUT_SINE, 300,
- "opacity", 0);
- var win_group = this.plugin.get_window_group ();
- win_group.animate (Clutter.AnimationMode.EASE_IN_SINE, 300,
- "opacity", 255);
- this.plugin.set_stage_input_area (0,
- this.PANEL_HEIGHT,
- this.QUICKLAUNCHER_WIDTH,
- (int)(this.stage.height
- - this.PANEL_HEIGHT));
+ this.places.opacity = 0;
+ this.plugin.get_above_window_group ().opacity = 255;
+ this.plugin.get_normal_window_group ().opacity = 255;
+ this.plugin.get_below_window_group().opacity = 255;
+
+ this.panel.set_indicator_mode (false);
+
+ this.restore_input_region ();
}
else
{
this.places_showing = true;
- this.places.animate (Clutter.AnimationMode.EASE_IN_SINE, 300,
- "opacity", 255);
- var win_group = this.plugin.get_window_group ();
- win_group.animate (Clutter.AnimationMode.EASE_OUT_SINE, 300,
- "opacity", 0);
+ this.places.opacity = 255;
+ this.plugin.get_above_window_group ().opacity = 0;
+ this.plugin.get_normal_window_group ().opacity = 0;
+ this.plugin.get_below_window_group().opacity = 0;
+
+ this.panel.set_indicator_mode (true);
this.plugin.set_stage_input_area (0,
- this.PANEL_HEIGHT,
+ 0,
(int)this.stage.width,
- (int)this.stage.height
- - this.PANEL_HEIGHT);
+ (int)this.stage.height);
}
debug ("Places showing: %s", this.places_showing ? "true":"false");
}
@@ -339,8 +349,17 @@ namespace Unity
public void kill_effect (Mutter.Window window, ulong events)
{
- debug ("Window kill event");
this.window_kill_effect (this, window, events);
}
+
+ public int get_panel_height ()
+ {
+ return PANEL_HEIGHT;
+ }
+
+ public int get_launcher_width ()
+ {
+ return QUICKLAUNCHER_WIDTH;
+ }
}
}