summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2011-12-13 17:09:58 +0200
committerUri Lublin <uril@redhat.com>2011-12-21 13:05:12 +0200
commitdf17a852fa23ab2bb47038313eda78f6614dd7f0 (patch)
tree8b3f0f95f3d4ac8c8c1d5dda7e935f9bfa8998a0
parent7d8cc134bf0b2175cae69c08bfe07b859d45a306 (diff)
downloadspice-df17a852fa23ab2bb47038313eda78f6614dd7f0.tar.gz
spice-df17a852fa23ab2bb47038313eda78f6614dd7f0.tar.xz
spice-df17a852fa23ab2bb47038313eda78f6614dd7f0.zip
client: foreign-menu: pass "active" param when creating a ForeignMenu (#769020)
The default stays the same -- false. A race could prevent setting ForeignMenu::_active correctly. That happened when Application::on_app_activated was called before _foriegn_menu was created. When foriegn_menu was created its _active defaults to false, and that has not changed, until focus was taken out and back in spice-client window. This caused usbrdr to sometimes not auto-share devices, unless the user switched focus to a different application and back to spicec. The fix updates ForiegnMenu::_active upon creation. (cherry picked from commit fdcef173645e564be71f1b73d476c0716e91663d)
-rw-r--r--client/application.cpp2
-rw-r--r--client/foreign_menu.cpp4
-rw-r--r--client/foreign_menu.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/client/application.cpp b/client/application.cpp
index 634fcddf..2a9ac793 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -594,7 +594,7 @@ int Application::run()
void Application::on_start_running()
{
- _foreign_menu.reset(new ForeignMenu(this));
+ _foreign_menu.reset(new ForeignMenu(this, _active));
if (_enable_controller) {
_controller.reset(new Controller(this));
return;
diff --git a/client/foreign_menu.cpp b/client/foreign_menu.cpp
index 988583a0..ebe2d5ce 100644
--- a/client/foreign_menu.cpp
+++ b/client/foreign_menu.cpp
@@ -33,9 +33,9 @@
#define PIPE_NAME "/tmp/SpiceForeignMenu-%lu.uds"
#endif
-ForeignMenu::ForeignMenu(ForeignMenuInterface *handler)
+ForeignMenu::ForeignMenu(ForeignMenuInterface *handler, bool active)
: _handler (handler)
- , _active (false)
+ , _active (active)
, _refs (1)
{
char pipe_name[PIPE_NAME_MAX_LEN];
diff --git a/client/foreign_menu.h b/client/foreign_menu.h
index 2fc4e535..6138087a 100644
--- a/client/foreign_menu.h
+++ b/client/foreign_menu.h
@@ -38,7 +38,7 @@ public:
class ForeignMenu : public NamedPipe::ListenerInterface {
public:
- ForeignMenu(ForeignMenuInterface *handler);
+ ForeignMenu(ForeignMenuInterface *handler, bool active = false);
virtual ~ForeignMenu();
ForeignMenu* ref() { _refs++; return this;}