]> code.delx.au - gnu-emacs/blobdiff - src/macterm.c
(w32_init_fringe, mac_init_fringe): Add rif argument.
[gnu-emacs] / src / macterm.c
index fa0682feca0fb4494ed1e7f63f708b619ad0e68e..8b3cee42f5c1422fe9aef1449a9fb47e01d1c4fd 100644 (file)
@@ -6,7 +6,7 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -3058,10 +3058,17 @@ x_draw_composite_glyph_string_foreground (s)
   else
     {
       for (i = 0; i < s->nchars; i++, ++s->gidx)
-       mac_draw_image_string_16 (s->f, s->gc,
-                                 x + s->cmp->offsets[s->gidx * 2],
-                                 s->ybase - s->cmp->offsets[s->gidx * 2 + 1],
-                                 s->char2b + i, 1, 0, s->face->overstrike);
+       if (mac_per_char_metric (GC_FONT (s->gc), s->char2b + i, 0) == NULL)
+         /* This is a nonexistent or zero-width glyph such as a
+            combining diacritic.  Draw a rectangle.  */
+         mac_draw_rectangle (s->f, s->gc,
+                             x + s->cmp->offsets[s->gidx * 2], s->y,
+                             FONT_WIDTH (GC_FONT (s->gc)) - 1, s->height - 1);
+       else
+         mac_draw_image_string_16 (s->f, s->gc,
+                                   x + s->cmp->offsets[s->gidx * 2],
+                                   s->ybase - s->cmp->offsets[s->gidx * 2 + 1],
+                                   s->char2b + i, 1, 0, s->face->overstrike);
     }
 }
 
@@ -4329,14 +4336,6 @@ static void
 frame_highlight (f)
      struct frame *f;
 {
-  OSErr err;
-  ControlRef root_control;
-
-  BLOCK_INPUT;
-  err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control);
-  if (err == noErr)
-    ActivateControl (root_control);
-  UNBLOCK_INPUT;
   x_update_cursor (f, 1);
 }
 
@@ -4344,14 +4343,6 @@ static void
 frame_unhighlight (f)
      struct frame *f;
 {
-  OSErr err;
-  ControlRef root_control;
-
-  BLOCK_INPUT;
-  err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control);
-  if (err == noErr)
-    DeactivateControl (root_control);
-  UNBLOCK_INPUT;
   x_update_cursor (f, 1);
 }
 
@@ -6109,7 +6100,9 @@ free_frame_tool_bar (f)
 
       BLOCK_INPUT;
       ShowHideWindowToolbar (FRAME_MAC_WINDOW (f), false,
-                            f == mac_focus_frame (dpyinfo));
+                            (NILP (Fsymbol_value
+                                   (intern ("frame-notice-user-settings")))
+                             && f == mac_focus_frame (dpyinfo)));
       /* Mac OS X 10.3 does not issue kEventWindowBoundsChanged events
         on toolbar visibility change.  */
       mac_handle_origin_change (f);
@@ -9386,11 +9379,13 @@ mac_handle_font_event (next_handler, event, data)
   static const EventParamName names_sel[] = {kEventParamATSUFontID,
                                             kEventParamATSUFontSize,
                                             kEventParamFMFontFamily,
+                                            kEventParamFMFontStyle,
                                             kEventParamFMFontSize,
                                             kEventParamFontColor};
   static const EventParamType types_sel[] = {typeATSUFontID,
                                             typeATSUSize,
                                             typeFMFontFamily,
+                                            typeFMFontStyle,
                                             typeFMFontSize,
                                             typeFontColor};
 
@@ -10711,7 +10706,7 @@ mac_handle_window_event (next_handler, event, data)
        {
          struct frame *sf = SELECTED_FRAME ();
 
-         if (!(FRAME_MAC_P (sf)))
+         if (!(FRAME_MAC_P (sf) && sf->async_visible))
            RepositionWindow (wp, NULL, kWindowCenterOnMainScreen);
          else
            {
@@ -10726,8 +10721,11 @@ mac_handle_window_event (next_handler, event, data)
              /* This is a workaround.  RepositionWindow fails to put
                 a window at the cascading position when its parent
                 window has a Carbon HIToolbar.  */
-             if (f->top_pos == sf->top_pos && f->left_pos == sf->left_pos)
-               MoveWindowStructure (wp,  f->left_pos + 10, f->top_pos + 32);
+             if ((f->left_pos == sf->left_pos
+                  && f->top_pos == sf->top_pos)
+                 || (f->left_pos == sf->left_pos + 10 * 2
+                     && f->top_pos == sf->top_pos + 32 * 2))
+               MoveWindowStructure (wp, sf->left_pos + 10, sf->top_pos + 32);
 #endif
            }
          result = noErr;
@@ -10952,7 +10950,7 @@ mac_handle_keyboard_event (next_handler, event, data)
      void *data;
 {
   OSStatus err, result = eventNotHandledErr;
-  UInt32 event_kind, key_code, modifiers, mapped_modifiers;
+  UInt32 event_kind, key_code, modifiers;
   unsigned char char_code;
 
   event_kind = GetEventKind (event);
@@ -10961,32 +10959,16 @@ mac_handle_keyboard_event (next_handler, event, data)
     case kEventRawKeyDown:
     case kEventRawKeyRepeat:
     case kEventRawKeyUp:
-      if (read_socket_inev == NULL)
-       {
-         result = CallNextEventHandler (next_handler, event);
-         break;
-       }
-
-      err = GetEventParameter (event, kEventParamKeyModifiers,
-                              typeUInt32, NULL,
-                              sizeof (UInt32), NULL, &modifiers);
-      if (err != noErr)
-       break;
-
-      mapped_modifiers = mac_mapped_modifiers (modifiers);
-
       /* When using Carbon Events, we need to pass raw keyboard events
         to the TSM ourselves.  If TSM handles it, it will pass back
         noErr, otherwise it will pass back "eventNotHandledErr" and
         we can process it normally.  */
-      if (!(mapped_modifiers
-           & ~(mac_pass_command_to_system ? cmdKey : 0)
-           & ~(mac_pass_control_to_system ? controlKey : 0)))
-       {
-         result = CallNextEventHandler (next_handler, event);
-         if (result != eventNotHandledErr)
-           break;
-       }
+      result = CallNextEventHandler (next_handler, event);
+      if (result != eventNotHandledErr)
+       break;
+
+      if (read_socket_inev == NULL)
+       break;
 
 #if USE_MAC_TSM
       if (read_socket_inev->kind != NO_EVENT)
@@ -11011,6 +10993,12 @@ mac_handle_keyboard_event (next_handler, event, data)
       if (err != noErr)
        break;
 
+      err = GetEventParameter (event, kEventParamKeyModifiers,
+                              typeUInt32, NULL,
+                              sizeof (UInt32), NULL, &modifiers);
+      if (err != noErr)
+       break;
+
       do_keystroke ((event_kind == kEventRawKeyDown ? keyDown : autoKey),
                    char_code, key_code, modifiers,
                    ((unsigned long)
@@ -12157,7 +12145,7 @@ XTread_socket (sd, expected, hold_quit)
                          /* Window will be selected only when it is
                             not selected now and last mouse movement
                             event was not in it.  Minibuffer window
-                            will be selected iff it is active.  */
+                            will be selected only when it is active.  */
                          if (WINDOWP (window)
                              && !EQ (window, last_window)
                              && !EQ (window, selected_window))
@@ -12192,6 +12180,8 @@ XTread_socket (sd, expected, hold_quit)
        case activateEvt:
          {
            WindowRef window_ptr = (WindowRef) er.message;
+           OSErr err;
+           ControlRef root_control;
 
            if (window_ptr == tip_window)
              {
@@ -12209,6 +12199,10 @@ XTread_socket (sd, expected, hold_quit)
                /* A window has been activated */
                Point mouse_loc;
 
+               err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control);
+               if (err == noErr)
+                 ActivateControl (root_control);
+
                x_detect_focus_change (dpyinfo, &er, &inev);
 
                mouse_loc.h = (er.where.h
@@ -12224,6 +12218,10 @@ XTread_socket (sd, expected, hold_quit)
            else
              {
                /* A window has been deactivated */
+               err = GetRootControl (FRAME_MAC_WINDOW (f), &root_control);
+               if (err == noErr)
+                 DeactivateControl (root_control);
+
 #ifdef USE_TOOLKIT_SCROLL_BARS
                if (dpyinfo->grabbed && tracked_scroll_bar)
                  {
@@ -12279,13 +12277,29 @@ XTread_socket (sd, expected, hold_quit)
              clear_mouse_face (dpyinfo);
              dpyinfo->mouse_face_hidden = 1;
            }
+
+         {
+           UInt32 modifiers = er.modifiers, mapped_modifiers;
+
+#ifdef MAC_OSX
+           GetEventParameter (eventRef, kEventParamKeyModifiers,
+                              typeUInt32, NULL,
+                              sizeof (UInt32), NULL, &modifiers);
+#endif
+           mapped_modifiers = mac_mapped_modifiers (modifiers);
+
 #if TARGET_API_MAC_CARBON
-         goto OTHER;
-#else
-         do_keystroke (er.what, er.message & charCodeMask,
-                       (er.message & keyCodeMask) >> 8,
-                       er.modifiers, timestamp, &inev);
+           if (!(mapped_modifiers
+                 & ~(mac_pass_command_to_system ? cmdKey : 0)
+                 & ~(mac_pass_control_to_system ? controlKey : 0)))
+             goto OTHER;
+           else
 #endif
+             if (er.what != keyUp)
+               do_keystroke (er.what, er.message & charCodeMask,
+                             (er.message & keyCodeMask) >> 8,
+                             modifiers, timestamp, &inev);
+         }
          break;
 
        case kHighLevelEvent:
@@ -12339,7 +12353,6 @@ XTread_socket (sd, expected, hold_quit)
            }
          count++;
        }
-
     }
 
   /* If the focus was just given to an autoraising frame,