summaryrefslogtreecommitdiff
path: root/plugins
diff options
authorTim Penhey <tim.penhey@canonical.com>2011-10-25 12:47:28 -0400
committerTim Penhey <tim.penhey@canonical.com>2011-10-25 12:47:28 -0400
commit950587954959ac8a13306e8cf699053cf76d66ca (patch)
tree0205582f43026d89eff2a3b3a54c4941fde21fa6 /plugins
parent0e809b8fc72c8f2b3df0f39f71c361294a5a7e81 (diff)
parent513f803a03099c0ee95f7a83230e56368bb85e7c (diff)
Merge prev.
(bzr r1635.13.1)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/unityshell/resources/dash-widgets.json2
-rw-r--r--plugins/unityshell/src/Autopilot.cpp2
-rw-r--r--plugins/unityshell/src/BGHash.cpp13
-rw-r--r--plugins/unityshell/src/BGHash.h3
-rw-r--r--plugins/unityshell/src/BackgroundEffectHelper.h1
-rw-r--r--plugins/unityshell/src/BamfLauncherIcon.cpp104
-rw-r--r--plugins/unityshell/src/BamfLauncherIcon.h4
-rw-r--r--plugins/unityshell/src/DashController.cpp6
-rw-r--r--plugins/unityshell/src/DashController.h2
-rw-r--r--plugins/unityshell/src/DashSearchBar.cpp18
-rw-r--r--plugins/unityshell/src/DashSearchBar.h1
-rw-r--r--plugins/unityshell/src/DashSearchBarSpinner.cpp6
-rw-r--r--plugins/unityshell/src/DashSearchBarSpinner.h1
-rw-r--r--plugins/unityshell/src/DashStyle.cpp116
-rw-r--r--plugins/unityshell/src/DashStyle.h16
-rw-r--r--plugins/unityshell/src/DashView.cpp33
-rw-r--r--plugins/unityshell/src/DashView.h1
-rw-r--r--plugins/unityshell/src/DeviceLauncherIcon.cpp63
-rw-r--r--plugins/unityshell/src/DeviceLauncherIcon.h7
-rw-r--r--plugins/unityshell/src/FilterBar.cpp9
-rw-r--r--plugins/unityshell/src/FilterBar.h1
-rw-r--r--plugins/unityshell/src/FilterBasicButton.cpp22
-rw-r--r--plugins/unityshell/src/FilterBasicButton.h5
-rw-r--r--plugins/unityshell/src/FilterExpanderLabel.cpp17
-rw-r--r--plugins/unityshell/src/FilterExpanderLabel.h5
-rw-r--r--plugins/unityshell/src/FilterGenreButton.cpp18
-rw-r--r--plugins/unityshell/src/FilterGenreButton.h1
-rw-r--r--plugins/unityshell/src/FilterGenreWidget.cpp18
-rw-r--r--plugins/unityshell/src/FilterGenreWidget.h1
-rw-r--r--plugins/unityshell/src/FilterMultiRangeButton.cpp33
-rw-r--r--plugins/unityshell/src/FilterMultiRangeButton.h5
-rw-r--r--plugins/unityshell/src/FilterMultiRangeWidget.cpp10
-rw-r--r--plugins/unityshell/src/FilterMultiRangeWidget.h1
-rw-r--r--plugins/unityshell/src/FilterRatingsButton.cpp62
-rw-r--r--plugins/unityshell/src/FilterRatingsButton.h7
-rw-r--r--plugins/unityshell/src/FilterRatingsWidget.cpp38
-rw-r--r--plugins/unityshell/src/FilterRatingsWidget.h4
-rw-r--r--plugins/unityshell/src/HomeView.cpp5
-rw-r--r--plugins/unityshell/src/HomeView.h1
-rw-r--r--plugins/unityshell/src/IMTextEntry.cpp40
-rw-r--r--plugins/unityshell/src/IconTexture.cpp5
-rw-r--r--plugins/unityshell/src/Launcher.cpp13
-rw-r--r--plugins/unityshell/src/Launcher.h3
-rw-r--r--plugins/unityshell/src/LensBar.cpp5
-rw-r--r--plugins/unityshell/src/LensBar.h1
-rw-r--r--plugins/unityshell/src/LensView.cpp7
-rw-r--r--plugins/unityshell/src/LensView.h1
-rw-r--r--plugins/unityshell/src/PanelIndicatorsView.cpp15
-rw-r--r--plugins/unityshell/src/PanelIndicatorsView.h1
-rw-r--r--plugins/unityshell/src/PanelMenuView.cpp85
-rw-r--r--plugins/unityshell/src/PanelMenuView.h2
-rw-r--r--plugins/unityshell/src/PanelStyle.cpp8
-rw-r--r--plugins/unityshell/src/PanelStyle.h6
-rw-r--r--plugins/unityshell/src/PanelTray.cpp6
-rw-r--r--plugins/unityshell/src/PanelTray.h1
-rw-r--r--plugins/unityshell/src/PanelView.cpp29
-rw-r--r--plugins/unityshell/src/PanelView.h1
-rw-r--r--plugins/unityshell/src/PlacesGroup.cpp31
-rw-r--r--plugins/unityshell/src/PlacesGroup.h1
-rw-r--r--plugins/unityshell/src/PlacesHomeView.cpp7
-rw-r--r--plugins/unityshell/src/PlacesTile.cpp7
-rw-r--r--plugins/unityshell/src/PlacesTile.h1
-rw-r--r--plugins/unityshell/src/PluginAdapter.cpp86
-rw-r--r--plugins/unityshell/src/PluginAdapter.h5
-rw-r--r--plugins/unityshell/src/PreviewApplications.cpp10
-rw-r--r--plugins/unityshell/src/PreviewApplications.h3
-rw-r--r--plugins/unityshell/src/PreviewBase.cpp8
-rw-r--r--plugins/unityshell/src/PreviewBase.h3
-rw-r--r--plugins/unityshell/src/PreviewBasicButton.cpp22
-rw-r--r--plugins/unityshell/src/PreviewBasicButton.h5
-rw-r--r--plugins/unityshell/src/PreviewGeneric.cpp10
-rw-r--r--plugins/unityshell/src/PreviewGeneric.h1
-rw-r--r--plugins/unityshell/src/PreviewMusic.cpp6
-rw-r--r--plugins/unityshell/src/PreviewMusic.h1
-rw-r--r--plugins/unityshell/src/PreviewMusicTrack.cpp6
-rw-r--r--plugins/unityshell/src/PreviewMusicTrack.h1
-rw-r--r--plugins/unityshell/src/PreviewMusicTrackWidget.cpp8
-rw-r--r--plugins/unityshell/src/PreviewMusicTrackWidget.h1
-rw-r--r--plugins/unityshell/src/QuicklistMenuItem.cpp12
-rw-r--r--plugins/unityshell/src/QuicklistMenuItem.h4
-rw-r--r--plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp11
-rw-r--r--plugins/unityshell/src/QuicklistMenuItemCheckmark.h2
-rw-r--r--plugins/unityshell/src/QuicklistMenuItemLabel.cpp11
-rw-r--r--plugins/unityshell/src/QuicklistMenuItemLabel.h2
-rw-r--r--plugins/unityshell/src/QuicklistMenuItemRadio.cpp11
-rw-r--r--plugins/unityshell/src/QuicklistMenuItemRadio.h4
-rw-r--r--plugins/unityshell/src/QuicklistMenuItemSeparator.cpp12
-rw-r--r--plugins/unityshell/src/QuicklistMenuItemSeparator.h2
-rw-r--r--plugins/unityshell/src/QuicklistView.cpp57
-rw-r--r--plugins/unityshell/src/QuicklistView.h4
-rw-r--r--plugins/unityshell/src/ResultView.cpp13
-rw-r--r--plugins/unityshell/src/ResultView.h3
-rw-r--r--plugins/unityshell/src/ResultViewGrid.cpp35
-rw-r--r--plugins/unityshell/src/ResultViewGrid.h6
-rw-r--r--plugins/unityshell/src/StaticCairoText.cpp13
-rw-r--r--plugins/unityshell/src/StaticCairoText.h4
-rw-r--r--plugins/unityshell/src/SwitcherView.cpp5
-rw-r--r--plugins/unityshell/src/SwitcherView.h1
-rw-r--r--plugins/unityshell/src/Tooltip.cpp9
-rw-r--r--plugins/unityshell/src/Tooltip.h4
-rw-r--r--plugins/unityshell/src/WindowButtons.cpp6
-rw-r--r--plugins/unityshell/src/WindowManager.cpp7
-rw-r--r--plugins/unityshell/src/WindowManager.h12
-rw-r--r--plugins/unityshell/src/compizminimizedwindowhandler.h28
-rw-r--r--plugins/unityshell/src/minimizedwindowhandler.h2
-rw-r--r--plugins/unityshell/src/nux-area-accessible.cpp13
-rw-r--r--plugins/unityshell/src/unityshell.cpp110
-rw-r--r--plugins/unityshell/src/unityshell.h2
-rw-r--r--plugins/unityshell/unityshell.xml.in10
109 files changed, 738 insertions, 791 deletions
diff --git a/plugins/unityshell/resources/dash-widgets.json b/plugins/unityshell/resources/dash-widgets.json
index 98e034f15..657dd7dd9 100644
--- a/plugins/unityshell/resources/dash-widgets.json
+++ b/plugins/unityshell/resources/dash-widgets.json
@@ -47,7 +47,7 @@
"text-color" : ["#ffffff", "#ffffff", "#ffffff", "#ffffff", "#ffffff"],
"text-opacity" : [ 1.0, 1.0, 1.0, 1.0, 1.0],
"fill-color" : ["#FFFFFF", "#000000", "#ffffff", "#000000", "#000000"],
- "fill-opacity" : [ 0.5, 0.0, 0.25, 0.0, 0.0],
+ "fill-opacity" : [ 0.25, 0.0, 0.25, 0.0, 0.0],
"overlay-opacity": [ 0.1, 0.1, 0.1, 0.0, 0.0],
"overlay-mode" : [ "normal", "normal", "normal", "normal", "normal"],
"blur-size" : [ 1, 1, 1, 0, 0]},
diff --git a/plugins/unityshell/src/Autopilot.cpp b/plugins/unityshell/src/Autopilot.cpp
index 77ecd7f71..ef3fa007f 100644
--- a/plugins/unityshell/src/Autopilot.cpp
+++ b/plugins/unityshell/src/Autopilot.cpp
@@ -99,7 +99,7 @@ Autopilot::StartTest(const gchar* name)
if (test_expiration_functor == NULL)
{
test_expiration_functor = new nux::TimerFunctor();
- test_expiration_functor->OnTimerExpired.connect(sigc::ptr_fun(&TestFinished));
+ test_expiration_functor->time_expires.connect(sigc::ptr_fun(&TestFinished));
}
args->name = g_strdup(name);
diff --git a/plugins/unityshell/src/BGHash.cpp b/plugins/unityshell/src/BGHash.cpp
index 749e8c3f1..840f0c22b 100644
--- a/plugins/unityshell/src/BGHash.cpp
+++ b/plugins/unityshell/src/BGHash.cpp
@@ -50,6 +50,7 @@ namespace unity {
_hires_time_end(20),
_ubus_handle_request_colour(0)
{
+ _override_color.alpha= 0.0f;
background_monitor = gnome_bg_new ();
client = g_settings_new ("org.gnome.desktop.background");
@@ -94,6 +95,12 @@ namespace unity {
ubus_server_unregister_interest (ubus, _ubus_handle_request_colour);
}
+ void BGHash::OverrideColor (nux::Color color)
+ {
+ _override_color = color;
+ OnBackgroundChanged(background_monitor);
+ }
+
gboolean BGHash::ForceUpdate (BGHash *self)
{
self->OnBackgroundChanged(self->background_monitor);
@@ -107,6 +114,12 @@ namespace unity {
void BGHash::OnBackgroundChanged (GnomeBG *bg)
{
+ if (_override_color.alpha)
+ {
+ TransitionToNewColor (_override_color);
+ return;
+ }
+
const gchar *filename = gnome_bg_get_filename (bg);
if (filename == NULL)
{
diff --git a/plugins/unityshell/src/BGHash.h b/plugins/unityshell/src/BGHash.h
index d16d800b2..e18ead70c 100644
--- a/plugins/unityshell/src/BGHash.h
+++ b/plugins/unityshell/src/BGHash.h
@@ -48,6 +48,7 @@ namespace unity
nux::Color CurrentColor ();
void OnBackgroundChanged (GnomeBG *bg);
void OnGSettingsChanged (GSettings *settings, gchar *key);
+ void OverrideColor (nux::Color color);
private:
static gboolean OnSlideshowTransition (BGHash *self);
@@ -73,6 +74,8 @@ namespace unity
nux::Color _new_color; // in transitions, the next colour, otherwise the current colour
nux::Color _old_color; // the last colour chosen, used for transitions
+ nux::Color _override_color;
+
guint64 _hires_time_start;
guint64 _hires_time_end;
glib::SignalManager signal_manager_;
diff --git a/plugins/unityshell/src/BackgroundEffectHelper.h b/plugins/unityshell/src/BackgroundEffectHelper.h
index bcba4072f..f540dc3c6 100644
--- a/plugins/unityshell/src/BackgroundEffectHelper.h
+++ b/plugins/unityshell/src/BackgroundEffectHelper.h
@@ -23,7 +23,6 @@
#include "config.h"
#include <Nux/Nux.h>
-#include <Nux/ColorArea.h>
#include <NuxGraphics/GLThread.h>
namespace unity
diff --git a/plugins/unityshell/src/BamfLauncherIcon.cpp b/plugins/unityshell/src/BamfLauncherIcon.cpp
index f8affbcd5..060b9e11b 100644
--- a/plugins/unityshell/src/BamfLauncherIcon.cpp
+++ b/plugins/unityshell/src/BamfLauncherIcon.cpp
@@ -59,6 +59,8 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
{
SimpleLauncherIcon::ActivateLauncherIcon(arg);
bool scaleWasActive = WindowManager::Default()->IsScaleActive();
+ GList *l;
+ BamfView *view;
bool active, running;
active = bamf_view_is_active(BAMF_VIEW(m_App));
@@ -70,6 +72,34 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
return;
}
+ /* We should check each child to see if there is
+ * an unmapped (!= minimized) window around and
+ * if so force "Focus" behaviour */
+
+ if (arg.source != ActionArg::SWITCHER)
+ {
+ bool any_visible = false;
+ for (l = bamf_view_get_children(BAMF_VIEW(m_App)); l; l = l->next)
+ {
+ view = static_cast <BamfView*> (l->data);
+
+ if (BAMF_IS_WINDOW(view))
+ {
+ Window xid = bamf_window_get_xid(BAMF_WINDOW(view));
+
+ if (WindowManager::Default ()->IsWindowOnCurrentDesktop(xid))
+ any_visible = true;
+ if (!WindowManager::Default ()->IsWindowMapped(xid))
+ {
+ active = false;
+ }
+ }
+ }
+
+ if (!any_visible)
+ active = false;
+ }
+
/* Behaviour:
* 1) Nothing running -> launch application
* 2) Running and active -> spread application
@@ -98,7 +128,7 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
if (scaleWasActive) // #5 above
{
WindowManager::Default()->TerminateScale();
- Focus();
+ Focus(arg);
}
else // #2 above
{
@@ -111,13 +141,13 @@ void BamfLauncherIcon::ActivateLauncherIcon(ActionArg arg)
if (scaleWasActive) // #4 above
{
WindowManager::Default()->TerminateScale();
- Focus();
+ Focus(arg);
if (arg.source != ActionArg::SWITCHER)
Spread(0, false);
}
else // #3 above
{
- Focus();
+ Focus(arg);
}
}
}
@@ -257,7 +287,7 @@ std::vector<Window> BamfLauncherIcon::RelatedXids ()
children = bamf_view_get_children(BAMF_VIEW(m_App));
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view))
{
guint32 xid = bamf_window_get_xid(BAMF_WINDOW(view));
@@ -280,7 +310,7 @@ std::string BamfLauncherIcon::NameForWindow (Window window)
children = bamf_view_get_children(BAMF_VIEW(m_App));
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view) && (Window) bamf_window_get_xid(BAMF_WINDOW(view)) == window)
{
gchar *name = bamf_view_get_name (view);
@@ -308,8 +338,9 @@ void BamfLauncherIcon::OnWindowMinimized(guint32 xid)
UpdateQuirkTimeDelayed(300, QUIRK_SHIMMER);
}
-gboolean BamfLauncherIcon::OnWindowMovedTimeout(BamfLauncherIcon* self)
+gboolean BamfLauncherIcon::OnWindowMovedTimeout(gpointer data)
{
+ BamfLauncherIcon *self = static_cast <BamfLauncherIcon *> (data);
GList *children = bamf_view_get_children(BAMF_VIEW(self->m_App));
bool any_on_current = false;
@@ -439,7 +470,7 @@ void BamfLauncherIcon::AddProperties(GVariantBuilder* builder)
int i = 0;
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view))
{
@@ -462,7 +493,7 @@ bool BamfLauncherIcon::OwnsWindow(Window w)
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view))
{
@@ -536,11 +567,12 @@ void BamfLauncherIcon::OpenInstanceLauncherIcon(ActionArg arg)
ubus_server_send_message(ubus_server_get_default(), UBUS_LAUNCHER_ACTION_DONE, NULL);
}
-void BamfLauncherIcon::Focus()
+void BamfLauncherIcon::Focus(ActionArg arg)
{
GList* children, *l;
BamfView* view;
bool any_urgent = false;
+ bool any_visible = false;
children = bamf_view_get_children(BAMF_VIEW(m_App));
@@ -549,13 +581,17 @@ void BamfLauncherIcon::Focus()
/* get the list of windows */
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view))
{
Window xid = bamf_window_get_xid(BAMF_WINDOW(view));
bool urgent = bamf_view_is_urgent(view);
+ if (WindowManager::Default ()->IsWindowOnCurrentDesktop (xid) &&
+ WindowManager::Default ()->IsWindowVisible (xid))
+ any_visible = true;
+
if (any_urgent)
{
if (urgent)
@@ -566,15 +602,31 @@ void BamfLauncherIcon::Focus()
if (urgent)
{
windows.clear();
+ any_visible = false;
any_urgent = true;
}
- windows.push_back(xid);
}
+ windows.push_back(xid);
}
}
g_list_free(children);
- WindowManager::Default()->FocusWindowGroup(windows);
+ if (arg.source != ActionArg::SWITCHER)
+ {
+ if (any_visible)
+ {
+ WindowManager::Default()->FocusWindowGroup(windows,
+ WindowManager::FocusVisibility::ForceUnminimizeInvisible);
+ }
+ else
+ {
+ WindowManager::Default()->FocusWindowGroup(windows,
+ WindowManager::FocusVisibility::ForceUnminimizeOnCurrentDesktop);
+ }
+ }
+ else
+ WindowManager::Default()->FocusWindowGroup(windows,
+ WindowManager::FocusVisibility::OnlyVisible);
}
bool BamfLauncherIcon::Spread(int state, bool force)
@@ -586,7 +638,7 @@ bool BamfLauncherIcon::Spread(int state, bool force)
std::vector<Window> windowList;
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view))
{
@@ -601,7 +653,7 @@ bool BamfLauncherIcon::Spread(int state, bool force)
void BamfLauncherIcon::OnClosed(BamfView* view, gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
if (!bamf_view_is_sticky(BAMF_VIEW(self->m_App)))
self->Remove();
@@ -610,7 +662,7 @@ void BamfLauncherIcon::OnClosed(BamfView* view, gpointer data)
void BamfLauncherIcon::OnUserVisibleChanged(BamfView* view, gboolean visible,
gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
if (!bamf_view_is_sticky(BAMF_VIEW(self->m_App)))
self->SetQuirk(QUIRK_VISIBLE, visible);
@@ -619,7 +671,7 @@ void BamfLauncherIcon::OnUserVisibleChanged(BamfView* view, gboolean visible,
void BamfLauncherIcon::OnRunningChanged(BamfView* view, gboolean running,
gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
self->SetQuirk(QUIRK_RUNNING, running);
if (running)
@@ -631,13 +683,13 @@ void BamfLauncherIcon::OnRunningChanged(BamfView* view, gboolean running,
void BamfLauncherIcon::OnActiveChanged(BamfView* view, gboolean active, gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
self->SetQuirk(QUIRK_ACTIVE, active);
}
void BamfLauncherIcon::OnUrgentChanged(BamfView* view, gboolean urgent, gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
self->SetQuirk(QUIRK_URGENT, urgent);
}
@@ -671,7 +723,7 @@ void BamfLauncherIcon::EnsureWindowState()
void BamfLauncherIcon::OnChildAdded(BamfView* view, BamfView* child, gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
self->EnsureWindowState();
self->UpdateMenus();
self->UpdateIconGeometries(self->GetCenter());
@@ -679,7 +731,7 @@ void BamfLauncherIcon::OnChildAdded(BamfView* view, BamfView* child, gpointer da
void BamfLauncherIcon::OnChildRemoved(BamfView* view, BamfView* child, gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
self->EnsureWindowState();
}
@@ -804,7 +856,7 @@ void BamfLauncherIcon::OnQuit(DbusmenuMenuitem* item, int time, BamfLauncherIcon
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view))
{
@@ -915,7 +967,7 @@ static void OnAppLabelActivated(DbusmenuMenuitem* sender,
if (!data)
return;
- self = (BamfLauncherIcon*) data;
+ self = static_cast <BamfLauncherIcon*> (data);
self->ActivateLauncherIcon(ActionArg(ActionArg::OTHER, 0));
}
@@ -1088,7 +1140,7 @@ void BamfLauncherIcon::UpdateIconGeometries(nux::Point3 center)
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view))
{
@@ -1147,7 +1199,7 @@ std::set<std::string> BamfLauncherIcon::ValidateUrisForLaunch(unity::DndData& ur
gboolean BamfLauncherIcon::OnDndHoveredTimeout(gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
// for now, let's not do this, it turns out to be quite buggy
//if (self->_dnd_hovered && bamf_view_is_running(BAMF_VIEW(self->m_App)))
@@ -1220,7 +1272,7 @@ BamfLauncherIcon::SwitcherPriority()
/* get the list of windows */
for (l = children; l; l = l->next)
{
- view = (BamfView*) l->data;
+ view = static_cast <BamfView*> (l->data);
if (BAMF_IS_WINDOW(view))
{
@@ -1245,7 +1297,7 @@ BamfLauncherIcon::GetSupportedTypes()
gboolean
BamfLauncherIcon::FillSupportedTypes(gpointer data)
{
- BamfLauncherIcon* self = (BamfLauncherIcon*) data;
+ BamfLauncherIcon* self = static_cast <BamfLauncherIcon*> (data);
if (self->_fill_supported_types_id)
{
diff --git a/plugins/unityshell/src/BamfLauncherIcon.h b/plugins/unityshell/src/BamfLauncherIcon.h
index ef46880de..ab404cf15 100644
--- a/plugins/unityshell/src/BamfLauncherIcon.h
+++ b/plugins/unityshell/src/BamfLauncherIcon.h
@@ -109,7 +109,7 @@ private:
void UpdateDesktopQuickList();
void OpenInstanceWithUris(std::set<std::string> uris);
- void Focus();
+ void Focus(ActionArg arg);
bool Spread(int state, bool force);
void EnsureMenuItemsReady();
@@ -141,7 +141,7 @@ private:
static gboolean OnDndHoveredTimeout(gpointer data);
static gboolean FillSupportedTypes(gpointer data);
- static gboolean OnWindowMovedTimeout(BamfLauncherIcon *self);
+ static gboolean OnWindowMovedTimeout(gpointer data);
};
#endif // BAMFLAUNCHERICON_H
diff --git a/plugins/unityshell/src/DashController.cpp b/plugins/unityshell/src/DashController.cpp
index 45a17e7ed..87b61dcf2 100644
--- a/plugins/unityshell/src/DashController.cpp
+++ b/plugins/unityshell/src/DashController.cpp
@@ -81,7 +81,6 @@ void Controller::SetupWindow()
window_->SetConfigureNotifyCallback(&Controller::OnWindowConfigure, this);
window_->ShowWindow(false);
window_->SetOpacity(0.0f);
- window_->SetFocused(true);
window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Controller::OnMouseDownOutsideWindow));
}
@@ -131,6 +130,8 @@ void Controller::EnsureDash()
SetupDashView();
Relayout();
ensure_id_ = 0;
+
+ on_realize.emit();
}
nux::BaseWindow* Controller::window() const
@@ -151,7 +152,7 @@ nux::Geometry Controller::GetIdealWindowGeometry()
UScreen *uscreen = UScreen::GetDefault();
int primary_monitor = uscreen->GetPrimaryMonitor();
auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor);
-
+
// We want to cover as much of the screen as possible to grab any mouse events outside
// of our window
return nux::Geometry (monitor_geo.x + launcher_width,
@@ -253,7 +254,6 @@ void Controller::HideDash(bool restore)
view_->AboutToHide();
window_->CaptureMouseDownAnyWhereElse(false);
- window_->ForceStopFocus(1, 1);
window_->EnableInputWindow(false, "Dash", true, false);
visible_ = false;
diff --git a/plugins/unityshell/src/DashController.h b/plugins/unityshell/src/DashController.h
index c4a2ebad7..7061eb6c5 100644
--- a/plugins/unityshell/src/DashController.h
+++ b/plugins/unityshell/src/DashController.h
@@ -54,6 +54,8 @@ public:
nux::Property<int> launcher_width;
nux::Property<int> panel_height;
+ sigc::signal<void> on_realize;
+
protected:
const gchar* GetName();
void AddProperties(GVariantBuilder* builder);
diff --git a/plugins/unityshell/src/DashSearchBar.cpp b/plugins/unityshell/src/DashSearchBar.cpp
index 93095caa0..55386c756 100644
--- a/plugins/unityshell/src/DashSearchBar.cpp
+++ b/plugins/unityshell/src/DashSearchBar.cpp
@@ -70,17 +70,14 @@ SearchBar::SearchBar(NUX_FILE_LINE_DECL)
spinner_ = new SearchBarSpinner();
spinner_->SetMinMaxSize(icon->GetWidth(), icon->GetHeight());
spinner_->mouse_click.connect(sigc::mem_fun(this, &SearchBar::OnClearClicked));
- spinner_->SetCanFocus(false);
layout_->AddView(spinner_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
hint_ = new nux::StaticCairoText(" ");
hint_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
- hint_->SetCanFocus(false);
hint_->SetMaximumWidth(570);
pango_entry_ = new IMTextEntry();
pango_entry_->sigTextChanged.connect(sigc::mem_fun(this, &SearchBar::OnSearchChanged));
- pango_entry_->SetCanFocus(true);
pango_entry_->activated.connect([&]() { activated.emit(); });
pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); });
pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown));
@@ -94,14 +91,13 @@ SearchBar::SearchBar(NUX_FILE_LINE_DECL)
layered_layout_->SetActiveLayerN(1);
layered_layout_->SetMinimumWidth(420);
layered_layout_->SetMaximumWidth(645);
- layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FIX);
+ layout_->AddView(layered_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FIX);
std::string filter_str = _("Filter results");
filter_str+= " â–¸";
show_filters_ = new nux::StaticCairoText(filter_str.c_str());
show_filters_->SetVisible(false);
show_filters_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
- show_filters_->SetCanFocus(true);
show_filters_->SetTextAlignment(nux::StaticCairoText::NUX_ALIGN_LEFT);
show_filters_->mouse_click.connect([&] (int x, int y, unsigned long b, unsigned long k) { showing_filters = !showing_filters; });
layout_->AddView(show_filters_, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FIX);
@@ -183,7 +179,8 @@ void SearchBar::OnSearchChanged(nux::TextEntry* text_entry)
(GSourceFunc)&OnLiveSearchTimeout,
this);
- bool is_empty = pango_entry_->GetText() == "";
+
+ bool is_empty = pango_entry_->im_active() ? false : pango_entry_->GetText() == "";
hint_->SetVisible(is_empty);
spinner_->SetState(is_empty ? STATE_READY : STATE_SEARCHING);
@@ -210,15 +207,6 @@ void SearchBar::OnShowingFiltersChanged(bool is_showing)
show_filters_->SetText(filter_str.c_str());
}
-long SearchBar::ProcessEvent(nux::IEvent& ievent, long TraverseInfo,
- long ProcessEventInfo)
-{
- long ret = TraverseInfo;
- ret = layout_->ProcessEvent(ievent, ret, ProcessEventInfo);
-
- return ret;
-}
-
void SearchBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
nux::Geometry geo = GetGeometry();
diff --git a/plugins/unityshell/src/DashSearchBar.h b/plugins/unityshell/src/DashSearchBar.h
index 4057e0863..ee64d3b62 100644
--- a/plugins/unityshell/src/DashSearchBar.h
+++ b/plugins/unityshell/src/DashSearchBar.h
@@ -69,7 +69,6 @@ private:
void OnFontChanged(GtkSettings* settings, GParamSpec* pspec=NULL);
void OnSearchHintChanged();
- long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/DashSearchBarSpinner.cpp b/plugins/unityshell/src/DashSearchBarSpinner.cpp
index beecefd8f..2908f8cb2 100644
--- a/plugins/unityshell/src/DashSearchBarSpinner.cpp
+++ b/plugins/unityshell/src/DashSearchBarSpinner.cpp
@@ -57,12 +57,6 @@ SearchBarSpinner::~SearchBarSpinner()
g_source_remove(_frame_timeout);
}
-long
-SearchBarSpinner::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- return PostProcessEvent2(ievent, TraverseInfo, ProcessEventInfo);
-}
-
void
SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
diff --git a/plugins/unityshell/src/DashSearchBarSpinner.h b/plugins/unityshell/src/DashSearchBarSpinner.h
index 31d5221fd..936a89c08 100644
--- a/plugins/unityshell/src/DashSearchBarSpinner.h
+++ b/plugins/unityshell/src/DashSearchBarSpinner.h
@@ -46,7 +46,6 @@ public:
SearchBarSpinner();
~SearchBarSpinner();
- long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/DashStyle.cpp b/plugins/unityshell/src/DashStyle.cpp
index f5ae06048..c40fa9926 100644
--- a/plugins/unityshell/src/DashStyle.cpp
+++ b/plugins/unityshell/src/DashStyle.cpp
@@ -138,7 +138,7 @@ public:
double height,
Segment segment,
Arrow arrow,
- nux::State state);
+ nux::ButtonVisualState state);
void Refresh();
void OnFontChanged(GtkSettings* object, GParamSpec* pspec);
@@ -746,49 +746,49 @@ void Style::Impl::Star(cairo_t* cr, double size)
void Style::Impl::SetDefaultValues()
{
// button-label
- button_label_border_color_[nux::NUX_STATE_NORMAL] = nux::Color(0.53, 1.0, 0.66, 0.5);
- button_label_border_color_[nux::NUX_STATE_ACTIVE] = nux::Color(1.0, 1.0, 1.0, 0.8);
- button_label_border_color_[nux::NUX_STATE_PRELIGHT] = nux::Color(0.06, 0.13, 1.0, 0.5);
- button_label_border_color_[nux::NUX_STATE_SELECTED] = nux::Color(0.07, 0.2, 0.33, 0.5);
- button_label_border_color_[nux::NUX_STATE_INSENSITIVE] = nux::Color(0.39, 0.26, 0.12, 0.5);
-
- button_label_border_size_[nux::NUX_STATE_NORMAL] = 0.5;
- button_label_border_size_[nux::NUX_STATE_ACTIVE] = 2.0;
- button_label_border_size_[nux::NUX_STATE_PRELIGHT] = 0.5;
- button_label_border_size_[nux::NUX_STATE_SELECTED] = 0.5;
- button_label_border_size_[nux::NUX_STATE_INSENSITIVE] = 0.5;
+ button_label_border_color_[nux::VISUAL_STATE_NORMAL] = nux::Color(0.53, 1.0, 0.66, 0.5);
+ button_label_border_color_[nux::VISUAL_STATE_PRESSED] = nux::Color(1.0, 1.0, 1.0, 0.8);
+ button_label_border_color_[nux::VISUAL_STATE_PRELIGHT] = nux::Color(0.06, 0.13, 1.0, 0.5);
+ //button_label_border_color_[nux::NUX_STATE_SELECTED] = nux::Color(0.07, 0.2, 0.33, 0.5);
+ //button_label_border_color_[nux::NUX_STATE_INSENSITIVE] = nux::Color(0.39, 0.26, 0.12, 0.5);
+
+ button_label_border_size_[nux::VISUAL_STATE_NORMAL] = 0.5;
+ button_label_border_size_[nux::VISUAL_STATE_PRESSED] = 2.0;
+ button_label_border_size_[nux::VISUAL_STATE_PRELIGHT] = 0.5;
+ //button_label_border_size_[nux::NUX_STATE_SELECTED] = 0.5;
+ //button_label_border_size_[nux::NUX_STATE_INSENSITIVE] = 0.5;
button_label_text_size_ = 1.0;
- button_label_text_color_[nux::NUX_STATE_NORMAL] = nux::color::White;
- button_label_text_color_[nux::NUX_STATE_ACTIVE] = nux::color::Black;
- button_label_text_color_[nux::NUX_STATE_PRELIGHT] = nux::color::White;
- button_label_text_color_[nux::NUX_STATE_SELECTED] = nux::color::White;
- button_label_text_color_[nux::NUX_STATE_INSENSITIVE] = nux::color::White;
-
- button_label_fill_color_[nux::NUX_STATE_NORMAL] = nux::color::Transparent;
- button_label_fill_color_[nux::NUX_STATE_ACTIVE] = nux::color::Transparent;
- button_label_fill_color_[nux::NUX_STATE_PRELIGHT] = nux::color::Transparent;
- button_label_fill_color_[nux::NUX_STATE_SELECTED] = nux::color::Transparent;
- button_label_fill_color_[nux::NUX_STATE_INSENSITIVE] = nux::color::Transparent;
-
- button_label_overlay_opacity_[nux::NUX_STATE_NORMAL] = 0.0;
- button_label_overlay_opacity_[nux::NUX_STATE_ACTIVE] = 0.3;
- button_label_overlay_opacity_[nux::NUX_STATE_PRELIGHT] = 0.0;
- button_label_overlay_opacity_[nux::NUX_STATE_SELECTED] = 0.0;
- button_label_overlay_opacity_[nux::NUX_STATE_INSENSITIVE] = 0.0;
-
- button_label_overlay_mode_[nux::NUX_STATE_NORMAL] = BlendMode::NORMAL;
- button_label_overlay_mode_[nux::NUX_STATE_ACTIVE] = BlendMode::NORMAL;
- button_label_overlay_mode_[nux::NUX_STATE_PRELIGHT] = BlendMode::NORMAL;
- button_label_overlay_mode_[nux::NUX_STATE_SELECTED] = BlendMode::NORMAL;
- button_label_overlay_mode_[nux::NUX_STATE_INSENSITIVE] = BlendMode::NORMAL;
-
- button_label_blur_size_[nux::NUX_STATE_NORMAL] = 0;
- button_label_blur_size_[nux::NUX_STATE_ACTIVE] = 5;
- button_label_blur_size_[nux::NUX_STATE_PRELIGHT] = 0;
- button_label_blur_size_[nux::NUX_STATE_SELECTED] = 0;
- button_label_blur_size_[nux::NUX_STATE_INSENSITIVE] = 0;
+ button_label_text_color_[nux::VISUAL_STATE_NORMAL] = nux::color::White;
+ button_label_text_color_[nux::VISUAL_STATE_PRESSED] = nux::color::Black;
+ button_label_text_color_[nux::VISUAL_STATE_PRELIGHT] = nux::color::White;
+ //button_label_text_color_[nux::NUX_STATE_SELECTED] = nux::color::White;
+ //button_label_text_color_[nux::NUX_STATE_INSENSITIVE] = nux::color::White;
+
+ button_label_fill_color_[nux::VISUAL_STATE_NORMAL] = nux::color::Transparent;
+ button_label_fill_color_[nux::VISUAL_STATE_PRESSED] = nux::color::Transparent;
+ button_label_fill_color_[nux::VISUAL_STATE_PRELIGHT] = nux::color::Transparent;
+ //button_label_fill_color_[nux::NUX_STATE_SELECTED] = nux::color::Transparent;
+ //button_label_fill_color_[nux::NUX_STATE_INSENSITIVE] = nux::color::Transparent;
+
+ button_label_overlay_opacity_[nux::VISUAL_STATE_NORMAL] = 0.0;
+ button_label_overlay_opacity_[nux::VISUAL_STATE_PRESSED] = 0.3;
+ button_label_overlay_opacity_[nux::VISUAL_STATE_PRELIGHT] = 0.0;
+ //button_label_overlay_opacity_[nux::NUX_STATE_SELECTED] = 0.0;
+ //button_label_overlay_opacity_[nux::NUX_STATE_INSENSITIVE] = 0.0;
+
+ button_label_overlay_mode_[nux::VISUAL_STATE_NORMAL] = BlendMode::NORMAL;
+ button_label_overlay_mode_[nux::VISUAL_STATE_PRESSED] = BlendMode::NORMAL;
+ button_label_overlay_mode_[nux::VISUAL_STATE_PRELIGHT] = BlendMode::NORMAL;
+ //button_label_overlay_mode_[nux::NUX_STATE_SELECTED] = BlendMode::NORMAL;
+ //button_label_overlay_mode_[nux::NUX_STATE_INSENSITIVE] = BlendMode::NORMAL;
+
+ button_label_blur_size_[nux::VISUAL_STATE_NORMAL] = 0;
+ button_label_blur_size_[nux::VISUAL_STATE_PRESSED] = 5;
+ button_label_blur_size_[nux::VISUAL_STATE_PRELIGHT] = 0;
+ //button_label_blur_size_[nux::NUX_STATE_SELECTED] = 0;
+ //button_label_blur_size_[nux::NUX_STATE_INSENSITIVE] = 0;
// regular-text
regular_text_color_ = nux::color::White;
@@ -1005,7 +1005,7 @@ void Style::Impl::RoundedRectSegment(cairo_t* cr,
double height,
Segment segment,
Arrow arrow,
- nux::State state)
+ nux::ButtonVisualState state)
{
double radius = cornerRadius / aspect;
double arrow_w = radius / 1.5;
@@ -1020,7 +1020,7 @@ void Style::Impl::RoundedRectSegment(cairo_t* cr,
// top-right
cairo_line_to(cr, x + width, y);
- if (arrow == Arrow::RIGHT && state == nux::NUX_STATE_ACTIVE)
+ if (arrow == Arrow::RIGHT && state == nux::VISUAL_STATE_PRESSED)
{
cairo_line_to(cr, x + width, y + height / 2.0 - arrow_h);
cairo_line_to(cr, x + width - arrow_w, y + height / 2.0);
@@ -1061,7 +1061,7 @@ void Style::Impl::RoundedRectSegment(cairo_t* cr,
// top-right
cairo_line_to(cr, x + width, y);
- if ((arrow == Arrow::RIGHT || arrow == Arrow::BOTH) && state == nux::NUX_STATE_ACTIVE)
+ if ((arrow == Arrow::RIGHT || arrow == Arrow::BOTH) && state == nux::VISUAL_STATE_PRESSED)
{
cairo_line_to(cr, x + width, y + height / 2.0 - arrow_h);
cairo_line_to(cr, x + width - arrow_w, y + height / 2.0);
@@ -1074,7 +1074,7 @@ void Style::Impl::RoundedRectSegment(cairo_t* cr,
// bottom-left
cairo_line_to(cr, x, y + height);
- if ((arrow == Arrow::LEFT || arrow == Arrow::BOTH) && state == nux::NUX_STATE_ACTIVE)
+ if ((arrow == Arrow::LEFT || arrow == Arrow::BOTH) && state == nux::VISUAL_STATE_PRESSED)
{
cairo_line_to(cr, x, y + height / 2.0 + arrow_h);
cairo_line_to(cr, x + arrow_w, y + height / 2.0);
@@ -1114,7 +1114,7 @@ void Style::Impl::RoundedRectSegment(cairo_t* cr,
// bottom-left
cairo_line_to(cr, x, y + height);
- if (arrow == Arrow::LEFT && state == nux::NUX_STATE_ACTIVE)
+ if (arrow == Arrow::LEFT && state == nux::VISUAL_STATE_PRESSED)
{
cairo_line_to(cr, x, y + height / 2.0 + arrow_h);
cairo_line_to(cr, x + arrow_w, y + height / 2.0);
@@ -1549,7 +1549,7 @@ void Style::Impl::DrawOverlay(cairo_t* cr,
cairo_set_operator(cr, old);
}
-bool Style::Button(cairo_t* cr, nux::State state, std::string const& label)
+bool Style::Button(cairo_t* cr, nux::ButtonVisualState state, std::string const& label)
{
// sanity checks
if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
@@ -1593,7 +1593,7 @@ bool Style::Button(cairo_t* cr, nux::State state, std::string const& label)
return true;
}
-bool Style::StarEmpty(cairo_t* cr, nux::State state)
+bool Style::StarEmpty(cairo_t* cr, nux::ButtonVisualState state)
{
// sanity checks
if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
@@ -1619,7 +1619,7 @@ bool Style::StarEmpty(cairo_t* cr, nux::State state)
return true;
}
-bool Style::StarHalf(cairo_t* cr, nux::State state)
+bool Style::StarHalf(cairo_t* cr, nux::ButtonVisualState state)
{
// sanity checks
if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
@@ -1653,7 +1653,7 @@ bool Style::StarHalf(cairo_t* cr, nux::State state)
return true;
}
-bool Style::StarFull(cairo_t* cr, nux::State state)
+bool Style::StarFull(cairo_t* cr, nux::ButtonVisualState state)
{
// sanity checks
if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
@@ -1678,10 +1678,10 @@ bool Style::StarFull(cairo_t* cr, nux::State state)
}
bool Style::MultiRangeSegment(cairo_t* cr,
- nux::State state,
- std::string const& label,
- Arrow arrow,
- Segment segment)
+ nux::ButtonVisualState state,
+ std::string const& label,
+ Arrow arrow,
+ Segment segment)
{
// sanity checks
if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
@@ -1735,8 +1735,8 @@ bool Style::MultiRangeSegment(cairo_t* cr,
}
bool Style::TrackViewNumber(cairo_t* cr,
- nux::State state,
- std::string const& trackNumber)
+ nux::ButtonVisualState state,
+ std::string const& trackNumber)
{
// sanity checks
if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
@@ -1749,7 +1749,7 @@ bool Style::TrackViewNumber(cairo_t* cr,
}
bool Style::TrackViewPlay(cairo_t* cr,
- nux::State state)
+ nux::ButtonVisualState state)
{
// sanity checks
if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
@@ -1762,7 +1762,7 @@ bool Style::TrackViewPlay(cairo_t* cr,
}
bool Style::TrackViewPause(cairo_t* cr,
- nux::State state)
+ nux::ButtonVisualState state)
{
// sanity checks
if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
diff --git a/plugins/unityshell/src/DashStyle.h b/plugins/unityshell/src/DashStyle.h
index c81f97963..0a0981468 100644
--- a/plugins/unityshell/src/DashStyle.h
+++ b/plugins/unityshell/src/DashStyle.h
@@ -80,30 +80,30 @@ public:
static Style& Instance();
- virtual bool Button(cairo_t* cr, nux::State state,
+ virtual bool Button(cairo_t* cr, nux::ButtonVisualState state,
std::string const& label);
- virtual bool StarEmpty(cairo_t* cr, nux::State state);
+ virtual bool StarEmpty(cairo_t* cr, nux::ButtonVisualState state);
- virtual bool StarHalf(cairo_t* cr, nux::State state);
+ virtual bool StarHalf(cairo_t* cr, nux::ButtonVisualState state);
- virtual bool StarFull(cairo_t* cr, nux::State state);
+ virtual bool StarFull(cairo_t* cr, nux::ButtonVisualState state);
virtual bool MultiRangeSegment(cairo_t* cr,
- nux::State state,
+ nux::ButtonVisualState state,
std::string const& label,
Arrow arrow,
Segment segment);
virtual bool TrackViewNumber(cairo_t* cr,
- nux::State state,
+ nux::ButtonVisualState state,
std::string const& trackNumber);
virtual bool TrackViewPlay(cairo_t* cr,
- nux::State state);
+ nux::ButtonVisualState state);
virtual bool TrackViewPause(cairo_t* cr,
- nux::State state);
+ nux::ButtonVisualState state);
virtual bool TrackViewProgress(cairo_t* cr);
diff --git a/plugins/unityshell/src/DashView.cpp b/plugins/unityshell/src/DashView.cpp
index 425b4ed7d..2ab5338f6 100644
--- a/plugins/unityshell/src/DashView.cpp
+++ b/plugins/unityshell/src/DashView.cpp
@@ -78,7 +78,6 @@ void DashView::AboutToShow()
visible_ = true;
bg_effect_helper_.enabled = true;
search_bar_->text_entry()->SelectAll();
- search_bar_->text_entry()->SetFocused(true);
}
void DashView::AboutToHide()
@@ -214,24 +213,6 @@ nux::Geometry DashView::GetBestFitGeometry(nux::Geometry const& for_geo)
return nux::Geometry(0, 0, width, height);
}
-long DashView::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info)
-{
- long ret = traverse_info;
-
- if ((ievent.e_event == nux::NUX_KEYDOWN) &&
- (ievent.GetKeySym() == NUX_VK_ESCAPE))
- {
- if (search_bar_->search_string == "")
- ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
- else
- search_bar_->search_string = "";
- return ret;
- }
-
- ret = layout_->ProcessEvent(ievent, traverse_info, event_info);
- return ret;
-}
-
void DashView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
{
bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE;
@@ -394,8 +375,8 @@ void DashView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
texxform_absolute_bg.flip_v_coord = false;
- texxform_absolute_bg.uoffset = (1.0f / 707) * (GetAbsoluteGeometry().x); // TODO (gord) don't use absolute values here
- texxform_absolute_bg.voffset = (1.0f / 737) * (GetAbsoluteGeometry().y);
+ texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * (GetAbsoluteGeometry().x);
+ texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * (GetAbsoluteGeometry().y);
gfx_context.GetRenderStates().SetColorMask(true, true, true, false);
gfx_context.GetRenderStates().SetBlend(true, GL_DST_COLOR, GL_ONE);
@@ -503,8 +484,8 @@ void DashView::DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw)
rop.SrcBlend = GL_DST_COLOR;
rop.DstBlend = GL_ONE;
texxform_absolute_bg.flip_v_coord = false;
- texxform_absolute_bg.uoffset = (1.0f / 707) * (GetAbsoluteGeometry().x); // TODO (gord) don't use absolute values here
- texxform_absolute_bg.voffset = (1.0f / 737) * (GetAbsoluteGeometry().y);
+ texxform_absolute_bg.uoffset = (1.0f / bg_shine_texture_->GetWidth()) * (GetAbsoluteGeometry().x);
+ texxform_absolute_bg.voffset = (1.0f / bg_shine_texture_->GetHeight()) * (GetAbsoluteGeometry().y);
nux::GetPainter().PushTextureLayer(gfx_context, bg_layer_->GetGeometry(),
bg_shine_texture_,
@@ -563,9 +544,6 @@ void DashView::OnActivateRequest(GVariant* args)
home_view_->search_string = "";
lens_bar_->Activate(id);
- // Reset focus
- SetFocused(false);
- SetFocused(true);
if (id == "home.lens" || !visible_)
ubus_manager_.SendMessage(UBUS_DASH_EXTERNAL_ACTIVATION);
@@ -702,7 +680,6 @@ void DashView::OnLensBarActivated(std::string const& id)
search_bar_->showing_filters = expanded;
search_bar_->text_entry()->SelectAll();
- search_bar_->text_entry()->SetFocused(true);
nux::GetWindowCompositor().SetKeyFocusArea(search_bar_->text_entry());
search_bar_->can_refine_search = view->can_refine_search();
@@ -942,7 +919,7 @@ Area* DashView::FindKeyFocusArea(unsigned int key_symbol,
{
return this;
}
- else if (direction == KEY_NAV_NONE)
+ else if (direction == KEY_NAV_NONE || search_bar_->im_active)
{
// then send the event to the search entry
return search_bar_->text_entry();
diff --git a/plugins/unityshell/src/DashView.h b/plugins/unityshell/src/DashView.h
index 21460c106..ad4b73b54 100644
--- a/plugins/unityshell/src/DashView.h
+++ b/plugins/unityshell/src/DashView.h
@@ -75,7 +75,6 @@ private:
nux::Geometry GetBestFitGeometry(nux::Geometry const& for_geo);
- long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info);
void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
virtual long PostLayoutManagement (long LayoutResult);
diff --git a/plugins/unityshell/src/DeviceLauncherIcon.cpp b/plugins/unityshell/src/DeviceLauncherIcon.cpp
index f960985fa..0927bafaa 100644
--- a/plugins/unityshell/src/DeviceLauncherIcon.cpp
+++ b/plugins/unityshell/src/DeviceLauncherIcon.cpp
@@ -35,12 +35,17 @@ namespace unity
namespace
{
nux::logging::Logger logger("unity.launcher");
+
+GduDevice* get_device_for_device_file (const gchar *device_file);
+
}
DeviceLauncherIcon::DeviceLauncherIcon(Launcher* launcher, GVolume* volume)
: SimpleLauncherIcon(launcher)
, volume_(volume)
-{
+ , device_file_(g_volume_get_identifier(volume_, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE))
+ , gdu_device_(get_device_for_device_file(device_file_.Value()))
+{
DevicesSettings::GetDefault().changed.connect(sigc::mem_fun(this, &DeviceLauncherIcon::OnSettingsChanged));
// Checks if in favourites!
@@ -118,6 +123,21 @@ std::list<DbusmenuMenuitem*> DeviceLauncherIcon::GetMenus()
G_CALLBACK(&DeviceLauncherIcon::OnOpen), this);
result.push_back(menu_item);
+
+ // "Format" item
+ if (gdu_device_ && !gdu_device_is_optical_disc(gdu_device_))
+ {
+ menu_item = dbusmenu_menuitem_new();
+
+ dbusmenu_menuitem_property_set(menu_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Format..."));
+ dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_ENABLED, true);
+ dbusmenu_menuitem_property_set_bool(menu_item, DBUSMENU_MENUITEM_PROP_VISIBLE, true);
+
+ g_signal_connect(menu_item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ G_CALLBACK(&DeviceLauncherIcon::OnFormat), this);
+
+ result.push_back(menu_item);
+ }
// "Eject" item
if (drive && g_drive_can_eject(drive))
@@ -329,6 +349,32 @@ void DeviceLauncherIcon::OnOpen(DbusmenuMenuitem* item,
self->ActivateLauncherIcon(ActionArg(ActionArg::OTHER, 0));
}
+void DeviceLauncherIcon::OnFormat(DbusmenuMenuitem* item,
+ int time,
+ DeviceLauncherIcon* self)
+{
+ glib::Error error;
+
+ gchar const* args[] = { "/usr/lib/gnome-disk-utility/gdu-format-tool",
+ "--device-file",
+ self->device_file_.Value(),
+ NULL};
+
+ g_spawn_async(NULL, // working dir
+ const_cast<gchar **>(args),
+ NULL, // envp
+ (GSpawnFlags) 0, // flags
+ NULL, // child_setup
+ NULL, // user_data
+ NULL, // GPid *child_pid
+ &error);
+
+ if (error)
+ {
+ LOG_WARNING(logger) << "Error launching " << args[0] << ": " << error;
+ }
+}
+
void DeviceLauncherIcon::OnEject(DbusmenuMenuitem* item,
int time,
DeviceLauncherIcon* self)
@@ -433,4 +479,19 @@ void DeviceLauncherIcon::OnSettingsChanged()
UpdateVisibility();
}
+namespace {
+
+GduDevice* get_device_for_device_file(const gchar *device_file)
+{
+ if (device_file == NULL || strlen(device_file) <= 1)
+ return NULL;
+
+ glib::Object<GduPool> pool(gdu_pool_new());
+ GduDevice *device = gdu_pool_get_by_device_file(pool, device_file);
+
+ return device;
+}
+
+} // anonymouse namespace
+
} // namespace unity
diff --git a/plugins/unityshell/src/DeviceLauncherIcon.h b/plugins/unityshell/src/DeviceLauncherIcon.h
index 73930d567..fa84300c0 100644
--- a/plugins/unityshell/src/DeviceLauncherIcon.h
+++ b/plugins/unityshell/src/DeviceLauncherIcon.h
@@ -21,8 +21,10 @@
#define _DEVICE_LAUNCHER_ICON_H__H
#include <gio/gio.h>
+#define GDU_API_IS_SUBJECT_TO_CHANGE
+G_BEGIN_DECLS
+#include <gdu/gdu.h>
#include <UnityCore/GLibWrapper.h>
-
#include "SimpleLauncherIcon.h"
namespace unity {
@@ -51,6 +53,7 @@ private:
void StopDrive();
static void OnTogglePin(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
static void OnOpen(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
+ static void OnFormat(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
static void OnEject(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
static void OnUnmount(DbusmenuMenuitem* item, int time, DeviceLauncherIcon* self);
static void OnChanged(GVolume* volume, DeviceLauncherIcon* self);
@@ -62,6 +65,8 @@ private:
private:
GVolume* volume_;
+ glib::String device_file_;
+ glib::Object<GduDevice> gdu_device_;
bool keep_in_launcher_;
};
diff --git a/plugins/unityshell/src/FilterBar.cpp b/plugins/unityshell/src/FilterBar.cpp
index 300396bb9..11705d8b9 100644
--- a/plugins/unityshell/src/FilterBar.cpp
+++ b/plugins/unityshell/src/FilterBar.cpp
@@ -44,8 +44,8 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterBar);
}
void FilterBar::Init () {
- nux::Layout *layout = new nux::VLayout (NUX_TRACKER_LOCATION);
- layout->SetVerticalInternalMargin(12);
+ nux::LinearLayout *layout = new nux::VLayout (NUX_TRACKER_LOCATION);
+ layout->SetSpaceBetweenChildren(12);
SetLayout (layout);
}
@@ -78,11 +78,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterBar);
}
}
-
- long int FilterBar::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterBar::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
nux::Geometry geo = GetGeometry();
diff --git a/plugins/unityshell/src/FilterBar.h b/plugins/unityshell/src/FilterBar.h
index e0bdebf20..a770ace6c 100644
--- a/plugins/unityshell/src/FilterBar.h
+++ b/plugins/unityshell/src/FilterBar.h
@@ -44,7 +44,6 @@ namespace unity {
void RemoveFilter (dash::Filter::Ptr filter);
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/FilterBasicButton.cpp b/plugins/unityshell/src/FilterBasicButton.cpp
index f876159fc..cbf900b37 100644
--- a/plugins/unityshell/src/FilterBasicButton.cpp
+++ b/plugins/unityshell/src/FilterBasicButton.cpp
@@ -82,22 +82,22 @@ namespace unity {
{
if (prelight_ == NULL)
{
- prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::State::NUX_STATE_PRELIGHT));
- active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::State::NUX_STATE_ACTIVE));
- normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::State::NUX_STATE_NORMAL));
+ prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT));
+ active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED));
+ normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL));
}
// SetMinimumHeight(32);
}
- void FilterBasicButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state)
+ void FilterBasicButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state)
{
dash::Style::Instance().Button(cr, faked_state, label_);
}
- long FilterBasicButton::ComputeLayout2 ()
+ long FilterBasicButton::ComputeContentSize ()
{
- long ret = nux::Button::ComputeLayout2();
+ long ret = nux::Button::ComputeContentSize();
if (cached_geometry_ != GetGeometry())
{
nux::Geometry geo = GetGeometry();
@@ -110,10 +110,6 @@ namespace unity {
return ret;
}
- long int FilterBasicButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return nux::Button::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
gPainter.PaintBackground(GfxContext, GetGeometry());
// set up our texture mode
@@ -135,11 +131,11 @@ namespace unity {
col);
nux::BaseTexture *texture = normal_->GetTexture();
- if (active)
+ if (Active())
texture = active_->GetTexture();
- else if (state == nux::State::NUX_STATE_PRELIGHT)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
texture = prelight_->GetTexture();
- else if (state == nux::State::NUX_STATE_ACTIVE)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
{
texture = active_->GetTexture();
}
diff --git a/plugins/unityshell/src/FilterBasicButton.h b/plugins/unityshell/src/FilterBasicButton.h
index d325fc73e..2370be03e 100644
--- a/plugins/unityshell/src/FilterBasicButton.h
+++ b/plugins/unityshell/src/FilterBasicButton.h
@@ -41,14 +41,13 @@ namespace unity {
virtual ~FilterBasicButton();
protected:
- virtual long ComputeLayout2();
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
+ virtual long ComputeContentSize();
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
void InitTheme ();
- void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state);
+ void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state);
nux::CairoWrapper *prelight_;
nux::CairoWrapper *active_;
diff --git a/plugins/unityshell/src/FilterExpanderLabel.cpp b/plugins/unityshell/src/FilterExpanderLabel.cpp
index da726e900..6d33d8c14 100644
--- a/plugins/unityshell/src/FilterExpanderLabel.cpp
+++ b/plugins/unityshell/src/FilterExpanderLabel.cpp
@@ -26,6 +26,7 @@
#include "FilterBasicButton.h"
#include "FilterExpanderLabel.h"
+#include "PlacesStyle.h"
namespace unity {
@@ -56,6 +57,8 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterExpanderLabel);
void FilterExpanderLabel::SetRightHandView (nux::View *view)
{
+ view->SetMaximumHeight(30);
+
right_hand_contents_ = view;
top_bar_layout_->AddView(right_hand_contents_, 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);
}
@@ -71,9 +74,11 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterExpanderLabel);
void FilterExpanderLabel::BuildLayout ()
{
+ PlacesStyle *style = PlacesStyle::GetDefault();
+
layout_ = new nux::VLayout(NUX_TRACKER_LOCATION);
top_bar_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
-
+
cairo_label_ = new nux::StaticText(label_.c_str(), NUX_TRACKER_LOCATION);
cairo_label_->SetFontName("Ubuntu 10");
cairo_label_->SetTextColor(nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
@@ -88,9 +93,11 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterExpanderLabel);
top_bar_layout_->AddView (cairo_label_, 1, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);
top_bar_layout_->AddSpace(1, 1);
+
+ top_bar_layout_->SetMaximumWidth((style->GetTileWidth() -12)*2+10);
- layout_->AddLayout (top_bar_layout_, 0);
- layout_->SetVerticalInternalMargin(12);
+ layout_->AddLayout (top_bar_layout_, 0, nux::MINOR_POSITION_LEFT);
+ layout_->SetVerticalInternalMargin(0);
SetLayout(layout_);
@@ -106,10 +113,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterExpanderLabel);
QueueRelayout();
}
- long int FilterExpanderLabel::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterExpanderLabel::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
nux::Geometry geo = GetGeometry();
diff --git a/plugins/unityshell/src/FilterExpanderLabel.h b/plugins/unityshell/src/FilterExpanderLabel.h
index a88139ac1..0115e7cf7 100644
--- a/plugins/unityshell/src/FilterExpanderLabel.h
+++ b/plugins/unityshell/src/FilterExpanderLabel.h
@@ -45,7 +45,6 @@ namespace unity {
nux::Property<bool> expanded;
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
@@ -54,8 +53,8 @@ namespace unity {
void BuildLayout ();
void DoExpandChange (bool change);
- nux::Layout* layout_;
- nux::Layout* top_bar_layout_;
+ nux::LinearLayout* layout_;
+ nux::LinearLayout* top_bar_layout_;
nux::Layout* contents_;
nux::View* right_hand_contents_;
nux::View* expander_graphic_;
diff --git a/plugins/unityshell/src/FilterGenreButton.cpp b/plugins/unityshell/src/FilterGenreButton.cpp
index bbedd59b8..9b9274b4e 100644
--- a/plugins/unityshell/src/FilterGenreButton.cpp
+++ b/plugins/unityshell/src/FilterGenreButton.cpp
@@ -28,8 +28,9 @@ namespace unity {
FilterGenreButton::FilterGenreButton (const std::string label, NUX_FILE_LINE_DECL)
: FilterBasicButton(label, NUX_FILE_LINE_PARAM) {
InitTheme();
- active.changed.connect ([&] (bool is_active) {
- bool tmp_active = active;
+
+ state_change.connect ([&] (Button* button) {
+ bool tmp_active = Active();
if (filter_ != NULL)
filter_->active = tmp_active;
});
@@ -38,8 +39,9 @@ namespace unity {
FilterGenreButton::FilterGenreButton (NUX_FILE_LINE_DECL)
: FilterBasicButton(NUX_FILE_LINE_PARAM) {
InitTheme();
- active.changed.connect ([&] (bool is_active) {
- bool tmp_active = active;
+
+ state_change.connect ([&] (Button* button) {
+ bool tmp_active = Active();
if (filter_ != NULL)
filter_->active = tmp_active;
});
@@ -51,9 +53,9 @@ namespace unity {
filter_ = filter;
bool tmp_active = filter_->active;
- active = tmp_active;
+ SetActive(tmp_active);
filter_->active.changed.connect ([&] (bool is_active) {
- active = is_active;
+ SetActive(is_active);
});
}
@@ -62,10 +64,6 @@ namespace unity {
return filter_;
}
- long int FilterGenreButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return FilterBasicButton::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterGenreButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
FilterBasicButton::Draw(GfxContext, force_draw);
}
diff --git a/plugins/unityshell/src/FilterGenreButton.h b/plugins/unityshell/src/FilterGenreButton.h
index de10d96af..4c13deb3f 100644
--- a/plugins/unityshell/src/FilterGenreButton.h
+++ b/plugins/unityshell/src/FilterGenreButton.h
@@ -41,7 +41,6 @@ namespace unity {
dash::FilterOption::Ptr GetFilter();
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/FilterGenreWidget.cpp b/plugins/unityshell/src/FilterGenreWidget.cpp
index 2616b1006..3e4e41c1e 100644
--- a/plugins/unityshell/src/FilterGenreWidget.cpp
+++ b/plugins/unityshell/src/FilterGenreWidget.cpp
@@ -49,17 +49,16 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterGenre);
InitTheme();
all_button_ = new FilterBasicButton(_("All"), NUX_TRACKER_LOCATION);
- all_button_->activated.connect(sigc::mem_fun(this, &FilterGenre::OnAllActivated));
- all_button_->label = _("All");
+ all_button_->state_change.connect(sigc::mem_fun(this, &FilterGenre::OnAllActivated));
+ all_button_->SetLabel(_("All"));
genre_layout_ = new nux::GridHLayout(NUX_TRACKER_LOCATION);
genre_layout_->ForceChildrenSize(true);
- genre_layout_->SetHeightMatchContent(true);
- genre_layout_->SetVerticalInternalMargin (12);
- genre_layout_->SetVerticalExternalMargin (12);
- genre_layout_->SetHorizontalInternalMargin (10);
+ genre_layout_->MatchContentSize(true);
+ genre_layout_->SetSpaceBetweenChildren (10, 12);
+ genre_layout_->SetTopAndBottomPadding (12);
genre_layout_->EnablePartialVisibility (false);
- genre_layout_->SetChildrenSize (dash::Style::Instance().GetTileWidth() - 12, 35);
+ genre_layout_->SetChildrenSize (dash::Style::Instance().GetTileWidth() - 12, 32);
SetRightHandView(all_button_);
SetContents(genre_layout_);
@@ -141,11 +140,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterGenre);
// if they are, then set the all status to true
}
-
- long int FilterGenre::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterGenre::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
nux::Geometry geo = GetGeometry();
nux::Color col(0.2f, 0.2f, 0.2f, 0.2f);
diff --git a/plugins/unityshell/src/FilterGenreWidget.h b/plugins/unityshell/src/FilterGenreWidget.h
index 05ff2e1a8..14f958d76 100644
--- a/plugins/unityshell/src/FilterGenreWidget.h
+++ b/plugins/unityshell/src/FilterGenreWidget.h
@@ -52,7 +52,6 @@ namespace unity {
nux::Property<bool> all_selected;
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/FilterMultiRangeButton.cpp b/plugins/unityshell/src/FilterMultiRangeButton.cpp
index a3ef621ad..ea5a418e9 100644
--- a/plugins/unityshell/src/FilterMultiRangeButton.cpp
+++ b/plugins/unityshell/src/FilterMultiRangeButton.cpp
@@ -35,8 +35,7 @@ namespace unity {
, side_ (MULTI_RANGE_CENTER)
{
InitTheme();
- activated.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated));
- active.changed.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActiveChanged));
+ state_change.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated));
}
FilterMultiRangeButton::FilterMultiRangeButton (NUX_FILE_LINE_DECL)
@@ -48,8 +47,7 @@ namespace unity {
, side_ (MULTI_RANGE_CENTER)
{
InitTheme();
- activated.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated));
- active.changed.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActiveChanged));
+ state_change.connect (sigc::mem_fun(this, &FilterMultiRangeButton::OnActivated));
}
FilterMultiRangeButton::~FilterMultiRangeButton()
@@ -61,7 +59,7 @@ namespace unity {
void FilterMultiRangeButton::OnActivated (nux::Area *area)
{
- bool tmp_active = active;
+ bool tmp_active = Active();
if (filter_ != NULL)
filter_->active = tmp_active;
}
@@ -75,7 +73,7 @@ namespace unity {
{
filter_ = filter;
bool tmp_active = filter_->active;
- active = tmp_active;
+ SetActive(tmp_active);
}
dash::FilterOption::Ptr FilterMultiRangeButton::GetFilter()
@@ -98,13 +96,13 @@ namespace unity {
NeedRedraw();
}
- long FilterMultiRangeButton::ComputeLayout2()
+ long FilterMultiRangeButton::ComputeContentSize()
{
if (prelight_ == NULL)
{
InitTheme();
}
- long ret = nux::ToggleButton::ComputeLayout2();
+ long ret = nux::ToggleButton::ComputeContentSize();
if (cached_geometry_ != GetGeometry())
{
prelight_->Invalidate(GetGeometry());
@@ -120,15 +118,15 @@ namespace unity {
{
if (prelight_ == NULL)
{
- prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::State::NUX_STATE_PRELIGHT));
- active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::State::NUX_STATE_ACTIVE));
- normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::State::NUX_STATE_NORMAL));
+ prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT));
+ active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED));
+ normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &FilterMultiRangeButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL));
}
- //SetMinimumHeight(32);
+ SetMinimumHeight(32);
}
- void FilterMultiRangeButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state)
+ void FilterMultiRangeButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state)
{
std::string name = "10";
std::stringstream final;
@@ -161,11 +159,6 @@ namespace unity {
NeedRedraw();
}
-
- long int FilterMultiRangeButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return nux::ToggleButton::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterMultiRangeButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
gPainter.PaintBackground(GfxContext, GetGeometry());
// set up our texture mode
@@ -188,11 +181,11 @@ namespace unity {
nux::BaseTexture *texture = normal_->GetTexture();
//FIXME - dashstyle does not give us a focused state yet, so ignore
- //~ if (state == nux::State::NUX_STATE_PRELIGHT)
+ //~ if (state == nux::ButtonVisualState::NUX_VISUAL_STATE_PRELIGHT)
//~ {
//~ texture = prelight_->GetTexture();
//~ }
- if (active)
+ if (Active())
{
texture = active_->GetTexture();
}
diff --git a/plugins/unityshell/src/FilterMultiRangeButton.h b/plugins/unityshell/src/FilterMultiRangeButton.h
index 1ea61046f..853ad32bd 100644
--- a/plugins/unityshell/src/FilterMultiRangeButton.h
+++ b/plugins/unityshell/src/FilterMultiRangeButton.h
@@ -60,8 +60,7 @@ namespace unity {
void SetHasArrow (MultiRangeArrow arrow); //0 = left, 1 = both, 2 = right, -1 = none
protected:
- virtual long ComputeLayout2();
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
+ virtual long ComputeContentSize();
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
@@ -70,7 +69,7 @@ namespace unity {
dash::FilterOption::Ptr filter_;
void InitTheme ();
- void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state);
+ void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state);
void OnActivated (nux::Area *area);
void OnActiveChanged(bool value);
diff --git a/plugins/unityshell/src/FilterMultiRangeWidget.cpp b/plugins/unityshell/src/FilterMultiRangeWidget.cpp
index c6946757f..25126406c 100644
--- a/plugins/unityshell/src/FilterMultiRangeWidget.cpp
+++ b/plugins/unityshell/src/FilterMultiRangeWidget.cpp
@@ -41,8 +41,8 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRange);
InitTheme();
all_button_ = new FilterBasicButton(_("All"), NUX_TRACKER_LOCATION);
- all_button_->activated.connect(sigc::mem_fun(this, &FilterMultiRange::OnAllActivated));
- all_button_->label = _("All");
+ all_button_->state_change.connect(sigc::mem_fun(this, &FilterMultiRange::OnAllActivated));
+ all_button_->SetLabel(_("All"));
layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
layout_->SetVerticalExternalMargin (12);
@@ -85,7 +85,7 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRange);
FilterMultiRangeButton* button = (*it);
dash::FilterOption::Ptr filter = button->GetFilter();
bool tmp_active = filter->active;
- button->active = tmp_active;
+ button->SetActive(tmp_active);
if (filter != NULL)
{
if (filter->active)
@@ -173,10 +173,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterMultiRange);
filter_->Clear();
}
- long int FilterMultiRange::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterMultiRange::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
nux::Geometry geo = GetGeometry();
nux::Color col(0.2f, 0.2f, 0.2f, 0.2f);
diff --git a/plugins/unityshell/src/FilterMultiRangeWidget.h b/plugins/unityshell/src/FilterMultiRangeWidget.h
index da20ec3b7..62d6676a0 100644
--- a/plugins/unityshell/src/FilterMultiRangeWidget.h
+++ b/plugins/unityshell/src/FilterMultiRangeWidget.h
@@ -50,7 +50,6 @@ namespace unity {
nux::Property<bool> all_selected;
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/FilterRatingsButton.cpp b/plugins/unityshell/src/FilterRatingsButton.cpp
index 745328bdd..fd7254dca 100644
--- a/plugins/unityshell/src/FilterRatingsButton.cpp
+++ b/plugins/unityshell/src/FilterRatingsButton.cpp
@@ -83,21 +83,21 @@ namespace unity {
{
nux::Geometry geometry = GetGeometry();
geometry.width /= 5;
- prelight_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::State::NUX_STATE_PRELIGHT));
- active_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::State::NUX_STATE_ACTIVE));
- normal_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::State::NUX_STATE_NORMAL));
+ prelight_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT));
+ active_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_PRESSED));
+ normal_empty_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 0, nux::ButtonVisualState::VISUAL_STATE_NORMAL));
- prelight_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::State::NUX_STATE_PRELIGHT));
- active_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::State::NUX_STATE_ACTIVE));
- normal_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::State::NUX_STATE_NORMAL));
+ prelight_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT));
+ active_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_PRESSED));
+ normal_half_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 1, nux::ButtonVisualState::VISUAL_STATE_NORMAL));
- prelight_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::State::NUX_STATE_PRELIGHT));
- active_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::State::NUX_STATE_ACTIVE));
- normal_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::State::NUX_STATE_NORMAL));
+ prelight_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_PRELIGHT));
+ active_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_PRESSED));
+ normal_full_ = new nux::CairoWrapper(geometry, sigc::bind(sigc::mem_fun(this, &FilterRatingsButton::RedrawTheme), 2, nux::ButtonVisualState::VISUAL_STATE_NORMAL));
}
}
- void FilterRatingsButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, int type, nux::State faked_state)
+ void FilterRatingsButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, int type, nux::ButtonVisualState faked_state)
{
dash::Style& dash_style = dash::Style::Instance();
if (type == 0)
@@ -117,9 +117,9 @@ namespace unity {
}
}
- long FilterRatingsButton::ComputeLayout2 ()
+ long FilterRatingsButton::ComputeContentSize ()
{
- long ret = nux::Button::ComputeLayout2();
+ long ret = nux::Button::ComputeContentSize();
if (cached_geometry_ != GetGeometry())
{
nux::Geometry geometry = GetGeometry();
@@ -142,15 +142,10 @@ namespace unity {
return ret;
}
-
- long int FilterRatingsButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return nux::Button::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterRatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
- int rating = 5;
- if (filter_ != NULL)
- rating = filter_->rating * 10;
+ int rating = 0;
+ if (filter_ != NULL && filter_->filtering)
+ rating = static_cast<int>(filter_->rating * 5);
// FIXME: 9/26/2011
// We should probably support an API for saying whether the ratings
// should or shouldn't support half stars...but our only consumer at
@@ -158,7 +153,7 @@ namespace unity {
// (Bug #839759) shouldn't. So for now just force rounding.
// int total_half_stars = rating % 2;
// int total_full_stars = rating / 2;
- int total_full_stars = ceil (rating / 2.0);
+ int total_full_stars = rating;
int total_half_stars = 0;
nux::Geometry geometry = GetGeometry ();
@@ -190,27 +185,27 @@ namespace unity {
nux::BaseTexture *texture = normal_empty_->GetTexture();
if (index < total_full_stars) {
- if (state == nux::State::NUX_STATE_NORMAL)
+ if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
texture = normal_full_->GetTexture();
- else if (state == nux::State::NUX_STATE_PRELIGHT)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
texture = prelight_full_->GetTexture();
- else if (state == nux::State::NUX_STATE_ACTIVE)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
texture = active_full_->GetTexture();
}
else if (index < total_full_stars + total_half_stars) {
- if (state == nux::State::NUX_STATE_NORMAL)
+ if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
texture = normal_half_->GetTexture();
- else if (state == nux::State::NUX_STATE_PRELIGHT)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
texture = prelight_half_->GetTexture();
- else if (state == nux::State::NUX_STATE_ACTIVE)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
texture = active_half_->GetTexture();
}
else {
- if (state == nux::State::NUX_STATE_NORMAL)
+ if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
texture = normal_empty_->GetTexture();
- else if (state == nux::State::NUX_STATE_PRELIGHT)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
texture = prelight_empty_->GetTexture();
- else if (state == nux::State::NUX_STATE_ACTIVE)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
texture = active_empty_->GetTexture();
}
@@ -241,13 +236,14 @@ namespace unity {
static void _UpdateRatingToMouse (dash::RatingsFilter::Ptr filter, int x)
{
int width = 180;
- float new_rating = (static_cast<float>(x) / width) + 0.10f;
+ float new_rating = (static_cast<float>(x) / width);
- new_rating = ceil(10*new_rating)/10;
+ // FIXME: change to 10 once we decide to support also half-stars
+ new_rating = ceil(5*new_rating)/5;
new_rating = new_rating > 1 ? 1 : (new_rating < 0 ? 0 : new_rating);
if (filter != NULL)
- filter->rating = new_rating;
+ filter->rating = new_rating;
}
void FilterRatingsButton::RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags)
diff --git a/plugins/unityshell/src/FilterRatingsButton.h b/plugins/unityshell/src/FilterRatingsButton.h
index 5a7623467..1ccf52b2d 100644
--- a/plugins/unityshell/src/FilterRatingsButton.h
+++ b/plugins/unityshell/src/FilterRatingsButton.h
@@ -43,15 +43,14 @@ namespace unity {
std::string GetFilterType ();
protected:
- virtual long ComputeLayout2 ();
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
+ virtual long ComputeContentSize ();
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
void InitTheme ();
- void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
+ //void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags);
void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags);
void RecvMouseDrag (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
void OnRatingsChanged (int rating);
@@ -67,7 +66,7 @@ namespace unity {
nux::CairoWrapper *normal_full_;
nux::Geometry cached_geometry_;
- void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, int type, nux::State faked_state);
+ void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, int type, nux::ButtonVisualState faked_state);
dash::RatingsFilter::Ptr filter_;
diff --git a/plugins/unityshell/src/FilterRatingsWidget.cpp b/plugins/unityshell/src/FilterRatingsWidget.cpp
index 03d286f9c..e30a59de0 100644
--- a/plugins/unityshell/src/FilterRatingsWidget.cpp
+++ b/plugins/unityshell/src/FilterRatingsWidget.cpp
@@ -38,11 +38,12 @@ namespace unity {
NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget);
FilterRatingsWidget::FilterRatingsWidget (NUX_FILE_LINE_DECL)
- : FilterExpanderLabel (_("Rating"), NUX_FILE_LINE_PARAM)
+ : FilterExpanderLabel (_("Rating"), NUX_FILE_LINE_PARAM),
+ last_rating_ (0.0f)
{
any_button_ = new FilterBasicButton(_("All"), NUX_TRACKER_LOCATION);
- any_button_->activated.connect(sigc::mem_fun(this, &FilterRatingsWidget::OnAnyButtonActivated));
- any_button_->label = _("All");
+ any_button_->state_change.connect(sigc::mem_fun(this, &FilterRatingsWidget::OnAnyButtonActivated));
+ any_button_->SetLabel(_("All"));
SetRightHandView(any_button_);
@@ -59,12 +60,36 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget);
void FilterRatingsWidget::OnAnyButtonActivated(nux::View *view)
{
- filter_->Clear();
+ if (any_button_->Active())
+ {
+ last_rating_ = filter_->rating;
+ // we need to make sure the property changes, otherwise there'll be no
+ // signals, so we'll set it to 0.0f
+ filter_->rating = 0.0f;
+ filter_->Clear();
+ }
+ else
+ {
+ filter_->rating = last_rating_;
+ }
+ }
+
+ void FilterRatingsWidget::OnFilterRatingChanged(float new_rating)
+ {
+ if (new_rating <= 0.0f)
+ {
+ any_button_->SetActive(true);
+ }
+ else
+ {
+ any_button_->SetActive(false);
+ }
}
void FilterRatingsWidget::SetFilter (dash::Filter::Ptr filter)
{
filter_ = std::static_pointer_cast<dash::RatingsFilter>(filter);
+ filter_->rating.changed.connect (sigc::mem_fun (this, &FilterRatingsWidget::OnFilterRatingChanged));
ratings_->SetFilter(filter);
SetLabel(filter_->name);
NeedRedraw();
@@ -75,11 +100,6 @@ NUX_IMPLEMENT_OBJECT_TYPE(FilterRatingsWidget);
return "FilterRatingsWidget";
}
-
- long int FilterRatingsWidget::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return GetLayout()->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void FilterRatingsWidget::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
nux::Geometry geo = GetGeometry();
diff --git a/plugins/unityshell/src/FilterRatingsWidget.h b/plugins/unityshell/src/FilterRatingsWidget.h
index d0d52f993..e189a0714 100644
--- a/plugins/unityshell/src/FilterRatingsWidget.h
+++ b/plugins/unityshell/src/FilterRatingsWidget.h
@@ -51,13 +51,12 @@ namespace unity {
nux::Property<int> rating;
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
void OnRatingsRatingChanged(const int& new_rating);
- void OnFilterRatingChanged(const int& new_rating);
+ void OnFilterRatingChanged(float new_rating);
void OnAnyButtonActivated(nux::View *view);
FilterBasicButton *any_button_;
@@ -65,6 +64,7 @@ namespace unity {
dash::RatingsFilter::Ptr filter_;
private:
+ float last_rating_;
};
}
diff --git a/plugins/unityshell/src/HomeView.cpp b/plugins/unityshell/src/HomeView.cpp
index ed73a07f2..4bb2fb47f 100644
--- a/plugins/unityshell/src/HomeView.cpp
+++ b/plugins/unityshell/src/HomeView.cpp
@@ -194,11 +194,6 @@ gboolean HomeView::FixRenderering(HomeView* self)
return FALSE;
}
-long HomeView::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info)
-{
- return layout_->ProcessEvent(ievent, traverse_info, event_info);
-}
-
void HomeView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
{
nux::Geometry geo = GetGeometry();
diff --git a/plugins/unityshell/src/HomeView.h b/plugins/unityshell/src/HomeView.h
index d3ef8f4f1..75c1ffaff 100644
--- a/plugins/unityshell/src/HomeView.h
+++ b/plugins/unityshell/src/HomeView.h
@@ -65,7 +65,6 @@ private:
static gboolean FixRenderering(HomeView* self);
- long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info);
void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
diff --git a/plugins/unityshell/src/IMTextEntry.cpp b/plugins/unityshell/src/IMTextEntry.cpp
index 82ba742c4..7bc7a625b 100644
--- a/plugins/unityshell/src/IMTextEntry.cpp
+++ b/plugins/unityshell/src/IMTextEntry.cpp
@@ -50,7 +50,6 @@ IMTextEntry::IMTextEntry()
CheckIMEnabled();
im_enabled ? SetupMultiIM() : SetupSimpleIM();
- FocusChanged.connect([&] (nux::Area*) { GetFocused() ? OnFocusIn() : OnFocusOut(); });
mouse_up.connect(sigc::mem_fun(this, &IMTextEntry::OnMouseButtonUp));
}
@@ -243,16 +242,6 @@ void IMTextEntry::OnCommit(GtkIMContext* context, char* str)
LOG_DEBUG(logger) << "Commit: " << str;
DeleteSelection();
- /* remove preedit text and set cursor to previous position */
- if (preedit_cursor_) {
- std::string new_text = GetText();
- new_text.replace(cursor_, preedit_cursor_, "");
- int cursor = cursor_;
- SetText(new_text.c_str());
- SetCursor(cursor);
- preedit_cursor_ = 0;
- }
-
if (str)
{
std::string new_text = GetText();
@@ -270,49 +259,36 @@ void IMTextEntry::OnPreeditChanged(GtkIMContext* context)
glib::String preedit;
int cursor_pos = -1;
- gtk_im_context_get_preedit_string(context, &preedit, NULL, &cursor_pos);
+ gtk_im_context_get_preedit_string(context, &preedit, &preedit_attrs_, &cursor_pos);
LOG_DEBUG(logger) << "Preedit changed: " << preedit;
- preedit_string = preedit.Str();
+ _preedit = preedit.Str();
if (strlen(preedit.Str().c_str())) {
- DeleteSelection();
- std::string new_text = GetText();
- new_text.replace(cursor_, preedit_cursor_, preedit.Str());
- int cursor = cursor_;
- SetText(new_text.c_str());
- SetCursor(cursor);
preedit_cursor_ = preedit.Str().length();
+ QueueRefresh(true, true);
+ sigTextChanged.emit(this);
UpdateCursorLocation();
}
}
void IMTextEntry::OnPreeditStart(GtkIMContext* context)
{
- preedit_string = "";
im_active = true;
- preedit_cursor_ = 0;
LOG_DEBUG(logger) << "Preedit start";
}
void IMTextEntry::OnPreeditEnd(GtkIMContext* context)
{
- preedit_string = "";
im_active = false;
+ ResetPreedit();
gtk_im_context_reset(im_context_);
- /* remove preedit text and set cursor to previous position */
- if (preedit_cursor_) {
- std::string new_text = GetText();
- new_text.replace(cursor_, preedit_cursor_, "");
- int cursor = cursor_;
- SetText(new_text.c_str());
- SetCursor(cursor);
- preedit_cursor_ = 0;
- }
-
+ QueueRefresh(true, true);
+ sigTextChanged.emit(this);
+
LOG_DEBUG(logger) << "Preedit ended";
}
diff --git a/plugins/unityshell/src/IconTexture.cpp b/plugins/unityshell/src/IconTexture.cpp
index e108645fd..e9787c315 100644
--- a/plugins/unityshell/src/IconTexture.cpp
+++ b/plugins/unityshell/src/IconTexture.cpp
@@ -52,8 +52,6 @@ IconTexture::IconTexture(nux::BaseTexture* texture, guint width, guint height)
_opacity(1.0f)
{
SetMinMaxSize(width, height);
- SetCanFocus(false);
- _can_pass_focus_to_composite_layout = false;
_accept_key_nav_focus = false;
}
@@ -71,9 +69,6 @@ IconTexture::IconTexture(const char* icon_name, unsigned int size, bool defer_ic
if (!g_strcmp0(_icon_name, "") == 0 && !defer_icon_loading)
LoadIcon();
-
- _can_pass_focus_to_composite_layout = false;
- SetCanFocus(false);
}
IconTexture::~IconTexture()
diff --git a/plugins/unityshell/src/Launcher.cpp b/plugins/unityshell/src/Launcher.cpp
index bca3ef316..da9557504 100644
--- a/plugins/unityshell/src/Launcher.cpp
+++ b/plugins/unityshell/src/Launcher.cpp
@@ -2035,13 +2035,6 @@ void Launcher::OnIconNeedsRedraw(AbstractLauncherIcon* icon)
EnsureAnimation();
}
-long Launcher::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- long ret = TraverseInfo;
- ret = PostProcessEvent2(ievent, ret, ProcessEventInfo);
- return ret;
-}
-
void Launcher::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
@@ -2137,7 +2130,7 @@ void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
texxform.uoffset = (1.0f / launcher_sheen_->GetWidth()) * (GetAbsoluteGeometry().x); // TODO (gord) don't use absolute values here
- texxform.voffset = (1.0f / launcher_sheen_->GetWidth()) * (GetAbsoluteGeometry().y);
+ texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * (GetAbsoluteGeometry().y);
GfxContext.QRP_1Tex(base.x, base.y, base.width, base.height,
launcher_sheen_->GetDeviceTexture(),
texxform,
@@ -2211,9 +2204,9 @@ void Launcher::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw)
void Launcher::PreLayoutManagement()
{
View::PreLayoutManagement();
- if (m_CompositionLayout)
+ if (view_layout_)
{
- m_CompositionLayout->SetGeometry(GetGeometry());
+ view_layout_->SetGeometry(GetGeometry());
}
}
diff --git a/plugins/unityshell/src/Launcher.h b/plugins/unityshell/src/Launcher.h
index cd2f56df9..696409d53 100644
--- a/plugins/unityshell/src/Launcher.h
+++ b/plugins/unityshell/src/Launcher.h
@@ -46,7 +46,7 @@
#define SUPER_TAP_DURATION 250
#define SHORTCUTS_SHOWN_DELAY 750
-#define START_DRAGICON_DURATION 500
+#define START_DRAGICON_DURATION 250
#define BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION 1000
#define IGNORE_REPEAT_SHORTCUT_DURATION 250
@@ -109,7 +109,6 @@ public:
nux::Property<Display*> display;
- virtual long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/LensBar.cpp b/plugins/unityshell/src/LensBar.cpp
index 03542bb8d..bcfa24b84 100644
--- a/plugins/unityshell/src/LensBar.cpp
+++ b/plugins/unityshell/src/LensBar.cpp
@@ -101,11 +101,6 @@ void LensBar::Activate(std::string id)
}
}
-long LensBar::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info)
-{
- return layout_->ProcessEvent(ievent, traverse_info, event_info);
-}
-
void LensBar::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
{
nux::Geometry geo = GetGeometry();
diff --git a/plugins/unityshell/src/LensBar.h b/plugins/unityshell/src/LensBar.h
index 74ee20fbb..87bac3cfa 100644
--- a/plugins/unityshell/src/LensBar.h
+++ b/plugins/unityshell/src/LensBar.h
@@ -59,7 +59,6 @@ private:
void SetupLayout();
void SetupHomeLens();
- long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info);
void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
diff --git a/plugins/unityshell/src/LensView.cpp b/plugins/unityshell/src/LensView.cpp
index f7ca25e5f..69dc0b0ee 100644
--- a/plugins/unityshell/src/LensView.cpp
+++ b/plugins/unityshell/src/LensView.cpp
@@ -144,6 +144,8 @@ LensView::~LensView()
void LensView::SetupViews()
{
layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
+
+ layout_->SetHorizontalExternalMargin(8);
scroll_view_ = new LensScrollView(new PlacesVScrollBar(NUX_TRACKER_LOCATION),
NUX_TRACKER_LOCATION);
@@ -357,11 +359,6 @@ void LensView::OnActiveChanged(bool is_active)
lens_->active = is_active;
}
-long LensView::ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info)
-{
- return layout_->ProcessEvent(ievent, traverse_info, event_info);
-}
-
void LensView::Draw(nux::GraphicsEngine& gfx_context, bool force_draw)
{
nux::Geometry geo = GetGeometry();
diff --git a/plugins/unityshell/src/LensView.h b/plugins/unityshell/src/LensView.h
index 479bd4a06..92b586f55 100644
--- a/plugins/unityshell/src/LensView.h
+++ b/plugins/unityshell/src/LensView.h
@@ -83,7 +83,6 @@ private:
static gboolean FixRenderering(LensView* self);
- virtual long ProcessEvent(nux::IEvent& ievent, long traverse_info, long event_info);
virtual void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
diff --git a/plugins/unityshell/src/PanelIndicatorsView.cpp b/plugins/unityshell/src/PanelIndicatorsView.cpp
index 1336bfd44..50a32a086 100644
--- a/plugins/unityshell/src/PanelIndicatorsView.cpp
+++ b/plugins/unityshell/src/PanelIndicatorsView.cpp
@@ -102,16 +102,6 @@ PanelIndicatorsView::RemoveIndicator(indicator::Indicator::Ptr const& indicator)
LOG_DEBUG(logger) << "IndicatorRemoved: " << indicator->name();
}
-long
-PanelIndicatorsView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- long ret = TraverseInfo;
-
- if (layout_)
- ret = layout_->ProcessEvent(ievent, ret, ProcessEventInfo);
- return ret;
-}
-
void
PanelIndicatorsView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
@@ -149,7 +139,12 @@ PanelIndicatorsView::ActivateEntry(std::string const& entry_id)
bool
PanelIndicatorsView::ActivateIfSensitive()
{
+ std::map<int, PanelIndicatorEntryView*> sorted_entries;
+
for (auto entry : entries_)
+ sorted_entries[entry.second->GetEntryPriority()] = entry.second;
+
+ for (auto entry : sorted_entries)
{
PanelIndicatorEntryView* view = entry.second;
if (view->IsSensitive())
diff --git a/plugins/unityshell/src/PanelIndicatorsView.h b/plugins/unityshell/src/PanelIndicatorsView.h
index e7da7b766..bd1ce4328 100644
--- a/plugins/unityshell/src/PanelIndicatorsView.h
+++ b/plugins/unityshell/src/PanelIndicatorsView.h
@@ -61,7 +61,6 @@ public:
bool ActivateIfSensitive();
void GetGeometryForSync(indicator::EntryLocationMap& locations);
- virtual long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void QueueDraw();
diff --git a/plugins/unityshell/src/PanelMenuView.cpp b/plugins/unityshell/src/PanelMenuView.cpp
index ba30012da..7ae828ab0 100644
--- a/plugins/unityshell/src/PanelMenuView.cpp
+++ b/plugins/unityshell/src/PanelMenuView.cpp
@@ -119,6 +119,7 @@ PanelMenuView::PanelMenuView(int padding)
_panel_titlebar_grab_area = new PanelTitlebarGrabArea();
_panel_titlebar_grab_area->SetParentObject(this);
_panel_titlebar_grab_area->SinkReference();
+ _panel_titlebar_grab_area->mouse_down.connect(sigc::mem_fun(this, &PanelMenuView::OnMouseClicked));
_panel_titlebar_grab_area->mouse_down.connect(sigc::mem_fun(this, &PanelMenuView::OnMouseMiddleClicked));
_panel_titlebar_grab_area->mouse_down.connect(sigc::mem_fun(this, &PanelMenuView::OnMaximizedGrabStart));
_panel_titlebar_grab_area->mouse_drag.connect(sigc::mem_fun(this, &PanelMenuView::OnMaximizedGrabMove));
@@ -214,51 +215,6 @@ PanelMenuView::FullRedraw()
NeedRedraw();
}
-long
-PanelMenuView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- long ret = TraverseInfo;
- nux::Geometry geo = GetAbsoluteGeometry();
- nux::Geometry geo_buttons = _window_buttons->GetAbsoluteGeometry();
-
- if (!_we_control_active)
- return _panel_titlebar_grab_area->OnEvent(ievent, ret, ProcessEventInfo);
-
- if (geo.IsPointInside(ievent.e_x, ievent.e_y) && !(_is_maximized && geo_buttons.IsPointInside(ievent.e_x, ievent.e_y)))
- {
- if (_is_inside != true)
- {
- if (_is_grabbed)
- _is_grabbed = false;
- else
- _is_inside = true;
- FullRedraw();
- }
- }
- else
- {
- if (_is_inside != false)
- {
- _is_inside = false;
- FullRedraw();
- }
- }
-
- if (_is_maximized || _places_showing)
- {
- if (_window_buttons)
- ret = _window_buttons->ProcessEvent(ievent, ret, ProcessEventInfo);
- if (_panel_titlebar_grab_area)
- ret = _panel_titlebar_grab_area->OnEvent(ievent, ret, ProcessEventInfo);
- }
- ret = _panel_titlebar_grab_area->OnEvent(ievent, ret, ProcessEventInfo);
-
- if (!_is_own_window)
- ret = _menu_layout->ProcessEvent(ievent, ret, ProcessEventInfo);
-
- return ret;
-}
-
nux::Area*
PanelMenuView::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
{
@@ -314,7 +270,7 @@ long PanelMenuView::PostLayoutManagement(long LayoutResult)
old_window_buttons_w = _window_buttons->GetContentWidth();
_window_buttons->SetGeometry(geo.x + _padding, geo.y, old_window_buttons_w, geo.height);
- _window_buttons->ComputeLayout2();
+ _window_buttons->ComputeContentSize();
new_window_buttons_w = _window_buttons->GetContentWidth();
/* Explicitly set the size and position of the widgets */
@@ -323,7 +279,7 @@ long PanelMenuView::PostLayoutManagement(long LayoutResult)
old_menu_area_w = _menu_layout->GetContentWidth();
_menu_layout->SetGeometry(geo.x, geo.y, old_menu_area_w, geo.height);
- _menu_layout->ComputeLayout2();
+ _menu_layout->ComputeContentSize();
new_menu_area_w = _menu_layout->GetContentWidth();
geo.x += new_menu_area_w;
@@ -447,7 +403,7 @@ PanelMenuView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
lockrect.pBits = 0;
bool locked = false;
- if (_gradient_texture.IsNull())
+ if (_gradient_texture.IsNull() || (_gradient_texture->GetWidth() != geo.width))
{
build_gradient = true;
}
@@ -1257,6 +1213,7 @@ PanelMenuView::GetMaximizedWindow()
void
PanelMenuView::OnMaximizedGrabStart(int x, int y, unsigned long button_flags, unsigned long)
{
+ Window maximized_win;
if (nux::GetEventButton(button_flags) != 1 || _places_showing)
return;
@@ -1265,8 +1222,15 @@ PanelMenuView::OnMaximizedGrabStart(int x, int y, unsigned long button_flags, un
//
// This is a workaround to avoid that the grid plugin would be fired
// showing the window shape preview effect. See bug #838923
- if (GetMaximizedWindow() != 0)
+
+ maximized_win = GetMaximizedWindow ();
+
+ if (maximized_win != 0)
+ {
+ /* Always activate the window in case it is on another monitor */
+ WindowManager::Default ()->Activate (maximized_win);
_panel_titlebar_grab_area->SetGrabbed(true);
+ }
}
void
@@ -1326,7 +1290,7 @@ PanelMenuView::OnMaximizedGrabEnd(int x, int y, unsigned long, unsigned long)
void
PanelMenuView::OnMouseDoubleClicked(int x, int y, unsigned long button_flags, unsigned long)
{
- if (nux::GetEventButton(button_flags) != 1)
+ if (nux::GetEventButton(button_flags) != 1 || _places_showing)
return;
guint32 window_xid = GetMaximizedWindow();
@@ -1339,9 +1303,23 @@ PanelMenuView::OnMouseDoubleClicked(int x, int y, unsigned long button_flags, un
}
void
+PanelMenuView::OnMouseClicked(int x, int y, unsigned long button_flags, unsigned long)
+{
+ if (nux::GetEventButton(button_flags) != 1)
+ return;
+
+ guint32 window_xid = GetMaximizedWindow();
+
+ if (window_xid != 0)
+ {
+ WindowManager::Default()->Raise(window_xid);
+ }
+}
+
+void
PanelMenuView::OnMouseMiddleClicked(int x, int y, unsigned long button_flags, unsigned long)
{
- if (nux::GetEventButton(button_flags) != 2)
+ if (nux::GetEventButton(button_flags) != 2 || _places_showing)
return;
guint32 window_xid = GetMaximizedWindow();
@@ -1356,18 +1334,17 @@ PanelMenuView::OnMouseMiddleClicked(int x, int y, unsigned long button_flags, un
const gchar*
PanelMenuView::GetName()
{
- return "MenuView";
+ return NULL;
}
const gchar*
PanelMenuView::GetChildsName()
{
- return "entries";
+ return NULL;
}
void PanelMenuView::AddProperties(GVariantBuilder* builder)
{
- variant::BuilderWrapper(builder).add(GetGeometry());
}
/*
diff --git a/plugins/unityshell/src/PanelMenuView.h b/plugins/unityshell/src/PanelMenuView.h
index 004a9b842..36c484adf 100644
--- a/plugins/unityshell/src/PanelMenuView.h
+++ b/plugins/unityshell/src/PanelMenuView.h
@@ -57,7 +57,6 @@ public:
void FullRedraw();
- virtual long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual long PostLayoutManagement(long LayoutResult);
@@ -84,6 +83,7 @@ public:
void OnMaximizedGrabMove(int, int, int, int, unsigned long, unsigned long);
void OnMaximizedGrabEnd(int, int, unsigned long, unsigned long);
void OnMouseDoubleClicked(int, int, unsigned long, unsigned long);
+ void OnMouseClicked(int, int, unsigned long, unsigned long);
void OnMouseMiddleClicked(int, int, unsigned long, unsigned long);
void Refresh();
diff --git a/plugins/unityshell/src/PanelStyle.cpp b/plugins/unityshell/src/PanelStyle.cpp
index f2bb084d5..e45ccdc94 100644
--- a/plugins/unityshell/src/PanelStyle.cpp
+++ b/plugins/unityshell/src/PanelStyle.cpp
@@ -77,7 +77,7 @@ Style::Style()
gtk_widget_path_free(widget_path);
_gtk_theme_changed_id = g_signal_connect(gtk_settings_get_default(), "notify::gtk-theme-name",
- G_CALLBACK(Style::OnStyleChanged), this);
+ G_CALLBACK(Style::OnGtkThemeChanged), this);
Refresh();
}
@@ -130,9 +130,9 @@ GtkStyleContext* Style::GetStyleContext()
return _style_context;
}
-void Style::OnStyleChanged(GObject* gobject,
- GParamSpec* pspec,
- gpointer data)
+void Style::OnGtkThemeChanged(GObject* gobject,
+ GParamSpec* pspec,
+ gpointer data)
{
Style* self = (Style*) data;
diff --git a/plugins/unityshell/src/PanelStyle.h b/plugins/unityshell/src/PanelStyle.h
index a1a3d05ca..489dcddd8 100644
--- a/plugins/unityshell/src/PanelStyle.h
+++ b/plugins/unityshell/src/PanelStyle.h
@@ -67,9 +67,9 @@ public:
private:
void Refresh();
- static void OnStyleChanged(GObject* gobject,
- GParamSpec* pspec,
- gpointer data);
+ static void OnGtkThemeChanged(GObject* gobject,
+ GParamSpec* pspec,
+ gpointer data);
nux::BaseTexture* GetWindowButtonForTheme(WindowButtonType type,
WindowState state);
diff --git a/plugins/unityshell/src/PanelTray.cpp b/plugins/unityshell/src/PanelTray.cpp
index 155d1c22a..5052b833a 100644
--- a/plugins/unityshell/src/PanelTray.cpp
+++ b/plugins/unityshell/src/PanelTray.cpp
@@ -275,10 +275,4 @@ PanelTray::AddProperties(GVariantBuilder* builder)
}
-long
-PanelTray::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- return TraverseInfo;
-}
-
} // namespace unity
diff --git a/plugins/unityshell/src/PanelTray.h b/plugins/unityshell/src/PanelTray.h
index aeddf0f9d..d23ba31b9 100644
--- a/plugins/unityshell/src/PanelTray.h
+++ b/plugins/unityshell/src/PanelTray.h
@@ -42,7 +42,6 @@ public:
~PanelTray();
void Draw(nux::GraphicsEngine& gfx_content, bool force_draw);
- long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
void Sync();
unsigned int xid ();
diff --git a/plugins/unityshell/src/PanelView.cpp b/plugins/unityshell/src/PanelView.cpp
index 86a73740b..fd5b953ca 100644
--- a/plugins/unityshell/src/PanelView.cpp
+++ b/plugins/unityshell/src/PanelView.cpp
@@ -141,6 +141,9 @@ PanelView::~PanelView()
ubus_server_unregister_interest(ubus, _handle_dash_shown);
_on_indicator_updated_connections.clear();
+ indicator::EntryLocationMap locations;
+ _remote->SyncGeometries(GetName() + boost::lexical_cast<std::string>(_monitor), locations);
+
delete _bg_layer;
}
@@ -210,14 +213,6 @@ void PanelView::AddProperties(GVariantBuilder* builder)
.add(GetGeometry());
}
-long
-PanelView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- long ret = TraverseInfo;
- ret = _layout->ProcessEvent(ievent, ret, ProcessEventInfo);
- return ret;
-}
-
void
PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
@@ -270,7 +265,7 @@ PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
GfxContext.PopClippingRectangle();
- if (_needs_geo_sync && _menu_view->GetControlsActive())
+ if (_needs_geo_sync)
{
SyncGeometries();
_needs_geo_sync = false;
@@ -368,7 +363,7 @@ PanelView::UpdateBackground()
_last_height = geo.height;
_is_dirty = false;
- if (_dash_is_open)
+ if (_dash_is_open && (_menu_view->GetMaximizedWindow() == 0))
{
if (_bg_layer)
delete _bg_layer;
@@ -437,7 +432,7 @@ void PanelView::OnObjectAdded(indicator::Indicator::Ptr const& proxy)
_layout->SetContentDistribution(nux::eStackLeft);
- ComputeChildLayout();
+ ComputeContentSize();
NeedRedraw();
}
@@ -454,14 +449,14 @@ void PanelView::OnObjectRemoved(indicator::Indicator::Ptr const& proxy)
_layout->SetContentDistribution(nux::eStackLeft);
- ComputeChildLayout();
+ ComputeContentSize();
NeedRedraw();
}
void PanelView::OnIndicatorViewUpdated(PanelIndicatorEntryView* view)
{
_needs_geo_sync = true;
- ComputeChildLayout();
+ ComputeContentSize();
}
void PanelView::OnMenuPointerMoved(int x, int y)
@@ -620,9 +615,13 @@ void
PanelView::SyncGeometries()
{
indicator::EntryLocationMap locations;
- _menu_view->GetGeometryForSync(locations);
+ std::string panel_id = GetName() + boost::lexical_cast<std::string>(_monitor);
+
+ if (_menu_view->GetControlsActive())
+ _menu_view->GetGeometryForSync(locations);
+
_indicators->GetGeometryForSync(locations);
- _remote->SyncGeometries(GetName(), locations);
+ _remote->SyncGeometries(panel_id, locations);
}
void
diff --git a/plugins/unityshell/src/PanelView.h b/plugins/unityshell/src/PanelView.h
index 7ec1ae37e..3b2481a8b 100644
--- a/plugins/unityshell/src/PanelView.h
+++ b/plugins/unityshell/src/PanelView.h
@@ -46,7 +46,6 @@ public:
PanelView(NUX_FILE_LINE_PROTO);
~PanelView();
- long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/PlacesGroup.cpp b/plugins/unityshell/src/PlacesGroup.cpp
index e2778b4f6..4ff3b62ed 100644
--- a/plugins/unityshell/src/PlacesGroup.cpp
+++ b/plugins/unityshell/src/PlacesGroup.cpp
@@ -256,7 +256,7 @@ void
PlacesGroup::Refresh()
{
RefreshLabel();
- ComputeChildLayout();
+ ComputeContentSize();
QueueDraw();
}
@@ -277,42 +277,31 @@ PlacesGroup::OnIdleRelayout(PlacesGroup* self)
self->QueueDraw();
self->_group_layout->QueueDraw();
self->GetChildView()->QueueDraw();
- self->ComputeChildLayout();
+ self->ComputeContentSize();
self->_idle_id = 0;
-
- if (self->GetFocused())
- {
- self->SetFocused(false); // unset focus on all children
- self->SetFocused(true); // set focus on first child
- }
}
return FALSE;
}
-long
-PlacesGroup::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- long ret = TraverseInfo;
- ret = _group_layout->ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- return ret;
-}
-
void PlacesGroup::Draw(nux::GraphicsEngine& GfxContext,
bool forceDraw)
{
nux::Geometry base = GetGeometry();
GfxContext.PushClippingRectangle(base);
- nux::Color col(0.2f, 0.2f, 0.2f, 0.2f);
+ nux::Color col(0.15f, 0.15f, 0.15f, 0.15f);
if (_draw_sep)
+ {
+ GfxContext.GetRenderStates().SetColorMask(true, true, true, true);
+ GfxContext.GetRenderStates().SetBlend(true);
+ GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
nux::GetPainter().Draw2DLine(GfxContext,
- base.x + 10, base.y + base.height - 1,
- base.x + base.width - 10, base.y + base.height - 1,
- col,
+ base.x + 15, base.y + base.height - 1,
+ base.x + base.width - 15, base.y + base.height - 1,
col);
-
+ }
GfxContext.PopClippingRectangle();
}
diff --git a/plugins/unityshell/src/PlacesGroup.h b/plugins/unityshell/src/PlacesGroup.h
index 16beceea3..cfd5dfaad 100644
--- a/plugins/unityshell/src/PlacesGroup.h
+++ b/plugins/unityshell/src/PlacesGroup.h
@@ -69,7 +69,6 @@ protected:
private:
void Refresh();
- long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
void PostDraw (nux::GraphicsEngine &GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/PlacesHomeView.cpp b/plugins/unityshell/src/PlacesHomeView.cpp
index 85251e004..7ac147cf5 100644
--- a/plugins/unityshell/src/PlacesHomeView.cpp
+++ b/plugins/unityshell/src/PlacesHomeView.cpp
@@ -99,10 +99,9 @@ PlacesHomeView::PlacesHomeView()
_layout->ForceChildrenSize(true);
_layout->SetChildrenSize(style.GetHomeTileWidth(), style.GetHomeTileHeight());
_layout->EnablePartialVisibility(false);
- _layout->SetHeightMatchContent(true);
- _layout->SetHorizontalExternalMargin(32);
- _layout->SetVerticalInternalMargin(32);
- _layout->SetHorizontalInternalMargin(32);
+ _layout->MatchContentSize(true);
+ _layout->SetLeftAndRightPadding(32);
+ _layout->SetSpaceBetweenChildren(32, 32);
_layout->SetMinMaxSize((style.GetHomeTileWidth() * 4) + (32 * 5),
(style.GetHomeTileHeight() * 2) + 32);
diff --git a/plugins/unityshell/src/PlacesTile.cpp b/plugins/unityshell/src/PlacesTile.cpp
index a6002c143..423a29366 100644
--- a/plugins/unityshell/src/PlacesTile.cpp
+++ b/plugins/unityshell/src/PlacesTile.cpp
@@ -47,7 +47,6 @@ PlacesTile::PlacesTile(NUX_FILE_LINE_DECL, const void* id) :
mouse_leave.connect(sigc::mem_fun(this, &PlacesTile::RecvMouseLeave));
OnKeyNavFocusChange.connect(sigc::mem_fun(this, &PlacesTile::OnFocusChanged));
OnKeyNavFocusActivate.connect(sigc::mem_fun(this, &PlacesTile::OnFocusActivated));
- _can_pass_focus_to_composite_layout = false;
}
PlacesTile::~PlacesTile()
@@ -182,12 +181,6 @@ PlacesTile::UpdateBackground()
rop);
}
-long
-PlacesTile::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- return PostProcessEvent2(ievent, TraverseInfo, ProcessEventInfo);
-}
-
nux::Area*
PlacesTile::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
{
diff --git a/plugins/unityshell/src/PlacesTile.h b/plugins/unityshell/src/PlacesTile.h
index 3fa5e62ef..86fa26e84 100644
--- a/plugins/unityshell/src/PlacesTile.h
+++ b/plugins/unityshell/src/PlacesTile.h
@@ -48,7 +48,6 @@ protected:
private:
void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
- long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
void RecvMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
void RecvMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
diff --git a/plugins/unityshell/src/PluginAdapter.cpp b/plugins/unityshell/src/PluginAdapter.cpp
index addf4c7c9..5b2f5e63e 100644
--- a/plugins/unityshell/src/PluginAdapter.cpp
+++ b/plugins/unityshell/src/PluginAdapter.cpp
@@ -190,9 +190,6 @@ PluginAdapter::Notify(CompWindow* window, CompWindowNotify notify)
case CompWindowNotifyUnmap:
WindowManager::window_unmapped.emit(window->id());
break;
- case CompWindowNotifyReparent:
- MaximizeIfBigEnough(window);
- break;
case CompWindowNotifyFocusChange:
WindowManager::window_focus_changed.emit(window->id());
break;
@@ -492,6 +489,19 @@ PluginAdapter::IsWindowMapped(guint32 xid)
return true;
}
+bool
+PluginAdapter::IsWindowVisible(guint32 xid)
+{
+ Window win = (Window) xid;
+ CompWindow* window;
+
+ window = m_Screen->findWindow(win);
+ if (window)
+ return !(window->state () & CompWindowStateHiddenMask);
+
+ return true;
+}
+
void
PluginAdapter::Restore(guint32 xid)
{
@@ -559,12 +569,13 @@ PluginAdapter::Lower(guint32 xid)
}
void
-PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids)
+PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids, FocusVisibility focus_visibility)
{
CompPoint target_vp = m_Screen->vp();
CompWindow* top_win = NULL;
bool any_on_current = false;
bool any_mapped = false;
+ bool forced_unminimize = false;
/* sort the list */
CompWindowList windows;
@@ -606,11 +617,36 @@ PluginAdapter::FocusWindowGroup(std::vector<Window> window_ids)
for (CompWindow* &win : windows)
{
- if (win->defaultViewport() == target_vp &&
- ((any_mapped && !win->minimized()) || !any_mapped))
+ if (win->defaultViewport() == target_vp)
{
- win->raise();
- top_win = win;
+ /* Any window which is actually unmapped is
+ * not going to be accessible by either switcher
+ * or scale, so unconditionally unminimize those
+ * windows when the launcher icon is activated */
+ if ((focus_visibility == WindowManager::FocusVisibility::ForceUnminimizeOnCurrentDesktop &&
+ WindowManager::Default ()->IsWindowOnCurrentDesktop(win->id ())) ||
+ (focus_visibility == WindowManager::FocusVisibility::ForceUnminimizeInvisible &&
+ win->mapNum () == 0))
+ {
+ bool is_mapped = win->mapNum () != 0;
+ top_win = win;
+ win->unminimize ();
+
+ forced_unminimize = true;
+
+ /* Initially minimized windows dont get raised */
+ if (!is_mapped)
+ win->raise ();
+ }
+ else if ((any_mapped && !win->minimized()) || !any_mapped)
+ {
+ if (!forced_unminimize ||
+ WindowManager::Default ()->IsWindowOnCurrentDesktop (win->id ()))
+ {
+ win->raise();
+ top_win = win;
+ }
+ }
}
}
@@ -703,7 +739,11 @@ PluginAdapter::CheckWindowIntersection(nux::Geometry const& region, CompWindow*
int intersect_types = CompWindowTypeNormalMask | CompWindowTypeDialogMask |
CompWindowTypeModalDialogMask | CompWindowTypeUtilMask;
- if (!window || !(window->type() & intersect_types) || !window->isMapped() || !window->isViewable() || window->minimized())
+ if (!window ||
+ !(window->type() & intersect_types) ||
+ !window->isMapped() ||
+ !window->isViewable() ||
+ window->state() & CompWindowStateHiddenMask)
return false;
if (CompRegion(window->borderRect()).intersects(CompRect(region.x, region.y, region.width, region.height)))
@@ -770,11 +810,14 @@ PluginAdapter::SetMwmWindowHints(Window xid, MotifWmHints* new_hints)
hints_atom = XInternAtom(display, _XA_MOTIF_WM_HINTS, false);
- XGetWindowProperty(display,
- xid,
- hints_atom, 0, sizeof(MotifWmHints) / sizeof(long),
- False, AnyPropertyType, &type, &format, &nitems,
- &bytes_after, (guchar**)&data);
+ if (XGetWindowProperty(display,
+ xid,
+ hints_atom, 0, sizeof(MotifWmHints) / sizeof(long),
+ False, AnyPropertyType, &type, &format, &nitems,
+ &bytes_after, (guchar**)&data) != Success)
+ {
+ return;
+ }
if (type != hints_atom || !data)
{
@@ -842,7 +885,8 @@ PluginAdapter::IsViewPortSwitchStarted()
return _vp_switch_started;
}
-void PluginAdapter::MaximizeIfBigEnough(CompWindow* window)
+/* Returns true if the window was maximized */
+bool PluginAdapter::MaximizeIfBigEnough(CompWindow* window)
{
XClassHint classHint;
Status status;
@@ -854,14 +898,14 @@ void PluginAdapter::MaximizeIfBigEnough(CompWindow* window)
float covering_part;
if (!window)
- return;
+ return false;
if ((window->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE)
- return;
+ return false;
if (window->type() != CompWindowTypeNormalMask
|| (window->actions() & MAXIMIZABLE) != MAXIMIZABLE)
- return;
+ return false;
status = XGetClassHint(m_Screen->dpy(), window->id(), &classHint);
if (status && classHint.res_class)
@@ -873,7 +917,7 @@ void PluginAdapter::MaximizeIfBigEnough(CompWindow* window)
XFree(classHint.res_name);
}
else
- return;
+ return false;
num_monitor = window->outputDevice();
CompOutput &o = m_Screen->outputDevs().at(num_monitor);
@@ -889,10 +933,12 @@ void PluginAdapter::MaximizeIfBigEnough(CompWindow* window)
(hints.flags & PMaxSize && (screen_width > hints.max_width || screen_height > hints.max_height)))
{
LOG_DEBUG(logger) << win_wmclass << " window size doesn't fit";
- return;
+ return false;
}
window->maximize(MAXIMIZE_STATE);
+
+ return true;
}
void
diff --git a/plugins/unityshell/src/PluginAdapter.h b/plugins/unityshell/src/PluginAdapter.h
index ee38ad176..153fe563c 100644
--- a/plugins/unityshell/src/PluginAdapter.h
+++ b/plugins/unityshell/src/PluginAdapter.h
@@ -117,6 +117,7 @@ public:
bool IsWindowOnCurrentDesktop(guint xid);
bool IsWindowObscured(guint xid);
bool IsWindowMapped(guint xid);
+ bool IsWindowVisible(guint32 xid);
void Restore(guint32 xid);
void Minimize(guint32 xid);
void Close(guint32 xid);
@@ -127,7 +128,7 @@ public:
void SetWindowIconGeometry(Window window, nux::Geometry const& geo);
- void FocusWindowGroup(std::vector<Window> windows);
+ void FocusWindowGroup(std::vector<Window> windows, FocusVisibility);
bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force);
bool IsScreenGrabbed();
@@ -135,7 +136,7 @@ public:
unsigned long long GetWindowActiveNumber (guint32 xid);
- void MaximizeIfBigEnough(CompWindow* window);
+ bool MaximizeIfBigEnough(CompWindow* window);
nux::Geometry GetWindowGeometry(guint32 xid);
nux::Geometry GetScreenGeometry();
diff --git a/plugins/unityshell/src/PreviewApplications.cpp b/plugins/unityshell/src/PreviewApplications.cpp
index 533d386e0..df9891d8d 100644
--- a/plugins/unityshell/src/PreviewApplications.cpp
+++ b/plugins/unityshell/src/PreviewApplications.cpp
@@ -89,7 +89,7 @@ namespace unity {
// create the action buttons
PreviewBasicButton* primary_button = new PreviewBasicButton(preview_->primary_action_name.c_str(), NUX_TRACKER_LOCATION);
//FIXME - add secondary action when we have the backend for it
- primary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); });
+ primary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); });
button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0);
button_container->AddView (primary_button, 1);
button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0);
@@ -147,9 +147,9 @@ namespace unity {
SetLayout(large_container);
}
- long PreviewApplications::ComputeLayout2 ()
+ long PreviewApplications::ComputeContentSize ()
{
- return PreviewBase::ComputeLayout2();
+ return PreviewBase::ComputeContentSize();
g_debug ("layout recomputing");
description->SetBaseWidth((GetGeometry().width / 2) - 16 - 12 );
description->SetMaximumWidth((GetGeometry().width / 2) - 16 - 12 );
@@ -169,10 +169,6 @@ namespace unity {
GfxContent.PopClippingRectangle();
}
- long int PreviewApplications::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return PreviewBase::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void PreviewApplications::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {
PreviewBase::PostDraw(GfxContext, force_draw);
}
diff --git a/plugins/unityshell/src/PreviewApplications.h b/plugins/unityshell/src/PreviewApplications.h
index 545a0aaf0..3ac27a116 100644
--- a/plugins/unityshell/src/PreviewApplications.h
+++ b/plugins/unityshell/src/PreviewApplications.h
@@ -42,8 +42,7 @@ namespace unity {
virtual void SetPreview(dash::Preview::Ptr preview);
protected:
- virtual long ComputeLayout2();
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
+ virtual long ComputeContentSize();
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/PreviewBase.cpp b/plugins/unityshell/src/PreviewBase.cpp
index c5b94b846..c055bd2b7 100644
--- a/plugins/unityshell/src/PreviewBase.cpp
+++ b/plugins/unityshell/src/PreviewBase.cpp
@@ -38,9 +38,9 @@ namespace unity {
{
}
- long PreviewBase::ComputeLayout2()
+ long PreviewBase::ComputeContentSize()
{
- return nux::View::ComputeLayout2();
+ return nux::View::ComputeContentSize();
}
void PreviewBase::Draw (nux::GraphicsEngine &GfxContext, bool force_draw)
@@ -58,10 +58,6 @@ namespace unity {
GfxContent.PopClippingRectangle();
}
- long int PreviewBase::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return PostProcessEvent2 (ievent, TraverseInfo, ProcessEventInfo);
- }
-
void PreviewBase::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
nux::View::PostDraw(GfxContext, force_draw);
diff --git a/plugins/unityshell/src/PreviewBase.h b/plugins/unityshell/src/PreviewBase.h
index 67d93ceae..17a19eb1e 100644
--- a/plugins/unityshell/src/PreviewBase.h
+++ b/plugins/unityshell/src/PreviewBase.h
@@ -42,8 +42,7 @@ namespace unity {
sigc::signal<void, std::string> UriActivated;
protected:
- virtual long ComputeLayout2();
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
+ virtual long ComputeContentSize();
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/PreviewBasicButton.cpp b/plugins/unityshell/src/PreviewBasicButton.cpp
index ace4aef01..7594f6432 100644
--- a/plugins/unityshell/src/PreviewBasicButton.cpp
+++ b/plugins/unityshell/src/PreviewBasicButton.cpp
@@ -71,20 +71,20 @@ namespace unity {
{
if (prelight_ == NULL)
{
- prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::State::NUX_STATE_PRELIGHT));
- active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::State::NUX_STATE_ACTIVE));
- normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::State::NUX_STATE_NORMAL));
+ prelight_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRELIGHT));
+ active_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_PRESSED));
+ normal_ = new nux::CairoWrapper(GetGeometry(), sigc::bind(sigc::mem_fun(this, &PreviewBasicButton::RedrawTheme), nux::ButtonVisualState::VISUAL_STATE_NORMAL));
}
}
- void PreviewBasicButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state)
+ void PreviewBasicButton::RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state)
{
- dash::Style::Instance().Button(cr, faked_state, label);
+ dash::Style::Instance().Button(cr, faked_state, GetLabel());
}
- long PreviewBasicButton::ComputeLayout2 ()
+ long PreviewBasicButton::ComputeContentSize ()
{
- long ret = nux::Button::ComputeLayout2();
+ long ret = nux::Button::ComputeContentSize();
if (cached_geometry_ != GetGeometry())
{
prelight_->Invalidate(GetGeometry());
@@ -96,10 +96,6 @@ namespace unity {
return ret;
}
- long int PreviewBasicButton::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return nux::Button::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void PreviewBasicButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
gPainter.PaintBackground(GfxContext, GetGeometry());
@@ -123,9 +119,9 @@ namespace unity {
col);
nux::BaseTexture *texture = normal_->GetTexture();
- if (state == nux::State::NUX_STATE_PRELIGHT)
+ if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
texture = prelight_->GetTexture();
- else if (state == nux::State::NUX_STATE_ACTIVE)
+ else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
{
texture = active_->GetTexture();
}
diff --git a/plugins/unityshell/src/PreviewBasicButton.h b/plugins/unityshell/src/PreviewBasicButton.h
index 20a0a7d23..f4addd76a 100644
--- a/plugins/unityshell/src/PreviewBasicButton.h
+++ b/plugins/unityshell/src/PreviewBasicButton.h
@@ -40,15 +40,14 @@ namespace unity {
virtual ~PreviewBasicButton();
protected:
- virtual long ComputeLayout2 ();
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
+ virtual long ComputeContentSize ();
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
private:
void InitTheme ();
- void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::State faked_state);
+ void RedrawTheme (nux::Geometry const& geom, cairo_t *cr, nux::ButtonVisualState faked_state);
nux::CairoWrapper *prelight_;
nux::CairoWrapper *active_;
diff --git a/plugins/unityshell/src/PreviewGeneric.cpp b/plugins/unityshell/src/PreviewGeneric.cpp
index 96c15e99a..5b45961ee 100644
--- a/plugins/unityshell/src/PreviewGeneric.cpp
+++ b/plugins/unityshell/src/PreviewGeneric.cpp
@@ -89,7 +89,7 @@ namespace unity {
if (preview_->tertiary_action_name.empty() == false)
{
PreviewBasicButton* tertiary_button = new PreviewBasicButton(preview_->tertiary_action_name.c_str(), NUX_TRACKER_LOCATION);
- tertiary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->tertiary_action_uri); });
+ tertiary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->tertiary_action_uri); });
button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0);
button_container->AddView (tertiary_button, 1);
}
@@ -97,7 +97,7 @@ namespace unity {
if (preview_->secondary_action_name.empty() == false)
{
PreviewBasicButton* secondary_button = new PreviewBasicButton(preview_->secondary_action_name.c_str(), NUX_TRACKER_LOCATION);
- secondary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->secondary_action_uri); });
+ secondary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->secondary_action_uri); });
button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0);
button_container->AddView (secondary_button, 1);
}
@@ -105,7 +105,7 @@ namespace unity {
if (preview_->primary_action_name.empty() == false)
{
PreviewBasicButton* primary_button = new PreviewBasicButton(preview_->primary_action_name.c_str(), NUX_TRACKER_LOCATION);
- primary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); });
+ primary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); });
button_container->AddLayout (new nux::SpaceLayout(6,6,6,6), 0);
button_container->AddView (primary_button, 1);
}
@@ -151,10 +151,6 @@ namespace unity {
GfxContent.PopClippingRectangle();
}
- long int PreviewGeneric::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return PreviewBase::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void PreviewGeneric::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {
PreviewBase::PostDraw(GfxContext, force_draw);
}
diff --git a/plugins/unityshell/src/PreviewGeneric.h b/plugins/unityshell/src/PreviewGeneric.h
index bed58d5b9..b2cd864e8 100644
--- a/plugins/unityshell/src/PreviewGeneric.h
+++ b/plugins/unityshell/src/PreviewGeneric.h
@@ -41,7 +41,6 @@ namespace unity {
virtual void SetPreview(dash::Preview::Ptr preview);
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/PreviewMusic.cpp b/plugins/unityshell/src/PreviewMusic.cpp
index e92cf959b..5d831a4fd 100644
--- a/plugins/unityshell/src/PreviewMusic.cpp
+++ b/plugins/unityshell/src/PreviewMusic.cpp
@@ -114,7 +114,7 @@ namespace unity {
PreviewBasicButton* primary_button = new PreviewBasicButton(preview_->primary_action_name.c_str(), NUX_TRACKER_LOCATION);
//FIXME - add secondary action when we have the backend for it
- primary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); });
+ primary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); });
nux::HLayout *large_container = new nux::HLayout(NUX_TRACKER_LOCATION);
@@ -177,10 +177,6 @@ namespace unity {
GfxContent.PopClippingRectangle();
}
- long int PreviewMusicAlbum::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return PreviewBase::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void PreviewMusicAlbum::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {
PreviewBase::PostDraw(GfxContext, force_draw);
}
diff --git a/plugins/unityshell/src/PreviewMusic.h b/plugins/unityshell/src/PreviewMusic.h
index 78e707781..87754a2bc 100644
--- a/plugins/unityshell/src/PreviewMusic.h
+++ b/plugins/unityshell/src/PreviewMusic.h
@@ -41,7 +41,6 @@ namespace unity {
virtual void SetPreview(dash::Preview::Ptr preview);
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/PreviewMusicTrack.cpp b/plugins/unityshell/src/PreviewMusicTrack.cpp
index f500cc314..9ca85ef9d 100644
--- a/plugins/unityshell/src/PreviewMusicTrack.cpp
+++ b/plugins/unityshell/src/PreviewMusicTrack.cpp
@@ -106,7 +106,7 @@ namespace unity {
PreviewBasicButton* primary_button = new PreviewBasicButton(preview_->primary_action_name.c_str(), NUX_TRACKER_LOCATION);
//FIXME - add secondary action when we have the backend for it
- primary_button->activated.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); });
+ primary_button->state_change.connect ([&] (nux::View *view) { UriActivated.emit (preview_->primary_action_uri); });
nux::HLayout *large_container = new nux::HLayout(NUX_TRACKER_LOCATION);
@@ -164,10 +164,6 @@ namespace unity {
GfxContent.PopClippingRectangle();
}
- long int PreviewMusicTrack::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return PreviewBase::ProcessEvent(ievent, TraverseInfo, ProcessEventInfo);
- }
-
void PreviewMusicTrack::PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw) {
PreviewBase::PostDraw(GfxContext, force_draw);
}
diff --git a/plugins/unityshell/src/PreviewMusicTrack.h b/plugins/unityshell/src/PreviewMusicTrack.h
index b94a0a85f..9b19a8ce8 100644
--- a/plugins/unityshell/src/PreviewMusicTrack.h
+++ b/plugins/unityshell/src/PreviewMusicTrack.h
@@ -41,7 +41,6 @@ namespace unity {
virtual void SetPreview(dash::Preview::Ptr preview);
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/PreviewMusicTrackWidget.cpp b/plugins/unityshell/src/PreviewMusicTrackWidget.cpp
index ba87c4a73..c62062e9d 100644
--- a/plugins/unityshell/src/PreviewMusicTrackWidget.cpp
+++ b/plugins/unityshell/src/PreviewMusicTrackWidget.cpp
@@ -83,7 +83,7 @@ namespace unity {
//FIXME - use a button subclass for absolute renderering
play_button_ = new nux::Button(number_.c_str());
- play_button_->activated.connect ([&] (nux::View *view) {
+ play_button_->state_change.connect ([&] (nux::View *view) {
if (track_is_active)
{
is_paused = !is_paused;
@@ -110,12 +110,6 @@ namespace unity {
SetLayout(track_layout);
}
-
-
- long int PreviewMusicTrackWidget::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo) {
- return PostProcessEvent2 (ievent, TraverseInfo, ProcessEventInfo);;
- }
-
void PreviewMusicTrackWidget::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) {
}
diff --git a/plugins/unityshell/src/PreviewMusicTrackWidget.h b/plugins/unityshell/src/PreviewMusicTrackWidget.h
index 386d30dc6..2870c5386 100644
--- a/plugins/unityshell/src/PreviewMusicTrackWidget.h
+++ b/plugins/unityshell/src/PreviewMusicTrackWidget.h
@@ -44,7 +44,6 @@ namespace unity {
sigc::signal<void, std::string> UriActivated;
protected:
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
virtual void PostDraw(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/QuicklistMenuItem.cpp b/plugins/unityshell/src/QuicklistMenuItem.cpp
index c586c97e1..d9263fb28 100644
--- a/plugins/unityshell/src/QuicklistMenuItem.cpp
+++ b/plugins/unityshell/src/QuicklistMenuItem.cpp
@@ -150,18 +150,6 @@ QuicklistMenuItem::PostLayoutManagement(long layoutResult)
return result;
}
-long
-QuicklistMenuItem::ProcessEvent(nux::IEvent& event,
- long traverseInfo,
- long processEventInfo)
-{
- long result = traverseInfo;
-
- result = nux::View::PostProcessEvent2(event, result, processEventInfo);
- return result;
-
-}
-
void
QuicklistMenuItem::Draw(nux::GraphicsEngine& gfxContext,
bool forceDraw)
diff --git a/plugins/unityshell/src/QuicklistMenuItem.h b/plugins/unityshell/src/QuicklistMenuItem.h
index 152950539..2a8aa5199 100644
--- a/plugins/unityshell/src/QuicklistMenuItem.h
+++ b/plugins/unityshell/src/QuicklistMenuItem.h
@@ -63,10 +63,6 @@ public:
long PostLayoutManagement(long layoutResult);
- long ProcessEvent(nux::IEvent& event,
- long traverseInfo,
- long processEventInfo);
-
void Draw(nux::GraphicsEngine& gfxContext,
bool forceDraw);
diff --git a/plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp b/plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp
index 79a66efae..c19cd9546 100644
--- a/plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp
+++ b/plugins/unityshell/src/QuicklistMenuItemCheckmark.cpp
@@ -130,17 +130,6 @@ QuicklistMenuItemCheckmark::PostLayoutManagement(long layoutResult)
return result;
}
-long
-QuicklistMenuItemCheckmark::ProcessEvent(nux::IEvent& event,
- long traverseInfo,
- long processEventInfo)
-{
- long result = traverseInfo;
-
- result = nux::View::PostProcessEvent2(event, result, processEventInfo);
- return result;
-}
-
void
QuicklistMenuItemCheckmark::Draw(nux::GraphicsEngine& gfxContext,
bool forceDraw)
diff --git a/plugins/unityshell/src/QuicklistMenuItemCheckmark.h b/plugins/unityshell/src/QuicklistMenuItemCheckmark.h
index dd8428cd4..94a300286 100644
--- a/plugins/unityshell/src/QuicklistMenuItemCheckmark.h
+++ b/plugins/unityshell/src/QuicklistMenuItemCheckmark.h
@@ -47,8 +47,6 @@ protected:
long PostLayoutManagement(long layoutResult);
- long ProcessEvent(nux::IEvent& event, long traverseInfo, long processEventInfo);
-
void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw);
void DrawContent(nux::GraphicsEngine& gfxContext, bool forceDraw);
diff --git a/plugins/unityshell/src/QuicklistMenuItemLabel.cpp b/plugins/unityshell/src/QuicklistMenuItemLabel.cpp
index b0d8d2902..e6c5b6456 100644
--- a/plugins/unityshell/src/QuicklistMenuItemLabel.cpp
+++ b/plugins/unityshell/src/QuicklistMenuItemLabel.cpp
@@ -119,17 +119,6 @@ QuicklistMenuItemLabel::PostLayoutManagement(long layoutResult)
return result;
}
-long
-QuicklistMenuItemLabel::ProcessEvent(nux::IEvent& event,
- long traverseInfo,
- long processEventInfo)
-{
- long result = traverseInfo;
-
- result = nux::View::PostProcessEvent2(event, result, processEventInfo);
- return result;
-}
-
void
QuicklistMenuItemLabel::Draw(nux::GraphicsEngine& gfxContext,
bool forceDraw)
diff --git a/plugins/unityshell/src/QuicklistMenuItemLabel.h b/plugins/unityshell/src/QuicklistMenuItemLabel.h
index 9f1888480..9fc104050 100644
--- a/plugins/unityshell/src/QuicklistMenuItemLabel.h
+++ b/plugins/unityshell/src/QuicklistMenuItemLabel.h
@@ -47,8 +47,6 @@ protected:
long PostLayoutManagement(long layoutResult);
- long ProcessEvent(nux::IEvent& event, long traverseInfo, long processEventInfo);
-
void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw);
void DrawContent(nux::GraphicsEngine& gfxContext, bool forceDraw);
diff --git a/plugins/unityshell/src/QuicklistMenuItemRadio.cpp b/plugins/unityshell/src/QuicklistMenuItemRadio.cpp
index 7ece35699..f9f916a7f 100644
--- a/plugins/unityshell/src/QuicklistMenuItemRadio.cpp
+++ b/plugins/unityshell/src/QuicklistMenuItemRadio.cpp
@@ -130,17 +130,6 @@ QuicklistMenuItemRadio::PostLayoutManagement(long layoutResult)
return result;
}
-long
-QuicklistMenuItemRadio::ProcessEvent(nux::IEvent& event,
- long traverseInfo,
- long processEventInfo)
-{
- long result = traverseInfo;
-
- result = nux::View::PostProcessEvent2(event, result, processEventInfo);
- return result;
-}
-
void
QuicklistMenuItemRadio::Draw(nux::GraphicsEngine& gfxContext,
bool forceDraw)
diff --git a/plugins/unityshell/src/QuicklistMenuItemRadio.h b/plugins/unityshell/src/QuicklistMenuItemRadio.h
index 161c34498..c84354ffc 100644
--- a/plugins/unityshell/src/QuicklistMenuItemRadio.h
+++ b/plugins/unityshell/src/QuicklistMenuItemRadio.h
@@ -45,10 +45,6 @@ protected:
long PostLayoutManagement(long layoutResult);
- long ProcessEvent(nux::IEvent& event,
- long traverseInfo,
- long processEventInfo);
-
void Draw(nux::GraphicsEngine& gfxContext,
bool forceDraw);
diff --git a/plugins/unityshell/src/QuicklistMenuItemSeparator.cpp b/plugins/unityshell/src/QuicklistMenuItemSeparator.cpp
index d6469c53e..08d26a016 100644
--- a/plugins/unityshell/src/QuicklistMenuItemSeparator.cpp
+++ b/plugins/unityshell/src/QuicklistMenuItemSeparator.cpp
@@ -97,18 +97,6 @@ QuicklistMenuItemSeparator::PostLayoutManagement(long layoutResult)
return result;
}
-long
-QuicklistMenuItemSeparator::ProcessEvent(nux::IEvent& event,
- long traverseInfo,
- long processEventInfo)
-{
- long result = traverseInfo;
-
- result = nux::View::PostProcessEvent2(event, result, processEventInfo);
- return result;
-
-}
-
void
QuicklistMenuItemSeparator::Draw(nux::GraphicsEngine& gfxContext,
bool forceDraw)
diff --git a/plugins/unityshell/src/QuicklistMenuItemSeparator.h b/plugins/unityshell/src/QuicklistMenuItemSeparator.h
index bf1157bb1..e882e67d2 100644
--- a/plugins/unityshell/src/QuicklistMenuItemSeparator.h
+++ b/plugins/unityshell/src/QuicklistMenuItemSeparator.h
@@ -46,8 +46,6 @@ protected:
long PostLayoutManagement(long layoutResult);
- long ProcessEvent(nux::IEvent& event, long traverseInfo, long processEventInfo);
-
void Draw(nux::GraphicsEngine& gfxContext, bool forceDraw);
void DrawContent(nux::GraphicsEngine& gfxContext, bool forceDraw);
diff --git a/plugins/unityshell/src/QuicklistView.cpp b/plugins/unityshell/src/QuicklistView.cpp
index 9725735f0..6e446a671 100644
--- a/plugins/unityshell/src/QuicklistView.cpp
+++ b/plugins/unityshell/src/QuicklistView.cpp
@@ -353,7 +353,6 @@ void QuicklistView::Hide()
{
CancelItemsPrelightStatus();
CaptureMouseDownAnyWhereElse(false);
- ForceStopFocus(1, 1);
UnGrabPointer();
UnGrabKeyboard();
//EnableInputWindow (false);
@@ -361,61 +360,6 @@ void QuicklistView::Hide()
}
}
-long QuicklistView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- long ret = TraverseInfo;
- long ProcEvInfo = 0;
-
- nux::IEvent window_event = ievent;
- nux::Geometry base = GetGeometry();
- window_event.e_x_root = base.x;
- window_event.e_y_root = base.y;
-
- // The child layout get the Mouse down button only if the MouseDown happened inside the client view Area
- nux::Geometry viewGeometry = GetGeometry();
-
- if (ievent.e_event == nux::NUX_MOUSE_PRESSED)
- {
- if (!viewGeometry.IsPointInside(ievent.e_x - ievent.e_x_root, ievent.e_y - ievent.e_y_root))
- {
- ProcEvInfo = nux::eDoNotProcess;
- }
- }
-
- // We choose to test the quicklist items ourselves instead of processing them as it is usual in nux.
- // This is meant to be easier since the quicklist has a atypical way of working.
- if (m_layout)
- {
- ret = m_layout->ProcessEvent(window_event, ret, ProcEvInfo);
- }
-
- // The quicklist itself does not process the evvent. Instead we do some analysis of the event
- // to detect the user action and perform the correct operation.
- if (ievent.e_event == nux::NUX_MOUSE_PRESSED)
- {
- if (GetGeometry().IsPointInside(ievent.e_x, ievent.e_y))
- {
- _mouse_down = true;
- }
- else
- {
- _mouse_down = false;
- Hide();
- return nux::eMouseEventSolved;
- }
- }
- else if ((ievent.e_event == nux::NUX_MOUSE_RELEASED) && _mouse_down)
- {
- _mouse_down = false;
- Hide();
- return nux::eMouseEventSolved;
- }
-
- ret = OnEvent(ievent, ret, ProcessEventInfo);
-
- return ret;
-}
-
void QuicklistView::Draw(nux::GraphicsEngine& gfxContext, bool forceDraw)
{
// Get the geometry of the QuicklistView on the display
@@ -806,7 +750,6 @@ void QuicklistView::RecvMouseDown(int x, int y, unsigned long button_flags, unsi
// if (IsVisible ())
// {
// CaptureMouseDownAnyWhereElse (false);
-// ForceStopFocus (1, 1);
// UnGrabPointer ();
// EnableInputWindow (false);
// ShowWindow (false);
diff --git a/plugins/unityshell/src/QuicklistView.h b/plugins/unityshell/src/QuicklistView.h
index 2adbd83dd..26d12c5b1 100644
--- a/plugins/unityshell/src/QuicklistView.h
+++ b/plugins/unityshell/src/QuicklistView.h
@@ -58,10 +58,6 @@ public:
~QuicklistView();
- long ProcessEvent(nux::IEvent& iEvent,
- long traverseInfo,
- long processEventInfo);
-
void Draw(nux::GraphicsEngine& gfxContext,
bool forceDraw);
diff --git a/plugins/unityshell/src/ResultView.cpp b/plugins/unityshell/src/ResultView.cpp
index b42eb2280..b63be1f1b 100644
--- a/plugins/unityshell/src/ResultView.cpp
+++ b/plugins/unityshell/src/ResultView.cpp
@@ -74,11 +74,6 @@ ResultView::~ResultView()
renderer_->UnReference();
}
-long int ResultView::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo)
-{
- return TraverseInfo;
-}
-
void ResultView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
@@ -145,7 +140,7 @@ void ResultView::SetPreview(PreviewBase* preview, Result& related_result)
preview_layout_->Reference();
//FIXME - replace with nicer button subclass widgets
nux::Button* left_arrow = new nux::Button("previous", NUX_TRACKER_LOCATION);
- left_arrow->activated.connect([&](nux::View * view)
+ left_arrow->state_change.connect([&](nux::View * view)
{
ResultList::reverse_iterator it;
std::string next_uri;
@@ -167,7 +162,7 @@ void ResultView::SetPreview(PreviewBase* preview, Result& related_result)
});
nux::Button* right_arrow = new nux::Button("next", NUX_TRACKER_LOCATION);
- right_arrow->activated.connect([&](nux::View * view)
+ right_arrow->state_change.connect([&](nux::View * view)
{
ResultList::iterator it;
std::string next_uri;
@@ -204,9 +199,9 @@ void ResultView::SetPreview(PreviewBase* preview, Result& related_result)
}
}
-long ResultView::ComputeLayout2()
+long ResultView::ComputeContentSize()
{
- return View::ComputeLayout2();
+ return View::ComputeContentSize();
}
diff --git a/plugins/unityshell/src/ResultView.h b/plugins/unityshell/src/ResultView.h
index 85f4ac619..3d288d937 100644
--- a/plugins/unityshell/src/ResultView.h
+++ b/plugins/unityshell/src/ResultView.h
@@ -61,9 +61,8 @@ public:
protected:
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
- virtual long ComputeLayout2();
+ virtual long ComputeContentSize();
// properties
nux::Layout* preview_layout_;
diff --git a/plugins/unityshell/src/ResultViewGrid.cpp b/plugins/unityshell/src/ResultViewGrid.cpp
index e1932e412..6799de5b0 100644
--- a/plugins/unityshell/src/ResultViewGrid.cpp
+++ b/plugins/unityshell/src/ResultViewGrid.cpp
@@ -59,6 +59,8 @@ ResultViewGrid::ResultViewGrid(NUX_FILE_LINE_DECL)
, last_mouse_down_y_(-1)
, recorded_dash_width_(-1)
, recorded_dash_height_(-1)
+ , mouse_last_x_(-1)
+ , mouse_last_y_(-1)
{
auto needredraw_lambda = [&](int value)
{
@@ -78,11 +80,22 @@ ResultViewGrid::ResultViewGrid(NUX_FILE_LINE_DECL)
{
last_mouse_down_x_ = x;
last_mouse_down_y_ = y;
+ uint index = GetIndexAtPosition(x, y);
+ mouse_over_index_ = index;
+ if (index >= 0 && index < results_.size())
+ {
+ // we got a click on a button so activate it
+ Result result = results_[index];
+ selected_index_ = index;
+ focused_uri_ = result.uri;
+ }
});
mouse_leave.connect([&](int x, int y, unsigned long mouse_state, unsigned long button_state)
{
mouse_over_index_ = -1;
+ mouse_last_x_ = -1;
+ mouse_last_y_ = -1;
NeedRedraw();
});
@@ -263,6 +276,8 @@ void ResultViewGrid::SizeReallocate()
SetMinimumHeight(total_height + (padding * 2));
SetMaximumHeight(total_height + (padding * 2));
PositionPreview();
+
+ mouse_over_index_ = GetIndexAtPosition(mouse_last_x_, mouse_last_y_);
}
void ResultViewGrid::PositionPreview()
@@ -306,11 +321,6 @@ void ResultViewGrid::PositionPreview()
}
}
-long int ResultViewGrid::ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo)
-{
- return TraverseInfo;
-}
-
bool ResultViewGrid::InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character)
{
nux::KeyNavDirection direction = nux::KEY_NAV_NONE;
@@ -489,7 +499,7 @@ void ResultViewGrid::OnOnKeyNavFocusChange(nux::Area *area)
{
if (selected_index_ < 0)
{
- if (mouse_over_index_ >= 0)
+ if (mouse_over_index_ >= 0 && mouse_over_index_ < static_cast<int>(results_.size()))
{
// to hack around nux, nux sends the keynavfocuschange event before
// mouse clicks, so when mouse click happens we have already scrolled away
@@ -503,7 +513,7 @@ void ResultViewGrid::OnOnKeyNavFocusChange(nux::Area *area)
selected_index_ = 0;
}
}
- NeedRedraw();
+
int items_per_row = GetItemsPerRow();
int focused_x = (renderer_->width + horizontal_spacing) * (selected_index_ % items_per_row);
@@ -517,13 +527,15 @@ void ResultViewGrid::OnOnKeyNavFocusChange(nux::Area *area)
selected_index_ = -1;
focused_uri_.clear();
}
+
+ NeedRedraw();
}
-long ResultViewGrid::ComputeLayout2()
+long ResultViewGrid::ComputeContentSize()
{
SizeReallocate();
QueueLazyLoad();
- long ret = ResultView::ComputeLayout2();
+ long ret = ResultView::ComputeContentSize();
return ret;
}
@@ -671,12 +683,17 @@ void ResultViewGrid::MouseMove(int x, int y, int dx, int dy, unsigned long butto
{
uint index = GetIndexAtPosition(x, y);
mouse_over_index_ = index;
+
+ mouse_last_x_ = x;
+ mouse_last_y_ = y;
+
NeedRedraw();
}
void ResultViewGrid::MouseClick(int x, int y, unsigned long button_flags, unsigned long key_flags)
{
uint index = GetIndexAtPosition(x, y);
+ mouse_over_index_ = index;
if (index >= 0 && index < results_.size())
{
// we got a click on a button so activate it
diff --git a/plugins/unityshell/src/ResultViewGrid.h b/plugins/unityshell/src/ResultViewGrid.h
index 6906da567..b1ccdd458 100644
--- a/plugins/unityshell/src/ResultViewGrid.h
+++ b/plugins/unityshell/src/ResultViewGrid.h
@@ -71,9 +71,8 @@ protected:
void OnKeyDown(unsigned long event_type, unsigned long event_keysym, unsigned long event_state, const TCHAR* character, unsigned short key_repeat_count);
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);;
- virtual long int ProcessEvent(nux::IEvent& ievent, long int TraverseInfo, long int ProcessEventInfo);
virtual void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
- virtual long ComputeLayout2();
+ virtual long ComputeContentSize();
private:
typedef std::tuple <int, int> ResultListBounds;
@@ -104,6 +103,9 @@ private:
int recorded_dash_width_;
int recorded_dash_height_;
+ int mouse_last_x_;
+ int mouse_last_y_;
+
UBusManager ubus_;
};
diff --git a/plugins/unityshell/src/StaticCairoText.cpp b/plugins/unityshell/src/StaticCairoText.cpp
index 08fc5bb28..72f307eb6 100644
--- a/plugins/unityshell/src/StaticCairoText.cpp
+++ b/plugins/unityshell/src/StaticCairoText.cpp
@@ -53,14 +53,12 @@ StaticCairoText::StaticCairoText(const TCHAR* text,
_need_new_extent_cache = true;
_pre_layout_width = 0;
_pre_layout_height = 0;
- _can_pass_focus_to_composite_layout = false;
SetMinimumSize(1, 1);
_ellipsize = NUX_ELLIPSIZE_END;
_align = NUX_ALIGN_LEFT;
_valign = NUX_ALIGN_TOP;
_fontstring = NULL;
- SetCanFocus(false);
_accept_key_nav_focus = false;
}
@@ -160,17 +158,6 @@ long StaticCairoText::PostLayoutManagement(long layoutResult)
return result;
}
-long
-StaticCairoText::ProcessEvent(IEvent& event,
- long traverseInfo,
- long processEventInfo)
-{
- long ret = traverseInfo;
-
- ret = PostProcessEvent2(event, ret, processEventInfo);
- return ret;
-}
-
void
StaticCairoText::Draw(GraphicsEngine& gfxContext,
bool forceDraw)
diff --git a/plugins/unityshell/src/StaticCairoText.h b/plugins/unityshell/src/StaticCairoText.h
index 37addefcf..5ce069d24 100644
--- a/plugins/unityshell/src/StaticCairoText.h
+++ b/plugins/unityshell/src/StaticCairoText.h
@@ -66,10 +66,6 @@ public:
long PostLayoutManagement(long layoutResult);
- long ProcessEvent(IEvent& event,
- long traverseInfo,
- long processEventInfo);
-
void Draw(GraphicsEngine& gfxContext,
bool forceDraw);
diff --git a/plugins/unityshell/src/SwitcherView.cpp b/plugins/unityshell/src/SwitcherView.cpp
index 2c8481f8e..8bb8b062b 100644
--- a/plugins/unityshell/src/SwitcherView.cpp
+++ b/plugins/unityshell/src/SwitcherView.cpp
@@ -173,11 +173,6 @@ SwitcherModel::Ptr SwitcherView::GetModel()
return model_;
}
-long SwitcherView::ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- return TraverseInfo;
-}
-
void SwitcherView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
return;
diff --git a/plugins/unityshell/src/SwitcherView.h b/plugins/unityshell/src/SwitcherView.h
index 68173a0b4..050a26785 100644
--- a/plugins/unityshell/src/SwitcherView.h
+++ b/plugins/unityshell/src/SwitcherView.h
@@ -69,7 +69,6 @@ public:
nux::Property<nux::Color> background_color;
protected:
- long ProcessEvent(nux::IEvent& ievent, long TraverseInfo, long ProcessEventInfo);
void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
void DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw);
diff --git a/plugins/unityshell/src/Tooltip.cpp b/plugins/unityshell/src/Tooltip.cpp
index 302a0e27d..8a9756ba9 100644
--- a/plugins/unityshell/src/Tooltip.cpp
+++ b/plugins/unityshell/src/Tooltip.cpp
@@ -107,15 +107,6 @@ Area* Tooltip::FindAreaUnderMouse(const Point& mouse_position, NuxEventType even
return 0;
}
-long Tooltip::ProcessEvent(IEvent& ievent, long TraverseInfo, long ProcessEventInfo)
-{
- long ret = TraverseInfo;
-
- _tooltip_text->ProcessEvent(ievent, ret, ProcessEventInfo);
-
- return ret;
-}
-
void Tooltip::ShowTooltipWithTipAt(int anchor_tip_x, int anchor_tip_y)
{
_anchorX = anchor_tip_x;
diff --git a/plugins/unityshell/src/Tooltip.h b/plugins/unityshell/src/Tooltip.h
index b73aae51f..7c05ba6c7 100644
--- a/plugins/unityshell/src/Tooltip.h
+++ b/plugins/unityshell/src/Tooltip.h
@@ -66,10 +66,6 @@ public:
~Tooltip();
- long ProcessEvent(IEvent& iEvent,
- long traverseInfo,
- long processEventInfo);
-
void Draw(GraphicsEngine& gfxContext,
bool forceDraw);
diff --git a/plugins/unityshell/src/WindowButtons.cpp b/plugins/unityshell/src/WindowButtons.cpp
index 21fe07982..33585671b 100644
--- a/plugins/unityshell/src/WindowButtons.cpp
+++ b/plugins/unityshell/src/WindowButtons.cpp
@@ -327,21 +327,21 @@ WindowButtons::WindowButtons()
but = new WindowButton(panel::WindowButtonType::CLOSE);
AddView(but, 0, nux::eCenter, nux::eFix);
- but->activated.connect(sigc::mem_fun(this, &WindowButtons::OnCloseClicked));
+ but->state_change.connect(sigc::mem_fun(this, &WindowButtons::OnCloseClicked));
but->mouse_enter.connect(lambda_enter);
but->mouse_leave.connect(lambda_leave);
but->mouse_move.connect(lambda_moved);
but = new WindowButton(panel::WindowButtonType::MINIMIZE);
AddView(but, 0, nux::eCenter, nux::eFix);
- but->activated.connect(sigc::mem_fun(this, &WindowButtons::OnMinimizeClicked));
+ but->state_change.connect(sigc::mem_fun(this, &WindowButtons::OnMinimizeClicked));
but->mouse_enter.connect(lambda_enter);
but->mouse_leave.connect(lambda_leave);
but->mouse_move.connect(lambda_moved);
but = new WindowButton(panel::WindowButtonType::UNMAXIMIZE);
AddView(but, 0, nux::eCenter, nux::eFix);
- but->activated.connect(sigc::mem_fun(this, &WindowButtons::OnRestoreClicked));
+ but->state_change.connect(sigc::mem_fun(this, &WindowButtons::OnRestoreClicked));
but->mouse_enter.connect(lambda_enter);
but->mouse_leave.connect(lambda_leave);
but->mouse_move.connect(lambda_moved);
diff --git a/plugins/unityshell/src/WindowManager.cpp b/plugins/unityshell/src/WindowManager.cpp
index bc84d688d..a242a78f0 100644
--- a/plugins/unityshell/src/WindowManager.cpp
+++ b/plugins/unityshell/src/WindowManager.cpp
@@ -68,6 +68,11 @@ class WindowManagerDummy : public WindowManager
return true;
}
+ bool IsWindowVisible(guint32 xid)
+ {
+ return true;
+ }
+
void Restore(guint32 xid)
{
g_debug("%s", G_STRFUNC);
@@ -98,7 +103,7 @@ class WindowManagerDummy : public WindowManager
g_debug("%s", G_STRFUNC);
}
- void FocusWindowGroup(std::vector<Window> windows)
+ void FocusWindowGroup(std::vector<Window> windows, FocusVisibility)
{
g_debug("%s", G_STRFUNC);
}
diff --git a/plugins/unityshell/src/WindowManager.h b/plugins/unityshell/src/WindowManager.h
index 932ea5253..6d2a0809d 100644
--- a/plugins/unityshell/src/WindowManager.h
+++ b/plugins/unityshell/src/WindowManager.h
@@ -43,7 +43,14 @@ public:
m_MoveResizeAtom(XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
"_NET_WM_MOVERESIZE", FALSE))
{
- }
+ };
+
+ enum class FocusVisibility
+ {
+ OnlyVisible,
+ ForceUnminimizeInvisible,
+ ForceUnminimizeOnCurrentDesktop
+ };
static WindowManager* Default();
static void SetDefault(WindowManager* manager);
@@ -53,6 +60,7 @@ public:
virtual bool IsWindowOnCurrentDesktop(guint32 xid) = 0;
virtual bool IsWindowObscured(guint32 xid) = 0;
virtual bool IsWindowMapped(guint32 xid) = 0;
+ virtual bool IsWindowVisible(guint32 xid) = 0;
virtual void ShowDesktop() = 0;
@@ -70,7 +78,7 @@ public:
virtual void InitiateExpo() = 0;
virtual bool IsExpoActive() = 0;
- virtual void FocusWindowGroup(std::vector<Window> windows) = 0;
+ virtual void FocusWindowGroup(std::vector<Window> windows, FocusVisibility) = 0;
virtual bool ScaleWindowGroup(std::vector<Window> windows, int state, bool force) = 0;
virtual void Decorate(guint32 xid) {};
diff --git a/plugins/unityshell/src/compizminimizedwindowhandler.h b/plugins/unityshell/src/compizminimizedwindowhandler.h
index 05aa7e57f..d5533210e 100644
--- a/plugins/unityshell/src/compizminimizedwindowhandler.h
+++ b/plugins/unityshell/src/compizminimizedwindowhandler.h
@@ -46,6 +46,7 @@ class CompizMinimizedWindowHandler:
public:
CompizMinimizedWindowHandler (CompWindow *w);
+ ~CompizMinimizedWindowHandler ();
void setVisibility (bool visible);
unsigned int getPaintMask ();
@@ -97,6 +98,17 @@ compiz::CompizMinimizedWindowHandler<Screen, Window>::CompizMinimizedWindowHandl
}
template <typename Screen, typename Window>
+compiz::CompizMinimizedWindowHandler<Screen, Window>::~CompizMinimizedWindowHandler ()
+{
+ typedef compiz::CompizMinimizedWindowHandler<Screen, Window> minimized_window_handler_full;
+
+ compiz::CompizMinimizedWindowHandler<Screen, Window>::Ptr compizMinimizeHandler =
+ boost::dynamic_pointer_cast <minimized_window_handler_full> (Window::get (priv->mWindow)->mMinimizeHandler);
+
+ minimizedWindows.remove (compizMinimizeHandler);
+}
+
+template <typename Screen, typename Window>
std::vector<unsigned int>
compiz::CompizMinimizedWindowHandler<Screen, Window>::getTransients ()
{
@@ -149,8 +161,11 @@ compiz::CompizMinimizedWindowHandler<Screen, Window>::minimize ()
{
CompWindow *win = screen->findWindow (w);
- Window::get (win)->mMinimizeHandler = MinimizedWindowHandler::Ptr (new CompizMinimizedWindowHandler (win));
- Window::get (win)->mMinimizeHandler->minimize ();
+ if (win)
+ {
+ Window::get (win)->mMinimizeHandler = MinimizedWindowHandler::Ptr (new CompizMinimizedWindowHandler (win));
+ Window::get (win)->mMinimizeHandler->minimize ();
+ }
}
priv->mWindow->windowNotify (CompWindowNotifyHide);
@@ -230,10 +245,13 @@ compiz::CompizMinimizedWindowHandler<Screen, Window>::unminimize ()
{
CompWindow *win = screen->findWindow (w);
- if (Window::get (win)->mMinimizeHandler)
- Window::get (win)->mMinimizeHandler->unminimize ();
+ if (win)
+ {
+ if (Window::get (win)->mMinimizeHandler)
+ Window::get (win)->mMinimizeHandler->unminimize ();
- Window::get (win)->mMinimizeHandler.reset ();
+ Window::get (win)->mMinimizeHandler.reset ();
+ }
}
setVisibility (true);
diff --git a/plugins/unityshell/src/minimizedwindowhandler.h b/plugins/unityshell/src/minimizedwindowhandler.h
index dc578dc41..a7dcf9d98 100644
--- a/plugins/unityshell/src/minimizedwindowhandler.h
+++ b/plugins/unityshell/src/minimizedwindowhandler.h
@@ -39,7 +39,7 @@ class MinimizedWindowHandler
public:
MinimizedWindowHandler (Display *dpy, unsigned int xid);
- ~MinimizedWindowHandler ();
+ virtual ~MinimizedWindowHandler ();
virtual void minimize ();
virtual void unminimize ();
diff --git a/plugins/unityshell/src/nux-area-accessible.cpp b/plugins/unityshell/src/nux-area-accessible.cpp
index c7d72a015..af8710857 100644
--- a/plugins/unityshell/src/nux-area-accessible.cpp
+++ b/plugins/unityshell/src/nux-area-accessible.cpp
@@ -261,8 +261,9 @@ nux_area_accessible_ref_state_set(AtkObject* obj)
atk_state_set_add_state(state_set, ATK_STATE_SHOWING);
}
- if (area->CanFocus())
- atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
+ // FIXME CanFocus is no longer part of Nux API
+// if (area->CanFocus())
+// atk_state_set_add_state(state_set, ATK_STATE_FOCUSABLE);
if (area->HasKeyFocus())
atk_state_set_add_state(state_set, ATK_STATE_FOCUSED);
@@ -335,7 +336,7 @@ static gboolean
nux_area_accessible_grab_focus(AtkComponent* component)
{
nux::Object* nux_object = NULL;
- nux::Area* area = NULL;
+ //nux::Area* area = NULL;
g_return_val_if_fail(NUX_IS_AREA_ACCESSIBLE(component), FALSE);
@@ -343,9 +344,7 @@ nux_area_accessible_grab_focus(AtkComponent* component)
if (nux_object == NULL) /* defunct */
return FALSE;
- area = dynamic_cast<nux::Area*>(nux_object);
-
- area->SetFocused(TRUE);
+ //area = dynamic_cast<nux::Area*>(nux_object);
/* FIXME: SetFocused doesn't return if the force was succesful or
not, we suppose that this is the case like in cally and gail */
@@ -539,7 +538,7 @@ check_focus(NuxAreaAccessible* self)
area = dynamic_cast<nux::Area*>(nux_object);
- if (area->GetFocused())
+ if (nux::GetWindowCompositor().GetKeyFocusArea() == area)
focus_in = TRUE;
if (self->priv->focused != focus_in)
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 8ff597197..f8f915109 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -233,6 +233,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
uScreen->mFbos[&(screen->fullscreenOutput ())] = UnityFBO::Ptr (new UnityFBO(&(screen->fullscreenOutput ())));
}
+ optionSetBackgroundColorNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetLauncherHideModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetBacklightModeNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetLaunchAnimationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
@@ -678,20 +679,49 @@ void UnityScreen::enterShowDesktopMode ()
for (CompWindow *w : screen->windows ())
{
if (UnityShowdesktopHandler::shouldHide (w))
+ {
UnityWindow::get (w)->enterShowDesktop ();
+ // the animation plugin does strange things here ...
+ // if this notification is sent
+ // w->windowNotify (CompWindowNotifyEnterShowDesktopMode);
+ }
if (w->type() & CompWindowTypeDesktopMask)
w->moveInputFocusTo();
}
PluginAdapter::Default()->OnShowDesktop();
+ /* Disable the focus handler as we will report that
+ * minimized windows can be focused which will
+ * allow them to enter showdesktop mode. That's
+ * no good */
+ for (CompWindow *w : screen->windows ())
+ {
+ UnityWindow *uw = UnityWindow::get (w);
+ w->focusSetEnabled (uw, false);
+ }
+
screen->enterShowDesktopMode ();
+
+ for (CompWindow *w : screen->windows ())
+ {
+ UnityWindow *uw = UnityWindow::get (w);
+ w->focusSetEnabled (uw, true);
+ }
}
void UnityScreen::leaveShowDesktopMode (CompWindow *w)
{
for (CompWindow *cw : screen->windows ())
- UnityWindow::get (cw)->leaveShowDesktop ();
+ {
+ if (cw->inShowDesktopMode ())
+ {
+ UnityWindow::get (cw)->leaveShowDesktop ();
+ // the animation plugin does strange things here ...
+ // if this notification is sent
+ //cw->windowNotify (CompWindowNotifyLeaveShowDesktopMode);
+ }
+ }
PluginAdapter::Default()->OnLeaveDesktop();
@@ -713,6 +743,8 @@ void UnityWindow::leaveShowDesktop ()
{
mShowdesktopHandler->fadeIn ();
window->setShowDesktopMode (false);
+ delete mShowdesktopHandler;
+ mShowdesktopHandler = NULL;
}
}
@@ -735,6 +767,9 @@ CompWindowList UnityShowdesktopHandler::animating_windows (0);
bool UnityShowdesktopHandler::shouldHide (CompWindow *w)
{
+ if (w->overrideRedirect ())
+ return false;
+
if (!w->managed ())
return false;
@@ -745,9 +780,14 @@ bool UnityShowdesktopHandler::shouldHide (CompWindow *w)
CompWindowTypeDockMask))
return false;
- if (w->state () & CompWindowStateSkipPagerMask)
+ if (w->state () & (CompWindowStateSkipPagerMask |
+ CompWindowStateSkipTaskbarMask))
return false;
+ if ((w->state () & CompWindowStateHiddenMask))
+ if (!(w->inShowDesktopMode () || w->shaded ()))
+ return false;
+
return true;
}
@@ -1701,7 +1741,7 @@ void UnityWindow::windowNotify(CompWindowNotify n)
if (!focusdesktop_handle_)
focusdesktop_handle_ = g_timeout_add (1000, &UnityWindow::FocusDesktopTimeout, this);
}
- break;
+ /* Fall through an re-evaluate wraps on map and unmap too */
case CompWindowNotifyUnmap:
if (UnityScreen::get (screen)->optionGetShowMinimizedWindows () &&
window->mapNum ())
@@ -1888,13 +1928,20 @@ CompPoint UnityWindow::tryNotIntersectUI(CompPoint& pos)
bool UnityWindow::place(CompPoint& pos)
{
- bool result = window->place(pos);
+ bool was_maximized = PluginAdapter::Default ()->MaximizeIfBigEnough(window);
+
+ if (!was_maximized)
+ {
+ bool result = window->place(pos);
- if (window->type() & NO_FOCUS_MASK)
+ if (window->type() & NO_FOCUS_MASK)
+ return result;
+
+ pos = tryNotIntersectUI(pos);
return result;
+ }
- pos = tryNotIntersectUI(pos);
- return result;
+ return true;
}
/* Configure callback for the launcher window */
@@ -1947,6 +1994,19 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
{
switch (num)
{
+ case UnityshellOptions::BackgroundColor:
+ {
+ nux::Color override_color (optionGetBackgroundColorRed() / 65535.0f,
+ optionGetBackgroundColorGreen() / 65535.0f,
+ optionGetBackgroundColorBlue() / 65535.0f,
+ optionGetBackgroundColorAlpha() / 65535.0f);
+
+ override_color.red = override_color.red / override_color.alpha;
+ override_color.green = override_color.green / override_color.alpha;
+ override_color.blue = override_color.blue / override_color.alpha;
+ _bghash.OverrideColor(override_color);
+ break;
+ }
case UnityshellOptions::LauncherHideMode:
launcher->SetHideMode((Launcher::LauncherHideMode) optionGetLauncherHideMode());
break;
@@ -2332,6 +2392,20 @@ UnityFBO::~UnityFBO ()
glDeleteTextures (1, &mFBTexture);
}
+void UnityScreen::OnDashRealized ()
+{
+ /* stack any windows named "onboard" above us */
+ for (CompWindow *w : screen->windows ())
+ {
+ if (w->resName() == "onboard")
+ {
+ Window xid = dashController->window()->GetInputWindowId();
+ XSetTransientForHint (screen->dpy(), w->id(), xid);
+ w->raise ();
+ }
+ }
+}
+
/* Start up the launcher */
void UnityScreen::initLauncher(nux::NThread* thread, void* InitData)
{
@@ -2387,6 +2461,7 @@ void UnityScreen::initLauncher(nux::NThread* thread, void* InitData)
/* Setup Places */
self->dash_controller_.reset(new dash::Controller());
+ self->dash_controller_->on_realize.connect(sigc::mem_fun(self, &UnityScreen::OnDashRealized));
/* FIXME: this should not be manual, should be managed with a
show/hide callback like in GAIL
@@ -2442,11 +2517,24 @@ UnityWindow::UnityWindow(CompWindow* window)
if (window->state () & CompWindowStateFullscreenMask)
UnityScreen::get (screen)->fullscreen_windows_.push_back(window);
-
- if (window->resName() == "onboard")
+
+ /* We might be starting up so make sure that
+ * we don't deref the dashcontroller that doesnt
+ * exist */
+ dash::Controller::Ptr dp = UnityScreen::get(screen)->dash_controller_;
+
+ if (dp)
{
- Window xid = UnityScreen::get (screen)->dash_controller_->window()->GetInputWindowId();
- XSetTransientForHint (screen->dpy(), window->id(), xid);
+ nux::BaseWindow* w = dp->window ();
+
+ if (w)
+ {
+ if (window->resName() == "onboard")
+ {
+ Window xid = dp->window()->GetInputWindowId();
+ XSetTransientForHint (screen->dpy(), window->id(), xid);
+ }
+ }
}
}
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index a05f98c68..c305606cc 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -264,6 +264,8 @@ private:
void restartLauncherKeyNav();
void OnLauncherHiddenChanged();
+ void OnDashRealized ();
+
static void OnQuicklistEndKeyNav(GVariant* data, void* value);
static void OnLauncherStartKeyNav(GVariant* data, void* value);
static void OnLauncherEndKeyNav(GVariant* data, void* value);
diff --git a/plugins/unityshell/unityshell.xml.in b/plugins/unityshell/unityshell.xml.in
index 968a775bc..f3d5cf6af 100644
--- a/plugins/unityshell/unityshell.xml.in
+++ b/plugins/unityshell/unityshell.xml.in
@@ -166,6 +166,16 @@
</group>
<group>
<_short>Experimental</_short>
+ <option name="background_color" type="color">
+ <_short>Background Color</_short>
+ <_long>Background color override used for testing purposes</_long>
+ <default>
+ <red>0x00</red>
+ <green>0x00</green>
+ <blue>0x00</blue>
+ <alpha>0x00</alpha>
+ </default>
+ </option>
<option name="backlight_mode" type="int">
<_short>Backlight Mode</_short>
<_long>Change how the icons are backlit</_long>