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 24d5852611)
(seperator vs separator --> a small typo that got fixed)
This commit is contained in:
Uri Lublin 2011-12-20 16:36:13 +02:00
parent baa375e8b5
commit 67e785f4fc
3 changed files with 14 additions and 5 deletions

View File

@ -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();

View File

@ -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)

View File

@ -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()