diff options
author | Uri Lublin <uril@redhat.com> | 2011-12-20 16:36:13 +0200 |
---|---|---|
committer | Uri Lublin <uril@redhat.com> | 2011-12-21 13:04:01 +0200 |
commit | 67e785f4fc853985ae968b44280c8985651e41ac (patch) | |
tree | f199894ac42b1d085366edcc0f9f90ce959bd49d | |
parent | baa375e8b51de94ee44466fe416202c29ea43e23 (diff) | |
download | spice-67e785f4fc853985ae968b44280c8985651e41ac.tar.gz spice-67e785f4fc853985ae968b44280c8985651e41ac.tar.xz spice-67e785f4fc853985ae968b44280c8985651e41ac.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)
(seperator vs separator --> a small typo that got fixed)
-rw-r--r-- | client/red_window.h | 2 | ||||
-rw-r--r-- | client/windows/red_window.cpp | 14 | ||||
-rw-r--r-- | client/x11/red_window.cpp | 3 |
3 files changed, 14 insertions, 5 deletions
diff --git a/client/red_window.h b/client/red_window.h index 632564d3..56a90cf2 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_OGL void untouch_context(); diff --git a/client/windows/red_window.cpp b/client/windows/red_window.cpp index 43587e13..188c7724 100644 --- a/client/windows/red_window.cpp +++ b/client/windows/red_window.cpp @@ -1066,18 +1066,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_seperator(_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 cfc10c5e..3be53add 100644 --- a/client/x11/red_window.cpp +++ b/client/x11/red_window.cpp @@ -2215,8 +2215,9 @@ void RedWindow::on_pointer_leave() } } -void RedWindow::set_menu(Menu* menu) +int RedWindow::set_menu(Menu* menu) { + return 0; } void RedWindow::init() |