/* Functions for the X window system.
-Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2013 Free Software Foundation, Inc.
This file is part of GNU Emacs.
FRAME_PTR
check_x_frame (Lisp_Object frame)
{
- FRAME_PTR f;
+ struct frame *f = decode_live_frame (frame);
- if (NILP (frame))
- frame = selected_frame;
- CHECK_LIVE_FRAME (frame);
- f = XFRAME (frame);
if (! FRAME_X_P (f))
error ("Non-X frame used");
return f;
Lisp_Object tail, frame;
struct frame *f;
- if (wdesc == None) return 0;
+ if (wdesc == None)
+ return NULL;
- for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
+ FOR_EACH_FRAME (tail, frame)
{
- frame = XCAR (tail);
- if (!FRAMEP (frame))
- continue;
f = XFRAME (frame);
if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue;
x_any_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
{
Lisp_Object tail, frame;
- struct frame *f, *found;
+ struct frame *f, *found = NULL;
struct x_output *x;
- if (wdesc == None) return NULL;
+ if (wdesc == None)
+ return NULL;
- found = NULL;
- for (tail = Vframe_list; CONSP (tail) && !found; tail = XCDR (tail))
+ FOR_EACH_FRAME (tail, frame)
{
- frame = XCAR (tail);
- if (!FRAMEP (frame))
- continue;
-
+ if (found)
+ break;
f = XFRAME (frame);
if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo)
{
struct frame *f;
struct x_output *x;
- if (wdesc == None) return 0;
+ if (wdesc == None)
+ return NULL;
- for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
+ FOR_EACH_FRAME (tail, frame)
{
- frame = XCAR (tail);
- if (!FRAMEP (frame))
- continue;
f = XFRAME (frame);
if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue;
struct frame *f;
struct x_output *x;
- if (wdesc == None) return 0;
+ if (wdesc == None)
+ return NULL;
- for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
+ FOR_EACH_FRAME (tail, frame)
{
- frame = XCAR (tail);
- if (!FRAMEP (frame))
- continue;
f = XFRAME (frame);
if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
continue;
/* Decide if color named COLOR_NAME is valid for use on frame F. If
- so, return the RGB values in COLOR. If ALLOC_P is non-zero,
- allocate the color. Value is zero if COLOR_NAME is invalid, or
+ so, return the RGB values in COLOR. If ALLOC_P,
+ allocate the color. Value is false if COLOR_NAME is invalid, or
no color could be allocated. */
-int
+bool
x_defined_color (struct frame *f, const char *color_name,
- XColor *color, int alloc_p)
+ XColor *color, bool alloc_p)
{
- int success_p = 0;
+ bool success_p = 0;
Display *dpy = FRAME_X_DISPLAY (f);
Colormap cmap = FRAME_X_COLORMAP (f);
success_p = xg_check_special_colors (f, color_name, color);
#endif
if (!success_p)
- success_p = XParseColor (dpy, cmap, color_name, color);
+ success_p = XParseColor (dpy, cmap, color_name, color) != 0;
if (success_p && alloc_p)
success_p = x_alloc_nearest_color (f, cmap, color);
unblock_input ();
DEFUN ("x-wm-set-size-hint", Fx_wm_set_size_hint, Sx_wm_set_size_hint,
0, 1, 0,
doc: /* Send the size hints for frame FRAME to the window manager.
-If FRAME is nil, use the selected frame. */)
+If FRAME is omitted or nil, use the selected frame.
+Signal error if FRAME is not an X frame. */)
(Lisp_Object frame)
{
- struct frame *f;
- if (NILP (frame))
- frame = selected_frame;
- f = XFRAME (frame);
+ struct frame *f = check_x_frame (frame);
+
block_input ();
- if (FRAME_X_P (f))
- x_wm_set_size_hint (f, 0, 0);
+ x_wm_set_size_hint (f, 0, 0);
unblock_input ();
return Qnil;
}
XSETFRAME (frame, f);
- /* Note that X Windows does support scroll bars. */
- FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
-
f->terminal = dpyinfo->terminal;
f->output_method = output_x_window;
return FRAME_PIXEL_HEIGHT (f);
}
-int
-x_char_width (register struct frame *f)
-{
- return FRAME_COLUMN_WIDTH (f);
-}
-
-int
-x_char_height (register struct frame *f)
-{
- return FRAME_LINE_HEIGHT (f);
-}
-
-
-\f
/************************************************************************
X Displays
************************************************************************/
Finsert (1, &text);
set_buffer_internal_1 (old_buffer);
- FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
record_unwind_protect (unwind_create_tip_frame, frame);
f->terminal = dpyinfo->terminal;
selection box, if specified. If MUSTMATCH is non-nil, the returned file
or directory must exist.
-This function is only defined on MS Windows, and X Windows with the
+This function is only defined on NS, MS Windows, and X Windows with the
Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
(Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
selection box, if specified. If MUSTMATCH is non-nil, the returned file
or directory must exist.
-This function is only defined on MS Windows, and X Windows with the
+This function is only defined on NS, MS Windows, and X Windows with the
Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
(Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)