From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: Semi-unhelpful error message given when trying to (provide 'CUA-mode) Date: Wed, 24 May 2006 13:19:15 +0200 Message-ID: <44744133.9060501@swipnet.se> References: <85fyj4bl8p.fsf@lola.goethe.zz> <20060520.211854.71848142.wl@gnu.org> <85lkswa29b.fsf@lola.goethe.zz> <44701B91.60606@swipnet.se> <44715093.4020906@swipnet.se> <4472AB5F.9090305@swipnet.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070803080609010909090003" X-Trace: sea.gmane.org 1148469606 9421 80.91.229.2 (24 May 2006 11:20:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 May 2006 11:20:06 +0000 (UTC) Cc: acm@muc.de, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 24 13:20:02 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FirP0-0002WB-HS for ged-emacs-devel@m.gmane.org; Wed, 24 May 2006 13:19:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FirOz-0006uR-Ne for ged-emacs-devel@m.gmane.org; Wed, 24 May 2006 07:19:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FirOk-0006tp-Rd for emacs-devel@gnu.org; Wed, 24 May 2006 07:19:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FirOk-0006tO-2h for emacs-devel@gnu.org; Wed, 24 May 2006 07:19:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FirOj-0006tL-Tp for emacs-devel@gnu.org; Wed, 24 May 2006 07:19:29 -0400 Original-Received: from [81.228.8.182] (helo=av10-2-sn2.hy.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FirTA-00046t-1W for emacs-devel@gnu.org; Wed, 24 May 2006 07:24:04 -0400 Original-Received: by av10-2-sn2.hy.skanova.net (Postfix, from userid 502) id B288B3829A; Wed, 24 May 2006 13:19:28 +0200 (CEST) Original-Received: from smtp4-2-sn2.hy.skanova.net (smtp4-2-sn2.hy.skanova.net [81.228.8.93]) by av10-2-sn2.hy.skanova.net (Postfix) with ESMTP id A234E37FAE; Wed, 24 May 2006 13:19:28 +0200 (CEST) Original-Received: from coolsville.localdomain (81-235-205-204-no59.tbcn.telia.com [81.235.205.204]) by smtp4-2-sn2.hy.skanova.net (Postfix) with ESMTP id 532E237E43; Wed, 24 May 2006 13:19:28 +0200 (CEST) User-Agent: Thunderbird 1.5.0.2 (Macintosh/20060308) Original-To: rms@gnu.org In-Reply-To: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:55190 Archived-At: This is a multi-part message in MIME format. --------------070803080609010909090003 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Richard Stallman skrev: > Could you show us your existing patch? Attached. BTW, this does not work for non-toolkit menus (i.e. oldXmenu). Jan D. --------------070803080609010909090003 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="emacs-F10.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="emacs-F10.diff" diff -w -c lwlib/xlwmenu.c.orig lwlib/xlwmenu.c Index: lwlib/xlwmenu.c *** lwlib/xlwmenu.c.orig 2006-05-22 10:10:07.000000000 +0200 --- lwlib/xlwmenu.c 2006-05-22 10:06:28.000000000 +0200 *************** *** 2088,2093 **** --- 2088,2094 ---- mw->menu.windows [0].y = ev->xmotion.y_root - ev->xmotion.y; /* handles the down like a move, slots are compatible */ + ev->xmotion.is_hint = 0; handle_motion_event (mw, &ev->xmotion); } } *************** *** 2503,2508 **** --- 2504,2510 ---- x_uncatch_errors (display, count); #endif + ((XMotionEvent*)event)->is_hint = 0; handle_motion_event (mw, (XMotionEvent*)event); } diff -w -c src/gtkutil.c.orig src/gtkutil.c Index: src/gtkutil.c *** src/gtkutil.c.orig 2006-03-06 17:51:14.000000000 +0100 --- src/gtkutil.c 2006-05-22 08:47:42.000000000 +0200 *************** *** 1970,1975 **** --- 1970,1999 ---- return w; } + /* Callback called when keyboard traversal (started by x-menu-bar-start) ends. + WMENU is the menu for which traversal has been done. DATA points to the + frame for WMENU. We must release grabs, some bad interaction between GTK + and Emacs makes the menus keep the grabs. */ + + static void + menu_nav_ended (wmenu, data) + GtkMenuShell *wmenu; + gpointer data; + { + FRAME_PTR f = (FRAME_PTR) data; + Display *dpy = FRAME_X_DISPLAY (f); + + BLOCK_INPUT; + GtkMenuShell *w = GTK_MENU_SHELL (FRAME_X_OUTPUT (f)->menubar_widget); + gtk_menu_shell_deactivate (w); + gtk_menu_shell_deselect (w); + + XUngrabKeyboard (dpy, CurrentTime); + XUngrabPointer (dpy, CurrentTime); + UNBLOCK_INPUT; + } + + static GtkWidget *create_menus P_ ((widget_value *, FRAME_PTR, GCallback, GCallback, GCallback, int, int, int, GtkWidget *, xg_menu_cb_data *, char *)); *************** *** 2024,2029 **** --- 2048,2059 ---- } else wmenu = gtk_menu_bar_new (); + /* Fix up grabs after keyboard traversal ends. */ + g_signal_connect (G_OBJECT (wmenu), + "selection-done", + G_CALLBACK (menu_nav_ended), + f); + /* Put cl_data on the top menu for easier access. */ cl_data = make_cl_data (cl_data, f, highlight_cb); g_object_set_data (G_OBJECT (wmenu), XG_FRAME_DATA, (gpointer)cl_data); diff -w -c src/xmenu.c.orig src/xmenu.c Index: src/xmenu.c *** src/xmenu.c.orig 2006-05-06 16:52:47.000000000 +0200 --- src/xmenu.c 2006-05-22 09:35:53.000000000 +0200 *************** *** 1301,1309 **** --- 1301,1417 ---- } } + DEFUN ("x-menu-bar-start", Fx_menu_bar_start, Sx_menu_bar_start, 0, 1, "i", + doc: /* Start key navigation of the menu bar in FRAME. + Usually the "File" menu is opened and you can then navigate with the + arrow keys, select a menu entry with the return key or cancel with the + escape key. If FRAME has no menu bar this function does nothing. + + If FRAME is nil or not given, use the selected frame. */) + (frame) + Lisp_Object frame; + { + XEvent ev; + FRAME_PTR f = check_x_frame (frame); + Widget menubar; + BLOCK_INPUT; + + if (FRAME_EXTERNAL_MENU_BAR (f)) + set_frame_menubar (f, 0, 1); + + menubar = FRAME_X_OUTPUT (f)->menubar_widget; + if (menubar) + { + Window child; + int error_p = 0; + + x_catch_errors (FRAME_X_DISPLAY (f)); + memset (&ev, 0, sizeof ev); + ev.xbutton.display = FRAME_X_DISPLAY (f); + ev.xbutton.window = XtWindow (menubar); + ev.xbutton.root = FRAME_X_DISPLAY_INFO (f)->root_window; + ev.xbutton.time = XtLastTimestampProcessed (FRAME_X_DISPLAY (f)); + ev.xbutton.button = Button1; + ev.xbutton.x = ev.xbutton.y = FRAME_MENUBAR_HEIGHT (f) / 2; + ev.xbutton.same_screen = True; + + #ifdef USE_MOTIF + { + Arg al[2]; + WidgetList list; + Cardinal nr; + XtSetArg (al[0], XtNchildren, &list); + XtSetArg (al[1], XtNnumChildren, &nr); + XtGetValues (menubar, al, 2); + ev.xbutton.window = XtWindow (list[0]); + } + #endif + + XTranslateCoordinates (FRAME_X_DISPLAY (f), + /* From-window, to-window. */ + ev.xbutton.window, ev.xbutton.root, + + /* From-position, to-position. */ + ev.xbutton.x, ev.xbutton.y, + &ev.xbutton.x_root, &ev.xbutton.y_root, + + /* Child of win. */ + &child); + error_p = x_had_errors_p (FRAME_X_DISPLAY (f)); + x_uncatch_errors (); + + if (! error_p) + { + ev.type = ButtonPress; + ev.xbutton.state = 0; + + XtDispatchEvent (&ev); + ev.xbutton.type = ButtonRelease; + ev.xbutton.state = Button1Mask; + XtDispatchEvent (&ev); + } + } + + UNBLOCK_INPUT; + } #endif /* USE_X_TOOLKIT */ + #ifdef USE_GTK + DEFUN ("x-menu-bar-start", Fx_menu_bar_start, Sx_menu_bar_start, 0, 1, "i", + doc: /* Start key navigation of the menu bar in FRAME. + Usually the "File" menu is opened and you can then navigate with the + arrow keys, select a menu entry with the return key or cancel with the + escape key. If FRAME has no menu bar this function does nothing. + + If FRAME is nil or not given, use the selected frame. */) + (frame) + Lisp_Object frame; + { + GtkWidget *menubar; + BLOCK_INPUT; + FRAME_PTR f = check_x_frame (frame); + + if (FRAME_EXTERNAL_MENU_BAR (f)) + set_frame_menubar (f, 0, 1); + + menubar = FRAME_X_OUTPUT (f)->menubar_widget; + if (menubar) + { + /* Activate the first menu. */ + GList *children = gtk_container_get_children (GTK_CONTAINER (menubar)); + + gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar), + GTK_WIDGET (children->data)); + + popup_activated_flag = 1; + g_list_free (children); + } + UNBLOCK_INPUT; + + return Qnil; + } + /* Loop util popup_activated_flag is set to zero in a callback. Used for popup menus and dialogs. */ *************** *** 3659,3664 **** --- 3767,3777 ---- #endif defsubr (&Sx_popup_menu); + + #if defined (USE_GTK) || defined (USE_X_TOOLKIT) + defsubr (&Sx_menu_bar_start); + #endif + #ifdef HAVE_MENUS defsubr (&Sx_popup_dialog); #endif diff -w -c lisp/term/x-win.el.orig lisp/term/x-win.el Index: lisp/term/x-win.el *** lisp/term/x-win.el.orig 2006-02-14 08:57:16.000000000 +0100 --- lisp/term/x-win.el 2006-05-22 08:42:00.000000000 +0200 *************** *** 2516,2520 **** --- 2516,2524 ---- (add-hook 'after-make-frame-functions 'x-dnd-init-frame) (global-set-key [drag-n-drop] 'x-dnd-handle-drag-n-drop-event) + ;; Let F10 do menu bar navigation. + (and (fboundp 'x-menu-bar-start) + (global-set-key [f10] 'x-menu-bar-start)) + ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 ;;; x-win.el ends here --------------070803080609010909090003 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --------------070803080609010909090003--