mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-09 13:02:01 +03:00
(menubar_callback): refactoring of menu draw after get focus and resize.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
41144d619c
commit
3debdac657
@ -574,14 +574,10 @@ menubar_handle_key (WMenuBar * menubar, int key)
|
|||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static cb_ret_t
|
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)
|
if (!menubar->is_active)
|
||||||
return MSG_NOT_HANDLED;
|
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);
|
widget_want_hotkey (w, TRUE);
|
||||||
menubar_draw (menubar);
|
menubar_draw (menubar);
|
||||||
return MSG_HANDLED;
|
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 */
|
/* We don't want the buttonbar to activate while using the menubar */
|
||||||
case MSG_HOTKEY:
|
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 */
|
/* Put the cursor in a suitable place */
|
||||||
return MSG_NOT_HANDLED;
|
return MSG_NOT_HANDLED;
|
||||||
|
|
||||||
case MSG_UNFOCUS:
|
|
||||||
return menubar->is_active ? MSG_NOT_HANDLED : MSG_HANDLED;
|
|
||||||
|
|
||||||
case MSG_DRAW:
|
case MSG_DRAW:
|
||||||
if (menubar->is_visible)
|
if (menubar->is_visible)
|
||||||
{
|
|
||||||
menubar_draw (menubar);
|
menubar_draw (menubar);
|
||||||
|
else
|
||||||
|
menubar_refresh (menubar);
|
||||||
return MSG_HANDLED;
|
return MSG_HANDLED;
|
||||||
}
|
|
||||||
/* fall through */
|
|
||||||
|
|
||||||
case MSG_RESIZE:
|
case MSG_RESIZE:
|
||||||
/* try show menu after screen resize */
|
/* try show menu after screen resize */
|
||||||
send_message (w, sender, MSG_FOCUS, 0, data);
|
menubar_refresh (menubar);
|
||||||
return MSG_HANDLED;
|
return MSG_HANDLED;
|
||||||
|
|
||||||
|
|
||||||
case MSG_DESTROY:
|
case MSG_DESTROY:
|
||||||
menubar_set_menu (menubar, NULL);
|
menubar_set_menu (menubar, NULL);
|
||||||
return MSG_HANDLED;
|
return MSG_HANDLED;
|
||||||
|
Loading…
Reference in New Issue
Block a user