/* X Communication module for terminals which understand the X protocol.
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2015 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2016 Free Software
Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "lisp.h"
#include "keyboard.h"
-#include "keymap.h"
#include "frame.h"
+#include "systime.h"
#include "termhooks.h"
#include "window.h"
#include "blockinput.h"
-#include "character.h"
#include "buffer.h"
-#include "charset.h"
#include "coding.h"
#include "sysselect.h"
#include <sys/types.h>
#endif
-#include "dispextern.h"
-
#ifdef HAVE_X_WINDOWS
/* Defining HAVE_MULTILINGUAL_MENU would mean that the toolkit menu
code accepts the Emacs internal encoding. */
/* Child of win. */
&child);
error_p = x_had_errors_p (FRAME_X_DISPLAY (f));
- x_uncatch_errors ();
+ x_uncatch_errors_after_check ();
if (! error_p)
{
lw_refigure_widget (x->column_widget, True);
/* Force the pane widget to resize itself. */
- int new_height = -1;
-#ifdef USE_LUCID
- /* For reasons I don't know Lucid wants to add one pixel to the frame
- height when adding the menu bar. Compensate that here. */
- new_height = FRAME_TEXT_HEIGHT (f) - 1;
-#endif /* USE_LUCID */
- adjust_frame_size (f, -1, new_height, 2, false, Qmenu_bar_lines);
+ adjust_frame_size (f, -1, -1, 2, false, Qupdate_frame_menubar);
unblock_input ();
#endif /* USE_GTK */
}
menubar_size
= (f->output_data.x->menubar_widget
? (f->output_data.x->menubar_widget->core.height
- + f->output_data.x->menubar_widget->core.border_width)
+#ifndef USE_LUCID
+ /* Damn me... With Lucid I get a core.border_width of 1
+ only the first time this is called and an ibw of 1 every
+ time this is called. So the first time this is called I
+ was off by one. Fix that here by never adding
+ core.border_width for Lucid. */
+ + f->output_data.x->menubar_widget->core.border_width
+#endif /* USE_LUCID */
+ )
: 0);
#ifdef USE_LUCID
if (FRAME_EXTERNAL_MENU_BAR (f))
{
Dimension ibw = 0;
+
XtVaGetValues (f->output_data.x->column_widget,
XtNinternalBorderWidth, &ibw, NULL);
- menubar_size += ibw;
+ menubar_size += ibw;
}
#endif /* USE_LUCID */
if (f->output_data.x->widget)
{
- int new_height = -1;
#ifdef USE_MOTIF
XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL);
if (x1 == 0 && y1 == 0)
XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
if (frame_inhibit_resize (f, false, Qmenu_bar_lines))
- new_height = old_height;
+ adjust_frame_size (f, -1, old_height, 1, false, Qfree_frame_menubar_1);
+ else
+ adjust_frame_size (f, -1, -1, 2, false, Qfree_frame_menubar_1);
+#else
+ adjust_frame_size (f, -1, -1, 2, false, Qfree_frame_menubar_1);
#endif /* USE_MOTIF */
- adjust_frame_size (f, -1, new_height, 2, false, Qmenu_bar_lines);
}
else
{
#ifdef USE_MOTIF
- if (frame_inhibit_resize (f, false, Qmenu_bar_lines))
- adjust_frame_size (f, -1, old_height, 1, false, Qmenu_bar_lines);
+ if (WINDOWP (FRAME_ROOT_WINDOW (f))
+ && frame_inhibit_resize (f, false, Qmenu_bar_lines))
+ adjust_frame_size (f, -1, old_height, 1, false, Qfree_frame_menubar_2);
#endif
}
XButtonPressedEvent *event = &(dummy.xbutton);
LWLIB_ID menu_id;
Widget menu;
+ Window dummy_window;
eassert (FRAME_X_P (f));
event->y = y;
/* Adjust coordinates to be root-window-relative. */
- x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
- y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
+ block_input ();
+ x += FRAME_LEFT_SCROLL_BAR_AREA_WIDTH (f);
+ XTranslateCoordinates (FRAME_X_DISPLAY (f),
+
+ /* From-window, to-window. */
+ FRAME_X_WINDOW (f),
+ FRAME_DISPLAY_INFO (f)->root_window,
+
+ /* From-position, to-position. */
+ x, y, &x, &y,
+
+ /* Child of win. */
+ &dummy_window);
+ unblock_input ();
event->x_root = x;
event->y_root = y;
inhibit_garbage_collection ();
#ifdef HAVE_X_WINDOWS
- /* Adjust coordinates to relative to the outer (window manager) window. */
- x += FRAME_OUTER_TO_INNER_DIFF_X (f);
- y += FRAME_OUTER_TO_INNER_DIFF_Y (f);
+ {
+ /* Adjust coordinates to relative to the outer (window manager) window. */
+ int left_off, top_off;
+
+ x_real_pos_and_offsets (f, &left_off, NULL, &top_off, NULL,
+ NULL, NULL, NULL, NULL, NULL);
+
+ x += left_off;
+ y += top_off;
+ }
#endif /* HAVE_X_WINDOWS */
- /* Adjust coordinates to be root-window-relative. */
x += f->left_pos;
y += f->top_pos;