extern int extra_keyboard_modifiers;
+/* The keysyms to use for the various modifiers. */
+
+static Lisp_Object Qalt, Qhyper, Qsuper, Qmodifier_value;
+
static Lisp_Object Qvendor_specific_keysyms;
#if 0
static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int,
enum text_cursor_kinds));
-static void x_clip_to_row P_ ((struct window *, struct glyph_row *, GC));
+static void x_clip_to_row P_ ((struct window *, struct glyph_row *, int, GC));
static void x_flush P_ ((struct frame *f));
static void x_update_begin P_ ((struct frame *));
static void x_update_window_begin P_ ((struct window *));
int oldVH = row->visible_height;
row->visible_height = p->h;
row->y -= rowY - p->y;
- x_clip_to_row (w, row, gc);
+ x_clip_to_row (w, row, -1, gc);
row->y = oldY;
row->visible_height = oldVH;
}
else
- x_clip_to_row (w, row, gc);
+ x_clip_to_row (w, row, -1, gc);
if (p->bx >= 0 && !p->overlay_p)
{
mode lines must be clipped to the whole window. */
static void
-x_clip_to_row (w, row, gc)
+x_clip_to_row (w, row, area, gc)
struct window *w;
struct glyph_row *row;
+ int area;
GC gc;
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
Rect clip_rect;
- int window_y, window_width;
+ int window_x, window_y, window_width;
- window_box (w, -1, 0, &window_y, &window_width, 0);
+ window_box (w, area, &window_x, &window_y, &window_width, 0);
- clip_rect.left = WINDOW_TO_FRAME_PIXEL_X (w, 0);
+ clip_rect.left = window_x;
clip_rect.top = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
clip_rect.top = max (clip_rect.top, window_y);
clip_rect.right = clip_rect.left + window_width;
gc = dpyinfo->scratch_cursor_gc;
/* Set clipping, draw the rectangle, and reset clipping again. */
- x_clip_to_row (w, row, gc);
+ x_clip_to_row (w, row, TEXT_AREA, gc);
mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h);
mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f));
}
width = min (cursor_glyph->pixel_width, width);
w->phys_cursor_width = width;
- x_clip_to_row (w, row, gc);
+ x_clip_to_row (w, row, TEXT_AREA, gc);
if (kind == BAR_CURSOR)
XFillRectangle (dpy, window, gc,
struct frame *f;
{
if (f->async_visible)
- SelectWindow (FRAME_MAC_WINDOW (f));
+ {
+ BLOCK_INPUT;
+ SelectWindow (FRAME_MAC_WINDOW (f));
+ UNBLOCK_INPUT;
+ }
}
/* Lower frame F. */
struct frame *f;
{
if (f->async_visible)
- SendBehind (FRAME_MAC_WINDOW (f), nil);
+ {
+ BLOCK_INPUT;
+ SendBehind (FRAME_MAC_WINDOW (f), nil);
+ UNBLOCK_INPUT;
+ }
}
static void
/* True if using command key as meta key. */
Lisp_Object Vmac_command_key_is_meta;
+/* Modifier associated with the option key, or nil for normal behavior. */
+Lisp_Object Vmac_option_modifier;
+
/* True if the ctrl and meta keys should be reversed. */
Lisp_Object Vmac_reverse_ctrl_meta;
result |= meta_modifier;
if (NILP (Vmac_command_key_is_meta) && (mods & macAltKey))
result |= alt_modifier;
+ if (!NILP (Vmac_option_modifier) && (mods & optionKey)) {
+ Lisp_Object val = Fget(Vmac_option_modifier, Qmodifier_value);
+ if (!NILP(val))
+ result |= XUINT(val);
+ }
+
return result;
}
unsigned long some_state = 0;
inev.code = KeyTranslate (kchr_ptr, new_keycode,
&some_state) & 0xff;
- }
+ } else if (!NILP(Vmac_option_modifier) && (er.modifiers & optionKey))
+ {
+ /* When using the option key as an emacs modifier, convert
+ the pressed key code back to one without the Mac option
+ modifier applied. */
+ int new_modifiers = er.modifiers & ~optionKey;
+ int new_keycode = keycode | new_modifiers;
+ Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
+ unsigned long some_state = 0;
+ inev.code = KeyTranslate (kchr_ptr, new_keycode,
+ &some_state) & 0xff;
+ }
else
inev.code = er.message & charCodeMask;
inev.kind = ASCII_KEYSTROKE_EVENT;
mwp = fp->output_data.mac;
+ BLOCK_INPUT;
if (making_terminal_window)
{
if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL,
/* so that update events can find this mac_output struct */
mwp->mFP = fp; /* point back to emacs frame */
- SetPortWindowPort (mwp->mWP);
-
SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);
+ UNBLOCK_INPUT;
}
signal (SIGPIPE, x_connection_signal);
#endif
+ BLOCK_INPUT;
mac_initialize_display_info ();
#if TARGET_API_MAC_CARBON
if (!inhibit_window_system)
MakeMeTheFrontProcess ();
#endif
+ UNBLOCK_INPUT;
}
x_error_message_string = Qnil;
#endif
+ Qmodifier_value = intern ("modifier-value");
+ Qalt = intern ("alt");
+ Fput (Qalt, Qmodifier_value, make_number (alt_modifier));
+ Qhyper = intern ("hyper");
+ Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier));
+ Qsuper = intern ("super");
+ Fput (Qsuper, Qmodifier_value, make_number (super_modifier));
+
Fprovide (intern ("mac-carbon"), Qnil);
staticpro (&Qreverse);
Otherwise the option key is used. */);
Vmac_command_key_is_meta = Qt;
+ DEFVAR_LISP ("mac-option-modifier", &Vmac_option_modifier,
+ doc: /* Modifier to use for the Mac alt/option key. The value can
+be alt, hyper, or super for the respective modifier. If the value is
+nil then the key will act as the normal Mac option modifier. */);
+ Vmac_option_modifier = Qnil;
+
DEFVAR_LISP ("mac-reverse-ctrl-meta", &Vmac_reverse_ctrl_meta,
doc: /* Non-nil means that the control and meta keys are reversed. This is
useful for non-standard keyboard layouts. */);