emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/macfns.c


From: Steven Tamm
Subject: [Emacs-diffs] Changes to emacs/src/macfns.c
Date: Mon, 27 Dec 2004 12:42:34 -0500

Index: emacs/src/macfns.c
diff -c emacs/src/macfns.c:1.44 emacs/src/macfns.c:1.45
*** emacs/src/macfns.c:1.44     Fri Dec  3 17:00:11 2004
--- emacs/src/macfns.c  Mon Dec 27 17:27:30 2004
***************
*** 158,166 ****
  
  extern Lisp_Object Vwindow_system_version;
  
! extern int mac_initialized;
! 
! 
  /* compare two strings ignoring case */
  
  static int
--- 158,164 ----
  
  extern Lisp_Object Vwindow_system_version;
  
! #if 0 /* Use xstricmp instead. */
  /* compare two strings ignoring case */
  
  static int
***************
*** 171,183 ****
        return 0;
    return tolower (*s) - tolower (*t);
  }
  
  /* compare two strings up to n characters, ignoring case */
  
  static int
  strnicmp (const char *s, const char *t, unsigned int n)
  {
!   for ( ; n-- > 0 && tolower (*s) == tolower (*t); s++, t++)
      if (*s == '\0')
        return 0;
    return n == 0 ? 0 : tolower (*s) - tolower (*t);
--- 169,182 ----
        return 0;
    return tolower (*s) - tolower (*t);
  }
+ #endif
  
  /* compare two strings up to n characters, ignoring case */
  
  static int
  strnicmp (const char *s, const char *t, unsigned int n)
  {
!   for ( ; n > 0 && tolower (*s) == tolower (*t); n--, s++, t++)
      if (*s == '\0')
        return 0;
    return n == 0 ? 0 : tolower (*s) - tolower (*t);
***************
*** 190,196 ****
  check_mac ()
  {
    if (! mac_in_use)
!     error ("Mac OS not in use or not initialized");
  }
  
  /* Nonzero if we can use mouse menus.
--- 189,195 ----
  check_mac ()
  {
    if (! mac_in_use)
!     error ("Mac native windows not in use or not initialized");
  }
  
  /* Nonzero if we can use mouse menus.
***************
*** 228,260 ****
  check_x_display_info (frame)
       Lisp_Object frame;
  {
!   if (!mac_initialized)
!     {
!       mac_initialize ();
!       mac_initialized = 1;
!     }
  
    if (NILP (frame))
      {
        struct frame *sf = XFRAME (selected_frame);
  
        if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf))
!       return FRAME_MAC_DISPLAY_INFO (sf);
        else
!       return &one_mac_display_info;
      }
    else if (STRINGP (frame))
!     return x_display_info_for_name (frame);
    else
      {
!       FRAME_PTR f;
! 
!       CHECK_LIVE_FRAME (frame);
!       f = XFRAME (frame);
!       if (! FRAME_MAC_P (f))
!       error ("non-mac frame used");
!       return FRAME_MAC_DISPLAY_INFO (f);
      }
  }
  
  /* Return the Emacs frame-object corresponding to a mac window.
--- 227,254 ----
  check_x_display_info (frame)
       Lisp_Object frame;
  {
!   struct mac_display_info *dpyinfo = NULL;
  
    if (NILP (frame))
      {
        struct frame *sf = XFRAME (selected_frame);
  
        if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf))
!       dpyinfo = FRAME_MAC_DISPLAY_INFO (sf);
!       else if (x_display_list != 0)
!       dpyinfo = x_display_list;
        else
!       error ("Mac native windows are not in use or not initialized");
      }
    else if (STRINGP (frame))
!     dpyinfo = x_display_info_for_name (frame);
    else
      {
!       FRAME_PTR f = check_x_frame (frame);
!       dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
      }
+ 
+   return dpyinfo;
  }
  
  /* Return the Emacs frame-object corresponding to a mac window.
***************
*** 1109,1115 ****
    BLOCK_INPUT;
  
    for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++)
!     if (stricmp (colorname, mac_color_map[i].name) == 0)
        {
          ret = make_number (mac_color_map[i].color);
          break;
--- 1103,1109 ----
    BLOCK_INPUT;
  
    for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++)
!     if (xstricmp (colorname, mac_color_map[i].name) == 0)
        {
          ret = make_number (mac_color_map[i].color);
          break;
***************
*** 2059,2071 ****
  
  /* Subroutines of creating a frame.  */
  
  char *
  x_get_string_resource (rdb, name, class)
       XrmDatabase rdb;
       char *name, *class;
  {
!   /* MAC_TODO: implement resource strings */
    return (char *)0;
  }
  
  /* Return the value of parameter PARAM.
--- 2053,2101 ----
  
  /* Subroutines of creating a frame.  */
  
+ static char *
+ mac_get_rdb_resource (rdb, resource)
+      char *rdb;
+      char *resource;
+ {
+   char *value = rdb;
+   int len = strlen (resource);
+ 
+   while (*value)
+     {
+       if ((strncmp (value, resource, len) == 0) && (value[len] == ':'))
+         return xstrdup (&value[len + 1]);
+ 
+       value = strchr (value, '\0') + 1;
+     }
+ 
+   return NULL;
+ }
+ 
+ /* Retrieve the string resource specified by NAME with CLASS from
+    database RDB. */
+ 
  char *
  x_get_string_resource (rdb, name, class)
       XrmDatabase rdb;
       char *name, *class;
  {
!   if (rdb)
!     {
!       char *resource;
! 
!       if (resource = mac_get_rdb_resource (rdb, name))
!         return resource;
!       if (resource = mac_get_rdb_resource (rdb, class))
!         return resource;
!     }
! 
!   /* MAC_TODO: implement resource strings.  (Maybe Property Lists?)  */
! #if 0
!   return mac_get_string_resource (name, class);
! #else
    return (char *)0;
+ #endif
  }
  
  /* Return the value of parameter PARAM.
***************
*** 2229,2264 ****
  }
  
  
- #if 0 /* MAC_TODO */
  /* Create and set up the Mac window for frame F.  */
  
  static void
! mac_window (f, window_prompting, minibuffer_only)
       struct frame *f;
-      long window_prompting;
-      int minibuffer_only;
  {
    Rect r;
  
    BLOCK_INPUT;
  
-   /* Use the resource name as the top-level window name
-      for looking up resources.  Make a non-Lisp copy
-      for the window manager, so GC relocation won't bother it.
- 
-      Elsewhere we specify the window name for the window manager.  */
- 
-   {
-     char *str = (char *) SDATA (Vx_resource_name);
-     f->namebuf = (char *) xmalloc (strlen (str) + 1);
-     strcpy (f->namebuf, str);
-   }
- 
    SetRect (&r, f->left_pos, f->top_pos,
             f->left_pos + FRAME_PIXEL_WIDTH (f),
             f->top_pos + FRAME_PIXEL_HEIGHT (f));
    FRAME_MAC_WINDOW (f)
!     = NewCWindow (NULL, &r, "\p", 1, zoomDocProc, (WindowPtr) -1, 1, (long) 
f->output_data.mac);
  
    validate_x_resource_name ();
  
--- 2259,2296 ----
  }
  
  
  /* Create and set up the Mac window for frame F.  */
  
+ extern install_window_handler (WindowPtr);
+ 
  static void
! mac_window (f)
       struct frame *f;
  {
    Rect r;
  
    BLOCK_INPUT;
  
    SetRect (&r, f->left_pos, f->top_pos,
             f->left_pos + FRAME_PIXEL_WIDTH (f),
             f->top_pos + FRAME_PIXEL_HEIGHT (f));
+ #if TARGET_API_MAC_CARBON
+   CreateNewWindow (kDocumentWindowClass,
+                  kWindowStandardDocumentAttributes
+                  /* | kWindowToolbarButtonAttribute */,
+                  &r, &FRAME_MAC_WINDOW (f));
+   if (FRAME_MAC_WINDOW (f))
+     {
+       SetWRefCon (FRAME_MAC_WINDOW (f), (long) f->output_data.mac);
+       install_window_handler (FRAME_MAC_WINDOW (f));
+     }
+ #else
    FRAME_MAC_WINDOW (f)
!     = NewCWindow (NULL, &r, "\p", false, zoomDocProc,
!                 (WindowPtr) -1, 1, (long) f->output_data.mac);
! #endif
!   /* so that update events can find this mac_output struct */
!   f->output_data.mac->mFP = f;  /* point back to emacs frame */
  
    validate_x_resource_name ();
  
***************
*** 2276,2292 ****
      x_set_name (f, name, explicit);
    }
  
-   ShowWindow (FRAME_MAC_WINDOW (f));
- 
    UNBLOCK_INPUT;
  
-   if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
-     initialize_frame_menubar (f);
- 
    if (FRAME_MAC_WINDOW (f) == 0)
      error ("Unable to create window");
  }
- #endif /* MAC_TODO */
  
  /* Handle the icon stuff for this window.  Perhaps later we might
     want an x_set_icon_position which can be called interactively as
--- 2308,2318 ----
***************
*** 2703,2708 ****
--- 2729,2736 ----
                       "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
    x_default_parameter (f, parms, Qtitle, Qnil,
                       "title", "Title", RES_TYPE_STRING);
+   x_default_parameter (f, parms, Qfullscreen, Qnil,
+                        "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
  
    f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
  
***************
*** 2728,2735 ****
    tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
    f->no_split = minibuffer_only || EQ (tem, Qt);
  
!   /* mac_window (f, window_prompting, minibuffer_only); */
!   make_mac_frame (f);
  
    x_icon (f, parms);
    x_make_gc (f);
--- 2756,2762 ----
    tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
    f->no_split = minibuffer_only || EQ (tem, Qt);
  
!   mac_window (f);
  
    x_icon (f, parms);
    x_make_gc (f);
***************
*** 2763,2776 ****
    FRAME_LINES (f) = 0;
    change_frame_size (f, height, width, 1, 0, 0);
  
- #if 0 /* MAC_TODO: when we have window manager hints */
    /* Tell the server what size and position, etc, we want, and how
       badly we want them.  This should be done after we have the menu
       bar so that its size can be taken into account.  */
    BLOCK_INPUT;
    x_wm_set_size_hint (f, window_prompting, 0);
    UNBLOCK_INPUT;
- #endif
  
    /* Make the window appear on the frame and enable display, unless
       the caller says not to.  However, with explicit parent, Emacs
--- 2790,2801 ----
***************
*** 3144,3149 ****
--- 3169,3177 ----
  
    CHECK_STRING (name);
  
+   if (! EQ (Vwindow_system, intern ("mac")))
+     error ("Not using Mac native windows");
+ 
    for (dpyinfo = &one_mac_display_info, names = x_display_name_list;
         dpyinfo;
         dpyinfo = dpyinfo->next, names = XCDR (names))
***************
*** 3171,3177 ****
    return dpyinfo;
  }
  
- #if 0 /* MAC_TODO: implement network support */
  DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
         1, 3, 0,
         doc: /* Open a connection to a server.
--- 3199,3204 ----
***************
*** 3190,3196 ****
      CHECK_STRING (xrm_string);
  
    if (! EQ (Vwindow_system, intern ("mac")))
!     error ("Not using Mac OS");
  
    if (! NILP (xrm_string))
      xrm_option = (unsigned char *) SDATA (xrm_string);
--- 3217,3223 ----
      CHECK_STRING (xrm_string);
  
    if (! EQ (Vwindow_system, intern ("mac")))
!     error ("Not using Mac native windows");
  
    if (! NILP (xrm_string))
      xrm_option = (unsigned char *) SDATA (xrm_string);
***************
*** 3238,3248 ****
    for (i = 0; i < dpyinfo->n_fonts; i++)
      if (dpyinfo->font_table[i].name)
        {
!         if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name)
!           xfree (dpyinfo->font_table[i].full_name);
!         xfree (dpyinfo->font_table[i].name);
!         x_unload_font (dpyinfo, dpyinfo->font_table[i].font);
        }
    x_destroy_all_bitmaps (dpyinfo);
  
    x_delete_display (dpyinfo);
--- 3265,3273 ----
    for (i = 0; i < dpyinfo->n_fonts; i++)
      if (dpyinfo->font_table[i].name)
        {
!         mac_unload_font (dpyinfo, dpyinfo->font_table[i].font);
        }
+ 
    x_destroy_all_bitmaps (dpyinfo);
  
    x_delete_display (dpyinfo);
***************
*** 3250,3256 ****
  
    return Qnil;
  }
- #endif /* 0 */
  
  DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
         doc: /* Return the list of display names that Emacs has connections 
to.  */)
--- 3275,3280 ----
***************
*** 3813,3830 ****
  
      BLOCK_INPUT;
      SetRect (&r, 0, 0, 1, 1);
      if (CreateNewWindow (kHelpWindowClass,
  #ifdef MAC_OS_X_VERSION_10_2
                         kWindowIgnoreClicksAttribute |
  #endif
                         kWindowNoActivatesAttribute,
                         &r, &tip_window) == noErr)
        {
        FRAME_MAC_WINDOW (f) = tip_window;
        SetWRefCon (tip_window, (long) f->output_data.mac);
        /* so that update events can find this mac_output struct */
        f->output_data.mac->mFP = f;
-       ShowWindow (tip_window);
        }
      UNBLOCK_INPUT;
    }
--- 3837,3859 ----
  
      BLOCK_INPUT;
      SetRect (&r, 0, 0, 1, 1);
+ #if TARGET_API_MAC_CARBON
      if (CreateNewWindow (kHelpWindowClass,
  #ifdef MAC_OS_X_VERSION_10_2
                         kWindowIgnoreClicksAttribute |
  #endif
+                        kWindowNoUpdatesAttribute |
                         kWindowNoActivatesAttribute,
                         &r, &tip_window) == noErr)
+ #else
+     if (tip_window = NewCWindow (NULL, &r, "\p", false, plainDBox,
+                                NULL, false, 0L))
+ #endif
        {
        FRAME_MAC_WINDOW (f) = tip_window;
        SetWRefCon (tip_window, (long) f->output_data.mac);
        /* so that update events can find this mac_output struct */
        f->output_data.mac->mFP = f;
        }
      UNBLOCK_INPUT;
    }
***************
*** 4140,4145 ****
--- 4169,4175 ----
    BLOCK_INPUT;
    MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false);
    SizeWindow (FRAME_MAC_WINDOW (f), width, height, true);
+   ShowWindow (FRAME_MAC_WINDOW (f));
    BringToFront (FRAME_MAC_WINDOW (f));
    UNBLOCK_INPUT;
  
***************
*** 4198,4204 ****
  
  
  
! #ifdef TARGET_API_MAC_CARBON
  /***********************************************************************
                        File selection dialog
   ***********************************************************************/
--- 4228,4234 ----
  
  
  
! #if TARGET_API_MAC_CARBON
  /***********************************************************************
                        File selection dialog
   ***********************************************************************/
***************
*** 4405,4418 ****
    x_set_fringe_width,
    x_set_fringe_width,
    0, /* x_set_wait_for_wm, */
!   0, /* MAC_TODO: x_set_fullscreen, */
  };
  
  void
  syms_of_macfns ()
  {
!   /* Certainly running on Mac.  */
    mac_in_use = 1;
  
    /* The section below is built by the lisp expression at the top of the file,
       just above where these variables are declared.  */
--- 4435,4453 ----
    x_set_fringe_width,
    x_set_fringe_width,
    0, /* x_set_wait_for_wm, */
!   x_set_fullscreen,
  };
  
  void
  syms_of_macfns ()
  {
! #ifdef MAC_OSX
!   /* This is zero if not using Mac native windows.  */
!   mac_in_use = 0;
! #else
!   /* Certainly running on Mac native windows.  */
    mac_in_use = 1;
+ #endif
  
    /* The section below is built by the lisp expression at the top of the file,
       just above where these variables are declared.  */
***************
*** 4536,4545 ****
    defsubr (&Sx_display_backing_store);
    defsubr (&Sx_display_save_under);
    defsubr (&Sx_create_frame);
- #if 0 /* MAC_TODO: implement network support */
    defsubr (&Sx_open_connection);
    defsubr (&Sx_close_connection);
- #endif
    defsubr (&Sx_display_list);
    defsubr (&Sx_synchronize);
  
--- 4571,4578 ----




reply via email to

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