emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src ChangeLog xfns.c xterm.c xterm.h


From: Jan Djärv
Subject: [Emacs-diffs] emacs/src ChangeLog xfns.c xterm.c xterm.h
Date: Wed, 02 Sep 2009 17:03:24 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Jan Djärv <jhd> 09/09/02 17:03:23

Modified files:
        src            : ChangeLog xfns.c xterm.c xterm.h 

Log message:
        * 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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7726&r2=1.7727
http://cvs.savannah.gnu.org/viewcvs/emacs/src/xfns.c?cvsroot=emacs&r1=1.742&r2=1.743
http://cvs.savannah.gnu.org/viewcvs/emacs/src/xterm.c?cvsroot=emacs&r1=1.1040&r2=1.1041
http://cvs.savannah.gnu.org/viewcvs/emacs/src/xterm.h?cvsroot=emacs&r1=1.213&r2=1.214

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7726
retrieving revision 1.7727
diff -u -b -r1.7726 -r1.7727
--- ChangeLog   2 Sep 2009 03:11:15 -0000       1.7726
+++ ChangeLog   2 Sep 2009 17:03:20 -0000       1.7727
@@ -1,3 +1,19 @@
+2009-09-02  Jan Djärv  <address@hidden>
+
+       * 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.
+
 2009-09-02  Glenn Morris  <address@hidden>
 
        * buffer.c (default-major-mode): Move most of the doc from here...

Index: xfns.c
===================================================================
RCS file: /sources/emacs/emacs/src/xfns.c,v
retrieving revision 1.742
retrieving revision 1.743
diff -u -b -r1.742 -r1.743
--- xfns.c      10 Jul 2009 17:07:38 -0000      1.742
+++ xfns.c      2 Sep 2009 17:03:22 -0000       1.743
@@ -377,10 +377,7 @@
 #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 @@
   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 @@
       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

Index: xterm.c
===================================================================
RCS file: /sources/emacs/emacs/src/xterm.c,v
retrieving revision 1.1040
retrieving revision 1.1041
diff -u -b -r1.1040 -r1.1041
--- xterm.c     25 Aug 2009 03:05:50 -0000      1.1040
+++ xterm.c     2 Sep 2009 17:03:23 -0000       1.1041
@@ -109,8 +109,6 @@
 #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 @@
 
 #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 @@
 
                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 @@
               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

Index: xterm.h
===================================================================
RCS file: /sources/emacs/emacs/src/xterm.h,v
retrieving revision 1.213
retrieving revision 1.214
diff -u -b -r1.213 -r1.214
--- xterm.h     3 Jul 2009 11:07:13 -0000       1.213
+++ xterm.h     2 Sep 2009 17:03:23 -0000       1.214
@@ -378,7 +378,7 @@
 
 #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
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]