comparison src/menubar-x.c @ 282:c42ec1d1cded r21-0b39

Import from CVS: tag r21-0b39
author cvs
date Mon, 13 Aug 2007 10:33:18 +0200
parents c5d627a313b1
children 558f606b08ae
comparison
equal deleted inserted replaced
281:090b52736db2 282:c42ec1d1cded
668 XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer))); 668 XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer)));
669 669
670 Boolean menubar_was_visible = XtIsManaged (FRAME_X_MENUBAR_WIDGET (f)); 670 Boolean menubar_was_visible = XtIsManaged (FRAME_X_MENUBAR_WIDGET (f));
671 Boolean menubar_will_be_visible = menubar_was_visible; 671 Boolean menubar_will_be_visible = menubar_was_visible;
672 Boolean menubar_visibility_changed; 672 Boolean menubar_visibility_changed;
673 Cardinal new_num_top_widgets = 1; /* for the menubar */
674 Widget container = FRAME_X_CONTAINER_WIDGET (f); 673 Widget container = FRAME_X_CONTAINER_WIDGET (f);
675 674
676 if (menubar_contents_changed) 675 if (menubar_contents_changed)
677 menubar_will_be_visible = set_frame_menubar (f, 0, 0); 676 menubar_will_be_visible = set_frame_menubar (f, 0, 0);
678 677
679 menubar_visibility_changed = menubar_was_visible != menubar_will_be_visible; 678 menubar_visibility_changed = menubar_was_visible != menubar_will_be_visible;
680 679
681 if (! (menubar_visibility_changed 680 if (!menubar_visibility_changed)
682 ))
683 return; 681 return;
684 682
685
686 /* Set menubar visibility */ 683 /* Set menubar visibility */
687 if (menubar_visibility_changed) 684 (menubar_will_be_visible ? XtManageChild : XtUnmanageChild)
688 (menubar_will_be_visible ? XtManageChild : XtUnmanageChild) 685 (FRAME_X_MENUBAR_WIDGET (f));
689 (FRAME_X_MENUBAR_WIDGET (f)); 686
690 687 MARK_FRAME_SIZE_SLIPPED (f);
691 /* Note that new_num_top_widgets doesn't need to reflect the actual
692 number of top widgets, but just the limit of FRAME_X_TOP_WIDGETS (f)[]. */
693 FRAME_X_NUM_TOP_WIDGETS (f) = new_num_top_widgets;
694 {
695 /* We want to end up as close in size as possible to what we
696 were before. So, ask the EmacsManager what size it wants to be
697 (suggesting the current size), and resize it to that size. It
698 in turn will call our query-geometry callback, which will round
699 the size to something that exactly fits the text widget. */
700 XtWidgetGeometry req, repl;
701 Arg al [2];
702
703 req.request_mode = CWWidth | CWHeight;
704 XtSetArg (al [0], XtNwidth, &req.width);
705 XtSetArg (al [1], XtNheight, &req.height);
706 XtGetValues (container, al, 2);
707 XtQueryGeometry (container, &req, &repl);
708 EmacsManagerChangeSize (container, repl.width, repl.height);
709 /* The window size might not have changed but the text size
710 did; thus, the base size might be incorrect. So update it. */
711 EmacsShellUpdateSizeHints (FRAME_X_SHELL_WIDGET (f));
712 }
713
714 } 688 }
715 689
716 static void 690 static void
717 x_update_frame_menubars (struct frame *f) 691 x_update_frame_menubars (struct frame *f)
718 { 692 {