all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: acm@muc.de, emacs-devel@gnu.org
Subject: Re: Semi-unhelpful error message given when trying to (provide	'CUA-mode)
Date: Wed, 24 May 2006 13:19:15 +0200	[thread overview]
Message-ID: <44744133.9060501@swipnet.se> (raw)
In-Reply-To: <E1FiixH-0006Vs-Ol@fencepost.gnu.org>

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

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.

[-- Attachment #2: emacs-F10.diff --]
[-- Type: text/plain, Size: 7134 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2006-05-24 11:19 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-20 13:15 Semi-unhelpful error message given when trying to (provide 'CUA-mode) Alan Mackenzie
2006-05-20 13:25 ` David Kastrup
2006-05-20 16:44   ` Alan Mackenzie
2006-05-20 18:32     ` David Kastrup
2006-05-20 19:18       ` Werner LEMBERG
2006-05-20 20:07         ` David Kastrup
2006-05-21  7:49           ` Jan Djärv
2006-05-21  9:54             ` David Kastrup
2006-05-21 17:43               ` Jan Djärv
2006-05-21 21:22                 ` David Kastrup
2006-05-21 22:51                   ` Lennart Borgman
2006-05-22  5:50                     ` Jan Djärv
2006-05-22  8:53                       ` Lennart Borgman
2006-05-22  9:47                         ` Jan Djärv
2006-05-22 10:21                           ` Lennart Borgman
2006-05-22 10:49                             ` David Kastrup
2006-05-22 11:26                             ` Kim F. Storm
2006-05-22 12:50                               ` Lennart Borgman
2006-05-22 13:02                                 ` David Kastrup
2006-05-22 13:32                                   ` Lennart Borgman
2006-05-22 13:34                                     ` David Kastrup
2006-05-22 13:44                                       ` Lennart Borgman
2006-05-22 13:51                                         ` David Kastrup
2006-05-22 13:58                                           ` Lennart Borgman
2006-05-22 14:57                                             ` David Kastrup
2006-05-22 22:04                                               ` Lennart Borgman
2006-05-23  8:19                                                 ` David Kastrup
2006-05-22 12:06                             ` martin rudalics
2006-05-22 12:47                               ` Lennart Borgman
2006-05-22 13:01                                 ` David Kastrup
2006-05-22 13:30                                   ` Lennart Borgman
2006-05-22 13:32                                     ` David Kastrup
2006-05-22 13:43                                       ` Lennart Borgman
2006-05-22 13:47                                         ` David Kastrup
2006-05-22 13:55                                           ` Lennart Borgman
2006-05-22 14:01                                             ` David Kastrup
2006-05-22 14:21                                               ` Lennart Borgman
2006-05-21 11:27             ` Stefan Monnier
2006-05-22  2:38             ` Richard Stallman
2006-05-22  3:32               ` Eli Zaretskii
2006-05-22  5:48               ` Jan Djärv
2006-05-22 20:37                 ` Richard Stallman
2006-05-23  6:27                   ` Jan Djärv
2006-05-23  8:22                     ` David Kastrup
2006-05-23 13:33                       ` Lennart Borgman
2006-05-23 13:45                         ` David Kastrup
2006-05-23 14:12                         ` Stefan Monnier
2006-05-23 14:32                           ` Lennart Borgman
2006-05-23 22:35                             ` Kim F. Storm
2006-05-24  2:18                         ` Richard Stallman
2006-05-23 11:54                     ` Kim F. Storm
2006-05-23 13:02                       ` Jan Djärv
2006-05-24  2:18                     ` Richard Stallman
2006-05-24 11:16                       ` Jan Djärv
2006-05-24 12:27                         ` Lennart Borgman
2006-05-24 12:59                           ` David Kastrup
2006-05-24 14:23                             ` Jan D.
2006-05-24 14:32                               ` David Kastrup
2006-05-24 14:48                                 ` Jason Rumney
2006-05-24 14:53                                   ` Lennart Borgman
2006-05-24 15:00                                   ` David Kastrup
2006-05-25  0:36                               ` Richard Stallman
2006-05-29  7:30                                 ` Jan Djärv
2006-05-29  7:49                                   ` David Kastrup
2006-05-29  8:16                                     ` Jan Djärv
2006-05-29  8:21                                       ` David Kastrup
2006-05-29  8:48                                         ` Jan Djärv
2006-05-29  9:06                                           ` David Kastrup
2006-06-01  7:48                                             ` Jan Djärv
2006-05-31 23:08                                   ` Menus (was: Semi-unhelpful error message etc.) Johan Bockgård
2006-05-31 23:14                                     ` Luc Teirlinck
2006-06-01  5:41                                       ` Menus Jan Djärv
2006-06-01  6:46                                         ` Menus Romain Francoise
2006-06-01  7:31                                           ` Menus David Kastrup
2006-06-01  7:30                                         ` Menus David Kastrup
2006-06-02  3:13                                         ` Menus Richard Stallman
2006-06-02  3:12                                     ` Menus (was: Semi-unhelpful error message etc.) Richard Stallman
2006-05-25  0:36                         ` Semi-unhelpful error message given when trying to (provide 'CUA-mode) Richard Stallman
2006-05-25 10:52                           ` Jason Rumney
2006-05-25 10:56                             ` David Kastrup
2006-05-25 13:29                               ` Jan Djärv
2006-05-26  2:22                                 ` Richard Stallman
2006-05-26  2:22                             ` Richard Stallman
2006-05-25 13:28                           ` Jan Djärv
2006-05-24  2:18                     ` Richard Stallman
2006-05-24 11:19                       ` Jan Djärv [this message]
2006-05-24 11:50                         ` Stefan Monnier
2006-05-24 16:36                           ` Jan Djärv
2006-05-24 17:14                             ` Stefan Monnier
2006-05-23  9:58             ` public
2006-05-23 11:03               ` Jan Djärv
2006-05-22  6:12     ` Miles Bader
2006-05-22  8:42       ` David Kastrup
2006-05-22 20:37         ` Richard Stallman
2006-05-23 11:48           ` Kim F. Storm
2006-05-24  2:18             ` Richard Stallman
2006-05-21  0:56   ` Richard Stallman
2006-05-20 21:38 ` Kim F. Storm
2006-05-20 22:57   ` Alan Mackenzie
2006-05-20 23:18     ` Kim F. Storm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44744133.9060501@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.