diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 22 | ||||
| -rw-r--r-- | src/gtkutil.c | 32 | ||||
| -rw-r--r-- | src/gtkutil.h | 2 | ||||
| -rw-r--r-- | src/w32fns.c | 5 | ||||
| -rw-r--r-- | src/xfns.c | 19 | ||||
| -rw-r--r-- | src/xmenu.c | 8 | ||||
| -rw-r--r-- | src/xterm.c | 2 | ||||
| -rw-r--r-- | src/xterm.h | 5 |
8 files changed, 70 insertions, 25 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 04e74667bc3..02c2969242f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2010-07-14 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xterm.h (x_menubar_window_to_frame): Second parameter is XEvent*. | ||
| 4 | |||
| 5 | * xterm.c (handle_one_xevent): Pass event to x_menubar_window_to_frame. | ||
| 6 | |||
| 7 | * xmenu.c (x_activate_menubar): Revert previous fix for Bug#6499, | ||
| 8 | i.e. don't put back ButtonRelease (Bug#6608). | ||
| 9 | |||
| 10 | * xfns.c (x_menubar_window_to_frame): Take XEvent as second parameter | ||
| 11 | instead of Window. Call xg_event_is_for_menubar when | ||
| 12 | USE_GTK (Bug#6499). | ||
| 13 | |||
| 14 | * gtkutil.h (xg_event_is_for_menubar): Declare. | ||
| 15 | |||
| 16 | * gtkutil.c (xg_event_is_for_menubar): New function (Bug#6499). | ||
| 17 | |||
| 18 | 2010-07-14 Eli Zaretskii <eliz@gnu.org> | ||
| 19 | |||
| 20 | * w32fns.c (x_set_foreground_color): Fix setting the cursor color | ||
| 21 | when it's the same as the old foreground. (Bug#6609) | ||
| 22 | |||
| 1 | 2010-07-16 Jan Djärv <jan.h.d@swipnet.se> | 23 | 2010-07-16 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 24 | ||
| 3 | * xmenu.c (free_frame_menubar): Only call x_set_window_size if | 25 | * xmenu.c (free_frame_menubar): Only call x_set_window_size if |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 396d9018e36..8676aa6200c 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -2856,6 +2856,38 @@ free_frame_menubar (FRAME_PTR f) | |||
| 2856 | } | 2856 | } |
| 2857 | } | 2857 | } |
| 2858 | 2858 | ||
| 2859 | int | ||
| 2860 | xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) | ||
| 2861 | { | ||
| 2862 | struct x_output *x = f->output_data.x; | ||
| 2863 | |||
| 2864 | if (! x->menubar_widget) return 0; | ||
| 2865 | |||
| 2866 | if (! (event->xbutton.x >= 0 | ||
| 2867 | && event->xbutton.x < FRAME_PIXEL_WIDTH (f) | ||
| 2868 | && event->xbutton.y >= 0 | ||
| 2869 | && event->xbutton.y < f->output_data.x->menubar_height | ||
| 2870 | && event->xbutton.same_screen)) | ||
| 2871 | return 0; | ||
| 2872 | |||
| 2873 | GList *list = gtk_container_get_children (GTK_CONTAINER (x->menubar_widget)); | ||
| 2874 | if (! list) return 0; | ||
| 2875 | GList *iter; | ||
| 2876 | GdkRectangle rec; | ||
| 2877 | rec.x = event->xbutton.x; | ||
| 2878 | rec.y = event->xbutton.y; | ||
| 2879 | rec.width = 1; | ||
| 2880 | rec.height = 1; | ||
| 2881 | for (iter = list ; iter; iter = g_list_next (iter)) | ||
| 2882 | { | ||
| 2883 | GtkWidget *w = GTK_WIDGET (iter->data); | ||
| 2884 | if (GTK_WIDGET_MAPPED (w) && gtk_widget_intersect (w, &rec, NULL)) | ||
| 2885 | break; | ||
| 2886 | } | ||
| 2887 | g_list_free (list); | ||
| 2888 | return iter == 0 ? 0 : 1; | ||
| 2889 | } | ||
| 2890 | |||
| 2859 | 2891 | ||
| 2860 | 2892 | ||
| 2861 | /*********************************************************************** | 2893 | /*********************************************************************** |
diff --git a/src/gtkutil.h b/src/gtkutil.h index fcd23b65132..14693650de5 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h | |||
| @@ -153,6 +153,8 @@ extern void xg_modify_menubar_widgets (GtkWidget *menubar, | |||
| 153 | 153 | ||
| 154 | extern int xg_update_frame_menubar (FRAME_PTR f); | 154 | extern int xg_update_frame_menubar (FRAME_PTR f); |
| 155 | 155 | ||
| 156 | extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event); | ||
| 157 | |||
| 156 | extern int xg_have_tear_offs (void); | 158 | extern int xg_have_tear_offs (void); |
| 157 | 159 | ||
| 158 | extern int xg_get_scroll_id_for_window (Display *dpy, Window wid); | 160 | extern int xg_get_scroll_id_for_window (Display *dpy, Window wid); |
diff --git a/src/w32fns.c b/src/w32fns.c index c1791f2bf3e..57786d76795 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1333,7 +1333,10 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 1333 | if (FRAME_W32_WINDOW (f) != 0) | 1333 | if (FRAME_W32_WINDOW (f) != 0) |
| 1334 | { | 1334 | { |
| 1335 | if (x->cursor_pixel == old_fg) | 1335 | if (x->cursor_pixel == old_fg) |
| 1336 | x->cursor_pixel = fg; | 1336 | { |
| 1337 | x->cursor_pixel = fg; | ||
| 1338 | x->cursor_gc->background = fg; | ||
| 1339 | } | ||
| 1337 | 1340 | ||
| 1338 | update_face_from_frame_parameter (f, Qforeground_color, arg); | 1341 | update_face_from_frame_parameter (f, Qforeground_color, arg); |
| 1339 | if (FRAME_VISIBLE_P (f)) | 1342 | if (FRAME_VISIBLE_P (f)) |
diff --git a/src/xfns.c b/src/xfns.c index c2135781811..ee020371683 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -398,8 +398,9 @@ x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc) | |||
| 398 | /* Likewise, but consider only the menu bar widget. */ | 398 | /* Likewise, but consider only the menu bar widget. */ |
| 399 | 399 | ||
| 400 | struct frame * | 400 | struct frame * |
| 401 | x_menubar_window_to_frame (struct x_display_info *dpyinfo, int wdesc) | 401 | x_menubar_window_to_frame (struct x_display_info *dpyinfo, XEvent *event) |
| 402 | { | 402 | { |
| 403 | Window wdesc = event->xany.window; | ||
| 403 | Lisp_Object tail, frame; | 404 | Lisp_Object tail, frame; |
| 404 | struct frame *f; | 405 | struct frame *f; |
| 405 | struct x_output *x; | 406 | struct x_output *x; |
| @@ -415,21 +416,11 @@ x_menubar_window_to_frame (struct x_display_info *dpyinfo, int wdesc) | |||
| 415 | if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) | 416 | if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) |
| 416 | continue; | 417 | continue; |
| 417 | x = f->output_data.x; | 418 | x = f->output_data.x; |
| 418 | /* Match if the window is this frame's menubar. */ | ||
| 419 | #ifdef USE_GTK | 419 | #ifdef USE_GTK |
| 420 | if (x->menubar_widget) | 420 | if (x->menubar_widget && xg_event_is_for_menubar (f, event)) |
| 421 | { | 421 | return f; |
| 422 | GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); | ||
| 423 | |||
| 424 | /* This gives false positives, but the rectangle check in xterm.c | ||
| 425 | where this is called takes care of that. */ | ||
| 426 | if (gwdesc != 0 | ||
| 427 | && (gwdesc == x->menubar_widget | ||
| 428 | || gtk_widget_is_ancestor (x->menubar_widget, gwdesc) | ||
| 429 | || gtk_widget_is_ancestor (gwdesc, x->menubar_widget))) | ||
| 430 | return f; | ||
| 431 | } | ||
| 432 | #else | 422 | #else |
| 423 | /* Match if the window is this frame's menubar. */ | ||
| 433 | if (x->menubar_widget | 424 | if (x->menubar_widget |
| 434 | && lw_window_is_in_menubar (wdesc, x->menubar_widget)) | 425 | && lw_window_is_in_menubar (wdesc, x->menubar_widget)) |
| 435 | return f; | 426 | return f; |
diff --git a/src/xmenu.c b/src/xmenu.c index 82b315f83cb..2fb39339b98 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -664,14 +664,6 @@ x_activate_menubar (FRAME_PTR f) | |||
| 664 | BLOCK_INPUT; | 664 | BLOCK_INPUT; |
| 665 | popup_activated_flag = 1; | 665 | popup_activated_flag = 1; |
| 666 | #ifdef USE_GTK | 666 | #ifdef USE_GTK |
| 667 | /* If we click outside any menu item, the menu bar still grabs. | ||
| 668 | So we send Press and the Release. If outside, grab is released. | ||
| 669 | If on a menu item, it is popped up normally. | ||
| 670 | PutBack is like a stack, so we put back in reverse order. */ | ||
| 671 | f->output_data.x->saved_menu_event->type = ButtonRelease; | ||
| 672 | XPutBackEvent (f->output_data.x->display_info->display, | ||
| 673 | f->output_data.x->saved_menu_event); | ||
| 674 | f->output_data.x->saved_menu_event->type = ButtonPress; | ||
| 675 | XPutBackEvent (f->output_data.x->display_info->display, | 667 | XPutBackEvent (f->output_data.x->display_info->display, |
| 676 | f->output_data.x->saved_menu_event); | 668 | f->output_data.x->saved_menu_event); |
| 677 | #else | 669 | #else |
diff --git a/src/xterm.c b/src/xterm.c index 0f6d432f979..ddc7a167684 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6743,7 +6743,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, | |||
| 6743 | f->mouse_moved = 0; | 6743 | f->mouse_moved = 0; |
| 6744 | 6744 | ||
| 6745 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 6745 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 6746 | f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window); | 6746 | f = x_menubar_window_to_frame (dpyinfo, &event); |
| 6747 | /* For a down-event in the menu bar, | 6747 | /* For a down-event in the menu bar, |
| 6748 | don't pass it to Xt right now. | 6748 | don't pass it to Xt right now. |
| 6749 | Instead, save it away | 6749 | Instead, save it away |
diff --git a/src/xterm.h b/src/xterm.h index b22c225fed7..5c1213d2bf1 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -381,12 +381,15 @@ extern int use_xim; | |||
| 381 | #endif | 381 | #endif |
| 382 | 382 | ||
| 383 | /* This checks to make sure we have a display. */ | 383 | /* This checks to make sure we have a display. */ |
| 384 | |||
| 384 | extern void check_x (void); | 385 | extern void check_x (void); |
| 385 | 386 | ||
| 386 | extern struct frame *x_window_to_frame (struct x_display_info *, int); | 387 | extern struct frame *x_window_to_frame (struct x_display_info *, int); |
| 387 | 388 | ||
| 388 | extern struct frame *x_any_window_to_frame (struct x_display_info *, int); | 389 | extern struct frame *x_any_window_to_frame (struct x_display_info *, int); |
| 389 | extern struct frame *x_menubar_window_to_frame (struct x_display_info *, int); | 390 | extern struct frame *x_menubar_window_to_frame (struct x_display_info *, |
| 391 | XEvent *); | ||
| 392 | |||
| 390 | extern struct frame *x_top_window_to_frame (struct x_display_info *, int); | 393 | extern struct frame *x_top_window_to_frame (struct x_display_info *, int); |
| 391 | 394 | ||
| 392 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) | 395 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) |