aboutsummaryrefslogtreecommitdiffstats
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorKenichi Handa2012-09-30 23:39:46 +0900
committerKenichi Handa2012-09-30 23:39:46 +0900
commitc194970e15b6d6efa07697679a25dfab3aa76442 (patch)
tree49aec8be9d2dcc74ad3c81f562e48308d8e27b75 /src/xmenu.c
parent95402d5faa114a311cabfb8c64cf22a93787a066 (diff)
parentdd946752ab8810149a66a3eff469eb128709972d (diff)
downloademacs-c194970e15b6d6efa07697679a25dfab3aa76442.tar.gz
emacs-c194970e15b6d6efa07697679a25dfab3aa76442.zip
merge trunk
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index d03a4bc974b..96a1ae87fdc 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -165,7 +165,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y)
165 if (! FRAME_X_P (f)) 165 if (! FRAME_X_P (f))
166 emacs_abort (); 166 emacs_abort ();
167 167
168 BLOCK_INPUT; 168 block_input ();
169 169
170 XQueryPointer (FRAME_X_DISPLAY (f), 170 XQueryPointer (FRAME_X_DISPLAY (f),
171 DefaultRootWindow (FRAME_X_DISPLAY (f)), 171 DefaultRootWindow (FRAME_X_DISPLAY (f)),
@@ -186,7 +186,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y)
186 we don't care. */ 186 we don't care. */
187 (unsigned int *) &dummy); 187 (unsigned int *) &dummy);
188 188
189 UNBLOCK_INPUT; 189 unblock_input ();
190 190
191 /* xmenu_show expects window coordinates, not root window 191 /* xmenu_show expects window coordinates, not root window
192 coordinates. Translate. */ 192 coordinates. Translate. */
@@ -328,9 +328,9 @@ for instance using the window manager, then this produces a quit and
328 list_of_panes (Fcons (contents, Qnil)); 328 list_of_panes (Fcons (contents, Qnil));
329 329
330 /* Display them in a dialog box. */ 330 /* Display them in a dialog box. */
331 BLOCK_INPUT; 331 block_input ();
332 selection = xdialog_show (f, 0, title, header, &error_name); 332 selection = xdialog_show (f, 0, title, header, &error_name);
333 UNBLOCK_INPUT; 333 unblock_input ();
334 334
335 unbind_to (specpdl_count, Qnil); 335 unbind_to (specpdl_count, Qnil);
336 discard_menu_items (); 336 discard_menu_items ();
@@ -490,7 +490,7 @@ If FRAME is nil or not given, use the selected frame. */)
490 XEvent ev; 490 XEvent ev;
491 FRAME_PTR f = check_x_frame (frame); 491 FRAME_PTR f = check_x_frame (frame);
492 Widget menubar; 492 Widget menubar;
493 BLOCK_INPUT; 493 block_input ();
494 494
495 if (FRAME_EXTERNAL_MENU_BAR (f)) 495 if (FRAME_EXTERNAL_MENU_BAR (f))
496 set_frame_menubar (f, 0, 1); 496 set_frame_menubar (f, 0, 1);
@@ -548,7 +548,7 @@ If FRAME is nil or not given, use the selected frame. */)
548 } 548 }
549 } 549 }
550 550
551 UNBLOCK_INPUT; 551 unblock_input ();
552 552
553 return Qnil; 553 return Qnil;
554} 554}
@@ -569,9 +569,9 @@ If FRAME is nil or not given, use the selected frame. */)
569 FRAME_PTR f; 569 FRAME_PTR f;
570 570
571 /* gcc 2.95 doesn't accept the FRAME_PTR declaration after 571 /* gcc 2.95 doesn't accept the FRAME_PTR declaration after
572 BLOCK_INPUT. */ 572 block_input (). */
573 573
574 BLOCK_INPUT; 574 block_input ();
575 f = check_x_frame (frame); 575 f = check_x_frame (frame);
576 576
577 if (FRAME_EXTERNAL_MENU_BAR (f)) 577 if (FRAME_EXTERNAL_MENU_BAR (f))
@@ -590,7 +590,7 @@ If FRAME is nil or not given, use the selected frame. */)
590 g_list_free (children); 590 g_list_free (children);
591 } 591 }
592 } 592 }
593 UNBLOCK_INPUT; 593 unblock_input ();
594 594
595 return Qnil; 595 return Qnil;
596} 596}
@@ -642,7 +642,7 @@ x_activate_menubar (FRAME_PTR f)
642#endif 642#endif
643 643
644 set_frame_menubar (f, 0, 1); 644 set_frame_menubar (f, 0, 1);
645 BLOCK_INPUT; 645 block_input ();
646 popup_activated_flag = 1; 646 popup_activated_flag = 1;
647#ifdef USE_GTK 647#ifdef USE_GTK
648 XPutBackEvent (f->output_data.x->display_info->display, 648 XPutBackEvent (f->output_data.x->display_info->display,
@@ -650,7 +650,7 @@ x_activate_menubar (FRAME_PTR f)
650#else 650#else
651 XtDispatchEvent (f->output_data.x->saved_menu_event); 651 XtDispatchEvent (f->output_data.x->saved_menu_event);
652#endif 652#endif
653 UNBLOCK_INPUT; 653 unblock_input ();
654 654
655 /* Ignore this if we get it a second time. */ 655 /* Ignore this if we get it a second time. */
656 f->output_data.x->saved_menu_event->type = 0; 656 f->output_data.x->saved_menu_event->type = 0;
@@ -803,10 +803,10 @@ menubar_selection_callback (GtkWidget *widget, gpointer client_data)
803 sit-for will exit at once if the focus event follows the menu selection 803 sit-for will exit at once if the focus event follows the menu selection
804 event. */ 804 event. */
805 805
806 BLOCK_INPUT; 806 block_input ();
807 while (gtk_events_pending ()) 807 while (gtk_events_pending ())
808 gtk_main_iteration (); 808 gtk_main_iteration ();
809 UNBLOCK_INPUT; 809 unblock_input ();
810 810
811 find_and_call_menu_selection (cb_data->cl_data->f, 811 find_and_call_menu_selection (cb_data->cl_data->f,
812 cb_data->cl_data->menu_bar_items_used, 812 cb_data->cl_data->menu_bar_items_used,
@@ -834,13 +834,13 @@ menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
834#endif /* not USE_GTK */ 834#endif /* not USE_GTK */
835 835
836/* Recompute all the widgets of frame F, when the menu bar has been 836/* Recompute all the widgets of frame F, when the menu bar has been
837 changed. Value is non-zero if widgets were updated. */ 837 changed. */
838 838
839static int 839static void
840update_frame_menubar (FRAME_PTR f) 840update_frame_menubar (FRAME_PTR f)
841{ 841{
842#ifdef USE_GTK 842#ifdef USE_GTK
843 return xg_update_frame_menubar (f); 843 xg_update_frame_menubar (f);
844#else 844#else
845 struct x_output *x; 845 struct x_output *x;
846 int columns, rows; 846 int columns, rows;
@@ -851,9 +851,9 @@ update_frame_menubar (FRAME_PTR f)
851 x = f->output_data.x; 851 x = f->output_data.x;
852 852
853 if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) 853 if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
854 return 0; 854 return;
855 855
856 BLOCK_INPUT; 856 block_input ();
857 /* Save the size of the frame because the pane widget doesn't accept 857 /* Save the size of the frame because the pane widget doesn't accept
858 to resize itself. So force it. */ 858 to resize itself. So force it. */
859 columns = FRAME_COLS (f); 859 columns = FRAME_COLS (f);
@@ -880,9 +880,8 @@ update_frame_menubar (FRAME_PTR f)
880 880
881 /* Force the pane widget to resize itself with the right values. */ 881 /* Force the pane widget to resize itself with the right values. */
882 EmacsFrameSetCharSize (x->edit_widget, columns, rows); 882 EmacsFrameSetCharSize (x->edit_widget, columns, rows);
883 UNBLOCK_INPUT; 883 unblock_input ();
884#endif 884#endif
885 return 1;
886} 885}
887 886
888#ifdef USE_LUCID 887#ifdef USE_LUCID
@@ -921,7 +920,7 @@ apply_systemfont_to_menu (struct frame *f, Widget w)
921 it is set the first time this is called, from initialize_frame_menubar. */ 920 it is set the first time this is called, from initialize_frame_menubar. */
922 921
923void 922void
924set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) 923set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
925{ 924{
926 xt_or_gtk_widget menubar_widget; 925 xt_or_gtk_widget menubar_widget;
927#ifdef USE_X_TOOLKIT 926#ifdef USE_X_TOOLKIT
@@ -1164,7 +1163,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1164 1163
1165 /* Create or update the menu bar widget. */ 1164 /* Create or update the menu bar widget. */
1166 1165
1167 BLOCK_INPUT; 1166 block_input ();
1168 1167
1169#ifdef USE_GTK 1168#ifdef USE_GTK
1170 xg_crazy_callback_abort = 1; 1169 xg_crazy_callback_abort = 1;
@@ -1264,7 +1263,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1264 xg_crazy_callback_abort = 0; 1263 xg_crazy_callback_abort = 0;
1265#endif 1264#endif
1266 1265
1267 UNBLOCK_INPUT; 1266 unblock_input ();
1268} 1267}
1269 1268
1270/* Called from Fx_create_frame to create the initial menubar of a frame 1269/* Called from Fx_create_frame to create the initial menubar of a frame
@@ -1313,7 +1312,7 @@ free_frame_menubar (FRAME_PTR f)
1313 Position x0, y0, x1, y1; 1312 Position x0, y0, x1, y1;
1314#endif 1313#endif
1315 1314
1316 BLOCK_INPUT; 1315 block_input ();
1317 1316
1318#ifdef USE_MOTIF 1317#ifdef USE_MOTIF
1319 if (f->output_data.x->widget) 1318 if (f->output_data.x->widget)
@@ -1332,7 +1331,7 @@ free_frame_menubar (FRAME_PTR f)
1332#endif 1331#endif
1333 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); 1332 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
1334 } 1333 }
1335 UNBLOCK_INPUT; 1334 unblock_input ();
1336 } 1335 }
1337} 1336}
1338#endif /* not USE_GTK */ 1337#endif /* not USE_GTK */
@@ -1417,9 +1416,9 @@ pop_down_menu (Lisp_Object arg)
1417 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1416 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1418 1417
1419 popup_activated_flag = 0; 1418 popup_activated_flag = 0;
1420 BLOCK_INPUT; 1419 block_input ();
1421 gtk_widget_destroy (GTK_WIDGET (p->pointer)); 1420 gtk_widget_destroy (GTK_WIDGET (p->pointer));
1422 UNBLOCK_INPUT; 1421 unblock_input ();
1423 return Qnil; 1422 return Qnil;
1424} 1423}
1425 1424
@@ -1527,9 +1526,9 @@ pop_down_menu (Lisp_Object arg)
1527 LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID) 1526 LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID)
1528 | XINT (XCDR (arg))); 1527 | XINT (XCDR (arg)));
1529 1528
1530 BLOCK_INPUT; 1529 block_input ();
1531 lw_destroy_all_widgets (id); 1530 lw_destroy_all_widgets (id);
1532 UNBLOCK_INPUT; 1531 unblock_input ();
1533 popup_activated_flag = 0; 1532 popup_activated_flag = 0;
1534 1533
1535 return Qnil; 1534 return Qnil;
@@ -1955,9 +1954,9 @@ dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
1955 if ((intptr_t) client_data != -1) 1954 if ((intptr_t) client_data != -1)
1956 menu_item_selection = (Lisp_Object *) client_data; 1955 menu_item_selection = (Lisp_Object *) client_data;
1957 1956
1958 BLOCK_INPUT; 1957 block_input ();
1959 lw_destroy_all_widgets (id); 1958 lw_destroy_all_widgets (id);
1960 UNBLOCK_INPUT; 1959 unblock_input ();
1961 popup_activated_flag = 0; 1960 popup_activated_flag = 0;
1962} 1961}
1963 1962
@@ -2251,7 +2250,7 @@ pop_down_menu (Lisp_Object arg)
2251 FRAME_PTR f = p1->pointer; 2250 FRAME_PTR f = p1->pointer;
2252 XMenu *menu = p2->pointer; 2251 XMenu *menu = p2->pointer;
2253 2252
2254 BLOCK_INPUT; 2253 block_input ();
2255#ifndef MSDOS 2254#ifndef MSDOS
2256 XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime); 2255 XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime);
2257 XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime); 2256 XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime);
@@ -2271,7 +2270,7 @@ pop_down_menu (Lisp_Object arg)
2271 2270
2272#endif /* HAVE_X_WINDOWS */ 2271#endif /* HAVE_X_WINDOWS */
2273 2272
2274 UNBLOCK_INPUT; 2273 unblock_input ();
2275 2274
2276 return Qnil; 2275 return Qnil;
2277} 2276}