(menubar_callback): refactoring of menu draw after get focus and resize.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-06-11 17:01:13 +03:00
parent 41144d619c
commit 3debdac657

View File

@ -574,14 +574,10 @@ menubar_handle_key (WMenuBar * menubar, int key)
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
menubar_refresh (WMenuBar * menubar)
{
WMenuBar *menubar = MENUBAR (w);
Widget *w = WIDGET (menubar);
switch (msg)
{
/* We do not want the focus unless we have been activated */
case MSG_FOCUS:
if (!menubar->is_active)
return MSG_NOT_HANDLED;
@ -592,6 +588,23 @@ menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
widget_want_hotkey (w, TRUE);
menubar_draw (menubar);
return MSG_HANDLED;
}
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
WMenuBar *menubar = MENUBAR (w);
switch (msg)
{
/* We do not want the focus unless we have been activated */
case MSG_FOCUS:
return menubar_refresh (menubar);
case MSG_UNFOCUS:
return menubar->is_active ? MSG_NOT_HANDLED : MSG_HANDLED;
/* We don't want the buttonbar to activate while using the menubar */
case MSG_HOTKEY:
@ -607,23 +620,18 @@ menubar_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void
/* Put the cursor in a suitable place */
return MSG_NOT_HANDLED;
case MSG_UNFOCUS:
return menubar->is_active ? MSG_NOT_HANDLED : MSG_HANDLED;
case MSG_DRAW:
if (menubar->is_visible)
{
menubar_draw (menubar);
else
menubar_refresh (menubar);
return MSG_HANDLED;
}
/* fall through */
case MSG_RESIZE:
/* try show menu after screen resize */
send_message (w, sender, MSG_FOCUS, 0, data);
menubar_refresh (menubar);
return MSG_HANDLED;
case MSG_DESTROY:
menubar_set_menu (menubar, NULL);
return MSG_HANDLED;