summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2011-12-20 16:36:13 +0200
committerUri Lublin <uril@redhat.com>2011-12-21 19:58:19 +0200
commit7e65100c4cd0ff1f5de34982caaa2563f8f50ee5 (patch)
treeda3f0111ae7af853a963623ab19269076d421c0d
parent0a13f2c03e3ba5895b43732adff493b8af1b1108 (diff)
downloadspice-7e65100c4cd0ff1f5de34982caaa2563f8f50ee5.tar.gz
spice-7e65100c4cd0ff1f5de34982caaa2563f8f50ee5.tar.xz
spice-7e65100c4cd0ff1f5de34982caaa2563f8f50ee5.zip
client: menu: make RedWindow::set_menu() return an error-code (#758260)
RedWindow::set_menu() can fail (on Windows when in fullscreen mode). For Windows spice-client, when in fullscreen mode, the system-menu is NULL. Returns 0 upon success, non-0 (currently only -1) upon failure. (cherry picked from commit 24d5852611c3d5be3ba824af64cd5a3356b82b9c)
-rw-r--r--client/red_window.h2
-rw-r--r--client/windows/red_window.cpp14
-rw-r--r--client/x11/red_window.cpp3
3 files changed, 14 insertions, 5 deletions
diff --git a/client/red_window.h b/client/red_window.h
index dc5bad79..1c7237b1 100644
--- a/client/red_window.h
+++ b/client/red_window.h
@@ -70,7 +70,7 @@ public:
void release_mouse();
void start_key_interception();
void stop_key_interception();
- void set_menu(Menu* menu);
+ int set_menu(Menu* menu);
#ifdef USE_OPENGL
void untouch_context();
diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp
index c86c458e..e436f833 100644
--- a/client/windows/red_window.cpp
+++ b/client/windows/red_window.cpp
@@ -1064,18 +1064,26 @@ void RedWindow_p::release_menu(Menu* menu)
}
}
-void RedWindow::set_menu(Menu* menu)
+int RedWindow::set_menu(Menu* menu)
{
release_menu(_menu);
_menu = NULL;
if (!menu) {
- return;
+ return 0;
}
- _menu = menu->ref();
+
_sys_menu = GetSystemMenu(_win, FALSE);
+ if (! _sys_menu) {
+ return -1;
+ }
+
+ _menu = menu->ref();
+
insert_separator(_sys_menu);
insert_menu(_menu, _sys_menu, _commands_map);
+
+ return 0;
}
static LRESULT CALLBACK MessageFilterProc(int nCode, WPARAM wParam, LPARAM lParam)
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index 2e98ae25..86ddd3bd 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -2218,8 +2218,9 @@ void RedWindow::on_pointer_leave()
}
}
-void RedWindow::set_menu(Menu* menu)
+int RedWindow::set_menu(Menu* menu)
{
+ return 0;
}
void RedWindow::init()