/* Generic frame functions.
Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006 Free Software Foundation, Inc.
+ 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Emacs.
Lisp_Object Qvisible;
Lisp_Object Qdisplay_type;
Lisp_Object Qbackground_mode;
-Lisp_Object Qinhibit_default_face_x_resources;
Lisp_Object Qx_frame_parameter;
Lisp_Object Qx_resource_name;
Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth;
+Lisp_Object Qinhibit_face_set_after_frame_default;
Lisp_Object Qface_set_after_frame_default;
Lisp_Object Vterminal_frame;
#else
#ifdef WINDOWSNT
f->output_method = output_termcap;
- f->output_data.x = &tty_display; /* XXX ??? */
+ f->terminal = terminal;
+ f->terminal->reference_count++;
+ create_w32cons_output (f);
#else
#ifdef MAC_OS8
make_mac_terminal_frame (f);
else
delete_terminal (terminal);
}
+#ifdef MULTI_KBOARD
else
kb = terminal->kboard;
+#endif
}
/* If we've deleted the last_nonminibuf_frame, then try to find
DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0,
doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
The position is given in character cells, where (0, 0) is the
-upper-left corner.
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
If Emacs is running on a mouseless terminal or hasn't been programmed
to read the mouse position, it returns the selected frame for FRAME
and nil for X and Y.
Smouse_pixel_position, 0, 0, 0,
doc: /* Return a list (FRAME X . Y) giving the current mouse frame and position.
The position is given in pixel units, where (0, 0) is the
-upper-left corner.
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
If Emacs is running on a mouseless terminal or hasn't been programmed
to read the mouse position, it returns the selected frame for FRAME
and nil for X and Y. */)
so the coordinates of the top left character in the frame
may be nonzero due to left-hand scroll bars or the menu bar.
+The position is given in character cells, where (0, 0) is the
+upper-left corner of the frame, X is the horizontal offset, and Y is
+the vertical offset.
+
This function is a no-op for an X frame that is not visible.
If you have just created a frame, you must wait for it to become visible
before calling this function on it, like this.
DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position,
Sset_mouse_pixel_position, 3, 3, 0,
doc: /* Move the mouse pointer to pixel position (X,Y) in FRAME.
+The position is given in pixels, where (0, 0) is the upper-left corner
+of the frame, X is the horizontal offset, and Y is the vertical offset.
+
Note, this is a no-op for an X frame that is not visible.
If you have just created a frame, you must wait for it to become visible
before calling this function on it, like this.
{
FRAME_PTR f;
register Lisp_Object tail, prop, val;
- int count = SPECPDL_INDEX ();
-
- /* Bind this to t to inhibit initialization of the default face from
- X resources in face-set-after-frame-default. If we don't inhibit
- this, modifying the `font' frame parameter, for example, while
- there is a `default.attributeFont' X resource, won't work,
- because `default's font is reset to the value of the X resource
- and that resets the `font' frame parameter. */
- specbind (Qinhibit_default_face_x_resources, Qt);
if (EQ (frame, Qnil))
frame = selected_frame;
call1 (Qframe_set_background_mode, frame);
}
}
-
- return unbind_to (count, Qnil);
}
DEFUN ("frame-with-environment", Fframe_with_environment, Sframe_with_environment, 0, 1, 0,
extern Lisp_Object Qtop;
/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
- wanted positions of the WM window (not emacs window).
+ wanted positions of the WM window (not Emacs window).
Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
window (FRAME_X_WINDOW).
*/
|| EQ (prop, Qfullscreen))
{
register Lisp_Object param_index, old_value;
+ int count = SPECPDL_INDEX ();
old_value = get_frame_param (f, prop);
fullscreen_is_being_set |= EQ (prop, Qfullscreen);
if (NILP (Fequal (val, old_value)))
{
+ /* For :font attributes, the frame_parm_handler
+ x_set_font calls `face-set-after-frame-default'.
+ Unless we bind inhibit-face-set-after-frame-default
+ here, this would reset the :font attribute that we
+ just applied to the default value for new faces. */
+ specbind (Qinhibit_face_set_after_frame_default, Qt);
+
store_frame_param (f, prop, val);
param_index = Fget (prop, Qx_frame_parameter);
< sizeof (frame_parms)/sizeof (frame_parms[0]))
&& FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])
(*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value);
+ unbind_to (count, Qnil);
}
}
}
f->want_fullscreen = FULLSCREEN_WIDTH;
else if (EQ (new_value, Qfullheight))
f->want_fullscreen = FULLSCREEN_HEIGHT;
+
+ if (FRAME_TERMINAL (f)->fullscreen_hook != NULL)
+ FRAME_TERMINAL (f)->fullscreen_hook (f);
}
else if (NATNUMP (new_value))
f->extra_line_spacing = XFASTINT (new_value);
else
- Fsignal (Qerror, Fcons (build_string ("Invalid line-spacing"),
- Fcons (new_value, Qnil)));
+ signal_error ("Invalid line-spacing", new_value);
if (FRAME_VISIBLE_P (f))
redraw_frame (f);
}
struct frame *f;
Lisp_Object new_value, old_value;
{
+ Lisp_Object bgcolor;
+
if (NILP (new_value))
f->gamma = 0;
else if (NUMBERP (new_value) && XFLOATINT (new_value) > 0)
/* The value 0.4545 is the normal viewing gamma. */
f->gamma = 1.0 / (0.4545 * XFLOATINT (new_value));
else
- Fsignal (Qerror, Fcons (build_string ("Invalid screen-gamma"),
- Fcons (new_value, Qnil)));
+ signal_error ("Invalid screen-gamma", new_value);
+
+ /* Apply the new gamma value to the frame background. */
+ bgcolor = Fassq (Qbackground_color, f->param_alist);
+ if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor)))
+ {
+ Lisp_Object index = Fget (Qbackground_color, Qx_frame_parameter);
+ if (NATNUMP (index)
+ && (XFASTINT (index)
+ < sizeof (frame_parms)/sizeof (frame_parms[0]))
+ && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (index)])
+ (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (index)])
+ (f, bgcolor, Qnil);
+ }
- clear_face_cache (0);
+ Fclear_face_cache (Qnil);
}
Qface_set_after_frame_default = intern ("face-set-after-frame-default");
staticpro (&Qface_set_after_frame_default);
+ Qinhibit_face_set_after_frame_default
+ = intern ("inhibit-face-set-after-frame-default");
+ staticpro (&Qinhibit_face_set_after_frame_default);
+
Qfullwidth = intern ("fullwidth");
staticpro (&Qfullwidth);
Qfullheight = intern ("fullheight");
Vdefault_frame_scroll_bars = Qnil;
#endif
- Qinhibit_default_face_x_resources
- = intern ("inhibit-default-face-x-resources");
- staticpro (&Qinhibit_default_face_x_resources);
-
DEFVAR_LISP ("terminal-frame", &Vterminal_frame,
doc: /* The initial frame-object, which represents Emacs's stdout. */);
DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified,
- doc: /* Non-nil if all of emacs is iconified and frame updates are not needed. */);
+ doc: /* Non-nil if all of Emacs is iconified and frame updates are not needed. */);
Vemacs_iconified = Qnil;
DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function,