diff --git a/emacs-23.1-bnc558884.patch b/emacs-23.1-bnc558884.patch new file mode 100644 index 0000000..85097ca --- /dev/null +++ b/emacs-23.1-bnc558884.patch @@ -0,0 +1,181 @@ +From 3715ffe3e3b2c64d113bf26d94aab559f8559e83 Mon Sep 17 00:00:00 2001 +From: Jan Djärv +Date: Wed, 02 Sep 2009 17:03:20 +0000 +Subject: * xterm.h: Rename x_non_menubar_window_to_frame to + +x_menubar_window_to_frame + +* xterm.c: Remove declarations also in xterm.h +(XTmouse_position): Do not return valid positions +for clicks in the menubar and the toolbar for Gtk+. + +* xfns.c (x_any_window_to_frame): Assume less about Gtk+ internals, +if the widget for the event has the same top level as a frame, +return the frame. +(x_menubar_window_to_frame): Detect menu bar even with Gtk+ +internal windows, bug #4122. +(x_non_menubar_window_to_frame): Remove. +--- +diff --git a/src/xfns.c b/src/xfns.c +index ed068b1..49a9c50 100644 +--- src/xfns.c ++++ src/xfns.c +@@ -377,10 +377,7 @@ x_any_window_to_frame (dpyinfo, wdesc) + #ifdef USE_GTK + GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); + if (gwdesc != 0 +- && (gwdesc == x->widget +- || gwdesc == x->edit_widget +- || gwdesc == x->vbox_widget +- || gwdesc == x->menubar_widget)) ++ && gtk_widget_get_toplevel (gwdesc) == x->widget) + found = f; + #else + if (wdesc == XtWindow (x->widget) +@@ -401,54 +398,6 @@ x_any_window_to_frame (dpyinfo, wdesc) + return found; + } + +-/* Likewise, but exclude the menu bar widget. */ +- +-struct frame * +-x_non_menubar_window_to_frame (dpyinfo, wdesc) +- struct x_display_info *dpyinfo; +- int wdesc; +-{ +- Lisp_Object tail, frame; +- struct frame *f; +- struct x_output *x; +- +- if (wdesc == None) return 0; +- +- for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) +- { +- frame = XCAR (tail); +- if (!FRAMEP (frame)) +- continue; +- f = XFRAME (frame); +- if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo) +- continue; +- x = f->output_data.x; +- /* This frame matches if the window is any of its widgets. */ +- if (x->hourglass_window == wdesc) +- return f; +- else if (x->widget) +- { +-#ifdef USE_GTK +- GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); +- if (gwdesc != 0 +- && (gwdesc == x->widget +- || gwdesc == x->edit_widget +- || gwdesc == x->vbox_widget)) +- return f; +-#else +- if (wdesc == XtWindow (x->widget) +- || wdesc == XtWindow (x->column_widget) +- || wdesc == XtWindow (x->edit_widget)) +- return f; +-#endif +- } +- else if (FRAME_X_WINDOW (f) == wdesc) +- /* A tooltip frame. */ +- return f; +- } +- return 0; +-} +- + /* Likewise, but consider only the menu bar widget. */ + + struct frame * +@@ -476,15 +425,14 @@ x_menubar_window_to_frame (dpyinfo, wdesc) + if (x->menubar_widget) + { + GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc); +- int found = 0; + +- BLOCK_INPUT; ++ /* This gives false positives, but the rectangle check in xterm.c ++ where this is called takes care of that. */ + if (gwdesc != 0 + && (gwdesc == x->menubar_widget +- || gtk_widget_get_parent (gwdesc) == x->menubar_widget)) +- found = 1; +- UNBLOCK_INPUT; +- if (found) return f; ++ || gtk_widget_is_ancestor (x->menubar_widget, gwdesc) ++ || gtk_widget_is_ancestor (gwdesc, x->menubar_widget))) ++ return f; + } + #else + if (x->menubar_widget +diff --git a/src/xterm.c b/src/xterm.c +index e536d0d..1e13ae8 100644 +--- src/xterm.c ++++ src/xterm.c +@@ -109,8 +109,6 @@ extern void xlwmenu_redisplay P_ ((Widget)); + #if defined (USE_X_TOOLKIT) || defined (USE_GTK) + + extern void free_frame_menubar P_ ((struct frame *)); +-extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *, +- int)); + #endif + + #ifdef USE_X_TOOLKIT +@@ -143,11 +141,6 @@ extern void _XEditResCheckMessages (); + + #endif /* USE_X_TOOLKIT */ + +-#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) +-#define x_any_window_to_frame x_window_to_frame +-#define x_top_window_to_frame x_window_to_frame +-#endif +- + #ifdef USE_X_TOOLKIT + #include "widget.h" + #ifndef XtNinitialState +@@ -3908,7 +3901,14 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) + + if (child == None || child == win) + break; +- ++#ifdef USE_GTK ++ /* We don't wan't to know the innermost window. We ++ want the edit window. For non-Gtk+ the innermost ++ window is the edit window. For Gtk+ it might not ++ be. It might be the tool bar for example. */ ++ if (x_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win)) ++ break; ++#endif + win = child; + parent_x = win_x; + parent_y = win_y; +@@ -3925,8 +3925,14 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) + parent_{x,y} are invalid, but that's okay, because we'll + never use them in that case.) */ + ++#ifdef USE_GTK ++ /* We don't wan't to know the innermost window. We ++ want the edit window. */ ++ f1 = x_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win); ++#else + /* Is win one of our frames? */ + f1 = x_any_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win); ++#endif + + #ifdef USE_X_TOOLKIT + /* If we end up with the menu bar window, say it's not +diff --git a/src/xterm.h b/src/xterm.h +index 0ab19fd..5e83ef8 100644 +--- src/xterm.h ++++ src/xterm.h +@@ -378,7 +378,7 @@ extern struct frame *x_window_to_frame P_ ((struct x_display_info *, int)); + + #if defined (USE_X_TOOLKIT) || defined (USE_GTK) + extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int)); +-extern struct frame *x_non_menubar_window_to_frame P_ ((struct x_display_info *, int)); ++extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *, int)); + extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int)); + #endif + +-- +cgit v0.8.2.1 diff --git a/emacs.changes b/emacs.changes index 375d4cf..6f945f6 100644 --- a/emacs.changes +++ b/emacs.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Dec 1 15:18:04 CET 2009 - werner@suse.de + +- Fix a nasty bug were menus do not occure with GTK (bnc#558884) + ------------------------------------------------------------------- Thu Nov 26 14:54:17 CET 2009 - werner@suse.de diff --git a/emacs.spec b/emacs.spec index fb4bb18..637e2fd 100644 --- a/emacs.spec +++ b/emacs.spec @@ -24,7 +24,7 @@ Url: http://www.gnu.org/software/emacs/ License: GPLv2+ Group: Productivity/Editors/Emacs Version: 23.1 -Release: 4 +Release: 5 Obsoletes: ge_exec ge_site emac_nox emacmisc emacsbin emacsger emacs-url Mule-UCS emacs-calc erc Requires: emacs-info = %{version} Requires: emacs_program = %{version}-%{release} @@ -55,6 +55,7 @@ Patch13: emacs-23.1-s390x.dif Patch14: emacs-23.1-bnc556175.patch Patch15: emacs-22.2-iconic.patch Patch16: emacs-23.1-flyspell.patch +Patch17: emacs-23.1-bnc558884.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %global bug_345669 0 %{expand: %%global _exec_prefix %(type -p pkg-config &>/dev/null && pkg-config --variable prefix x11 || echo /usr/X11R6)} @@ -234,6 +235,7 @@ Authors: %patch14 -p0 -b .loop %patch15 -p0 -b .iconic %patch16 -p0 -b .flyspell +%patch17 -p0 -b .gtkmenus %patch if test ! -e $HOME/.mh_profile && type -p install-mh > /dev/null 2>&1; then install-mh -auto < /dev/null