diff options
Diffstat (limited to 'src/xmenu.c')
| -rw-r--r-- | src/xmenu.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index cad892444ff..823c63bfc6f 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -373,12 +373,12 @@ x_menu_wait_for_event (void *data) | |||
| 373 | #elif defined USE_GTK | 373 | #elif defined USE_GTK |
| 374 | ! gtk_events_pending () | 374 | ! gtk_events_pending () |
| 375 | #else | 375 | #else |
| 376 | ! XPending ((Display*) data) | 376 | ! XPending (data) |
| 377 | #endif | 377 | #endif |
| 378 | ) | 378 | ) |
| 379 | { | 379 | { |
| 380 | EMACS_TIME next_time = timer_check (), *ntp; | 380 | struct timespec next_time = timer_check (), *ntp; |
| 381 | SELECT_TYPE read_fds; | 381 | fd_set read_fds; |
| 382 | struct x_display_info *dpyinfo; | 382 | struct x_display_info *dpyinfo; |
| 383 | int n = 0; | 383 | int n = 0; |
| 384 | 384 | ||
| @@ -391,7 +391,7 @@ x_menu_wait_for_event (void *data) | |||
| 391 | XFlush (dpyinfo->display); | 391 | XFlush (dpyinfo->display); |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | if (! EMACS_TIME_VALID_P (next_time)) | 394 | if (! timespec_valid_p (next_time)) |
| 395 | ntp = 0; | 395 | ntp = 0; |
| 396 | else | 396 | else |
| 397 | ntp = &next_time; | 397 | ntp = &next_time; |
| @@ -722,8 +722,7 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data) | |||
| 722 | xg_menu_item_cb_data *cb_data; | 722 | xg_menu_item_cb_data *cb_data; |
| 723 | Lisp_Object help; | 723 | Lisp_Object help; |
| 724 | 724 | ||
| 725 | cb_data = (xg_menu_item_cb_data*) g_object_get_data (G_OBJECT (widget), | 725 | cb_data = g_object_get_data (G_OBJECT (widget), XG_ITEM_DATA); |
| 726 | XG_ITEM_DATA); | ||
| 727 | if (! cb_data) return; | 726 | if (! cb_data) return; |
| 728 | 727 | ||
| 729 | help = call_data ? cb_data->help : Qnil; | 728 | help = call_data ? cb_data->help : Qnil; |
| @@ -741,15 +740,11 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data) | |||
| 741 | static void | 740 | static void |
| 742 | menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data) | 741 | menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data) |
| 743 | { | 742 | { |
| 744 | struct frame *f; | 743 | widget_value *wv = call_data; |
| 745 | Lisp_Object help; | 744 | Lisp_Object help = wv ? wv->help : Qnil; |
| 746 | |||
| 747 | widget_value *wv = (widget_value *) call_data; | ||
| 748 | |||
| 749 | help = wv ? wv->help : Qnil; | ||
| 750 | 745 | ||
| 751 | /* Determine the frame for the help event. */ | 746 | /* Determine the frame for the help event. */ |
| 752 | f = menubar_id_to_frame (id); | 747 | struct frame *f = menubar_id_to_frame (id); |
| 753 | 748 | ||
| 754 | show_help_event (f, widget, help); | 749 | show_help_event (f, widget, help); |
| 755 | } | 750 | } |
| @@ -769,7 +764,7 @@ static int xg_crazy_callback_abort; | |||
| 769 | static void | 764 | static void |
| 770 | menubar_selection_callback (GtkWidget *widget, gpointer client_data) | 765 | menubar_selection_callback (GtkWidget *widget, gpointer client_data) |
| 771 | { | 766 | { |
| 772 | xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data*) client_data; | 767 | xg_menu_item_cb_data *cb_data = client_data; |
| 773 | 768 | ||
| 774 | if (xg_crazy_callback_abort) | 769 | if (xg_crazy_callback_abort) |
| 775 | return; | 770 | return; |
| @@ -1370,7 +1365,7 @@ struct next_popup_x_y | |||
| 1370 | static void | 1365 | static void |
| 1371 | menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) | 1366 | menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) |
| 1372 | { | 1367 | { |
| 1373 | struct next_popup_x_y* data = (struct next_popup_x_y*)user_data; | 1368 | struct next_popup_x_y *data = user_data; |
| 1374 | GtkRequisition req; | 1369 | GtkRequisition req; |
| 1375 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (data->f); | 1370 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (data->f); |
| 1376 | int disp_width = x_display_pixel_width (dpyinfo); | 1371 | int disp_width = x_display_pixel_width (dpyinfo); |
| @@ -1391,10 +1386,10 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer | |||
| 1391 | static void | 1386 | static void |
| 1392 | popup_selection_callback (GtkWidget *widget, gpointer client_data) | 1387 | popup_selection_callback (GtkWidget *widget, gpointer client_data) |
| 1393 | { | 1388 | { |
| 1394 | xg_menu_item_cb_data *cb_data = (xg_menu_item_cb_data*) client_data; | 1389 | xg_menu_item_cb_data *cb_data = client_data; |
| 1395 | 1390 | ||
| 1396 | if (xg_crazy_callback_abort) return; | 1391 | if (xg_crazy_callback_abort) return; |
| 1397 | if (cb_data) menu_item_selection = (Lisp_Object *) cb_data->call_data; | 1392 | if (cb_data) menu_item_selection = cb_data->call_data; |
| 1398 | } | 1393 | } |
| 1399 | 1394 | ||
| 1400 | static void | 1395 | static void |
| @@ -1497,7 +1492,7 @@ LWLIB_ID widget_id_tick; | |||
| 1497 | static void | 1492 | static void |
| 1498 | popup_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) | 1493 | popup_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) |
| 1499 | { | 1494 | { |
| 1500 | menu_item_selection = (Lisp_Object *) client_data; | 1495 | menu_item_selection = client_data; |
| 1501 | } | 1496 | } |
| 1502 | 1497 | ||
| 1503 | /* ARG is the LWLIB ID of the dialog box, represented | 1498 | /* ARG is the LWLIB ID of the dialog box, represented |
| @@ -1583,7 +1578,7 @@ create_and_show_popup_menu (struct frame *f, widget_value *first_wv, | |||
| 1583 | make_number (menu_id & ~(-1 << (fact))))); | 1578 | make_number (menu_id & ~(-1 << (fact))))); |
| 1584 | 1579 | ||
| 1585 | /* Process events that apply to the menu. */ | 1580 | /* Process events that apply to the menu. */ |
| 1586 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1); | 1581 | popup_get_selection (0, FRAME_X_DISPLAY_INFO (f), menu_id, 1); |
| 1587 | 1582 | ||
| 1588 | unbind_to (specpdl_count, Qnil); | 1583 | unbind_to (specpdl_count, Qnil); |
| 1589 | } | 1584 | } |
| @@ -1882,7 +1877,7 @@ dialog_selection_callback (GtkWidget *widget, gpointer client_data) | |||
| 1882 | /* Treat the pointer as an integer. There's no problem | 1877 | /* Treat the pointer as an integer. There's no problem |
| 1883 | as long as pointers have enough bits to hold small integers. */ | 1878 | as long as pointers have enough bits to hold small integers. */ |
| 1884 | if ((intptr_t) client_data != -1) | 1879 | if ((intptr_t) client_data != -1) |
| 1885 | menu_item_selection = (Lisp_Object *) client_data; | 1880 | menu_item_selection = client_data; |
| 1886 | 1881 | ||
| 1887 | popup_activated_flag = 0; | 1882 | popup_activated_flag = 0; |
| 1888 | } | 1883 | } |
| @@ -1924,7 +1919,7 @@ dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) | |||
| 1924 | /* Treat the pointer as an integer. There's no problem | 1919 | /* Treat the pointer as an integer. There's no problem |
| 1925 | as long as pointers have enough bits to hold small integers. */ | 1920 | as long as pointers have enough bits to hold small integers. */ |
| 1926 | if ((intptr_t) client_data != -1) | 1921 | if ((intptr_t) client_data != -1) |
| 1927 | menu_item_selection = (Lisp_Object *) client_data; | 1922 | menu_item_selection = client_data; |
| 1928 | 1923 | ||
| 1929 | block_input (); | 1924 | block_input (); |
| 1930 | lw_destroy_all_widgets (id); | 1925 | lw_destroy_all_widgets (id); |
| @@ -1967,8 +1962,7 @@ create_and_show_dialog (struct frame *f, widget_value *first_wv) | |||
| 1967 | Fcons (make_number (dialog_id >> (fact)), | 1962 | Fcons (make_number (dialog_id >> (fact)), |
| 1968 | make_number (dialog_id & ~(-1 << (fact))))); | 1963 | make_number (dialog_id & ~(-1 << (fact))))); |
| 1969 | 1964 | ||
| 1970 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), | 1965 | popup_get_selection (0, FRAME_X_DISPLAY_INFO (f), dialog_id, 1); |
| 1971 | dialog_id, 1); | ||
| 1972 | 1966 | ||
| 1973 | unbind_to (count, Qnil); | 1967 | unbind_to (count, Qnil); |
| 1974 | } | 1968 | } |