summaryrefslogtreecommitdiff
path: root/client/windows
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2011-12-20 16:36:13 +0200
committerUri Lublin <uril@redhat.com>2011-12-20 18:43:53 +0200
commit24d5852611c3d5be3ba824af64cd5a3356b82b9c (patch)
tree7fc9d2bbebdfa3ab3be9d02eb23d5f4e4a253860 /client/windows
parent5d28d1662e6e415367bb283d051e0a690a8ec2f2 (diff)
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.
Diffstat (limited to 'client/windows')
-rw-r--r--client/windows/red_window.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp
index 1345e918..981fe9a5 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)