#include <config.h>
-#define FRAME_INLINE EXTERN_INLINE
-
#include <stdio.h>
#include <errno.h>
#include <limits.h>
static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
+/* The currently selected frame. */
+
+Lisp_Object selected_frame;
+
+/* A frame which is not just a mini-buffer, or NULL if there are no such
+ frames. This is usually the most recent such frame that was selected. */
+
+static struct frame *last_nonminibuf_frame;
+
+/* Nonzero means there is at least one garbaged frame. */
+
+bool frame_garbaged;
+
#ifdef HAVE_WINDOW_SYSTEM
static void x_report_frame_params (struct frame *, Lisp_Object *);
#endif
initialize enum members explicitly even if their values are zero. */
f->wants_modeline = 1;
f->garbaged = 1;
- f->has_minibuffer = mini_p;
f->vertical_scroll_bar_type = vertical_scroll_bar_none;
f->column_width = 1; /* !FRAME_WINDOW_P value */
f->line_height = 1; /* !FRAME_WINDOW_P value */
f->auto_lower = 0;
f->no_split = 1;
f->wants_modeline = 0;
- f->has_minibuffer = 1;
/* Now label the root window as also being the minibuffer.
Avoid infinite looping on the window chain by marking next pointer
if (!noninteractive)
init_frame_faces (f);
+ last_nonminibuf_frame = f;
+
return f;
}
/* Verify that we can still talk to the frame's X window,
and note any recent change in visibility. */
-#ifdef HAVE_WINDOW_SYSTEM
+#ifdef HAVE_X_WINDOWS
if (FRAME_WINDOW_P (XFRAME (this)))
x_sync (XFRAME (this));
#endif
delete_frame (Lisp_Object frame, Lisp_Object force)
{
struct frame *f = decode_any_frame (frame);
- struct frame *sf = SELECTED_FRAME ();
+ struct frame *sf;
struct kboard *kb;
int minibuffer_selected, is_tooltip_frame;
There is no more chance for errors to prevent it. */
minibuffer_selected = EQ (minibuf_window, selected_window);
-
+ sf = SELECTED_FRAME ();
/* Don't let the frame remain selected. */
if (f == sf)
{
have called the window-system-dependent frame destruction
routine. */
- if (FRAME_TERMINAL (f)->delete_frame_hook)
- (*FRAME_TERMINAL (f)->delete_frame_hook) (f);
{
+ block_input ();
+ if (FRAME_TERMINAL (f)->delete_frame_hook)
+ (*FRAME_TERMINAL (f)->delete_frame_hook) (f);
struct terminal *terminal = FRAME_TERMINAL (f);
f->output_data.nothing = 0;
f->terminal = 0; /* Now the frame is dead. */
+ unblock_input ();
/* If needed, delete the terminal that this frame was on.
(This must be done after the frame is killed.) */
return FRAME_FOCUS_FRAME (decode_live_frame (frame));
}
+DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0,
+ doc: /* Set the input focus to FRAME.
+FRAME nil means use the selected frame.
+If there is no window system support, this function does nothing. */)
+ (Lisp_Object frame)
+{
+#ifdef HAVE_WINDOW_SYSTEM
+ x_focus_frame (decode_window_system_frame (frame));
+#endif
+ return Qnil;
+}
\f
/* Return the value of frame parameter PROP in frame FRAME. */
value = f->name;
#ifdef HAVE_X_WINDOWS
else if (EQ (parameter, Qdisplay) && FRAME_X_P (f))
- value = XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element);
+ value = XCAR (FRAME_DISPLAY_INFO (f)->name_list_element);
#endif /* HAVE_X_WINDOWS */
else if (EQ (parameter, Qbackground_color)
|| EQ (parameter, Qforeground_color))
{
int newwidth = FRAME_COLS (f);
int newheight = FRAME_LINES (f);
- Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
*top_pos = f->top_pos;
*left_pos = f->left_pos;
(FRAME_VISIBLE_P (f) ? Qt
: FRAME_ICONIFIED_P (f) ? Qicon : Qnil));
store_in_alist (alistptr, Qdisplay,
- XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element));
+ XCAR (FRAME_DISPLAY_INFO (f)->name_list_element));
- if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window)
+ if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_DISPLAY_INFO (f)->root_window)
tem = Qnil;
else
tem = make_natnum ((uintptr_t) FRAME_X_OUTPUT (f)->parent_desc);
else if (RANGED_INTEGERP (1, arg, INT_MAX)
&& XFASTINT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
{
- if (XFASTINT (arg) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM)
- XSETINT (arg, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM + 1);
-
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFASTINT (arg);
FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid;
if (FRAME_X_WINDOW (f))
XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0;
}
-
-
-/* Return non-nil if frame F wants a bitmap icon. */
-
-Lisp_Object
-x_icon_type (struct frame *f)
-{
- Lisp_Object tem;
-
- tem = assq_no_quit (Qicon_type, f->param_alist);
- if (CONSP (tem))
- return XCDR (tem);
- else
- return Qnil;
-}
-
void
x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
return;
}
-\f
+#ifndef HAVE_NS
+
+/* Non-zero if mouse is grabbed on DPYINFO
+ and we know the frame where it is. */
+
+bool x_mouse_grabbed (Display_Info *dpyinfo)
+{
+ return (dpyinfo->grabbed
+ && dpyinfo->last_mouse_frame
+ && FRAME_LIVE_P (dpyinfo->last_mouse_frame));
+}
+
+/* Re-highlight something with mouse-face properties
+ on DPYINFO using saved frame and mouse position. */
+
+void
+x_redo_mouse_highlight (Display_Info *dpyinfo)
+{
+ if (dpyinfo->last_mouse_motion_frame
+ && FRAME_LIVE_P (dpyinfo->last_mouse_motion_frame))
+ note_mouse_highlight (dpyinfo->last_mouse_motion_frame,
+ dpyinfo->last_mouse_motion_x,
+ dpyinfo->last_mouse_motion_y);
+}
+
+#endif /* HAVE_NS */
+
/* Subroutines of creating an X frame. */
/* Make sure that Vx_resource_name is set to a reasonable value.
}
}
-
-extern char *x_get_string_resource (XrmDatabase, const char *, const char *);
-extern Display_Info *check_x_display_info (Lisp_Object);
-
-
/* Get specified attribute from resource database RDB.
See Fx_get_resource below for other parameters. */
esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute);
sprintf (class_key, "%s.%s", EMACS_CLASS, class);
- result = x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb,
+ result = x_get_string_resource (FRAME_DISPLAY_INFO (sf)->xrdb,
name_key, class_key);
SAFE_FREE ();
return result;
const char *attribute, const char *class,
enum resource_types type)
{
- return x_get_arg (FRAME_X_DISPLAY_INFO (f),
+ return x_get_arg (FRAME_DISPLAY_INFO (f),
alist, param, attribute, class, type);
}
{
Lisp_Object value;
- value = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, param,
+ value = x_get_arg (FRAME_DISPLAY_INFO (f), alist, param,
attribute, class, type);
if (! NILP (value) && ! EQ (value, Qunbound))
store_frame_param (f, param, value);
{
int mask = NoValue;
char *strind;
- unsigned long int tempWidth, tempHeight;
+ unsigned long tempWidth, tempHeight;
long int tempX, tempY;
char *nextCharacter;
{
register Lisp_Object tem0, tem1, tem2;
long window_prompting = 0;
- Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
/* Default values if we fall through.
Actually, if that happens we should get
defsubr (&Svisible_frame_list);
defsubr (&Sraise_frame);
defsubr (&Slower_frame);
+ defsubr (&Sx_focus_frame);
defsubr (&Sredirect_frame_focus);
defsubr (&Sframe_focus);
defsubr (&Sframe_parameters);