summaryrefslogtreecommitdiff
path: root/src/nsfns.m
diff options
context:
space:
mode:
authorYuuki Harano <masm+github@masm11.me>2021-11-11 00:39:53 +0900
committerYuuki Harano <masm+github@masm11.me>2021-11-11 00:39:53 +0900
commit4dd1f56f29fc598a8339a345c2f8945250600602 (patch)
treeaf341efedffe027e533b1bcc0dbf270532e48285 /src/nsfns.m
parent4c49ec7f865bdad1629d2f125f71f4e506b258f2 (diff)
parent810fa21d26453f898de9747ece7205dfe6de9d08 (diff)
downloademacs-4dd1f56f29fc598a8339a345c2f8945250600602.tar.gz
emacs-4dd1f56f29fc598a8339a345c2f8945250600602.tar.bz2
emacs-4dd1f56f29fc598a8339a345c2f8945250600602.zip
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'src/nsfns.m')
-rw-r--r--src/nsfns.m80
1 files changed, 74 insertions, 6 deletions
diff --git a/src/nsfns.m b/src/nsfns.m
index 454a6fdab62..f4d81722460 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -609,13 +609,72 @@ ns_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
}
}
+void
+ns_change_tab_bar_height (struct frame *f, int height)
+{
+ int unit = FRAME_LINE_HEIGHT (f);
+ int old_height = FRAME_TAB_BAR_HEIGHT (f);
+ int lines = (height + unit - 1) / unit;
+ Lisp_Object fullscreen = get_frame_param (f, Qfullscreen);
+
+ /* Make sure we redisplay all windows in this frame. */
+ fset_redisplay (f);
+
+ /* Recalculate tab bar and frame text sizes. */
+ FRAME_TAB_BAR_HEIGHT (f) = height;
+ FRAME_TAB_BAR_LINES (f) = lines;
+ store_frame_param (f, Qtab_bar_lines, make_fixnum (lines));
+
+ if (FRAME_NS_WINDOW (f) && FRAME_TAB_BAR_HEIGHT (f) == 0)
+ {
+ clear_frame (f);
+ clear_current_matrices (f);
+ }
+
+ if ((height < old_height) && WINDOWP (f->tab_bar_window))
+ clear_glyph_matrix (XWINDOW (f->tab_bar_window)->current_matrix);
+
+ if (!f->tab_bar_resized)
+ {
+ /* As long as tab_bar_resized is false, effectively try to change
+ F's native height. */
+ if (NILP (fullscreen) || EQ (fullscreen, Qfullwidth))
+ adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
+ 1, false, Qtab_bar_lines);
+ else
+ adjust_frame_size (f, -1, -1, 4, false, Qtab_bar_lines);
+
+ f->tab_bar_resized = f->tab_bar_redisplayed;
+ }
+ else
+ /* Any other change may leave the native size of F alone. */
+ adjust_frame_size (f, -1, -1, 3, false, Qtab_bar_lines);
+
+ /* adjust_frame_size might not have done anything, garbage frame
+ here. */
+ adjust_frame_glyphs (f);
+ SET_FRAME_GARBAGED (f);
+}
/* tabbar support */
static void
ns_set_tab_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
- /* Currently unimplemented. */
- NSTRACE ("ns_set_tab_bar_lines");
+ int olines = FRAME_TAB_BAR_LINES (f);
+ int nlines;
+
+ /* Treat tab bars like menu bars. */
+ if (FRAME_MINIBUF_ONLY_P (f))
+ return;
+
+ /* Use VALUE only if an int >= 0. */
+ if (RANGED_FIXNUMP (0, value, INT_MAX))
+ nlines = XFIXNAT (value);
+ else
+ nlines = 0;
+
+ if (nlines != olines && (olines == 0 || nlines == 0))
+ ns_change_tab_bar_height (f, nlines * FRAME_LINE_HEIGHT (f));
}
@@ -947,11 +1006,7 @@ frame_parm_handler ns_frame_parm_handlers[] =
0, /* x_set_sticky */
0, /* x_set_tool_bar_position */
0, /* x_set_inhibit_double_buffering */
-#ifdef NS_IMPL_COCOA
ns_set_undecorated,
-#else
- 0, /* ns_set_undecorated */
-#endif
ns_set_parent_frame,
0, /* x_set_skip_taskbar */
ns_set_no_focus_on_map,
@@ -1181,6 +1236,7 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
"fontBackend", "FontBackend", RES_TYPE_STRING);
{
+#ifdef NS_IMPL_COCOA
/* use for default font name */
id font = [NSFont userFixedPitchFontOfSize: -1.0]; /* default */
gui_default_parameter (f, parms, Qfontsize,
@@ -1195,6 +1251,11 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
build_string (fontname),
"font", "Font", RES_TYPE_STRING);
xfree (fontname);
+#else
+ gui_default_parameter (f, parms, Qfont,
+ build_string ("fixed"),
+ "font", "Font", RES_TYPE_STRING);
+#endif
}
unblock_input ();
@@ -1347,6 +1408,11 @@ DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
f->output_data.ns->in_animation = NO;
+#ifdef NS_IMPL_COCOA
+ /* If the app has previously been disabled, start it up again. */
+ [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
+#endif
+
[[EmacsView alloc] initFrameFromEmacs: f];
ns_icon (f, parms);
@@ -1965,12 +2031,14 @@ is layered in front of the windows of other applications. */)
[NSApp unhide: NSApp];
[NSApp activateIgnoringOtherApps: YES];
}
+#if GNUSTEP_GUI_MAJOR_VERSION > 0 || GNUSTEP_GUI_MINOR_VERSION >= 27
else if (EQ (on, intern ("activate-front")))
{
[NSApp unhide: NSApp];
[[NSRunningApplication currentApplication]
activateWithOptions: NSApplicationActivateIgnoringOtherApps];
}
+#endif
else if (NILP (on))
[NSApp unhide: NSApp];
else