Fix enabling menu bar multiple times on Haiku
* src/haiku_support.cc (FrameResized): Adjust width and height appropriately when sending menu bar resize event. * src/haikufns.c (haiku_set_menu_bar_lines): Don't always reset FRAME_MENU_BAR_LINES and FRAME_MENU_BAR_HEIGHT. * src/haikumenu.c (free_frame_menubar): Clear Haiku menu bar. (set_frame_menubar): Fix coding style. * src/haikuterm.c (haiku_read_socket): Don't adjust height here anymore.
This commit is contained in:
parent
992cf3cb67
commit
bd3b2a6781
4 changed files with 17 additions and 12 deletions
|
@ -1272,8 +1272,8 @@ class EmacsMenuBar : public BMenuBar
|
|||
{
|
||||
struct haiku_menu_bar_resize_event rq;
|
||||
rq.window = this->Window ();
|
||||
rq.height = std::lrint (newHeight);
|
||||
rq.width = std::lrint (newWidth);
|
||||
rq.height = std::lrint (newHeight + 1);
|
||||
rq.width = std::lrint (newWidth + 1);
|
||||
|
||||
haiku_write (MENU_BAR_RESIZE, &rq);
|
||||
BMenuBar::FrameResized (newWidth, newHeight);
|
||||
|
|
|
@ -1278,9 +1278,6 @@ haiku_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval
|
|||
|
||||
fset_redisplay (f);
|
||||
|
||||
FRAME_MENU_BAR_LINES (f) = 0;
|
||||
FRAME_MENU_BAR_HEIGHT (f) = 0;
|
||||
|
||||
if (nlines)
|
||||
{
|
||||
FRAME_EXTERNAL_MENU_BAR (f) = 1;
|
||||
|
@ -1289,11 +1286,14 @@ haiku_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval
|
|||
}
|
||||
else
|
||||
{
|
||||
FRAME_MENU_BAR_LINES (f) = 0;
|
||||
FRAME_MENU_BAR_HEIGHT (f) = 0;
|
||||
|
||||
if (FRAME_EXTERNAL_MENU_BAR (f))
|
||||
free_frame_menubar (f);
|
||||
|
||||
FRAME_EXTERNAL_MENU_BAR (f) = 0;
|
||||
if (FRAME_HAIKU_P (f))
|
||||
FRAME_HAIKU_MENU_BAR (f) = 0;
|
||||
FRAME_HAIKU_MENU_BAR (f) = 0;
|
||||
}
|
||||
|
||||
adjust_frame_glyphs (f);
|
||||
|
|
|
@ -486,14 +486,19 @@ haiku_menu_show (struct frame *f, int x, int y, int menuflags,
|
|||
void
|
||||
free_frame_menubar (struct frame *f)
|
||||
{
|
||||
void *mbar;
|
||||
|
||||
FRAME_MENU_BAR_LINES (f) = 0;
|
||||
FRAME_MENU_BAR_HEIGHT (f) = 0;
|
||||
FRAME_EXTERNAL_MENU_BAR (f) = 0;
|
||||
|
||||
block_input ();
|
||||
void *mbar = FRAME_HAIKU_MENU_BAR (f);
|
||||
mbar = FRAME_HAIKU_MENU_BAR (f);
|
||||
FRAME_HAIKU_MENU_BAR (f) = NULL;
|
||||
|
||||
if (mbar)
|
||||
BMenuBar_delete (mbar);
|
||||
|
||||
if (FRAME_OUTPUT_DATA (f)->menu_bar_open_p)
|
||||
--popup_activated_p;
|
||||
FRAME_OUTPUT_DATA (f)->menu_bar_open_p = 0;
|
||||
|
@ -516,8 +521,7 @@ set_frame_menubar (struct frame *f, bool deep_p)
|
|||
{
|
||||
void *mbar = FRAME_HAIKU_MENU_BAR (f);
|
||||
void *view = FRAME_HAIKU_VIEW (f);
|
||||
|
||||
int first_time_p = 0;
|
||||
bool first_time_p = false;
|
||||
|
||||
if (!mbar)
|
||||
{
|
||||
|
@ -529,6 +533,7 @@ set_frame_menubar (struct frame *f, bool deep_p)
|
|||
initial dimensions of that menu bar. */
|
||||
if (FRAME_VISIBLE_P (f))
|
||||
haiku_wait_for_event (f, MENU_BAR_RESIZE);
|
||||
|
||||
unblock_input ();
|
||||
}
|
||||
|
||||
|
|
|
@ -3514,11 +3514,11 @@ haiku_read_socket (struct terminal *terminal, struct input_event *hold_quit)
|
|||
|
||||
int old_height = FRAME_MENU_BAR_HEIGHT (f);
|
||||
|
||||
FRAME_MENU_BAR_HEIGHT (f) = b->height + 1;
|
||||
FRAME_MENU_BAR_HEIGHT (f) = b->height;
|
||||
FRAME_MENU_BAR_LINES (f)
|
||||
= (b->height + FRAME_LINE_HEIGHT (f)) / FRAME_LINE_HEIGHT (f);
|
||||
|
||||
if (old_height != b->height + 1)
|
||||
if (old_height != b->height)
|
||||
{
|
||||
adjust_frame_size (f, -1, -1, 3, true, Qmenu_bar_lines);
|
||||
haiku_clear_under_internal_border (f);
|
||||
|
|
Loading…
Add table
Reference in a new issue