diff options
25 files changed, 366 insertions, 295 deletions
diff --git a/configure.ac b/configure.ac index 643fbe207..47a6a350d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ m4_define([unity_major], [0]) m4_define([unity_minor], [2]) -m4_define([unity_micro], [7]) +m4_define([unity_micro], [9]) m4_define([unity_api], [unity_major.unity_minor]) @@ -53,7 +53,7 @@ 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_ERROR([*** `perceptualdiff` not found, required for UI tests]) + AC_MSG_WARN([*** `perceptualdiff` not found, required for UI tests]) fi dnl Setup a few consts @@ -92,7 +92,7 @@ AC_SUBST(MAINTAINER_VALAFLAGS) dnl Check for module and library dependancies GLIB_REQUIRED=2.22 GTK_REQUIRED=2.18 -PKG_CHECK_MODULES(BASE, +PKG_CHECK_MODULES(BASE, clutter-1.0 >= 1.0 clutter-gtk-0.10 >= 0.10 clutk-0.3 >= 0.3.26 @@ -107,7 +107,6 @@ PKG_CHECK_MODULES(BASE, gconf-2.0 indicator libbamf >= 0.2 - libwnck-1.0 >= 2.28.0 unique-1.0 unity-misc x11) diff --git a/targets/mutter/Makefile.am b/targets/mutter/Makefile.am index 00206c0e7..1b8d6616c 100644 --- a/targets/mutter/Makefile.am +++ b/targets/mutter/Makefile.am @@ -44,7 +44,6 @@ libunity_mutter_la_VALAFLAGS = \ --pkg gee-1.0 \ --pkg indicator \ --pkg mutter-2.28 \ - --pkg libwnck-1.0 \ --pkg unique-1.0 \ --pkg x11 \ --pkg unity-const \ diff --git a/targets/mutter/expose-manager.vala b/targets/mutter/expose-manager.vala index f4847d53b..cd4203bb0 100644 --- a/targets/mutter/expose-manager.vala +++ b/targets/mutter/expose-manager.vala @@ -26,7 +26,7 @@ namespace Unity private Clutter.Actor darken_box; private bool hovered; - public unowned Mutter.Window source { get; private set; } + public unowned Clutter.Actor source { get; private set; } public uint8 hovered_opacity { get; set; } public uint8 unhovered_opacity { get; set; } @@ -41,7 +41,7 @@ namespace Unity } } - public ExposeClone (Mutter.Window source) + public ExposeClone (Clutter.Actor source) { darken = 0; hovered_opacity = 255; @@ -130,7 +130,7 @@ namespace Unity { } - public void start_expose (SList<Wnck.Window> windows) + public void start_expose (SList<Clutter.Actor> windows) { var controller = Launcher.QuicklistController.get_default (); if (controller.menu_is_open ()) @@ -150,36 +150,28 @@ namespace Unity expose_group.raise_top (); expose_group.show (); - unowned GLib.List<Mutter.Window> mutter_windows = owner.plugin.get_windows (); - foreach (Mutter.Window w in mutter_windows) + foreach (Clutter.Actor actor in windows) { - bool keep = false; - ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (w.get_meta_window ()); - foreach (Wnck.Window window in windows) - { - if (window.get_xid () == xid) - { - keep = true; - break; - } - } - - if (keep) - { - ExposeClone clone = new ExposeClone (w); - clone.set_position (w.x, w.y); - clone.set_size (w.width, w.height); - exposed_windows.append (clone); - clone.reactive = true; - - expose_group.add_actor (clone); - - clone.hovered_opacity = hovered_opacity; - clone.unhovered_opacity = unhovered_opacity; - clone.opacity = unhovered_opacity; - clone.darken = darken; - - clone.enter_event.connect (() => { + 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 = new ExposeClone (actor); + 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.hovered_opacity = hovered_opacity; + clone.unhovered_opacity = unhovered_opacity; + clone.opacity = unhovered_opacity; + clone.darken = darken; + + clone.enter_event.connect (() => { var ql_controller = Launcher.QuicklistController.get_default (); if (ql_controller.menu_is_open () && this.menu_in_hover_close_state) { @@ -188,7 +180,7 @@ namespace Unity return false; }); - clone.leave_event.connect (() => { + clone.leave_event.connect (() => { var ql_controller = Launcher.QuicklistController.get_default (); if (ql_controller.menu_is_open () && this.menu_in_hover_close_state) { @@ -196,8 +188,11 @@ namespace Unity } return false; }); - } - + } + + 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; diff --git a/targets/mutter/plugin.vala b/targets/mutter/plugin.vala index 5f2b17b72..17aeb991a 100644 --- a/targets/mutter/plugin.vala +++ b/targets/mutter/plugin.vala @@ -128,6 +128,8 @@ namespace Unity private Panel.View panel; private ActorBlur actor_blur; private Clutter.Rectangle dark_box; + private unowned Mutter.MetaWindow? focus_window = null; + private unowned Mutter.MetaDisplay? display = null; private bool places_enabled = false; @@ -153,8 +155,6 @@ namespace Unity private DBus.Connection screensaver_conn; private dynamic DBus.Object screensaver; - private unowned Mutter.Window? active_window = null; - construct { Unity.global_shell = this; @@ -238,12 +238,6 @@ namespace Unity this.background.lower_bottom (); this.background.show (); - /* Allows us to activate windows, essential as we are the WM */ -/* - LibLauncher.Application.set_window_activate_func (this.on_window_activated, - this.plugin); -*/ - this.launcher = new Launcher.Launcher (this); this.launcher.get_view ().opacity = 0; @@ -297,99 +291,27 @@ namespace Unity } this.ensure_input_region (); - - Wnck.Screen.get_default ().active_window_changed.connect (on_active_window_changed); - - if (Wnck.Screen.get_default ().get_active_window () != null) - Wnck.Screen.get_default ().get_active_window ().state_changed.connect (on_active_window_state_changed); - return false; } - - private static void on_window_activated (Wnck.Window window, - uint32 timestamp, - void *data) - { - Mutter.Plugin plugin = data as Mutter.Plugin; - - unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows (); - foreach (Mutter.Window w in mutter_windows) - { - ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (w.get_meta_window ()); - if (window.get_xid () == xid) - { - unowned Mutter.MetaWindow win = w.get_meta_window (); - - Mutter.MetaWorkspace.activate (Mutter.MetaWindow.get_workspace(win), - timestamp); - Mutter.MetaWindow.activate (win, timestamp); - break; - } - } - } - - private void on_active_window_state_changed (Wnck.WindowState change_mask, Wnck.WindowState new_state) - { - check_fullscreen_obstruction (); - } - - private void on_active_window_changed (Wnck.Window? previous_window) - { - if (previous_window != null) - previous_window.state_changed.disconnect (on_active_window_state_changed); - - - Wnck.Window current = Wnck.Screen.get_default ().get_active_window (); - if (current == null) - return; - - current.state_changed.connect (on_active_window_state_changed); - - check_fullscreen_obstruction (); - } - -/* - private void on_launcher_changed_event (LauncherView? last, LauncherView? current) + + private void on_focus_window_changed () { - if (last != null) - { - last.menu_opened.disconnect (on_launcher_menu_opened); - last.menu_closed.disconnect (on_launcher_menu_closed); - } - - if (current != null) - { - current.menu_opened.connect (on_launcher_menu_opened); - current.menu_closed.connect (on_launcher_menu_closed); - } - check_fullscreen_obstruction (); - } -*/ -/* - - private void on_launcher_menu_opened (LauncherView sender) - { - if (sender != quicklauncher.manager.active_launcher || sender == null) - return; - - if (sender.model is ApplicationModel && sender.model.is_active) + + if (focus_window != null) { - if (QuicklistController.get_default ().menu_is_open ()) - expose_windows ((sender.model as ApplicationModel).windows); + 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_launcher_menu_closed (LauncherView sender) + + private void on_focus_window_fullscreen_changed () { - if (sender != quicklauncher.manager.active_launcher) - return; - - dexpose_windows (); + warning ("FOCUS WINDOW FULLSCREEN CHANGED"); + check_fullscreen_obstruction (); } -*/ private void got_screensaver_changed (dynamic DBus.Object screensaver, bool changed) { @@ -410,51 +332,32 @@ namespace Unity } } - bool window_is_obstructing (Wnck.Window window) + void check_fullscreen_obstruction () { - if (window.is_fullscreen ()) - return true; - - /* Sometimes we're not getting the fullscreen hint updating fast enough - * but the geometry seems to mostly be in sync. Seeing if the window is - * size-wise fullscreen seems to give us a good fallback when the props - * aren't in-sync. - * The -2.0 is because we have some variation when converting float to int - * from the stage. - */ - int x, y, w, h; - window.get_geometry (out x, out y, out w, out h); - - if (w >= (int)this.stage.width - 2.0 - && h >= (int)this.stage.height - 2.0) - return true; - - /* Finally try figuring out if the window is fullscreen in Mutter - * itself */ + 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 win in mutter_windows) + foreach (Mutter.Window w in mutter_windows) { - ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (win.get_meta_window ()); - if (xid == window.get_xid ()) - { - if (win.width >= ((int)this.stage.width - 2.0) && - win.height >= ((int)this.stage.height - 2.0)) - { - return true; - } + unowned Mutter.MetaWindow meta = w.get_meta_window (); + + if (meta != null && Mutter.MetaWindow.has_focus (w.get_meta_window ())) + { + focus = w; + break; } } - - return false; - } - - void check_fullscreen_obstruction () - { - Wnck.Window current = Wnck.Screen.get_default ().get_active_window (); - if (current == null) + + if (focus == null) return; - - if (window_is_obstructing (current)) + + (focus.get_meta_window () as GLib.Object).get ("fullscreen", ref fullscreen); + if (fullscreen) { this.launcher.get_view ().animate (Clutter.AnimationMode.EASE_IN_SINE, 200, "x", -100f); this.panel.animate (Clutter.AnimationMode.EASE_IN_SINE, 200, "opacity", 0); @@ -576,24 +479,12 @@ namespace Unity return; } - unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows (); - - GLib.SList <Wnck.Window> windows = null; + GLib.SList <Clutter.Actor> windows = null; + unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows (); foreach (Mutter.Window window in mutter_windows) { - int type = window.get_window_type (); - - if (type == Mutter.MetaWindowType.NORMAL || - type == Mutter.MetaWindowType.DIALOG || - type == Mutter.MetaWindowType.MODAL_DIALOG - ) - { - ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (window.get_meta_window ()); - Wnck.Window wnck_window = Wnck.Window.get (xid); - if (wnck_window is Wnck.Window) - windows.append (wnck_window); - } + windows.append (window as Clutter.Actor); } this.expose_windows (windows, 80); @@ -609,58 +500,69 @@ namespace Unity for (int i = 0; i < xids.length; i++) { uint32 xid = xids.index (i); - Wnck.Window window = Wnck.Window.get (xid); - if (window is Wnck.Window) - window.close (Clutter.get_current_event_time ()); + + 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) - { - SList<Wnck.Window> windows = new SList<Wnck.Window> (); - for (int i = 0; i < xids.length; i++) + public void expose_xids (Array<uint32> xids) + { + SList<Clutter.Actor> windows = new SList<Clutter.Actor> (); + for (int i = 0; i < xids.length; i++) { uint32 xid = xids.index (i); - Wnck.Window window = Wnck.Window.get (xid); - if (window is Wnck.Window) - windows.append (window); + + 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); - } + + expose_windows (windows); + } - public void stop_expose () - { - dexpose_windows (); - } + public void stop_expose () + { + dexpose_windows (); + } public void show_window (uint32 xid) { - Wnck.Window window = Wnck.Window.get (xid); - if (window is Wnck.Window) + unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_windows (); + + foreach (Mutter.Window mutter_window in mutter_windows) { - unowned GLib.List<Mutter.Window> mutter_windows = this.plugin.get_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 (); - foreach (Mutter.Window mutter_window in mutter_windows) - { - 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 (); - if (type == Mutter.MetaWindowType.NORMAL || - type == Mutter.MetaWindowType.DIALOG || - type == Mutter.MetaWindowType.MODAL_DIALOG - ) - { - ulong window_xid = (ulong) Mutter.MetaWindow.get_xwindow (mutter_window.get_meta_window ()); - if (window_xid == xid) - { - 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_); - } - } - } + 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_); } } @@ -674,7 +576,7 @@ namespace Unity return this.panel.get_indicators_width (); } - public void expose_windows (GLib.SList<Wnck.Window> windows, + public void expose_windows (GLib.SList<Clutter.Actor> windows, int left_buffer = 250) { expose_manager.left_buffer = left_buffer; @@ -801,21 +703,12 @@ namespace Unity { this.maximus.process_window (window); this.window_mapped (this, window); - -/* - int type = window.get_window_type (); - - if (type == Mutter.MetaWindowType.NORMAL || - type == Mutter.MetaWindowType.DIALOG || - type == Mutter.MetaWindowType.MODAL_DIALOG - ) + + if (display == null) { - ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (window.get_meta_window ()); - Wnck.Window wnck_window = Wnck.Window.get (xid); - if (wnck_window is Wnck.Window) - Launcher.Session.get_default ().update_windows (wnck_window); + display = Mutter.MetaWindow.get_display (window.get_meta_window ()); + display.notify["focus-window"].connect (on_focus_window_changed); } -*/ } public void destroy (Mutter.Window window) diff --git a/targets/mutter/window-management.vala b/targets/mutter/window-management.vala index 5468ed0ca..fd719b4a3 100644 --- a/targets/mutter/window-management.vala +++ b/targets/mutter/window-management.vala @@ -295,20 +295,16 @@ namespace Unity int speed = get_animation_speed (window); - ulong xid = (ulong) Mutter.MetaWindow.get_xwindow (window.get_meta_window ()); - Wnck.Window wnck_window = Wnck.Window.get (xid); - Mutter.MetaRectangle rect = {0, 0, 0, 0}; - if (wnck_window is Wnck.Window && - Mutter.MetaWindow.get_icon_geometry (window.get_meta_window (), rect)) + if (Mutter.MetaWindow.get_icon_geometry (window.get_meta_window (), rect)) { - int x, y, w, h; - wnck_window.get_geometry (out x, out y, out w, out h); + 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) x, - "y", (float) y, + "x", (float) rect.x, + "y", (float) rect.y, "scale-x", 1f, "scale-y", 1f); } diff --git a/targets/unity/Makefile.am b/targets/unity/Makefile.am index 81a463460..5fc417378 100644 --- a/targets/unity/Makefile.am +++ b/targets/unity/Makefile.am @@ -44,7 +44,6 @@ unity_VALAFLAGS = \ --pkg x11 \ --pkg gtk+-2.0 \ --pkg gee-1.0 \ - --pkg libwnck-1.0 \ --pkg unique-1.0 \ --pkg unity \ --pkg unity-const \ diff --git a/targets/unity/main.vala b/targets/unity/main.vala index 6882a737c..49a0afd26 100644 --- a/targets/unity/main.vala +++ b/targets/unity/main.vala @@ -191,7 +191,6 @@ public class Main }); } - Wnck.set_client_type (Wnck.ClientType.PAGER); Gtk.main (); /* Restore envvar */ diff --git a/tests/ui/Makefile.am b/tests/ui/Makefile.am index 3fc609d63..8d9b408de 100644 --- a/tests/ui/Makefile.am +++ b/tests/ui/Makefile.am @@ -38,7 +38,6 @@ test_ui_VALAFLAGS = \ --pkg indicator \ --pkg clutk-0.3 \ --pkg launcher-0.3 \ - --pkg libwnck-1.0 \ --pkg test-const \ --pkg unique-1.0 \ --pkg unity \ diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 7b4f77958..e6e64e1cf 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -39,7 +39,6 @@ test_unit_VALAFLAGS = \ --pkg indicator \ --pkg clutk-0.3 \ --pkg launcher-0.3 \ - --pkg libwnck-1.0 \ --pkg posix \ --pkg test-const \ --pkg unique-1.0 \ diff --git a/unity-private/Makefile.am b/unity-private/Makefile.am index 45a3b5270..8a09b5319 100644 --- a/unity-private/Makefile.am +++ b/unity-private/Makefile.am @@ -74,6 +74,7 @@ private_sources = \ panel_sources = \ panel/panel-background.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 \ @@ -86,8 +87,10 @@ panel_sources = \ places_sources = \ places/places-controller.vala \ places/places-place-bar.vala \ + places/places-place-entry-view.vala \ places/places-place-entry.vala \ places/places-place-model.vala \ + places/places-place-view.vala \ places/places-place.vala \ places/places-model.vala \ places/places-view.vala diff --git a/unity-private/launcher/application-controller.vala b/unity-private/launcher/application-controller.vala index 81f1e87c4..f4ba86637 100644 --- a/unity-private/launcher/application-controller.vala +++ b/unity-private/launcher/application-controller.vala @@ -241,6 +241,8 @@ namespace Unity.Launcher is_favorite = false; child.pin_type = PinType.UNPINNED; closed (); + if (".local" in desktop_filename) ++ FileUtils.remove (desktop_filename); } } diff --git a/unity-private/launcher/launcher-child.vala b/unity-private/launcher/launcher-child.vala index d9ad752ec..907d22653 100644 --- a/unity-private/launcher/launcher-child.vala +++ b/unity-private/launcher/launcher-child.vala @@ -223,7 +223,7 @@ namespace Unity.Launcher { progress = get_ease_out_sine (progress); processed_icon.set_rotation (Clutter.RotateAxis.Z_AXIS, progress * WIGGLE_SIZE, - 24.0f, 24.0f, 0.0f); + 25.0f, 25.0f, 0.0f); previous_wiggle_alpha = progress; if (progress >= 1.0) { @@ -250,7 +250,7 @@ namespace Unity.Launcher progress = get_circular_alpha (Math.fmodf (progress * frequency, 1.0f)); progress = (1.0f - progress) * 2.0f - 1.0f; processed_icon.set_rotation (Clutter.RotateAxis.Z_AXIS, progress * WIGGLE_SIZE, - 24.0f, 24.0f, 0.0f); + 25.0f, 25.0f, 0.0f); processed_icon.do_queue_redraw (); previous_wiggle_alpha = progress; @@ -273,7 +273,7 @@ namespace Unity.Launcher float alpha_length = previous_wiggle_alpha; float angle = alpha_length - (progress * alpha_length); processed_icon.set_rotation (Clutter.RotateAxis.Z_AXIS, angle, - 24.0f, 24.0f, 0.0f); + 25.0f, 25.0f, 0.0f); if (progress >= 1.0) { @@ -424,10 +424,8 @@ namespace Unity.Launcher out float minimum_height, out float natural_height) { - float nat, min; - processed_icon.get_preferred_height (for_width, out min, out nat); - natural_height = nat; - minimum_height = min; + natural_height = 48; + minimum_height = 48; } public override void allocate (Clutter.ActorBox box, Clutter.AllocationFlags flags) diff --git a/unity-private/panel/panel-indicator-background.vala b/unity-private/panel/panel-indicator-background.vala new file mode 100644 index 000000000..4cc765bf8 --- /dev/null +++ b/unity-private/panel/panel-indicator-background.vala @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2010 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.Panel +{ + public class IndicatorBackground : Clutter.CairoTexture + { + public const string BG = "/usr/share/unity/themes/panel_background.png"; + private int last_width = 0; + private int last_height = 0; + + Gdk.Pixbuf tile = null; + + public IndicatorBackground () + { + Object (); + } + + construct + { + try + { + /* I've loaded this in directly and not through theme due to use + * not having a good loader for pixbufs from the theme right now + */ + tile = new Gdk.Pixbuf.from_file (BG); + } + catch (Error e) + { + warning ("Unable to load panel background"); + } + } + + private override void allocate (Clutter.ActorBox box, + Clutter.AllocationFlags flags) + { + int width = (int)(box.x2 - box.x1) + 12; + int height = (int)(box.y2 - box.y1); + + Clutter.ActorBox child; + child = box; + child.x1 = child.x1 - 12; + child.x2 = child.x2 + 12; + + base.allocate (child, flags); + + if (width != last_width || height != last_height) + { + last_width = width; + last_height = height; + + Idle.add (update_background); + } + } + + private bool update_background () + { + Cairo.Context cr; + + set_surface_size (last_width, last_height); + + cr = create (); + + cr.set_operator (Cairo.Operator.CLEAR); + cr.paint (); + + cr.set_operator (Cairo.Operator.OVER); + cr.set_line_width (1.0); + + //cr.translate (0.5f, 0.5f); + + cr.move_to (-1, -1); + cr.line_to (last_width+1, -1); + cr.line_to (last_width+1, last_height); + cr.line_to (12, last_height); + cr.arc (12.0, last_height - 6.0f, 6, -Math.PI/2.0, 1.5*Math.PI/2.0); + cr.line_to (-1, -1); + + cr.set_source_rgb (61/255.0, 60/255.0, 56/255.0); + cr.fill (); + + + cr.move_to (-1, -1); + cr.line_to (last_width+1, -1); + cr.line_to (last_width+1, last_height-3); + cr.line_to (12, last_height-3); + cr.arc (12.0, last_height - 9.0f, 6, -Math.PI/2.0, 1.5*Math.PI/2.0); + cr.line_to (-1, -1); + if (tile is Gdk.Pixbuf) + { + Gdk.cairo_set_source_pixbuf (cr, tile, 0, 0); + var pat = cr.get_source (); + pat.set_extend (Cairo.Extend.REPEAT); + cr.fill (); + } + + return false; + } + } +} diff --git a/unity-private/panel/panel-indicator-bar.vala b/unity-private/panel/panel-indicator-bar.vala index fa9b6a5c7..bdca8a301 100644 --- a/unity-private/panel/panel-indicator-bar.vala +++ b/unity-private/panel/panel-indicator-bar.vala @@ -23,7 +23,8 @@ namespace Unity.Panel.Indicators public class IndicatorBar : Ctk.Box { private Gee.ArrayList<Indicators.IndicatorObjectView> indicator_array; - + IndicatorBackground indicator_bground; + public IndicatorBar () { Object (orientation: Ctk.Orientation.HORIZONTAL, @@ -35,6 +36,10 @@ namespace Unity.Panel.Indicators { Unity.Testing.ObjectRegistry.get_default ().register ("IndicatorBar", this); + indicator_bground = new IndicatorBackground (); + set_background (indicator_bground); + indicator_bground.hide (); + indicator_array = new Gee.ArrayList<Indicators.IndicatorObjectView> (); var model = IndicatorsModel.get_default (); @@ -107,5 +112,17 @@ namespace Unity.Panel.Indicators } return null; } + + public void set_indicator_mode (bool mode) + { + if (mode) + { + indicator_bground.show (); + } + else + { + indicator_bground.hide (); + } + } } } diff --git a/unity-private/panel/panel-view.vala b/unity-private/panel/panel-view.vala index 2e44da241..80c10ca9a 100644 --- a/unity-private/panel/panel-view.vala +++ b/unity-private/panel/panel-view.vala @@ -28,11 +28,11 @@ namespace Unity.Panel public bool expanded = true; public Shell shell { get; construct;} - Background bground; - HomeButton home_button; - MenuBar menu_bar; - SystemTray system_tray; - IndicatorBar indicator_bar; + Background bground; + HomeButton home_button; + MenuBar menu_bar; + SystemTray system_tray; + IndicatorBar indicator_bar; public View (Shell shell) { @@ -56,7 +56,7 @@ namespace Unity.Panel bground = new Background (); set_background (bground); bground.show (); - + /* Create the views and add them to the box */ home_button = new HomeButton (shell); pack (home_button, false, true); @@ -130,12 +130,20 @@ namespace Unity.Panel public void set_indicator_mode (bool mode) { -// float x; -// x = mode ? this.width - this.get_indicators_width () : 0; -// this.rect.set_clip (x, -// 0, -// mode ? this.get_indicators_width () : this.width, -// mode ? PANEL_HEIGHT -1 : PANEL_HEIGHT); + if (mode) + { + menu_bar.hide (); + bground.hide (); + system_tray.hide (); + indicator_bar.set_indicator_mode (mode); + } + else + { + menu_bar.show (); + bground.show (); + system_tray.show (); + indicator_bar.set_indicator_mode (mode); + } } } } diff --git a/unity-private/places/places-place-bar.vala b/unity-private/places/places-place-bar.vala index d1cec3d2c..8d90aa201 100644 --- a/unity-private/places/places-place-bar.vala +++ b/unity-private/places/places-place-bar.vala @@ -29,12 +29,39 @@ namespace Unity.Places { Object (shell:shell, model:model, - orientation:Ctk.Orientation.HORIZONTAL); + orientation:Ctk.Orientation.HORIZONTAL, + homogeneous:false, + spacing:0); } construct { + foreach (Place place in model) + { + var view = new PlaceView (place); + pack (view, false, true); + view.show (); + } + } + + private override void allocate (Clutter.ActorBox box, + Clutter.AllocationFlags flags) + { + padding = { + 0.0f, + (float)shell.get_indicators_width (), + 0.0f, + (float)shell.get_launcher_width_foobar ()}; + base.allocate (box, flags); + } + + private override void get_preferred_height (float for_width, + out float min_height, + out float nat_height) + { + min_height = 56.0f; + nat_height = 56.0f; } } } diff --git a/unity-private/places/places-place-model.vala b/unity-private/places/places-place-model.vala index 57d72d9ef..6560b638d 100644 --- a/unity-private/places/places-place-model.vala +++ b/unity-private/places/places-place-model.vala @@ -93,6 +93,7 @@ namespace Unity.Places if (place is Place) { place.connect (); + (place as GLib.Object).ref (); add (place); } } diff --git a/unity-private/places/places-place-view.vala b/unity-private/places/places-place-view.vala index 57d49721d..62264b7bc 100644 --- a/unity-private/places/places-place-view.vala +++ b/unity-private/places/places-place-view.vala @@ -19,19 +19,28 @@ namespace Unity.Places { - public interface PlaceView : Clutter.Actor + public class PlaceView : Ctk.Box { - /** - * This interface should be implemented by any view that represents a - * place. This allows the place to request a view over dbus by the - * (hopefully) unique name of the view, together with a bunch of properties - * that it wants to set on the view (to basically initialise the view). - * - * The interface is very, very small, but it needs to be done so we can, in - * the future, load in views from dynamic modules installed by the places - **/ + /* Properties */ + public Place place { get; construct; } - public abstract void init_with_properties (HashTable<string, string> props); + public PlaceView (Place place) + { + Object (orientation:Ctk.Orientation.HORIZONTAL, + place:place, + spacing:0); + + } + + construct + { + foreach (PlaceEntry entry in place.get_entries ()) + { + var view = new PlaceEntryView (entry); + add_actor (view); + view.show (); + } + } } } diff --git a/unity-private/places/places-place.vala b/unity-private/places/places-place.vala index 8780bcad6..b101fdf7b 100644 --- a/unity-private/places/places-place.vala +++ b/unity-private/places/places-place.vala @@ -92,6 +92,11 @@ namespace Unity.Places } } + public unowned ArrayList<PlaceEntry> get_entries () + { + return entries_array; + } + public PlaceEntry? get_nth_entry (int index) { return entries_array.get (index); diff --git a/unity-private/places/places-view.vala b/unity-private/places/places-view.vala index 5390956dd..e8cc61bc9 100644 --- a/unity-private/places/places-view.vala +++ b/unity-private/places/places-view.vala @@ -25,15 +25,15 @@ namespace Unity.Places private PlaceModel _model; /* Properties */ - public Shell shell { - get; - construct; - } + public Shell shell { get; construct; } + public PlaceModel model { get { return _model; } set { _model = value; } } + private PlaceBar place_bar; + public View (Shell shell) { Object (shell:shell, orientation:Ctk.Orientation.VERTICAL); @@ -42,6 +42,14 @@ namespace Unity.Places construct { _model = new PlaceFileModel () as PlaceModel; + + Idle.add (() => { + place_bar = new PlaceBar (shell, _model); + pack (place_bar, false, true); + place_bar.show (); + + return false; + }); } } } diff --git a/unity-private/testing/test-window.vala b/unity-private/testing/test-window.vala index 611be3103..40ac23470 100644 --- a/unity-private/testing/test-window.vala +++ b/unity-private/testing/test-window.vala @@ -237,7 +237,7 @@ namespace Unity.Testing /* * UNDERLAY WINDOW MANAGEMENT */ - public void on_active_window_changed (Wnck.Window? previous_window) + private void on_active_window_changed (Wnck.Window? previous_window) { Wnck.Window new_window = this.wnck_screen.get_active_window (); if (new_window == null) diff --git a/unity/Makefile.am b/unity/Makefile.am index 267ae1fce..803c7867d 100644 --- a/unity/Makefile.am +++ b/unity/Makefile.am @@ -49,7 +49,6 @@ libunity_la_VALAFLAGS = \ --pkg gtk+-2.0 \ --pkg gee-1.0 \ --pkg Bamf-0.2 \ - --pkg libwnck-1.0 \ --pkg unique-1.0 \ --pkg unity-const \ $(MAINTAINER_VALAFLAGS) diff --git a/unity/chrome-handler.vala b/unity/chrome-handler.vala index 176d7560b..e08c22565 100644 --- a/unity/chrome-handler.vala +++ b/unity/chrome-handler.vala @@ -32,7 +32,7 @@ Comment=A Chromium Webapp Terminal=false X-MultipleArgs=false Type=Application -Icon=%s +Icon=emblem-web Categories=Network; MimeType=text/html; StartupWMClass=Chromium @@ -56,7 +56,7 @@ StartupNotify=true this.name = split_url[1]; try { - var regex = new Regex ("(/)"); + var regex = new Regex ("(\\?|/|~|=)"); name = regex.replace (name, -1, 0, "-"); } catch (RegexError e) { warning ("%s", e.message); diff --git a/unity/webapp-fetcher.vala b/unity/webapp-fetcher.vala index 78517c804..edddbd2af 100644 --- a/unity/webapp-fetcher.vala +++ b/unity/webapp-fetcher.vala @@ -206,7 +206,7 @@ namespace Unity.Webapp } // set the icon name in the desktop file to the default webapp icon - this.set_desktop_file_icon ("webapp-default-icon"); + this.set_desktop_file_icon ("emblem-web"); } private void set_desktop_file_icon (string iconname) diff --git a/vapi/mutter-2.28.vapi b/vapi/mutter-2.28.vapi index 025614c71..6aec95270 100644 --- a/vapi/mutter-2.28.vapi +++ b/vapi/mutter-2.28.vapi @@ -85,7 +85,7 @@ namespace Mutter { } [Compact] [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaDisplay")] - public class MetaDisplay { + public class MetaDisplay : GLib.Object { [CCode (cname = "meta_display_begin_grab_op")] public static bool begin_grab_op (Mutter.MetaDisplay display, Mutter.MetaScreen screen, Mutter.MetaWindow window, Mutter.MetaGrabOp op, bool pointer_already_grabbed, bool frame_action, int button, ulong modmask, uint32 timestamp, int root_x, int root_y); [CCode (cname = "meta_display_end_grab_op")] @@ -675,7 +675,7 @@ namespace Mutter { } [Compact] [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaWindow")] - public class MetaWindow { + public class MetaWindow : GLib.Object { [CCode (cname = "meta_window_activate")] public static void activate (Mutter.MetaWindow window, uint32 current_time); [CCode (cname = "meta_window_activate_with_workspace")] |
