(calc-set-mode-line): Add square matrix option.
[bpt/emacs.git] / src / xfns.c
index 603a948..a0f6f3b 100644 (file)
@@ -1,6 +1,6 @@
 /* Functions for the X window system.
    Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-     2001, 2002, 2003, 2004, 2005  Free Software Foundation.
+                 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -16,11 +16,10 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
-#include <signal.h>
 #include <stdio.h>
 #include <math.h>
 
@@ -1516,11 +1515,12 @@ x_set_scroll_bar_background (f, value, oldval)
    Otherwise store 0 in *STRINGP, which means that the `encoding' of
    the result should be `COMPOUND_TEXT'.  */
 
-unsigned char *
-x_encode_text (string, coding_system, selectionp, text_bytes, stringp)
+static unsigned char *
+x_encode_text (string, coding_system, selectionp, text_bytes, stringp, freep)
      Lisp_Object string, coding_system;
      int *text_bytes, *stringp;
      int selectionp;
+     int *freep;
 {
   unsigned char *str = SDATA (string);
   int chars = SCHARS (string);
@@ -1537,6 +1537,7 @@ x_encode_text (string, coding_system, selectionp, text_bytes, stringp)
       /* No multibyte character in OBJ.  We need not encode it.  */
       *text_bytes = bytes;
       *stringp = 1;
+      *freep = 0;
       return str;
     }
 
@@ -1564,6 +1565,7 @@ x_encode_text (string, coding_system, selectionp, text_bytes, stringp)
   *stringp = (charset_info == 1
              || (!EQ (coding_system, Qcompound_text)
                  && !EQ (coding_system, Qcompound_text_with_extensions)));
+  *freep = 1;
   return buf;
 }
 
@@ -1602,16 +1604,13 @@ x_set_name_internal (f, name)
           in the future which can encode all Unicode characters.
           But, for the moment, there's no way to know that the
           current window manager supports it or not.  */
-       text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp);
+       text.value = x_encode_text (name, coding_system, 0, &bytes, &stringp,
+                                   &do_free_text_value);
        text.encoding = (stringp ? XA_STRING
                         : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
        text.format = 8;
        text.nitems = bytes;
 
-        /* Check early, because ENCODE_UTF_8 below may GC and name may be
-           relocated.  */
-        do_free_text_value = text.value != SDATA (name);
-
        if (NILP (f->icon_name))
          {
            icon = text;
@@ -1620,12 +1619,11 @@ x_set_name_internal (f, name)
          {
            /* See the above comment "Note: Encoding strategy".  */
            icon.value = x_encode_text (f->icon_name, coding_system, 0,
-                                       &bytes, &stringp);
+                                       &bytes, &stringp, &do_free_icon_value);
            icon.encoding = (stringp ? XA_STRING
                             : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
            icon.format = 8;
            icon.nitems = bytes;
-            do_free_icon_value = icon.value != SDATA (f->icon_name);
          }
 
 #ifdef USE_GTK
@@ -1988,7 +1986,7 @@ xic_create_fontsetname (base_fontname, motif)
         - the same but with the family also replaced with -*-*-.  */
       char *p = base_fontname;
       int i;
-      
+
       for (i = 0; *p; p++)
        if (*p == '-') i++;
       if (i != 14)
@@ -2012,7 +2010,7 @@ xic_create_fontsetname (base_fontname, motif)
          char *allcs = "*-*-*-*-*-*-*";
          char *allfamilies = "-*-*-";
          char *all = "*-*-*-*-";
-         
+
          for (i = 0, p = base_fontname; i < 8; p++)
            {
              if (*p == '-')
@@ -4384,6 +4382,10 @@ start_hourglass ()
   EMACS_TIME delay;
   int secs, usecs = 0;
 
+  /* Don't bother for ttys.  */
+  if (NILP (Vwindow_system))
+    return;
+
   cancel_hourglass ();
 
   if (INTEGERP (Vhourglass_delay)
@@ -4602,9 +4604,6 @@ x_create_tip_frame (dpyinfo, parms, text)
 
   check_x ();
 
-  /* Use this general default value to start with until we know if
-     this frame has a specified name.  */
-  Vx_resource_name = Vinvocation_name;
 
 #ifdef MULTI_KBOARD
   kb = dpyinfo->kboard;
@@ -4618,7 +4617,6 @@ x_create_tip_frame (dpyinfo, parms, text)
       && !EQ (name, Qunbound)
       && !NILP (name))
     error ("Invalid frame name--not a string or nil");
-  Vx_resource_name = name;
 
   frame = Qnil;
   GCPRO3 (parms, name, frame);
@@ -5087,7 +5085,7 @@ Text larger than the specified size is clipped.  */)
   clear_glyph_matrix (w->desired_matrix);
   clear_glyph_matrix (w->current_matrix);
   SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
-  try_window (FRAME_ROOT_WINDOW (f), pos);
+  try_window (FRAME_ROOT_WINDOW (f), pos, 0);
 
   /* Compute width and height of the tooltip.  */
   width = height = 0;