Reduce code duplication in ns_set_appearance
* src/nsterm.h (ns_set_appearance_1): Declare. * src/nsterm.m (ns_set_appearance_1): Break out new function... (ns_set_appearance): ...here. * src/nsfns.m (Fx_create_frame): Use above new function.
This commit is contained in:
parent
81c21d89ed
commit
92b373318d
3 changed files with 14 additions and 12 deletions
|
@ -1404,12 +1404,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side.
|
|||
#ifdef NS_IMPL_COCOA
|
||||
tem = gui_display_get_arg (dpyinfo, parms, Qns_appearance, NULL, NULL,
|
||||
RES_TYPE_SYMBOL);
|
||||
if (EQ (tem, Qdark))
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark;
|
||||
else if (EQ (tem, Qlight))
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_aqua;
|
||||
else
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_system_default;
|
||||
ns_set_appearance_1 (f, tem);
|
||||
store_frame_param (f, Qns_appearance,
|
||||
(!NILP (tem) && !EQ (tem, Qunbound)) ? tem : Qnil);
|
||||
|
||||
|
|
|
@ -1236,6 +1236,7 @@ extern void ns_set_no_accept_focus (struct frame *f, Lisp_Object new_value,
|
|||
extern void ns_set_z_group (struct frame *f, Lisp_Object new_value,
|
||||
Lisp_Object old_value);
|
||||
#ifdef NS_IMPL_COCOA
|
||||
extern void ns_set_appearance_1 (struct frame *f, Lisp_Object value);
|
||||
extern void ns_set_appearance (struct frame *f, Lisp_Object new_value,
|
||||
Lisp_Object old_value);
|
||||
extern void ns_set_transparent_titlebar (struct frame *f,
|
||||
|
|
18
src/nsterm.m
18
src/nsterm.m
|
@ -1931,6 +1931,17 @@ Hide the window (X11 semantics)
|
|||
}
|
||||
|
||||
#ifdef NS_IMPL_COCOA
|
||||
void
|
||||
ns_set_appearance_1 (struct frame *f, Lisp_Object new_value)
|
||||
{
|
||||
if (EQ (new_value, Qdark))
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark;
|
||||
else if (EQ (new_value, Qlight))
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_aqua;
|
||||
else
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_system_default;
|
||||
}
|
||||
|
||||
void
|
||||
ns_set_appearance (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
|
||||
{
|
||||
|
@ -1943,12 +1954,7 @@ Hide the window (X11 semantics)
|
|||
if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10)
|
||||
return;
|
||||
|
||||
if (EQ (new_value, Qdark))
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_vibrant_dark;
|
||||
else if (EQ (new_value, Qlight))
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_aqua;
|
||||
else
|
||||
FRAME_NS_APPEARANCE (f) = ns_appearance_system_default;
|
||||
ns_set_appearance_1 (f, new_value);
|
||||
|
||||
[window setAppearance];
|
||||
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 */
|
||||
|
|
Loading…
Add table
Reference in a new issue