aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorAlan Third2017-04-20 15:25:56 +0100
committerAlan Third2017-04-21 20:44:35 +0100
commitd812d20fbc3e1eff0f10443baed801adda9031cd (patch)
tree184f53fd04d4b5cae0bfe5297bd904043e9db3b9 /src/nsfns.m
parenta3b8618d79657af0d7fea9cb6fd914ccf0f67849 (diff)
downloademacs-d812d20fbc3e1eff0f10443baed801adda9031cd.tar.gz
emacs-d812d20fbc3e1eff0f10443baed801adda9031cd.zip
Add no-accept-focus and frame-list-z-order to NS port
* lisp/frame.el (frame-list-z-order): Add NS. * src/nsfns.m: Add x_set_no_accept_focus to handler struct. (Fx_create_frame): Handle no-accept-focus parameter. (ns_window_is_ancestor): (Fns_frame_list_z_order): New functions. * src/nsterm.m (x_set_no_accept_focus): New function. (initFrameFromEmacs): Use EmacsWindow instead of EmacsFSWindow for non-fullscreen windows. (EmacsWindow:canBecomeKeyWindow): New function.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m61
1 files changed, 58 insertions, 3 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index f1a5df8f27e..3a37df95759 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -973,14 +973,14 @@ frame_parm_handler ns_frame_parm_handlers[] =
973 0, /* x_set_tool_bar_position */ 973 0, /* x_set_tool_bar_position */
974 0, /* x_set_inhibit_double_buffering */ 974 0, /* x_set_inhibit_double_buffering */
975#ifdef NS_IMPL_COCOA 975#ifdef NS_IMPL_COCOA
976 x_set_undecorated, /* x_set_undecorated */ 976 x_set_undecorated,
977#else 977#else
978 0, /*x_set_undecorated */ 978 0, /*x_set_undecorated */
979#endif 979#endif
980 x_set_parent_frame, /* x_set_parent_frame */ 980 x_set_parent_frame,
981 0, /* x_set_skip_taskbar */ 981 0, /* x_set_skip_taskbar */
982 0, /* x_set_no_focus_on_map */ 982 0, /* x_set_no_focus_on_map */
983 0, /* x_set_no_accept_focus */ 983 x_set_no_accept_focus,
984 x_set_z_group, /* x_set_z_group */ 984 x_set_z_group, /* x_set_z_group */
985 0, /* x_set_override_redirect */ 985 0, /* x_set_override_redirect */
986}; 986};
@@ -1287,6 +1287,8 @@ This function is an internal primitive--use `make-frame' instead. */)
1287 store_frame_param (f, Qparent_frame, parent_frame); 1287 store_frame_param (f, Qparent_frame, parent_frame);
1288 1288
1289 x_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL); 1289 x_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL);
1290 x_default_parameter (f, parms, Qno_accept_focus, Qnil,
1291 NULL, NULL, RES_TYPE_BOOLEAN);
1290 1292
1291 /* The resources controlling the menu-bar and tool-bar are 1293 /* The resources controlling the menu-bar and tool-bar are
1292 processed specially at startup, and reflected in the mode 1294 processed specially at startup, and reflected in the mode
@@ -1428,6 +1430,58 @@ x_focus_frame (struct frame *f, bool noactivate)
1428 } 1430 }
1429} 1431}
1430 1432
1433static BOOL
1434ns_window_is_ancestor (NSWindow *win, NSWindow *candidate)
1435/* Test whether CANDIDATE is an ancestor window of WIN. */
1436{
1437 if (candidate == NULL)
1438 return NO;
1439 else if (win == candidate)
1440 return YES;
1441 else
1442 return ns_window_is_ancestor(win, [candidate parentWindow]);
1443}
1444
1445DEFUN ("ns-frame-list-z-order", Fns_frame_list_z_order,
1446 Sns_frame_list_z_order, 0, 1, 0,
1447 doc: /* Return list of Emacs' frames, in Z (stacking) order.
1448The optional argument TERMINAL specifies which display to ask about.
1449TERMINAL should be either a frame or a display name (a string). If
1450omitted or nil, that stands for the selected frame's display. Return
1451nil if TERMINAL contains no Emacs frame.
1452
1453As a special case, if TERMINAL is non-nil and specifies a live frame,
1454return the child frames of that frame in Z (stacking) order.
1455
1456Frames are listed from topmost (first) to bottommost (last). */)
1457 (Lisp_Object terminal)
1458{
1459 NSArray *list = [NSApp orderedWindows];
1460 Lisp_Object frames = Qnil;
1461
1462 if (FRAMEP (terminal) && FRAME_LIVE_P (XFRAME (terminal)))
1463 {
1464 /* Filter LIST to just those that are ancestors of TERMINAL. */
1465 NSWindow *win = [FRAME_NS_VIEW (XFRAME (terminal)) window];
1466
1467 NSPredicate *ancestor_pred =
1468 [NSPredicate predicateWithBlock:^BOOL(id candidate, NSDictionary *bind) {
1469 return ns_window_is_ancestor (win, [(NSWindow *)candidate parentWindow]);
1470 }];
1471
1472 list = [[NSApp orderedWindows] filteredArrayUsingPredicate: ancestor_pred];
1473 }
1474
1475 for (NSWindow *win in [list reverseObjectEnumerator])
1476 {
1477 Lisp_Object frame;
1478 XSETFRAME (frame, ((EmacsView *)[win delegate])->emacsframe);
1479 frames = Fcons(frame, frames);
1480 }
1481
1482 return frames;
1483}
1484
1431DEFUN ("ns-frame-restack", Fns_frame_restack, Sns_frame_restack, 2, 3, 0, 1485DEFUN ("ns-frame-restack", Fns_frame_restack, Sns_frame_restack, 2, 3, 0,
1432 doc: /* Restack FRAME1 below FRAME2. 1486 doc: /* Restack FRAME1 below FRAME2.
1433This means that if both frames are visible and the display areas of 1487This means that if both frames are visible and the display areas of
@@ -3188,6 +3242,7 @@ be used as the image of the icon representing the frame. */);
3188 defsubr (&Sns_display_monitor_attributes_list); 3242 defsubr (&Sns_display_monitor_attributes_list);
3189 defsubr (&Sns_frame_geometry); 3243 defsubr (&Sns_frame_geometry);
3190 defsubr (&Sns_frame_edges); 3244 defsubr (&Sns_frame_edges);
3245 defsubr (&Sns_frame_list_z_order);
3191 defsubr (&Sns_frame_restack); 3246 defsubr (&Sns_frame_restack);
3192 defsubr (&Sx_display_mm_width); 3247 defsubr (&Sx_display_mm_width);
3193 defsubr (&Sx_display_mm_height); 3248 defsubr (&Sx_display_mm_height);