aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan D2010-07-14 16:32:25 +0200
committerJan D2010-07-14 16:32:25 +0200
commitcf28cebc2e93dbd2cd0e6eb2f1a9543a015a1235 (patch)
treef342da6952fb8e6e523fff9ef43f26fa2a641088 /src
parentebd3d6afa42948e3fb136583f12f9f72e7830ec5 (diff)
downloademacs-cf28cebc2e93dbd2cd0e6eb2f1a9543a015a1235.tar.gz
emacs-cf28cebc2e93dbd2cd0e6eb2f1a9543a015a1235.zip
Fix menu bar activation with click for Motif/Lesstif.
* src/xdisp.c (pending_menu_activation): Remove extern declaration. (prepare_menu_bars): Remove setting of pending_menu_activation. * src/xmenu.c (pending_menu_activation): Remove. (x_activate_menubar): Set popup_activated_flag for Xt also. Remove setting of pending_menu_activation. (set_frame_menubar): Remove check of pending_menu_activation. Declare menubar_size before code. Correct spelling in comment. * src/xterm.c (xm_scroll_callback, x_process_timeouts): K&R => prototype. (SET_SAVED_KEY_EVENT): Remove (not used). (SET_SAVED_MENU_EVENT): Rename to SET_SAVED_BUTTON_EVENT and remove size parameter. (handle_one_xevent): Check popup_activated () for menu for Xt also. Remove #ifdef USE_GTK around finish = X_EVENT_DROP. Remove #ifdef USE_MOTIF code that did SET_SAVED_BUTTON_EVENT for ButtonRelease.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog20
-rw-r--r--src/xdisp.c7
-rw-r--r--src/xmenu.c21
-rw-r--r--src/xterm.c38
4 files changed, 30 insertions, 56 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 923ba3afafd..6ca09f99fe7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,23 @@
12010-07-14 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xterm.c (xm_scroll_callback, x_process_timeouts): K&R => prototype.
4 (SET_SAVED_KEY_EVENT): Remove (not used).
5 (SET_SAVED_MENU_EVENT): Rename to SET_SAVED_BUTTON_EVENT and
6 remove size parameter.
7 (handle_one_xevent): Check popup_activated () for menu for Xt also.
8 Remove #ifdef USE_GTK around finish = X_EVENT_DROP.
9 Remove #ifdef USE_MOTIF code that did SET_SAVED_BUTTON_EVENT for
10 ButtonRelease.
11
12 * xdisp.c (pending_menu_activation): Remove extern declaration.
13 (prepare_menu_bars): Remove setting of pending_menu_activation.
14
15 * xmenu.c (pending_menu_activation): Remove.
16 (x_activate_menubar): Set popup_activated_flag for Xt also. Remove
17 setting of pending_menu_activation.
18 (set_frame_menubar): Remove check of pending_menu_activation.
19 Declare menubar_size before code. Correct spelling in comment.
20
12010-07-14 Kenichi Handa <handa@m17n.org> 212010-07-14 Kenichi Handa <handa@m17n.org>
2 22
3 * font.c (font_open_entity): Cancel previous change. 23 * font.c (font_open_entity): Cancel previous change.
diff --git a/src/xdisp.c b/src/xdisp.c
index 3464efd6435..53fba8caa90 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -271,7 +271,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
271#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ 271#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
272 || defined(HAVE_NS) || defined (USE_GTK) 272 || defined(HAVE_NS) || defined (USE_GTK)
273extern void set_frame_menubar (struct frame *f, int, int); 273extern void set_frame_menubar (struct frame *f, int, int);
274extern int pending_menu_activation;
275#endif 274#endif
276 275
277extern int interrupt_input; 276extern int interrupt_input;
@@ -9866,12 +9865,6 @@ prepare_menu_bars (void)
9866 update_tool_bar (sf, 1); 9865 update_tool_bar (sf, 1);
9867#endif 9866#endif
9868 } 9867 }
9869
9870 /* Motif needs this. See comment in xmenu.c. Turn it off when
9871 pending_menu_activation is not defined. */
9872#ifdef USE_X_TOOLKIT
9873 pending_menu_activation = 0;
9874#endif
9875} 9868}
9876 9869
9877 9870
diff --git a/src/xmenu.c b/src/xmenu.c
index b0bdbcfecaa..4b99297e772 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -151,14 +151,6 @@ extern widget_value *xmalloc_widget_value (void);
151extern widget_value *digest_single_submenu (int, int, int); 151extern widget_value *digest_single_submenu (int, int, int);
152#endif 152#endif
153 153
154/* This is set nonzero after the user activates the menu bar, and set
155 to zero again after the menu bars are redisplayed by prepare_menu_bar.
156 While it is nonzero, all calls to set_frame_menubar go deep.
157
158 I don't understand why this is needed, but it does seem to be
159 needed on Motif, according to Marcus Daniels <marcus@sysc.pdx.edu>. */
160
161int pending_menu_activation;
162 154
163#ifdef USE_X_TOOLKIT 155#ifdef USE_X_TOOLKIT
164 156
@@ -670,6 +662,7 @@ x_activate_menubar (FRAME_PTR f)
670 662
671 set_frame_menubar (f, 0, 1); 663 set_frame_menubar (f, 0, 1);
672 BLOCK_INPUT; 664 BLOCK_INPUT;
665 popup_activated_flag = 1;
673#ifdef USE_GTK 666#ifdef USE_GTK
674 /* If we click outside any menu item, the menu bar still grabs. 667 /* If we click outside any menu item, the menu bar still grabs.
675 So we send Press and the Release. If outside, grab is released. 668 So we send Press and the Release. If outside, grab is released.
@@ -681,15 +674,10 @@ x_activate_menubar (FRAME_PTR f)
681 f->output_data.x->saved_menu_event->type = ButtonPress; 674 f->output_data.x->saved_menu_event->type = ButtonPress;
682 XPutBackEvent (f->output_data.x->display_info->display, 675 XPutBackEvent (f->output_data.x->display_info->display,
683 f->output_data.x->saved_menu_event); 676 f->output_data.x->saved_menu_event);
684 popup_activated_flag = 1;
685#else 677#else
686 XtDispatchEvent (f->output_data.x->saved_menu_event); 678 XtDispatchEvent (f->output_data.x->saved_menu_event);
687#endif 679#endif
688 UNBLOCK_INPUT; 680 UNBLOCK_INPUT;
689#ifdef USE_MOTIF
690 if (f->output_data.x->saved_menu_event->type == ButtonRelease)
691 pending_menu_activation = 1;
692#endif
693 681
694 /* Ignore this if we get it a second time. */ 682 /* Ignore this if we get it a second time. */
695 f->output_data.x->saved_menu_event->type = 0; 683 f->output_data.x->saved_menu_event->type = 0;
@@ -991,8 +979,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
991 979
992 if (! menubar_widget) 980 if (! menubar_widget)
993 deep_p = 1; 981 deep_p = 1;
994 else if (pending_menu_activation && !deep_p)
995 deep_p = 1;
996 /* Make the first call for any given frame always go deep. */ 982 /* Make the first call for any given frame always go deep. */
997 else if (!f->output_data.x->saved_menu_event && !deep_p) 983 else if (!f->output_data.x->saved_menu_event && !deep_p)
998 { 984 {
@@ -1274,10 +1260,11 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1274 } 1260 }
1275 1261
1276 { 1262 {
1263 int menubar_size;
1277 if (f->output_data.x->menubar_widget) 1264 if (f->output_data.x->menubar_widget)
1278 XtRealizeWidget (f->output_data.x->menubar_widget); 1265 XtRealizeWidget (f->output_data.x->menubar_widget);
1279 1266
1280 int menubar_size 1267 menubar_size
1281 = (f->output_data.x->menubar_widget 1268 = (f->output_data.x->menubar_widget
1282 ? (f->output_data.x->menubar_widget->core.height 1269 ? (f->output_data.x->menubar_widget->core.height
1283 + f->output_data.x->menubar_widget->core.border_width) 1270 + f->output_data.x->menubar_widget->core.border_width)
@@ -1286,7 +1273,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1286#if 1 /* Experimentally, we now get the right results 1273#if 1 /* Experimentally, we now get the right results
1287 for -geometry -0-0 without this. 24 Aug 96, rms. 1274 for -geometry -0-0 without this. 24 Aug 96, rms.
1288 Maybe so, but the menu bar size is missing the pixels so the 1275 Maybe so, but the menu bar size is missing the pixels so the
1289 WM size hints are off by theses pixel. Jan D, oct 2009. */ 1276 WM size hints are off by these pixels. Jan D, oct 2009. */
1290#ifdef USE_LUCID 1277#ifdef USE_LUCID
1291 if (FRAME_EXTERNAL_MENU_BAR (f)) 1278 if (FRAME_EXTERNAL_MENU_BAR (f))
1292 { 1279 {
diff --git a/src/xterm.c b/src/xterm.c
index 2f581d9f590..e66845df26c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4159,9 +4159,7 @@ x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent)
4159 CALL_DATA is a pointer to a XmScrollBarCallbackStruct. */ 4159 CALL_DATA is a pointer to a XmScrollBarCallbackStruct. */
4160 4160
4161static void 4161static void
4162xm_scroll_callback (widget, client_data, call_data) 4162xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4163 Widget widget;
4164 XtPointer client_data, call_data;
4165{ 4163{
4166 struct scroll_bar *bar = (struct scroll_bar *) client_data; 4164 struct scroll_bar *bar = (struct scroll_bar *) client_data;
4167 XmScrollBarCallbackStruct *cs = (XmScrollBarCallbackStruct *) call_data; 4165 XmScrollBarCallbackStruct *cs = (XmScrollBarCallbackStruct *) call_data;
@@ -5546,22 +5544,18 @@ struct x_display_info *XTread_socket_fake_io_error;
5546 5544
5547static struct x_display_info *next_noop_dpyinfo; 5545static struct x_display_info *next_noop_dpyinfo;
5548 5546
5549#define SET_SAVED_MENU_EVENT(size) \ 5547#define SET_SAVED_BUTTON_EVENT \
5550 do \ 5548 do \
5551 { \ 5549 { \
5552 if (f->output_data.x->saved_menu_event == 0) \ 5550 if (f->output_data.x->saved_menu_event == 0) \
5553 f->output_data.x->saved_menu_event \ 5551 f->output_data.x->saved_menu_event \
5554 = (XEvent *) xmalloc (sizeof (XEvent)); \ 5552 = (XEvent *) xmalloc (sizeof (XEvent)); \
5555 memcpy (f->output_data.x->saved_menu_event, &event, size); \ 5553 *f->output_data.x->saved_menu_event = event; \
5556 inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \ 5554 inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \
5557 XSETFRAME (inev.ie.frame_or_window, f); \ 5555 XSETFRAME (inev.ie.frame_or_window, f); \
5558 } \ 5556 } \
5559 while (0) 5557 while (0)
5560 5558
5561#define SET_SAVED_BUTTON_EVENT SET_SAVED_MENU_EVENT (sizeof (XButtonEvent))
5562#define SET_SAVED_KEY_EVENT SET_SAVED_MENU_EVENT (sizeof (XKeyEvent))
5563
5564
5565enum 5559enum
5566{ 5560{
5567 X_EVENT_NORMAL, 5561 X_EVENT_NORMAL,
@@ -6755,14 +6749,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6755 Instead, save it away 6749 Instead, save it away
6756 and we will pass it to Xt from kbd_buffer_get_event. 6750 and we will pass it to Xt from kbd_buffer_get_event.
6757 That way, we can run some Lisp code first. */ 6751 That way, we can run some Lisp code first. */
6758 if ( 6752 if (! popup_activated ()
6759#ifdef USE_GTK 6753#ifdef USE_GTK
6760 ! popup_activated ()
6761 /* Gtk+ menus only react to the first three buttons. */ 6754 /* Gtk+ menus only react to the first three buttons. */
6762 && event.xbutton.button < 3 6755 && event.xbutton.button < 3
6763 &&
6764#endif 6756#endif
6765 f && event.type == ButtonPress 6757 && f && event.type == ButtonPress
6766 /* Verify the event is really within the menu bar 6758 /* Verify the event is really within the menu bar
6767 and not just sent to it due to grabbing. */ 6759 and not just sent to it due to grabbing. */
6768 && event.xbutton.x >= 0 6760 && event.xbutton.x >= 0
@@ -6773,30 +6765,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6773 { 6765 {
6774 SET_SAVED_BUTTON_EVENT; 6766 SET_SAVED_BUTTON_EVENT;
6775 XSETFRAME (last_mouse_press_frame, f); 6767 XSETFRAME (last_mouse_press_frame, f);
6776#ifdef USE_GTK
6777 *finish = X_EVENT_DROP; 6768 *finish = X_EVENT_DROP;
6778#endif
6779 } 6769 }
6780 else if (event.type == ButtonPress) 6770 else if (event.type == ButtonPress)
6781 { 6771 {
6782 last_mouse_press_frame = Qnil; 6772 last_mouse_press_frame = Qnil;
6783 goto OTHER; 6773 goto OTHER;
6784 } 6774 }
6785
6786#ifdef USE_MOTIF /* This should do not harm for Lucid,
6787 but I am trying to be cautious. */
6788 else if (event.type == ButtonRelease)
6789 {
6790 if (!NILP (last_mouse_press_frame))
6791 {
6792 f = XFRAME (last_mouse_press_frame);
6793 if (f->output_data.x)
6794 SET_SAVED_BUTTON_EVENT;
6795 }
6796 else
6797 goto OTHER;
6798 }
6799#endif /* USE_MOTIF */
6800 else 6775 else
6801 goto OTHER; 6776 goto OTHER;
6802#endif /* USE_X_TOOLKIT || USE_GTK */ 6777#endif /* USE_X_TOOLKIT || USE_GTK */
@@ -10336,8 +10311,7 @@ x_delete_display (struct x_display_info *dpyinfo)
10336 that slows us down. */ 10311 that slows us down. */
10337 10312
10338static void 10313static void
10339x_process_timeouts (timer) 10314x_process_timeouts (struct atimer *timer)
10340 struct atimer *timer;
10341{ 10315{
10342 BLOCK_INPUT; 10316 BLOCK_INPUT;
10343 x_timeout_atimer_activated_flag = 0; 10317 x_timeout_atimer_activated_flag = 0;