]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix menu bar activation with click for Motif/Lesstif.
authorJan D <jan.h.d@swipnet.se>
Wed, 14 Jul 2010 14:32:25 +0000 (16:32 +0200)
committerJan D <jan.h.d@swipnet.se>
Wed, 14 Jul 2010 14:32:25 +0000 (16:32 +0200)
* src/xdisp.c (pending_menu_activation): Remove extern declaration.
(prepare_menu_bars): Remove setting of pending_menu_activation.

* src/xmenu.c (pending_menu_activation): Remove.
(x_activate_menubar): Set popup_activated_flag for Xt also. Remove
setting of pending_menu_activation.
(set_frame_menubar): Remove check of pending_menu_activation.
Declare menubar_size before code.  Correct spelling in comment.

* src/xterm.c (xm_scroll_callback, x_process_timeouts): K&R => prototype.
(SET_SAVED_KEY_EVENT): Remove (not used).
(SET_SAVED_MENU_EVENT): Rename to SET_SAVED_BUTTON_EVENT and
remove size parameter.
(handle_one_xevent): Check popup_activated () for menu for Xt also.
Remove #ifdef USE_GTK around finish = X_EVENT_DROP.
Remove #ifdef USE_MOTIF code that did SET_SAVED_BUTTON_EVENT for
ButtonRelease.

src/ChangeLog
src/xdisp.c
src/xmenu.c
src/xterm.c

index 923ba3afafd2bf75b79986dbd612d7fb7265a17a..6ca09f99fe70a204fb59490cc37a96eb8ae141b8 100644 (file)
@@ -1,3 +1,23 @@
+2010-07-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * xterm.c (xm_scroll_callback, x_process_timeouts): K&R => prototype.
+       (SET_SAVED_KEY_EVENT): Remove (not used).
+       (SET_SAVED_MENU_EVENT): Rename to SET_SAVED_BUTTON_EVENT and
+       remove size parameter.
+       (handle_one_xevent): Check popup_activated () for menu for Xt also.
+       Remove #ifdef USE_GTK around finish = X_EVENT_DROP.
+       Remove #ifdef USE_MOTIF code that did SET_SAVED_BUTTON_EVENT for
+       ButtonRelease.
+
+       * xdisp.c (pending_menu_activation): Remove extern declaration.
+       (prepare_menu_bars): Remove setting of pending_menu_activation.
+
+       * xmenu.c (pending_menu_activation): Remove.
+       (x_activate_menubar): Set popup_activated_flag for Xt also. Remove
+       setting of pending_menu_activation.
+       (set_frame_menubar): Remove check of pending_menu_activation.
+       Declare menubar_size before code.  Correct spelling in comment.
+
 2010-07-14  Kenichi Handa  <handa@m17n.org>
 
        * font.c (font_open_entity): Cancel previous change.
index 3464efd643561fe5baeffe9120d6a44355d433e7..53fba8caa909b6ad7a9bf07cb3c021cc10db129f 100644 (file)
@@ -271,7 +271,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
     || defined(HAVE_NS) || defined (USE_GTK)
 extern void set_frame_menubar (struct frame *f, int, int);
-extern int pending_menu_activation;
 #endif
 
 extern int interrupt_input;
@@ -9866,12 +9865,6 @@ prepare_menu_bars (void)
       update_tool_bar (sf, 1);
 #endif
     }
-
-  /* Motif needs this.  See comment in xmenu.c.  Turn it off when
-     pending_menu_activation is not defined.  */
-#ifdef USE_X_TOOLKIT
-  pending_menu_activation = 0;
-#endif
 }
 
 
index b0bdbcfecaaad2d2c9cf5f6111a88dbe8249d419..4b99297e772348291699aa4c46486042b1decf73 100644 (file)
@@ -151,14 +151,6 @@ extern widget_value *xmalloc_widget_value (void);
 extern widget_value *digest_single_submenu (int, int, int);
 #endif
 
-/* This is set nonzero after the user activates the menu bar, and set
-   to zero again after the menu bars are redisplayed by prepare_menu_bar.
-   While it is nonzero, all calls to set_frame_menubar go deep.
-
-   I don't understand why this is needed, but it does seem to be
-   needed on Motif, according to Marcus Daniels <marcus@sysc.pdx.edu>.  */
-
-int pending_menu_activation;
 \f
 #ifdef USE_X_TOOLKIT
 
@@ -670,6 +662,7 @@ x_activate_menubar (FRAME_PTR f)
 
   set_frame_menubar (f, 0, 1);
   BLOCK_INPUT;
+  popup_activated_flag = 1;
 #ifdef USE_GTK
   /* If we click outside any menu item, the menu bar still grabs.
      So we send Press and the Release.  If outside, grab is released.
@@ -681,15 +674,10 @@ x_activate_menubar (FRAME_PTR f)
   f->output_data.x->saved_menu_event->type = ButtonPress;
   XPutBackEvent (f->output_data.x->display_info->display,
                  f->output_data.x->saved_menu_event);
-  popup_activated_flag = 1;
 #else
   XtDispatchEvent (f->output_data.x->saved_menu_event);
 #endif
   UNBLOCK_INPUT;
-#ifdef USE_MOTIF
-  if (f->output_data.x->saved_menu_event->type == ButtonRelease)
-    pending_menu_activation = 1;
-#endif
 
   /* Ignore this if we get it a second time.  */
   f->output_data.x->saved_menu_event->type = 0;
@@ -991,8 +979,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
 
   if (! menubar_widget)
     deep_p = 1;
-  else if (pending_menu_activation && !deep_p)
-    deep_p = 1;
   /* Make the first call for any given frame always go deep.  */
   else if (!f->output_data.x->saved_menu_event && !deep_p)
     {
@@ -1274,10 +1260,11 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
     }
 
   {
+    int menubar_size;
     if (f->output_data.x->menubar_widget)
       XtRealizeWidget (f->output_data.x->menubar_widget);
 
-    int menubar_size
+    menubar_size
       = (f->output_data.x->menubar_widget
         ? (f->output_data.x->menubar_widget->core.height
            + f->output_data.x->menubar_widget->core.border_width)
@@ -1286,7 +1273,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
 #if 1 /* Experimentally, we now get the right results
         for -geometry -0-0 without this.  24 Aug 96, rms.
          Maybe so, but the menu bar size is missing the pixels so the
-         WM size hints are off by theses pixel.  Jan D, oct 2009.  */
+         WM size hints are off by these pixels.  Jan D, oct 2009.  */
 #ifdef USE_LUCID
     if (FRAME_EXTERNAL_MENU_BAR (f))
       {
index 2f581d9f5907e6e99647a9d00d74f83fbb4eaea4..e66845df26caba1884c2e197429d1f35ea6218b7 100644 (file)
@@ -4159,9 +4159,7 @@ x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent)
    CALL_DATA is a pointer to a XmScrollBarCallbackStruct.  */
 
 static void
-xm_scroll_callback (widget, client_data, call_data)
-     Widget widget;
-     XtPointer client_data, call_data;
+xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
 {
   struct scroll_bar *bar = (struct scroll_bar *) client_data;
   XmScrollBarCallbackStruct *cs = (XmScrollBarCallbackStruct *) call_data;
@@ -5546,22 +5544,18 @@ struct x_display_info *XTread_socket_fake_io_error;
 
 static struct x_display_info *next_noop_dpyinfo;
 
-#define SET_SAVED_MENU_EVENT(size)                                     \
+#define SET_SAVED_BUTTON_EVENT                                          \
      do                                                                        \
        {                                                               \
         if (f->output_data.x->saved_menu_event == 0)                   \
            f->output_data.x->saved_menu_event                          \
             = (XEvent *) xmalloc (sizeof (XEvent));                    \
-         memcpy (f->output_data.x->saved_menu_event, &event, size);    \
+         *f->output_data.x->saved_menu_event = event;                   \
         inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;                        \
         XSETFRAME (inev.ie.frame_or_window, f);                        \
        }                                                               \
      while (0)
 
-#define SET_SAVED_BUTTON_EVENT SET_SAVED_MENU_EVENT (sizeof (XButtonEvent))
-#define SET_SAVED_KEY_EVENT    SET_SAVED_MENU_EVENT (sizeof (XKeyEvent))
-
-
 enum
 {
   X_EVENT_NORMAL,
@@ -6755,14 +6749,12 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
            Instead, save it away
            and we will pass it to Xt from kbd_buffer_get_event.
            That way, we can run some Lisp code first.  */
-        if (
+        if (! popup_activated ()
 #ifdef USE_GTK
-            ! popup_activated ()
             /* Gtk+ menus only react to the first three buttons. */
             && event.xbutton.button < 3
-            &&
 #endif
-            f && event.type == ButtonPress
+            && f && event.type == ButtonPress
             /* Verify the event is really within the menu bar
                and not just sent to it due to grabbing.  */
             && event.xbutton.x >= 0
@@ -6773,30 +6765,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
           {
             SET_SAVED_BUTTON_EVENT;
             XSETFRAME (last_mouse_press_frame, f);
-#ifdef USE_GTK
             *finish = X_EVENT_DROP;
-#endif
           }
         else if (event.type == ButtonPress)
           {
             last_mouse_press_frame = Qnil;
             goto OTHER;
           }
-
-#ifdef USE_MOTIF /* This should do not harm for Lucid,
-                   but I am trying to be cautious.  */
-        else if (event.type == ButtonRelease)
-          {
-            if (!NILP (last_mouse_press_frame))
-              {
-                f = XFRAME (last_mouse_press_frame);
-                if (f->output_data.x)
-                  SET_SAVED_BUTTON_EVENT;
-              }
-            else
-              goto OTHER;
-          }
-#endif /* USE_MOTIF */
         else
           goto OTHER;
 #endif /* USE_X_TOOLKIT || USE_GTK */
@@ -10336,8 +10311,7 @@ x_delete_display (struct x_display_info *dpyinfo)
    that slows us down.  */
 
 static void
-x_process_timeouts (timer)
-     struct atimer *timer;
+x_process_timeouts (struct atimer *timer)
 {
   BLOCK_INPUT;
   x_timeout_atimer_activated_flag = 0;