Lisp_Object ns_use_system_highlight_color;
NSString *ns_selection_color;
+/* Confirm on exit. */
+Lisp_Object ns_confirm_quit;
NSArray *ns_send_types =0, *ns_return_types =0, *ns_drag_types =0;
}
+void
+ns_query_color(void *col, XColor *color_def, int setPixel)
+/* --------------------------------------------------------------------------
+ Get ARGB values out of NSColor col and put them into color_def.
+ If setPixel, set the pixel to a concatenated version.
+ and set color_def pixel to the resulting index.
+ -------------------------------------------------------------------------- */
+{
+ float r, g, b, a;
+
+ [((NSColor *)col) getRed: &r green: &g blue: &b alpha: &a];
+ color_def->red = r * 65535;
+ color_def->green = g * 65535;
+ color_def->blue = b * 65535;
+
+ if (setPixel == YES)
+ color_def->pixel
+ = ARGB_TO_ULONG((int)(a*255),
+ (int)(r*255), (int)(g*255), (int)(b*255));
+}
+
+
int
ns_defined_color (struct frame *f, char *name, XColor *color_def, int alloc,
char makeIndex)
-------------------------------------------------------------------------- */
{
NSColor *temp;
- float r, g, b, a;
int notFound = ns_get_color (name, &temp);
NSTRACE (ns_defined_color);
if (makeIndex && alloc)
color_def->pixel = ns_index_color(temp, f); /* [temp retain]; */
- [temp getRed: &r green: &g blue: &b alpha: &a];
- color_def->red = r * 65535;
- color_def->green = g * 65535;
- color_def->blue = b * 65535;
-
- if (!makeIndex)
- color_def->pixel
- = ARGB_TO_ULONG((int)(a*255),
- (int)(r*255), (int)(g*255), (int)(b*255));
+ ns_query_color (temp, color_def, !makeIndex);
return 1;
}
BLOCK_INPUT;
#ifdef COCOA_EXPERIMENTAL_CTRL_G
- /* causes Feval to abort; unclear on why this isn't in calling code */
+ /* causes Feval to abort; should probably set this in calling code when
+ it IS actually called from signal handler (which is only the case
+ under NS if SYNC_INPUT is off) */
++handling_signal;
#endif
ns_antialias_threshold = 10.0; /* not exposed to lisp side */
ns_use_qd_smoothing = Qnil;
ns_use_system_highlight_color = Qt;
+ ns_confirm_quit = Qnil;
}
}
-void
-ns_initialize ()
-/* --------------------------------------------------------------------------
- Mainly vestigial under NS now that ns_create_terminal () does most things.
- -------------------------------------------------------------------------- */
-{
- baud_rate = 38400;
- Fset_input_interrupt_mode (Qt);
-}
-
-
struct ns_display_info *
ns_term_init (Lisp_Object display_name)
/* --------------------------------------------------------------------------
Start the Application and get things rolling.
-------------------------------------------------------------------------- */
{
- extern Lisp_Object Fset_input_mode (Lisp_Object, Lisp_Object,
- Lisp_Object, Lisp_Object);
struct terminal *terminal;
struct ns_display_info *dpyinfo;
static int ns_initialized = 0;
if (!ns_initialized)
{
- ns_initialize ();
+ baud_rate = 38400;
+ Fset_input_interrupt_mode (Qnil);
ns_initialized = 1;
}
Qt, Qnil, NO, NO);
ns_default ("UseSystemHighlightColor", &ns_use_system_highlight_color,
Qt, Qnil, NO, NO);
+ ns_default ("ConfirmQuit", &ns_confirm_quit,
+ Qt, Qnil, NO, NO);
}
if (EQ (ns_use_system_highlight_color, Qt))
{
int ret;
- if (ns_shutdown_properly)
+ if (ns_shutdown_properly || NILP (ns_confirm_quit))
return NSTerminateNow;
/* XXX: This while() loop is needed because if the user switches to another
[smoothFontsCheck setState: (NILP (ns_antialias_text) ? NO : YES)];
[useQuickdrawCheck setState: (NILP (ns_use_qd_smoothing) ? NO : YES)];
[useSysHiliteCheck setState: (NILP (prevUseHighlightColor) ? NO : YES)];
+ [confirmQuitCheck setState: (NILP (ns_confirm_quit) ? NO : YES)];
#endif
}
ns_antialias_text = [smoothFontsCheck state] ? Qt : Qnil;
ns_use_qd_smoothing = [useQuickdrawCheck state] ? Qt : Qnil;
ns_use_system_highlight_color = [useSysHiliteCheck state] ? Qt : Qnil;
+ ns_confirm_quit = [confirmQuitCheck state] ? Qt : Qnil;
if (! EQ (ns_use_system_highlight_color, prevUseHighlightColor))
{
prevUseHighlightColor = ns_use_system_highlight_color;
&ns_use_system_highlight_color,
"Whether to use the system default (on OS X only) for the highlight color. Nil means to use standard emacs (prior to version 21) 'grey'.");
+ DEFVAR_LISP ("ns-confirm-quit", &ns_confirm_quit,
+ "Whether to confirm application quit using dialog.");
+
staticpro (&ns_display_name_list);
ns_display_name_list = Qnil;