diff options
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/>. */ | |||
| 19 | 19 | ||
| 20 | #include <config.h> | 20 | #include <config.h> |
| 21 | 21 | ||
| 22 | #define FRAME_INLINE EXTERN_INLINE | ||
| 23 | |||
| 24 | #include <stdio.h> | 22 | #include <stdio.h> |
| 25 | #include <errno.h> | 23 | #include <errno.h> |
| 26 | #include <limits.h> | 24 | #include <limits.h> |
| @@ -115,6 +113,19 @@ static Lisp_Object Qdelete_frame_functions; | |||
| 115 | 113 | ||
| 116 | static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; | 114 | static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource; |
| 117 | 115 | ||
| 116 | /* The currently selected frame. */ | ||
| 117 | |||
| 118 | Lisp_Object selected_frame; | ||
| 119 | |||
| 120 | /* A frame which is not just a mini-buffer, or NULL if there are no such | ||
| 121 | frames. This is usually the most recent such frame that was selected. */ | ||
| 122 | |||
| 123 | static struct frame *last_nonminibuf_frame; | ||
| 124 | |||
| 125 | /* Nonzero means there is at least one garbaged frame. */ | ||
| 126 | |||
| 127 | bool frame_garbaged; | ||
| 128 | |||
| 118 | #ifdef HAVE_WINDOW_SYSTEM | 129 | #ifdef HAVE_WINDOW_SYSTEM |
| 119 | static void x_report_frame_params (struct frame *, Lisp_Object *); | 130 | static void x_report_frame_params (struct frame *, Lisp_Object *); |
| 120 | #endif | 131 | #endif |
| @@ -224,7 +235,7 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 224 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 235 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 225 | FRAME_MENU_BAR_LINES (f) = nlines; | 236 | FRAME_MENU_BAR_LINES (f) = nlines; |
| 226 | set_menu_bar_lines_1 (f->root_window, nlines - olines); | 237 | set_menu_bar_lines_1 (f->root_window, nlines - olines); |
| 227 | adjust_glyphs (f); | 238 | adjust_frame_glyphs (f); |
| 228 | } | 239 | } |
| 229 | } | 240 | } |
| 230 | 241 | ||
| @@ -548,6 +559,8 @@ make_initial_frame (void) | |||
| 548 | if (!noninteractive) | 559 | if (!noninteractive) |
| 549 | init_frame_faces (f); | 560 | init_frame_faces (f); |
| 550 | 561 | ||
| 562 | last_nonminibuf_frame = f; | ||
| 563 | |||
| 551 | return f; | 564 | return f; |
| 552 | } | 565 | } |
| 553 | 566 | ||
| @@ -712,7 +725,7 @@ affects all frames on the same terminal device. */) | |||
| 712 | change_frame_size (f, height, width, 0, 0, 0); | 725 | change_frame_size (f, height, width, 0, 0, 0); |
| 713 | } | 726 | } |
| 714 | 727 | ||
| 715 | adjust_glyphs (f); | 728 | adjust_frame_glyphs (f); |
| 716 | calculate_costs (f); | 729 | calculate_costs (f); |
| 717 | XSETFRAME (frame, f); | 730 | XSETFRAME (frame, f); |
| 718 | 731 | ||
| @@ -1108,7 +1121,7 @@ other_visible_frames (struct frame *f) | |||
| 1108 | 1121 | ||
| 1109 | /* Verify that we can still talk to the frame's X window, | 1122 | /* Verify that we can still talk to the frame's X window, |
| 1110 | and note any recent change in visibility. */ | 1123 | and note any recent change in visibility. */ |
| 1111 | #ifdef HAVE_WINDOW_SYSTEM | 1124 | #ifdef HAVE_X_WINDOWS |
| 1112 | if (FRAME_WINDOW_P (XFRAME (this))) | 1125 | if (FRAME_WINDOW_P (XFRAME (this))) |
| 1113 | x_sync (XFRAME (this)); | 1126 | x_sync (XFRAME (this)); |
| 1114 | #endif | 1127 | #endif |
| @@ -1901,6 +1914,17 @@ See `redirect-frame-focus'. */) | |||
| 1901 | return FRAME_FOCUS_FRAME (decode_live_frame (frame)); | 1914 | return FRAME_FOCUS_FRAME (decode_live_frame (frame)); |
| 1902 | } | 1915 | } |
| 1903 | 1916 | ||
| 1917 | DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, | ||
| 1918 | doc: /* Set the input focus to FRAME. | ||
| 1919 | FRAME nil means use the selected frame. | ||
| 1920 | If there is no window system support, this function does nothing. */) | ||
| 1921 | (Lisp_Object frame) | ||
| 1922 | { | ||
| 1923 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1924 | x_focus_frame (decode_window_system_frame (frame)); | ||
| 1925 | #endif | ||
| 1926 | return Qnil; | ||
| 1927 | } | ||
| 1904 | 1928 | ||
| 1905 | 1929 | ||
| 1906 | /* Return the value of frame parameter PROP in frame FRAME. */ | 1930 | /* Return the value of frame parameter PROP in frame FRAME. */ |
| @@ -2207,7 +2231,7 @@ If FRAME is nil, describe the currently selected frame. */) | |||
| 2207 | value = f->name; | 2231 | value = f->name; |
| 2208 | #ifdef HAVE_X_WINDOWS | 2232 | #ifdef HAVE_X_WINDOWS |
| 2209 | else if (EQ (parameter, Qdisplay) && FRAME_X_P (f)) | 2233 | else if (EQ (parameter, Qdisplay) && FRAME_X_P (f)) |
| 2210 | value = XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element); | 2234 | value = XCAR (FRAME_DISPLAY_INFO (f)->name_list_element); |
| 2211 | #endif /* HAVE_X_WINDOWS */ | 2235 | #endif /* HAVE_X_WINDOWS */ |
| 2212 | else if (EQ (parameter, Qbackground_color) | 2236 | else if (EQ (parameter, Qbackground_color) |
| 2213 | || EQ (parameter, Qforeground_color)) | 2237 | || EQ (parameter, Qforeground_color)) |
| @@ -2598,7 +2622,7 @@ x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int | |||
| 2598 | { | 2622 | { |
| 2599 | int newwidth = FRAME_COLS (f); | 2623 | int newwidth = FRAME_COLS (f); |
| 2600 | int newheight = FRAME_LINES (f); | 2624 | int newheight = FRAME_LINES (f); |
| 2601 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 2625 | Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 2602 | 2626 | ||
| 2603 | *top_pos = f->top_pos; | 2627 | *top_pos = f->top_pos; |
| 2604 | *left_pos = f->left_pos; | 2628 | *left_pos = f->left_pos; |
| @@ -2973,9 +2997,9 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) | |||
| 2973 | (FRAME_VISIBLE_P (f) ? Qt | 2997 | (FRAME_VISIBLE_P (f) ? Qt |
| 2974 | : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); | 2998 | : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); |
| 2975 | store_in_alist (alistptr, Qdisplay, | 2999 | store_in_alist (alistptr, Qdisplay, |
| 2976 | XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); | 3000 | XCAR (FRAME_DISPLAY_INFO (f)->name_list_element)); |
| 2977 | 3001 | ||
| 2978 | if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window) | 3002 | if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_DISPLAY_INFO (f)->root_window) |
| 2979 | tem = Qnil; | 3003 | tem = Qnil; |
| 2980 | else | 3004 | else |
| 2981 | tem = make_natnum ((uintptr_t) FRAME_X_OUTPUT (f)->parent_desc); | 3005 | 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) | |||
| 3358 | else if (RANGED_INTEGERP (1, arg, INT_MAX) | 3382 | else if (RANGED_INTEGERP (1, arg, INT_MAX) |
| 3359 | && XFASTINT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f)) | 3383 | && XFASTINT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f)) |
| 3360 | { | 3384 | { |
| 3361 | if (XFASTINT (arg) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM) | ||
| 3362 | XSETINT (arg, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM + 1); | ||
| 3363 | |||
| 3364 | FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFASTINT (arg); | 3385 | FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFASTINT (arg); |
| 3365 | FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid; | 3386 | FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid; |
| 3366 | if (FRAME_X_WINDOW (f)) | 3387 | if (FRAME_X_WINDOW (f)) |
| @@ -3373,22 +3394,6 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 3373 | XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; | 3394 | XWINDOW (FRAME_SELECTED_WINDOW (f))->cursor.x = 0; |
| 3374 | } | 3395 | } |
| 3375 | 3396 | ||
| 3376 | |||
| 3377 | |||
| 3378 | /* Return non-nil if frame F wants a bitmap icon. */ | ||
| 3379 | |||
| 3380 | Lisp_Object | ||
| 3381 | x_icon_type (struct frame *f) | ||
| 3382 | { | ||
| 3383 | Lisp_Object tem; | ||
| 3384 | |||
| 3385 | tem = assq_no_quit (Qicon_type, f->param_alist); | ||
| 3386 | if (CONSP (tem)) | ||
| 3387 | return XCDR (tem); | ||
| 3388 | else | ||
| 3389 | return Qnil; | ||
| 3390 | } | ||
| 3391 | |||
| 3392 | void | 3397 | void |
| 3393 | x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 3398 | x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) |
| 3394 | { | 3399 | { |
| @@ -3440,7 +3445,33 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 3440 | return; | 3445 | return; |
| 3441 | } | 3446 | } |
| 3442 | 3447 | ||
| 3443 | 3448 | #ifndef HAVE_NS | |
| 3449 | |||
| 3450 | /* Non-zero if mouse is grabbed on DPYINFO | ||
| 3451 | and we know the frame where it is. */ | ||
| 3452 | |||
| 3453 | bool x_mouse_grabbed (Display_Info *dpyinfo) | ||
| 3454 | { | ||
| 3455 | return (dpyinfo->grabbed | ||
| 3456 | && dpyinfo->last_mouse_frame | ||
| 3457 | && FRAME_LIVE_P (dpyinfo->last_mouse_frame)); | ||
| 3458 | } | ||
| 3459 | |||
| 3460 | /* Re-highlight something with mouse-face properties | ||
| 3461 | on DPYINFO using saved frame and mouse position. */ | ||
| 3462 | |||
| 3463 | void | ||
| 3464 | x_redo_mouse_highlight (Display_Info *dpyinfo) | ||
| 3465 | { | ||
| 3466 | if (dpyinfo->last_mouse_motion_frame | ||
| 3467 | && FRAME_LIVE_P (dpyinfo->last_mouse_motion_frame)) | ||
| 3468 | note_mouse_highlight (dpyinfo->last_mouse_motion_frame, | ||
| 3469 | dpyinfo->last_mouse_motion_x, | ||
| 3470 | dpyinfo->last_mouse_motion_y); | ||
| 3471 | } | ||
| 3472 | |||
| 3473 | #endif /* HAVE_NS */ | ||
| 3474 | |||
| 3444 | /* Subroutines of creating an X frame. */ | 3475 | /* Subroutines of creating an X frame. */ |
| 3445 | 3476 | ||
| 3446 | /* Make sure that Vx_resource_name is set to a reasonable value. | 3477 | /* Make sure that Vx_resource_name is set to a reasonable value. |
| @@ -3512,11 +3543,6 @@ validate_x_resource_name (void) | |||
| 3512 | } | 3543 | } |
| 3513 | } | 3544 | } |
| 3514 | 3545 | ||
| 3515 | |||
| 3516 | extern char *x_get_string_resource (XrmDatabase, const char *, const char *); | ||
| 3517 | extern Display_Info *check_x_display_info (Lisp_Object); | ||
| 3518 | |||
| 3519 | |||
| 3520 | /* Get specified attribute from resource database RDB. | 3546 | /* Get specified attribute from resource database RDB. |
| 3521 | See Fx_get_resource below for other parameters. */ | 3547 | See Fx_get_resource below for other parameters. */ |
| 3522 | 3548 | ||
| @@ -3631,7 +3657,7 @@ x_get_resource_string (const char *attribute, const char *class) | |||
| 3631 | esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute); | 3657 | esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute); |
| 3632 | sprintf (class_key, "%s.%s", EMACS_CLASS, class); | 3658 | sprintf (class_key, "%s.%s", EMACS_CLASS, class); |
| 3633 | 3659 | ||
| 3634 | result = x_get_string_resource (FRAME_X_DISPLAY_INFO (sf)->xrdb, | 3660 | result = x_get_string_resource (FRAME_DISPLAY_INFO (sf)->xrdb, |
| 3635 | name_key, class_key); | 3661 | name_key, class_key); |
| 3636 | SAFE_FREE (); | 3662 | SAFE_FREE (); |
| 3637 | return result; | 3663 | return result; |
| @@ -3753,7 +3779,7 @@ x_frame_get_arg (struct frame *f, Lisp_Object alist, Lisp_Object param, | |||
| 3753 | const char *attribute, const char *class, | 3779 | const char *attribute, const char *class, |
| 3754 | enum resource_types type) | 3780 | enum resource_types type) |
| 3755 | { | 3781 | { |
| 3756 | return x_get_arg (FRAME_X_DISPLAY_INFO (f), | 3782 | return x_get_arg (FRAME_DISPLAY_INFO (f), |
| 3757 | alist, param, attribute, class, type); | 3783 | alist, param, attribute, class, type); |
| 3758 | } | 3784 | } |
| 3759 | 3785 | ||
| @@ -3767,7 +3793,7 @@ x_frame_get_and_record_arg (struct frame *f, Lisp_Object alist, | |||
| 3767 | { | 3793 | { |
| 3768 | Lisp_Object value; | 3794 | Lisp_Object value; |
| 3769 | 3795 | ||
| 3770 | value = x_get_arg (FRAME_X_DISPLAY_INFO (f), alist, param, | 3796 | value = x_get_arg (FRAME_DISPLAY_INFO (f), alist, param, |
| 3771 | attribute, class, type); | 3797 | attribute, class, type); |
| 3772 | if (! NILP (value) && ! EQ (value, Qunbound)) | 3798 | if (! NILP (value) && ! EQ (value, Qunbound)) |
| 3773 | store_frame_param (f, param, value); | 3799 | store_frame_param (f, param, value); |
| @@ -3971,7 +3997,7 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p) | |||
| 3971 | { | 3997 | { |
| 3972 | register Lisp_Object tem0, tem1, tem2; | 3998 | register Lisp_Object tem0, tem1, tem2; |
| 3973 | long window_prompting = 0; | 3999 | long window_prompting = 0; |
| 3974 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 4000 | Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 3975 | 4001 | ||
| 3976 | /* Default values if we fall through. | 4002 | /* Default values if we fall through. |
| 3977 | Actually, if that happens we should get | 4003 | Actually, if that happens we should get |
| @@ -4524,6 +4550,7 @@ automatically. See also `mouse-autoselect-window'. */); | |||
| 4524 | defsubr (&Svisible_frame_list); | 4550 | defsubr (&Svisible_frame_list); |
| 4525 | defsubr (&Sraise_frame); | 4551 | defsubr (&Sraise_frame); |
| 4526 | defsubr (&Slower_frame); | 4552 | defsubr (&Slower_frame); |
| 4553 | defsubr (&Sx_focus_frame); | ||
| 4527 | defsubr (&Sredirect_frame_focus); | 4554 | defsubr (&Sredirect_frame_focus); |
| 4528 | defsubr (&Sframe_focus); | 4555 | defsubr (&Sframe_focus); |
| 4529 | defsubr (&Sframe_parameters); | 4556 | defsubr (&Sframe_parameters); |