emacs-diffs
[Top][All Lists]
Advanced

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

scratch/igc 3a3911c3a5c 3/7: EmacsView::emacsframe with added indirectio


From: Gerd Moellmann
Subject: scratch/igc 3a3911c3a5c 3/7: EmacsView::emacsframe with added indirection
Date: Thu, 18 Jul 2024 02:14:34 -0400 (EDT)

branch: scratch/igc
commit 3a3911c3a5c4c5a26d7a2e4f54bb1e2954b77068
Author: Gerd Möllmann <gerd@gnu.org>
Commit: Gerd Möllmann <gerd@gnu.org>

    EmacsView::emacsframe with added indirection
---
 src/igc.c    |   6 --
 src/nsterm.h |   3 +-
 src/nsterm.m | 234 ++++++++++++++++++++++++++++++-----------------------------
 3 files changed, 120 insertions(+), 123 deletions(-)

diff --git a/src/igc.c b/src/igc.c
index e333bec8ee0..0faea9eb630 100644
--- a/src/igc.c
+++ b/src/igc.c
@@ -1969,12 +1969,6 @@ fix_frame (mps_ss_t ss, struct frame *f)
          IGC_FIX12_RAW (ss, font_ptr);
        Lisp_Object *nle = &FRAME_DISPLAY_INFO (f)->name_list_element;
        IGC_FIX12_OBJ (ss, nle);
-
-#ifdef HAVE_NS
-       struct frame **pf = ns_emacs_view_emacs_frame (f);
-       if (pf)
-         IGC_FIX12_RAW (ss, pf);
-#endif
       }
 #endif // HAVE_WINDOW_SYSTEM
 
diff --git a/src/nsterm.h b/src/nsterm.h
index 959eb070e69..b9ed9f8eb8d 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -482,7 +482,7 @@ enum ns_return_frame_mode
   EmacsWindow *nonfs_window;
   BOOL fs_is_native;
 @public
-  struct frame *emacsframe;
+  struct frame **emacsframe;
   int scrollbarsNeedingUpdate;
   NSRect ns_userRect;
 }
@@ -1399,7 +1399,6 @@ enum NSWindowTabbingMode
 #endif
 
 extern void mark_nsterm (void);
-struct frame **ns_emacs_view_emacs_frame (struct frame *f);
 int ns_emacs_scroller_refs (struct window *w, void **refs, size_t n);
 
 #endif /* HAVE_NS */
diff --git a/src/nsterm.m b/src/nsterm.m
index c7b70281560..0a872827ccc 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2355,7 +2355,7 @@ ns_mouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
        continue;
 
       if (w && [[w delegate] isKindOfClass: [EmacsView class]])
-        f = ((EmacsView *) [w delegate])->emacsframe;
+        f = *((EmacsView *) [w delegate])->emacsframe;
       else if (EQ (track_mouse, Qdrag_source))
        break;
 
@@ -6700,6 +6700,13 @@ ns_create_font_panel_buttons (id target, SEL select, SEL 
cancel_action)
 
   if (fs_state == FULLSCREEN_BOTH)
     [nonfs_window release];
+
+#ifdef HAVE_MPS
+  igc_xfree (emacsframe);
+#else
+  xfree (emacsframe);
+#endif
+
   [super dealloc];
 }
 
@@ -6707,7 +6714,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL 
cancel_action)
 /* Called on font panel selection.  */
 - (void) changeFont: (id) sender
 {
-  struct font *font = FRAME_OUTPUT_DATA (emacsframe)->font;
+  struct font *font = FRAME_OUTPUT_DATA (*emacsframe)->font;
   NSFont *nsfont;
 
 #ifdef NS_IMPL_GNUSTEP
@@ -6741,10 +6748,10 @@ ns_create_font_panel_buttons (id target, SEL select, 
SEL cancel_action)
   /* If no font was previously selected, use the currently selected
      font.  */
 
-  if (!font_panel_result && FRAME_FONT (emacsframe))
+  if (!font_panel_result && FRAME_FONT (*emacsframe))
     {
       font_panel_result
-       = macfont_get_nsctfont (FRAME_FONT (emacsframe));
+       = macfont_get_nsctfont (FRAME_FONT (*emacsframe));
 
       if (font_panel_result)
        [font_panel_result retain];
@@ -6768,7 +6775,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL 
cancel_action)
 - (Lisp_Object) showFontPanel
 {
   id fm = [NSFontManager sharedFontManager];
-  struct font *font = FRAME_OUTPUT_DATA (emacsframe)->font;
+  struct font *font = FRAME_OUTPUT_DATA (*emacsframe)->font;
   NSFont *nsfont, *result;
   struct timespec timeout;
 #ifdef NS_IMPL_COCOA
@@ -6838,7 +6845,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL 
cancel_action)
 - (void)resetCursorRects
 {
   NSRect visible = [self visibleRect];
-  NSCursor *currentCursor = FRAME_POINTER_TYPE (emacsframe);
+  NSCursor *currentCursor = FRAME_POINTER_TYPE (*emacsframe);
   NSTRACE ("[EmacsView resetCursorRects]");
 
   if (currentCursor == nil)
@@ -6863,7 +6870,7 @@ ns_create_font_panel_buttons (id target, SEL select, SEL 
cancel_action)
 
 - (void)keyDown: (NSEvent *)theEvent
 {
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (*emacsframe);
   int code;
   unsigned fnKeysym = 0;
   static NSMutableArray *nsEvArray;
@@ -7232,13 +7239,13 @@ ns_in_echo_area (void)
   if (WINDOWP (echo_area_window) && ns_in_echo_area ())
     win = XWINDOW (echo_area_window);
   else
-    win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
+    win = XWINDOW (FRAME_SELECTED_WINDOW (*emacsframe));
 
-  rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
-  rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
+  rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (*emacsframe);
+  rect.size.height = FRAME_LINE_HEIGHT (*emacsframe);
   pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
   pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
-                                       +FRAME_LINE_HEIGHT (emacsframe));
+                                       +FRAME_LINE_HEIGHT (*emacsframe));
 
   pt = [self convertPoint: pt toView: nil];
 
@@ -7335,7 +7342,7 @@ ns_in_echo_area (void)
 /* This is what happens when the user presses a mouse button.  */
 - (void)mouseDown: (NSEvent *)theEvent
 {
-  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
+  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (*emacsframe);
   NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
   EmacsWindow *window;
 
@@ -7344,13 +7351,13 @@ ns_in_echo_area (void)
   if (!emacs_event)
     return;
 
-  if (FRAME_TOOLTIP_P (emacsframe))
+  if (FRAME_TOOLTIP_P (*emacsframe))
     return;
 
-  dpyinfo->last_mouse_frame = emacsframe;
+  dpyinfo->last_mouse_frame = *emacsframe;
   /* Appears to be needed to prevent spurious movement events generated on
      button clicks.  */
-  emacsframe->mouse_moved = 0;
+  (*emacsframe)->mouse_moved = 0;
 
   window = (EmacsWindow *) [self window];
   [window setLastDragEvent: theEvent];
@@ -7411,7 +7418,7 @@ ns_in_echo_area (void)
                 {
                   /* FIXME: Use actual line height instead of the default.  */
                   lineHeight = default_line_pixel_height
-                    (XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)));
+                    (XWINDOW (FRAME_SELECTED_WINDOW (*emacsframe)));
                 }
 
               if ([theEvent phase] == NSEventPhaseBegan)
@@ -7480,9 +7487,9 @@ ns_in_echo_area (void)
 
               scrollUp = delta > 0;
              x = ([theEvent scrollingDeltaX]
-                  * FRAME_COLUMN_WIDTH (emacsframe));
+                  * FRAME_COLUMN_WIDTH (*emacsframe));
              y = ([theEvent scrollingDeltaY]
-                  * FRAME_LINE_HEIGHT (emacsframe));
+                  * FRAME_LINE_HEIGHT (*emacsframe));
             }
 
           if (lines == 0 && mwheel_coalesce_scroll_events)
@@ -7536,18 +7543,18 @@ ns_in_echo_area (void)
       Lisp_Object tab_bar_arg = Qnil;
       bool tab_bar_p = false;
 
-      if (WINDOWP (emacsframe->tab_bar_window)
-         && WINDOW_TOTAL_LINES (XWINDOW (emacsframe->tab_bar_window)))
+      if (WINDOWP ((*emacsframe)->tab_bar_window)
+         && WINDOW_TOTAL_LINES (XWINDOW ((*emacsframe)->tab_bar_window)))
        {
          Lisp_Object window;
          int x = lrint (p.x);
          int y = lrint (p.y);
 
-         window = window_from_coordinates (emacsframe, x, y, 0, true, true, 
true);
-         tab_bar_p = EQ (window, emacsframe->tab_bar_window);
+         window = window_from_coordinates (*emacsframe, x, y, 0, true, true, 
true);
+         tab_bar_p = EQ (window, (*emacsframe)->tab_bar_window);
 
          if (tab_bar_p)
-           tab_bar_arg = handle_tab_bar_click (emacsframe, x, y,
+           tab_bar_arg = handle_tab_bar_click (*emacsframe, x, y,
                                                EV_UDMODIFIERS (theEvent) & 
down_modifier,
                                                EV_MODIFIERS (theEvent) | 
EV_UDMODIFIERS (theEvent));
        }
@@ -7560,9 +7567,9 @@ ns_in_echo_area (void)
                              | EV_UDMODIFIERS (theEvent);
 
       if (emacs_event->modifiers & down_modifier)
-       FRAME_DISPLAY_INFO (emacsframe)->grabbed |= 1 << EV_BUTTON (theEvent);
+       FRAME_DISPLAY_INFO (*emacsframe)->grabbed |= 1 << EV_BUTTON (theEvent);
       else
-       FRAME_DISPLAY_INFO (emacsframe)->grabbed &= ~(1 << EV_BUTTON 
(theEvent));
+       FRAME_DISPLAY_INFO (*emacsframe)->grabbed &= ~(1 << EV_BUTTON 
(theEvent));
     }
 
   XSETINT (emacs_event->x, lrint (p.x));
@@ -7617,13 +7624,13 @@ ns_in_echo_area (void)
 /* Tell emacs the mouse has moved.  */
 - (void)mouseMoved: (NSEvent *)e
 {
-  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (emacsframe);
-  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
+  Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (*emacsframe);
+  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (*emacsframe);
   Lisp_Object frame;
   NSPoint pt;
   BOOL dragging;
 
-  if (FRAME_TOOLTIP_P (emacsframe))
+  if (FRAME_TOOLTIP_P (*emacsframe))
     return;
 
   NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "[EmacsView mouseMoved:]");
@@ -7649,7 +7656,7 @@ ns_in_echo_area (void)
       NSTRACE_MSG ("mouse_autoselect_window");
       static Lisp_Object last_mouse_window;
       Lisp_Object window
-       = window_from_coordinates (emacsframe, pt.x, pt.y, 0, 0, 0, 0);
+       = window_from_coordinates (*emacsframe, pt.x, pt.y, 0, 0, 0, 0);
 
       if (WINDOWP (window)
           && !EQ (window, last_mouse_window)
@@ -7669,7 +7676,7 @@ ns_in_echo_area (void)
     }
 
   dragging = (e.type == NSEventTypeLeftMouseDragged);
-  if (!ns_note_mouse_movement (emacsframe, pt.x, pt.y, dragging))
+  if (!ns_note_mouse_movement (*emacsframe, pt.x, pt.y, dragging))
     help_echo_string = previous_help_echo_string;
 
   XSETFRAME (frame, emacsframe);
@@ -7683,7 +7690,7 @@ ns_in_echo_area (void)
                       help_echo_object, help_echo_pos);
     }
 
-  if (emacsframe->mouse_moved && send_appdefined)
+  if ((*emacsframe)->mouse_moved && send_appdefined)
     ns_send_appdefined (-1);
 }
 
@@ -7773,7 +7780,7 @@ ns_in_echo_area (void)
   NSTRACE_RECT   ("[sender frame]", [sender frame]);
   NSTRACE_FSTYPE ("fs_state", fs_state);
 
-  if (!FRAME_LIVE_P (emacsframe))
+  if (!FRAME_LIVE_P (*emacsframe))
     return frameSize;
 
   if (fs_state == FULLSCREEN_MAXIMIZED
@@ -7792,15 +7799,15 @@ ns_in_echo_area (void)
 
   if (! [self isFullscreen])
     {
-      extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
-        + FRAME_TOOLBAR_HEIGHT (emacsframe);
+      extra = FRAME_NS_TITLEBAR_HEIGHT (*emacsframe)
+        + FRAME_TOOLBAR_HEIGHT (*emacsframe);
     }
 
-  cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, frameSize.width);
+  cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (*emacsframe, frameSize.width);
   if (cols < MINWIDTH)
     cols = MINWIDTH;
 
-  rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (emacsframe,
+  rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (*emacsframe,
                                            frameSize.height - extra);
   if (rows < MINHEIGHT)
     rows = MINHEIGHT;
@@ -7853,13 +7860,13 @@ ns_in_echo_area (void)
       if (r.size.width != frameSize.width)
         {
           frameSize.width =
-            FRAME_TEXT_COLS_TO_PIXEL_WIDTH  (emacsframe, cols);
+            FRAME_TEXT_COLS_TO_PIXEL_WIDTH  (*emacsframe, cols);
         }
 
       if (r.size.height != frameSize.height)
         {
           frameSize.height =
-            FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (emacsframe, rows) + extra;
+            FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (*emacsframe, rows) + extra;
         }
     }
 
@@ -7895,7 +7902,7 @@ ns_in_echo_area (void)
 
   [super resizeWithOldSuperviewSize:oldSize];
 
-  if (! FRAME_LIVE_P (emacsframe))
+  if (! FRAME_LIVE_P (*emacsframe))
     return;
 
   frame = [[self superview] bounds];
@@ -7909,10 +7916,10 @@ ns_in_echo_area (void)
      view's frame isn't resized correctly, or can end up with the
      wrong origin.  */
   [self setFrame:frame];
-  change_frame_size (emacsframe, width, height, false, YES, false);
+  change_frame_size (*emacsframe, width, height, false, YES, false);
 
-  SET_FRAME_GARBAGED (emacsframe);
-  cancel_mouse_face (emacsframe);
+  SET_FRAME_GARBAGED (*emacsframe);
+  cancel_mouse_face (*emacsframe);
   ns_send_appdefined (-1);
 }
 
@@ -7926,7 +7933,7 @@ ns_in_echo_area (void)
 
 - (void)windowDidBecomeKey      /* for direct calls */
 {
-  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
+  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (*emacsframe);
   struct frame *old_focus = dpyinfo->ns_focus_frame;
   struct input_event event;
 
@@ -7934,13 +7941,13 @@ ns_in_echo_area (void)
 
   NSTRACE ("[EmacsView windowDidBecomeKey]");
 
-  if (emacsframe != old_focus)
-    dpyinfo->ns_focus_frame = emacsframe;
+  if (*emacsframe != old_focus)
+    dpyinfo->ns_focus_frame = *emacsframe;
 
-  ns_frame_rehighlight (emacsframe);
+  ns_frame_rehighlight (*emacsframe);
 
   event.kind = FOCUS_IN_EVENT;
-  XSETFRAME (event.frame_or_window, emacsframe);
+  XSETFRAME (event.frame_or_window, *emacsframe);
   kbd_buffer_store_event (&event);
 }
 
@@ -7948,22 +7955,22 @@ ns_in_echo_area (void)
 - (void)windowDidResignKey: (NSNotification *)notification
 /* cf. x_detect_focus_change(), x_focus_changed(), x_new_focus_frame() */
 {
-  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (emacsframe);
-  BOOL is_focus_frame = dpyinfo->ns_focus_frame == emacsframe;
+  struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (*emacsframe);
+  BOOL is_focus_frame = dpyinfo->ns_focus_frame == *emacsframe;
   NSTRACE ("[EmacsView windowDidResignKey:]");
 
   if (is_focus_frame)
     dpyinfo->ns_focus_frame = 0;
 
-  emacsframe->mouse_moved = 0;
-  ns_frame_rehighlight (emacsframe);
+  (*emacsframe)->mouse_moved = 0;
+  ns_frame_rehighlight (*emacsframe);
 
   /* FIXME: for some reason needed on second and subsequent clicks away
             from sole-frame Emacs to get hollow box to show.  */
   if (!windowClosing && [[self window] isVisible] == YES)
     {
-      gui_update_cursor (emacsframe, 1);
-      ns_set_frame_alpha (emacsframe);
+      gui_update_cursor (*emacsframe, 1);
+      ns_set_frame_alpha (*emacsframe);
     }
 
   if (any_help_event_p)
@@ -8039,7 +8046,12 @@ ns_in_echo_area (void)
   [self setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
 
   FRAME_NS_VIEW (f) = self;
-  emacsframe = f;
+#ifdef HAVE_MPS
+  emacsframe = igc_xzalloc_ambig (sizeof *emacsframe);
+#else
+  emacsframe = xzalloc (sizeof *emacsframe);
+#endif
+  *emacsframe = f;
 #ifdef NS_IMPL_COCOA
   old_title = 0;
   maximizing_resize = NO;
@@ -8094,15 +8106,15 @@ ns_in_echo_area (void)
 
   NSTRACE ("[EmacsView windowDidMove:]");
 
-  if (!emacsframe->output_data.ns)
+  if (!(*emacsframe)->output_data.ns)
     return;
 
   if (screen != nil)
     {
-      emacsframe->left_pos = (NSMinX (r)
-                             - NS_PARENT_WINDOW_LEFT_POS (emacsframe));
-      emacsframe->top_pos = (NS_PARENT_WINDOW_TOP_POS (emacsframe)
-                            - NSMaxY (r));
+      (*emacsframe)->left_pos = (NSMinX (r)
+                                - NS_PARENT_WINDOW_LEFT_POS (*emacsframe));
+      (*emacsframe)->top_pos = (NS_PARENT_WINDOW_TOP_POS (*emacsframe)
+                               - NSMaxY (r));
 
       if (emacs_event)
        {
@@ -8110,8 +8122,8 @@ ns_in_echo_area (void)
          EVENT_INIT (ie);
          ie.kind = MOVE_FRAME_EVENT;
          XSETFRAME (ie.frame_or_window, emacsframe);
-         XSETINT (ie.x, emacsframe->left_pos);
-         XSETINT (ie.y, emacsframe->top_pos);
+         XSETINT (ie.x, (*emacsframe)->left_pos);
+         XSETINT (ie.y, (*emacsframe)->top_pos);
          kbd_buffer_store_event (&ie);
        }
     }
@@ -8127,7 +8139,7 @@ ns_in_echo_area (void)
             NSTRACE_FMT_RETURN "YES"),
            NSTRACE_ARG_RECT (newFrame));
 
-  emacsframe->output_data.ns->zooming = 1;
+  (*emacsframe)->output_data.ns->zooming = 1;
   return YES;
 }
 
@@ -8178,7 +8190,7 @@ ns_in_echo_area (void)
       if (next_maximized == FULLSCREEN_HEIGHT
           || (next_maximized == -1
               && abs ((int)(defaultFrame.size.height - result.size.height))
-              > FRAME_LINE_HEIGHT (emacsframe)))
+              > FRAME_LINE_HEIGHT (*emacsframe)))
         {
           /* first click */
           NSTRACE_MSG ("FULLSCREEN_HEIGHT");
@@ -8211,7 +8223,7 @@ ns_in_echo_area (void)
       else if (next_maximized == FULLSCREEN_MAXIMIZED
                || (next_maximized == -1
                    && abs ((int)(defaultFrame.size.width - result.size.width))
-                   > FRAME_COLUMN_WIDTH (emacsframe)))
+                   > FRAME_COLUMN_WIDTH (*emacsframe)))
         {
           NSTRACE_MSG ("FULLSCREEN_MAXIMIZED");
 
@@ -8256,11 +8268,11 @@ ns_in_echo_area (void)
 - (void)windowDidDeminiaturize: sender
 {
   NSTRACE ("[EmacsView windowDidDeminiaturize:]");
-  if (!emacsframe->output_data.ns)
+  if (!(*emacsframe)->output_data.ns)
     return;
 
-  SET_FRAME_ICONIFIED (emacsframe, 0);
-  SET_FRAME_VISIBLE (emacsframe, 1);
+  SET_FRAME_ICONIFIED (*emacsframe, 0);
+  SET_FRAME_VISIBLE (*emacsframe, 1);
   windows_or_buffers_changed = 63;
 
   if (emacs_event)
@@ -8274,11 +8286,11 @@ ns_in_echo_area (void)
 - (void)windowDidExpose: sender
 {
   NSTRACE ("[EmacsView windowDidExpose:]");
-  if (!emacsframe->output_data.ns)
+  if (!(*emacsframe)->output_data.ns)
     return;
 
-  SET_FRAME_VISIBLE (emacsframe, 1);
-  SET_FRAME_GARBAGED (emacsframe);
+  SET_FRAME_VISIBLE (*emacsframe, 1);
+  SET_FRAME_GARBAGED (*emacsframe);
 
   if (send_appdefined)
     ns_send_appdefined (-1);
@@ -8288,11 +8300,11 @@ ns_in_echo_area (void)
 - (void)windowDidMiniaturize: sender
 {
   NSTRACE ("[EmacsView windowDidMiniaturize:]");
-  if (!emacsframe->output_data.ns)
+  if (!(*emacsframe)->output_data.ns)
     return;
 
-  SET_FRAME_ICONIFIED (emacsframe, 1);
-  SET_FRAME_VISIBLE (emacsframe, 0);
+  SET_FRAME_ICONIFIED (*emacsframe, 1);
+  SET_FRAME_VISIBLE (*emacsframe, 0);
 
   if (emacs_event)
     {
@@ -8367,7 +8379,7 @@ ns_in_echo_area (void)
 - (void)windowWillExitFullScreen /* provided for direct calls */
 {
   NSTRACE ("[EmacsView windowWillExitFullScreen]");
-  if (!FRAME_LIVE_P (emacsframe))
+  if (!FRAME_LIVE_P (*emacsframe))
     {
       NSTRACE_MSG ("Ignored (frame dead)");
       return;
@@ -8385,7 +8397,7 @@ ns_in_echo_area (void)
 - (void)windowDidExitFullScreen /* provided for direct calls */
 {
   NSTRACE ("[EmacsView windowDidExitFullScreen]");
-  if (!FRAME_LIVE_P (emacsframe))
+  if (!FRAME_LIVE_P (*emacsframe))
     {
       NSTRACE_MSG ("Ignored (frame dead)");
       return;
@@ -8439,7 +8451,7 @@ ns_in_echo_area (void)
       NSWindowCollectionBehavior b = [win collectionBehavior];
       if (ns_use_native_fullscreen)
         {
-          if (FRAME_PARENT_FRAME (emacsframe))
+          if (FRAME_PARENT_FRAME (*emacsframe))
             {
               b &= ~NSWindowCollectionBehaviorFullScreenPrimary;
               b |= NSWindowCollectionBehaviorFullScreenAuxiliary;
@@ -8487,7 +8499,7 @@ ns_in_echo_area (void)
 
   w = (EmacsWindow *)[self window];
   onFirstScreen = [[w screen] isEqual:[[NSScreen screens] objectAtIndex:0]];
-  f = emacsframe;
+  f = *emacsframe;
   col = [NSColor colorWithUnsignedLong:NS_FACE_BACKGROUND
                                 (FACE_FROM_ID (f, DEFAULT_FACE_ID))];
 
@@ -8518,7 +8530,7 @@ ns_in_echo_area (void)
 #endif
         }
 
-      fw = [[EmacsWindow alloc] initWithEmacsFrame:emacsframe
+      fw = [[EmacsWindow alloc] initWithEmacsFrame:*emacsframe
                                         fullscreen:YES
                                             screen:screen];
 
@@ -8572,7 +8584,7 @@ ns_in_echo_area (void)
 {
   NSTRACE ("[EmacsView handleFS]");
 
-  if (fs_state != emacsframe->want_fullscreen)
+  if (fs_state != (*emacsframe)->want_fullscreen)
     {
       if (fs_state == FULLSCREEN_BOTH)
         {
@@ -8580,7 +8592,7 @@ ns_in_echo_area (void)
           [self toggleFullScreen:self];
         }
 
-      switch (emacsframe->want_fullscreen)
+      switch ((*emacsframe)->want_fullscreen)
         {
         case FULLSCREEN_BOTH:
           NSTRACE_MSG ("FULLSCREEN_BOTH");
@@ -8614,7 +8626,7 @@ ns_in_echo_area (void)
           break;
         }
 
-      emacsframe->want_fullscreen = FULLSCREEN_NONE;
+      (*emacsframe)->want_fullscreen = FULLSCREEN_NONE;
     }
 
 }
@@ -8640,7 +8652,7 @@ ns_in_echo_area (void)
       lval = Qmaximized;
       break;
     }
-  store_frame_param (emacsframe, Qfullscreen, lval);
+  store_frame_param (*emacsframe, Qfullscreen, lval);
   fs_state = value;
 }
 
@@ -8648,24 +8660,24 @@ ns_in_echo_area (void)
 {
   NSTRACE ("[EmacsView mouseEntered:]");
   if (emacsframe)
-    FRAME_DISPLAY_INFO (emacsframe)->last_mouse_movement_time
+    FRAME_DISPLAY_INFO (*emacsframe)->last_mouse_movement_time
       = EV_TIMESTAMP (theEvent);
 }
 
 
 - (void)mouseExited: (NSEvent *)theEvent
 {
-  Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL;
+  Mouse_HLInfo *hlinfo = *emacsframe ? MOUSE_HL_INFO (*emacsframe) : NULL;
 
   NSTRACE ("[EmacsView mouseExited:]");
 
   if (!hlinfo)
     return;
 
-  FRAME_DISPLAY_INFO (emacsframe)->last_mouse_movement_time
+  FRAME_DISPLAY_INFO (*emacsframe)->last_mouse_movement_time
     = EV_TIMESTAMP (theEvent);
 
-  if (emacsframe == hlinfo->mouse_face_mouse_frame)
+  if (*emacsframe == hlinfo->mouse_face_mouse_frame)
     {
       clear_mouse_face (hlinfo);
       hlinfo->mouse_face_mouse_frame = 0;
@@ -8681,8 +8693,8 @@ ns_in_echo_area (void)
   else
     {
       NSInteger tag = [sender tag];
-      find_and_call_menu_selection (emacsframe, 
emacsframe->menu_bar_items_used,
-                                    emacsframe->menu_bar_vector,
+      find_and_call_menu_selection (*emacsframe, 
(*emacsframe)->menu_bar_items_used,
+                                    (*emacsframe)->menu_bar_vector,
                                     (void *)tag);
     }
 
@@ -8705,7 +8717,7 @@ ns_in_echo_area (void)
   theEvent = [[self window] currentEvent];
   emacs_event->kind = TOOL_BAR_EVENT;
   /* XSETINT (emacs_event->code, 0); */
-  emacs_event->arg = AREF (emacsframe->tool_bar_items,
+  emacs_event->arg = AREF ((*emacsframe)->tool_bar_items,
                           idx + TOOL_BAR_ITEM_KEY);
   emacs_event->modifiers = EV_MODIFIERS (theEvent);
   EV_TRAILER (theEvent);
@@ -8735,7 +8747,7 @@ ns_in_echo_area (void)
 - (CALayer *)makeBackingLayer
 {
   EmacsLayer *l = [[EmacsLayer alloc]
-                    initWithDoubleBuffered:FRAME_DOUBLE_BUFFERED (emacsframe)];
+                    initWithDoubleBuffered:FRAME_DOUBLE_BUFFERED 
(*emacsframe)];
 
   [l setDelegate:(id)self];
 
@@ -8776,8 +8788,8 @@ ns_in_echo_area (void)
   [layer setContentsScale:[[notification object] backingScaleFactor]];
   [layer setColorSpace:[(id) [[notification object] colorSpace] CGColorSpace]];
 
-  ns_clear_frame (emacsframe);
-  expose_frame (emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
+  ns_clear_frame (*emacsframe);
+  expose_frame (*emacsframe, 0, 0, NSWidth (frame), NSHeight (frame));
 }
 #endif
 
@@ -8844,7 +8856,7 @@ ns_in_echo_area (void)
    appears to be safe to call redisplay here.  */
 - (void)layoutSublayersOfLayer:(CALayer *)layer
 {
-  if (!redisplaying_p && FRAME_GARBAGED_P (emacsframe))
+  if (!redisplaying_p && FRAME_GARBAGED_P (*emacsframe))
     {
       /* If there is IO going on when redisplay is run here Emacs
          crashes.  I think it's because this code will always be run
@@ -8868,15 +8880,15 @@ ns_in_echo_area (void)
   NSTRACE ("[EmacsView drawRect:" NSTRACE_FMT_RECT "]",
            NSTRACE_ARG_RECT(rect));
 
-  if (!emacsframe || !emacsframe->output_data.ns)
+  if (!emacsframe || !(*emacsframe)->output_data.ns)
     return;
 
   int x = NSMinX (rect), y = NSMinY (rect);
   int width = NSWidth (rect), height = NSHeight (rect);
 
-  ns_clear_frame_area (emacsframe, x, y, width, height);
+  ns_clear_frame_area (*emacsframe, x, y, width, height);
   block_input ();
-  expose_frame (emacsframe, x, y, width, height);
+  expose_frame (*emacsframe, x, y, width, height);
   unblock_input ();
 }
 
@@ -9160,12 +9172,12 @@ ns_in_echo_area (void)
   /* NOTE: under Cocoa miniwindowImage always returns nil, documentation
      about "AppleDockIconEnabled" notwithstanding, however the set message
      below has its effect nonetheless.  */
-  if (image != emacsframe->output_data.ns->miniimage)
+  if (image != (*emacsframe)->output_data.ns->miniimage)
     {
       if (image && [image isKindOfClass: [EmacsImage class]])
         [image release];
       [[self window] setMiniwindowImage:
-                       setMini ? emacsframe->output_data.ns->miniimage : nil];
+                       setMini ? (*emacsframe)->output_data.ns->miniimage : 
nil];
     }
 
   return self;
@@ -9372,7 +9384,7 @@ ns_in_echo_area (void)
 
   Lisp_Object frame, tail;
   EmacsView *ourView = (EmacsView *)[self delegate];
-  struct frame *ourFrame = ourView->emacsframe;
+  struct frame *ourFrame = *ourView->emacsframe;
   struct frame *parentFrame = FRAME_PARENT_FRAME (ourFrame);
   EmacsWindow *oldParentWindow = (EmacsWindow *)[self parentWindow];
 
@@ -9409,7 +9421,7 @@ ns_in_echo_area (void)
   /* Check if we have an incorrectly set parent.  */
   if ((! parentFrame && oldParentWindow)
       || (parentFrame && oldParentWindow
-          && ((EmacsView *)[oldParentWindow delegate])->emacsframe != 
parentFrame))
+          && *((EmacsView *)[oldParentWindow delegate])->emacsframe != 
parentFrame))
     {
       [[self parentWindow] removeChildWindow:self];
 
@@ -9677,7 +9689,7 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
     // screen.  If it is not, ask the system to reposition it (only
     // for non-child windows).
 
-    if (!FRAME_PARENT_FRAME (((EmacsView *)[self delegate])->emacsframe))
+    if (!FRAME_PARENT_FRAME (*((EmacsView *)[self delegate])->emacsframe))
     {
       NSArray *screens = [NSScreen screens];
       NSUInteger nr_screens = [screens count];
@@ -9814,7 +9826,7 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
 - (void)setAppearance
 {
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
-  struct frame *f = ((EmacsView *)[self delegate])->emacsframe;
+  struct frame *f = *((EmacsView *)[self delegate])->emacsframe;
   NSAppearance *appearance = nil;
 
   NSTRACE ("[EmacsWindow setAppearance]");
@@ -9867,7 +9879,7 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
 
 - (BOOL)canBecomeKeyWindow
 {
-  return !FRAME_NO_ACCEPT_FOCUS (((EmacsView *)[self delegate])->emacsframe);
+  return !FRAME_NO_ACCEPT_FOCUS (*((EmacsView *)[self delegate])->emacsframe);
 }
 
 - (BOOL)canBecomeMainWindow
@@ -9918,10 +9930,10 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
 
       if (dnd_mode != RETURN_FRAME_NOW
          || ![[w delegate] isKindOfClass: [EmacsView class]]
-         || ((EmacsView *) [w delegate])->emacsframe->tooltip)
+         || (*((EmacsView *) [w delegate])->emacsframe)->tooltip)
        goto out;
 
-      dnd_return_frame = ((EmacsView *) [w delegate])->emacsframe;
+      dnd_return_frame = *((EmacsView *) [w delegate])->emacsframe;
 
       /* FIXME: there must be a better way to leave the event loop.  */
       [NSException raise: @""
@@ -9977,9 +9989,9 @@ nswindow_orderedIndex_sort (id w1, id w2, void *c)
       w = [NSApp windowWithWindowNumber: window_number];
 
       if (w && [[w delegate] isKindOfClass: [EmacsView class]]
-         && !((EmacsView *) [w delegate])->emacsframe->tooltip)
+         && !(*((EmacsView *) [w delegate])->emacsframe)->tooltip)
        {
-         *frame_return = ((EmacsView *) [w delegate])->emacsframe;
+         *frame_return = *((EmacsView *) [w delegate])->emacsframe;
          [image release];
          unblock_input ();
 
@@ -11209,14 +11221,6 @@ respectively.  */);
   staticpro (&last_known_monitors);
 }
 
-struct frame **
-ns_emacs_view_emacs_frame (struct frame *f)
-{
-  if (FRAME_NS_VIEW (f))
-    return &FRAME_NS_VIEW (f)->emacsframe;
-  return NULL;
-}
-
 int
 ns_emacs_scroller_refs (struct window *w, void **refs, size_t n)
 {



reply via email to

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