diff options
| author | Marco Trevisan (TreviƱo) <mail@3v1n0.net> | 2017-04-25 17:57:25 +0000 | 
|---|---|---|
| committer | Bileto Bot <ci-train-bot@canonical.com> | 2017-04-25 17:57:25 +0000 | 
| commit | 7edf16cb43b1e72c1b66299525b8fec3047e8581 (patch) | |
| tree | b90c0c5510ba40ba87f4943d7132de51af5b8e32 | |
| parent | 52784a352ec43729fa65c3784f927fad30f14f23 (diff) | |
| parent | 33138573d2c4c7d91f5da98d9bf592050ce466f6 (diff) | |
Panel: ensure the menu-manager tracker is updated to match monitor
Also always use an unique name for panel depending on monitor (LP: #1671432) Approved by: Andrea Azzarone (bzr r4229)
| -rw-r--r-- | dash/DashView.cpp | 1 | ||||
| -rw-r--r-- | dash/ResultRendererTile.cpp | 5 | ||||
| -rw-r--r-- | lockscreen/LockScreenPanel.cpp | 2 | ||||
| -rw-r--r-- | panel/PanelView.cpp | 11 | ||||
| -rw-r--r-- | panel/PanelView.h | 1 | ||||
| -rw-r--r-- | services/panel-main.c | 36 | ||||
| -rw-r--r-- | services/panel-service.c | 8 | ||||
| -rw-r--r-- | services/panel-service.h | 2 | ||||
| -rw-r--r-- | tests/test_tabiterator.cpp | 6 | ||||
| -rw-r--r-- | tests/test_thumbnail_generator.cpp | 6 | ||||
| -rw-r--r-- | unity-shared/UScreen.cpp | 3 | 
11 files changed, 64 insertions, 17 deletions
| diff --git a/dash/DashView.cpp b/dash/DashView.cpp index de8f834c5..e7c516c30 100644 --- a/dash/DashView.cpp +++ b/dash/DashView.cpp @@ -1447,6 +1447,7 @@ void DashView::OnEntryActivated()  for (auto const& view : scope_views_)  view.second->neko_mode = (i != 0); + search_bar_->search_string = "";  return;  }  } diff --git a/dash/ResultRendererTile.cpp b/dash/ResultRendererTile.cpp index 35a438c9e..ae0fc2246 100644 --- a/dash/ResultRendererTile.cpp +++ b/dash/ResultRendererTile.cpp @@ -282,8 +282,9 @@ void ResultRendererTile::LoadIcon(Result const& row)  };  gsize tmp0;  int tmp1 = tile_size - (rand() % RawPixel(16).CP(scale)); - glib::String tmp2((gchar*)g_base64_decode(pool[rand() % pool.size()], &tmp0)); - icon_name = glib::String(g_strdup_printf(tmp2, tmp1, tmp1)).Str(); + int tmp2 = tile_size - (rand() % RawPixel(16).CP(scale)); + glib::String tmp3((gchar*)g_base64_decode(pool[rand() % pool.size()], &tmp0)); + icon_name = glib::String(g_strdup_printf(tmp3, tmp1, tmp2)).Str();  }  glib::Object<GIcon> icon(g_icon_new_for_string(icon_name.c_str(), nullptr)); diff --git a/lockscreen/LockScreenPanel.cpp b/lockscreen/LockScreenPanel.cpp index 168a46c6e..e54e2f1b4 100644 --- a/lockscreen/LockScreenPanel.cpp +++ b/lockscreen/LockScreenPanel.cpp @@ -149,7 +149,7 @@ void Panel::RemoveIndicator(indicator::Indicator::Ptr const& indicator)  std::string Panel::GetPanelName() const  { - return "LockScreenPanel"; + return "LockScreenPanel" + std::to_string(reinterpret_cast<uintptr_t>(this));  }  void Panel::OnIndicatorViewUpdated() diff --git a/panel/PanelView.cpp b/panel/PanelView.cpp index cd08c46cd..fd492b62e 100644 --- a/panel/PanelView.cpp +++ b/panel/PanelView.cpp @@ -52,7 +52,8 @@ NUX_IMPLEMENT_OBJECT_TYPE(PanelView);  PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus, NUX_FILE_LINE_DECL)  : View(NUX_FILE_LINE_PARAM)  , parent_(parent) - , remote_(menus->Indicators()) + , menus_(menus) + , remote_(menus_->Indicators())  , is_dirty_(true)  , opacity_maximized_toggle_(false)  , needs_geo_sync_(false) @@ -134,7 +135,7 @@ PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus  PanelView::~PanelView()  {  indicator::EntryLocationMap locations; - remote_->SyncGeometries(GetName() + std::to_string(monitor_), locations); + remote_->SyncGeometries(GetPanelName(), locations);  }  void PanelView::LoadTextures() @@ -735,7 +736,7 @@ void PanelView::SetOpacityMaximizedToggle(bool enabled)  std::string PanelView::GetPanelName() const  { - return GetName() + std::to_string(monitor_); + return GetName() + std::to_string(reinterpret_cast<uintptr_t>(this)) + '_' + std::to_string(monitor_);  }  void PanelView::SyncGeometries() @@ -751,9 +752,13 @@ void PanelView::SyncGeometries()  void PanelView::SetMonitor(int monitor)  { + auto mouse_tracker_cb = sigc::mem_fun(this, &PanelView::OnMenuPointerMoved); + menus_->UnregisterTracker(GetPanelName(), mouse_tracker_cb); +  monitor_ = monitor;  menu_view_->SetMonitor(monitor);  indicators_->SetMonitor(monitor); + menus_->RegisterTracker(GetPanelName(), mouse_tracker_cb);  Resize();  if (WindowManager::Default().IsScaleActive()) diff --git a/panel/PanelView.h b/panel/PanelView.h index 48a6a4bed..d2d91c5d6 100644 --- a/panel/PanelView.h +++ b/panel/PanelView.h @@ -111,6 +111,7 @@ private:  void AddPanelView(PanelIndicatorsView* child, unsigned int stretchFactor);  MockableBaseWindow* parent_; + menu::Manager::Ptr menus_;  indicator::Indicators::Ptr remote_;  // No ownership is taken for these views, that is done by the AddChild method. diff --git a/services/panel-main.c b/services/panel-main.c index 14535fcde..f6488ba38 100644 --- a/services/panel-main.c +++ b/services/panel-main.c @@ -343,6 +343,31 @@ on_icon_theme_changed (GtkIconTheme* theme, GDBusConnection *connection)  }  } +void +on_unity_dbus_name_owner_changed_cb (GDBusConnection *connection, + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data) +{ + PanelService *service; + const gchar *owner_name; + const gchar *old_address; + const gchar *new_address; + + g_variant_get (parameters, "(&s&s&s)", &owner_name, &old_address, &new_address); + g_debug ("%s: %s, %s -> %s", G_STRFUNC, owner_name, old_address, new_address); + + service = user_data; + + if (!new_address || *new_address == '\0') + { + panel_service_clear_remote_data (service); + } +} +  static void  on_bus_acquired (GDBusConnection *connection,  const gchar *name, @@ -368,6 +393,17 @@ on_bus_acquired (GDBusConnection *connection,  g_signal_connect (gtk_icon_theme_get_default(), "changed",  G_CALLBACK (on_icon_theme_changed), connection); + g_dbus_connection_signal_subscribe (connection, + /*sender*/ NULL, + /*interface_name*/ "org.freedesktop.DBus", + /*member*/ "NameOwnerChanged", + /*object_path*/ "/org/freedesktop/DBus", + /*arg0*/ "com.canonical.Unity", + G_DBUS_SIGNAL_FLAGS_NONE, + on_unity_dbus_name_owner_changed_cb, + service, + NULL); +  g_debug ("%s", G_STRFUNC);  g_assert (reg_id > 0);  } diff --git a/services/panel-service.c b/services/panel-service.c index 4451fffa5..f65647d4d 100644 --- a/services/panel-service.c +++ b/services/panel-service.c @@ -195,6 +195,14 @@ panel_service_class_dispose (GObject *self)  G_OBJECT_CLASS (panel_service_parent_class)->dispose (self);  } +void +panel_service_clear_remote_data (PanelService *self) +{ + g_return_if_fail (PANEL_IS_SERVICE (self)); + + g_hash_table_remove_all (self->priv->panel2entries_hash); +} +  static void  panel_service_class_finalize (GObject *object)  { diff --git a/services/panel-service.h b/services/panel-service.h index 5d267c23f..1c3de10ec 100644 --- a/services/panel-service.h +++ b/services/panel-service.h @@ -76,6 +76,8 @@ void panel_service_remove_indicator (PanelService *self, IndicatorO  void panel_service_clear_indicators (PanelService *self); +void panel_service_clear_remote_data (PanelService *self); +  GVariant * panel_service_sync (PanelService *self);  GVariant * panel_service_sync_one (PanelService *self, diff --git a/tests/test_tabiterator.cpp b/tests/test_tabiterator.cpp index e156d2c24..a32de9652 100644 --- a/tests/test_tabiterator.cpp +++ b/tests/test_tabiterator.cpp @@ -171,9 +171,6 @@ TEST_F(TestTabIterator, InsertBeforeMissing)  auto second_entry = IMTextEntryPtr(new IMTextEntry);  tab_iterator.InsertBefore(second_entry.GetPointer(), first_entry.GetPointer()); - std::list<nux::InputArea*>::iterator it = std::find(tab_iterator.areas_.begin(), - tab_iterator.areas_.end(), second_entry.GetPointer()); -  nux::InputArea* last = tab_iterator.areas_.back();  EXPECT_EQ(second_entry.GetPointer(), last); @@ -206,9 +203,6 @@ TEST_F(TestTabIterator, InsertAfterMissing)  auto second_entry = IMTextEntryPtr(new IMTextEntry);  tab_iterator.InsertAfter(second_entry.GetPointer(), first_entry.GetPointer()); - std::list<nux::InputArea*>::iterator it = std::find(tab_iterator.areas_.begin(), - tab_iterator.areas_.end(), second_entry.GetPointer()); -  nux::InputArea* last = tab_iterator.areas_.back();  EXPECT_EQ(second_entry.GetPointer(), last); diff --git a/tests/test_thumbnail_generator.cpp b/tests/test_thumbnail_generator.cpp index 19dc75a4a..f6fdb04ba 100644 --- a/tests/test_thumbnail_generator.cpp +++ b/tests/test_thumbnail_generator.cpp @@ -58,7 +58,7 @@ struct LoadResult  }  }; -void CheckResults(std::vector<LoadResult> const& results, unsigned max_wait = 500) +void CheckResults(std::vector<LoadResult> const& results, unsigned max_wait = 1500)  {  Utils::WaitUntilMSec([&results] {  bool got_all = true; @@ -149,7 +149,7 @@ TEST(TestThumbnailGenerator, TestGetManyFileThumbnail)  results[i].cancelled = true;  } - CheckResults(results, 15000); + CheckResults(results, 30000);  } @@ -206,7 +206,7 @@ TEST(TestThumbnailGenerator, TestGetManyGIcon)  results[i].cancelled = true;  } - CheckResults(results); + CheckResults(results, 3000);  } diff --git a/unity-shared/UScreen.cpp b/unity-shared/UScreen.cpp index c3f47b3f1..ce18a5d11 100644 --- a/unity-shared/UScreen.cpp +++ b/unity-shared/UScreen.cpp @@ -170,9 +170,8 @@ void UScreen::Refresh()  float scale = gdk_screen_get_monitor_scale_factor(screen_, i);  nux::Geometry geo(rect.x, rect.y, rect.width, rect.height); -   nux::Size physical_size(gdk_screen_get_monitor_width_mm(screen_, i), - gdk_screen_get_monitor_height_mm(screen_, i)); + gdk_screen_get_monitor_height_mm(screen_, i));  if (scale != 1.0)  geo = geo * scale; | 
