diff options
| author | Eli Zaretskii <eliz@gnu.org> | 2013-09-26 10:37:16 +0300 |
|---|---|---|
| committer | Eli Zaretskii <eliz@gnu.org> | 2013-09-26 10:37:16 +0300 |
| commit | b87c4ff2817e71ca71b028792200b1e069a95e04 (patch) | |
| tree | bfe00c0655fa02078a9ab2c633ea06d90c4a2064 /src/frame.c | |
| parent | bbc108377873aa6ed7cf21c731770103096eea39 (diff) | |
| parent | ba355de014b75ed104da4777f909db70d62f2357 (diff) | |
| download | emacs-b87c4ff2817e71ca71b028792200b1e069a95e04.tar.gz | |
Merge from trunk.
Diffstat (limited to 'src/frame.c')
| -rw-r--r-- | src/frame.c | 103 |
1 files changed, 65 insertions, 38 deletions
diff --git a/src/frame.c b/src/frame.c index b4638ed53c8..2e90713b6c3 100644 --- a/src/frame.c +++ b/src/frame.c @@ -19,8 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> -#define FRAME_INLINE EXTERN_INLINE - #include <stdio.h> #include <errno.h> #include <limits.h> @@ -115,6 +113,19 @@ static Lisp_Object Qdelete_frame_functions; 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 @@ -224,7 +235,7 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) FRAME_WINDOW_SIZES_CHANGED (f) = 1; FRAME_MENU_BAR_LINES (f) = nlines; set_menu_bar_lines_1 (f->root_window, nlines - olines); - adjust_glyphs (f); + adjust_frame_glyphs (f); } } @@ -548,6 +559,8 @@ make_initial_frame (void) if (!noninteractive) init_frame_faces (f); + last_nonminibuf_frame = f; + return f; } @@ -712,7 +725,7 @@ affects all frames on the same terminal device. */) change_frame_size (f, height, width, 0, 0, 0); } - adjust_glyphs (f); + adjust_frame_glyphs (f); calculate_costs (f); XSETFRAME (frame, f); @@ -1108,7 +1121,7 @@ other_visible_frames (struct frame *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 @@ -1901,6 +1914,17 @@ See `redirect-frame-focus'. */) 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; +} /* Return the value of frame parameter PROP in frame FRAME. */ @@ -2207,7 +2231,7 @@ If FRAME is nil, describe the currently selected 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)) @@ -2598,7 +2622,7 @@ x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int { 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; @@ -2973,9 +2997,9 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) (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); @@ -3358,9 +3382,6 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 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)) @@ -3373,22 +3394,6 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) 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) { @@ -3440,7 +3445,33 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) return; } - +#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. @@ -3512,11 +3543,6 @@ validate_x_resource_name (void) } } - -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. */ @@ -3631,7 +3657,7 @@ x_get_resource_string (const char *attribute, const char *class) 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; @@ -3753,7 +3779,7 @@ x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, 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); } @@ -3767,7 +3793,7 @@ x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist, { 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); @@ -3971,7 +3997,7 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p) { 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 @@ -4524,6 +4550,7 @@ automatically. See also `mouse-autoselect-window'. */); defsubr (&Svisible_frame_list); defsubr (&Sraise_frame); defsubr (&Slower_frame); + defsubr (&Sx_focus_frame); defsubr (&Sredirect_frame_focus); defsubr (&Sframe_focus); defsubr (&Sframe_parameters); |
