diff options
| author | Daniel Colascione | 2012-10-07 14:31:58 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2012-10-07 14:31:58 -0800 |
| commit | 36a305a723c63fd345be65c536c52fe9765c14be (patch) | |
| tree | fb89d9e103552863214c60297a65320917109357 /src/frame.c | |
| parent | 2ab329f3b5d52a39f0a45c3d9c129f1c19560142 (diff) | |
| parent | 795b1482a9e314cda32d62ac2988f573d359366e (diff) | |
| download | emacs-36a305a723c63fd345be65c536c52fe9765c14be.tar.gz emacs-36a305a723c63fd345be65c536c52fe9765c14be.zip | |
Merge from trunk
Diffstat (limited to 'src/frame.c')
| -rw-r--r-- | src/frame.c | 119 |
1 files changed, 104 insertions, 15 deletions
diff --git a/src/frame.c b/src/frame.c index 73e46eff00f..599d8879169 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -120,12 +120,12 @@ static void x_report_frame_params (struct frame *, Lisp_Object *); | |||
| 120 | #endif | 120 | #endif |
| 121 | 121 | ||
| 122 | /* These setters are used only in this file, so they can be private. */ | 122 | /* These setters are used only in this file, so they can be private. */ |
| 123 | static inline void | 123 | static void |
| 124 | fset_buffer_predicate (struct frame *f, Lisp_Object val) | 124 | fset_buffer_predicate (struct frame *f, Lisp_Object val) |
| 125 | { | 125 | { |
| 126 | f->buffer_predicate = val; | 126 | f->buffer_predicate = val; |
| 127 | } | 127 | } |
| 128 | static inline void | 128 | static void |
| 129 | fset_minibuffer_window (struct frame *f, Lisp_Object val) | 129 | fset_minibuffer_window (struct frame *f, Lisp_Object val) |
| 130 | { | 130 | { |
| 131 | f->minibuffer_window = val; | 131 | f->minibuffer_window = val; |
| @@ -632,7 +632,7 @@ affects all frames on the same terminal device. */) | |||
| 632 | Lisp_Object terminal; | 632 | Lisp_Object terminal; |
| 633 | 633 | ||
| 634 | terminal = Fassq (Qterminal, parms); | 634 | terminal = Fassq (Qterminal, parms); |
| 635 | if (!NILP (terminal)) | 635 | if (CONSP (terminal)) |
| 636 | { | 636 | { |
| 637 | terminal = XCDR (terminal); | 637 | terminal = XCDR (terminal); |
| 638 | t = get_terminal (terminal, 1); | 638 | t = get_terminal (terminal, 1); |
| @@ -3028,9 +3028,9 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) | |||
| 3028 | void | 3028 | void |
| 3029 | x_report_frame_params (struct frame *f, Lisp_Object *alistptr) | 3029 | x_report_frame_params (struct frame *f, Lisp_Object *alistptr) |
| 3030 | { | 3030 | { |
| 3031 | char buf[16]; | ||
| 3032 | Lisp_Object tem; | 3031 | Lisp_Object tem; |
| 3033 | unsigned long w; | 3032 | uprintmax_t w; |
| 3033 | char buf[INT_BUFSIZE_BOUND (w)]; | ||
| 3034 | 3034 | ||
| 3035 | /* Represent negative positions (off the top or left screen edge) | 3035 | /* Represent negative positions (off the top or left screen edge) |
| 3036 | in a way that Fmodify_frame_parameters will understand correctly. */ | 3036 | in a way that Fmodify_frame_parameters will understand correctly. */ |
| @@ -3067,17 +3067,17 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) | |||
| 3067 | MS-Windows it returns a value whose type is HANDLE, which is | 3067 | MS-Windows it returns a value whose type is HANDLE, which is |
| 3068 | actually a pointer. Explicit casting avoids compiler | 3068 | actually a pointer. Explicit casting avoids compiler |
| 3069 | warnings. */ | 3069 | warnings. */ |
| 3070 | w = (unsigned long) FRAME_X_WINDOW (f); | 3070 | w = (uintptr_t) FRAME_X_WINDOW (f); |
| 3071 | store_in_alist (alistptr, Qwindow_id, | 3071 | store_in_alist (alistptr, Qwindow_id, |
| 3072 | make_formatted_string (buf, "%lu", w)); | 3072 | make_formatted_string (buf, "%"pMu, w)); |
| 3073 | #ifdef HAVE_X_WINDOWS | 3073 | #ifdef HAVE_X_WINDOWS |
| 3074 | #ifdef USE_X_TOOLKIT | 3074 | #ifdef USE_X_TOOLKIT |
| 3075 | /* Tooltip frame may not have this widget. */ | 3075 | /* Tooltip frame may not have this widget. */ |
| 3076 | if (FRAME_X_OUTPUT (f)->widget) | 3076 | if (FRAME_X_OUTPUT (f)->widget) |
| 3077 | #endif | 3077 | #endif |
| 3078 | w = (unsigned long) FRAME_OUTER_WINDOW (f); | 3078 | w = (uintptr_t) FRAME_OUTER_WINDOW (f); |
| 3079 | store_in_alist (alistptr, Qouter_window_id, | 3079 | store_in_alist (alistptr, Qouter_window_id, |
| 3080 | make_formatted_string (buf, "%lu", w)); | 3080 | make_formatted_string (buf, "%"pMu, w)); |
| 3081 | #endif | 3081 | #endif |
| 3082 | store_in_alist (alistptr, Qicon_name, f->icon_name); | 3082 | store_in_alist (alistptr, Qicon_name, f->icon_name); |
| 3083 | FRAME_SAMPLE_VISIBILITY (f); | 3083 | FRAME_SAMPLE_VISIBILITY (f); |
| @@ -3533,9 +3533,9 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 3533 | f->alpha[i] = newval[i]; | 3533 | f->alpha[i] = newval[i]; |
| 3534 | 3534 | ||
| 3535 | #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) | 3535 | #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) |
| 3536 | BLOCK_INPUT; | 3536 | block_input (); |
| 3537 | x_set_frame_alpha (f); | 3537 | x_set_frame_alpha (f); |
| 3538 | UNBLOCK_INPUT; | 3538 | unblock_input (); |
| 3539 | #endif | 3539 | #endif |
| 3540 | 3540 | ||
| 3541 | return; | 3541 | return; |
| @@ -3897,6 +3897,95 @@ x_default_parameter (struct frame *f, Lisp_Object alist, Lisp_Object prop, | |||
| 3897 | } | 3897 | } |
| 3898 | 3898 | ||
| 3899 | 3899 | ||
| 3900 | #if !defined (HAVE_X_WINDOWS) && defined (NoValue) | ||
| 3901 | |||
| 3902 | /* | ||
| 3903 | * XParseGeometry parses strings of the form | ||
| 3904 | * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where | ||
| 3905 | * width, height, xoffset, and yoffset are unsigned integers. | ||
| 3906 | * Example: "=80x24+300-49" | ||
| 3907 | * The equal sign is optional. | ||
| 3908 | * It returns a bitmask that indicates which of the four values | ||
| 3909 | * were actually found in the string. For each value found, | ||
| 3910 | * the corresponding argument is updated; for each value | ||
| 3911 | * not found, the corresponding argument is left unchanged. | ||
| 3912 | */ | ||
| 3913 | |||
| 3914 | static int | ||
| 3915 | XParseGeometry (char *string, | ||
| 3916 | int *x, int *y, | ||
| 3917 | unsigned int *width, unsigned int *height) | ||
| 3918 | { | ||
| 3919 | int mask = NoValue; | ||
| 3920 | char *strind; | ||
| 3921 | unsigned long int tempWidth, tempHeight; | ||
| 3922 | long int tempX, tempY; | ||
| 3923 | char *nextCharacter; | ||
| 3924 | |||
| 3925 | if (string == NULL || *string == '\0') | ||
| 3926 | return mask; | ||
| 3927 | if (*string == '=') | ||
| 3928 | string++; /* ignore possible '=' at beg of geometry spec */ | ||
| 3929 | |||
| 3930 | strind = string; | ||
| 3931 | if (*strind != '+' && *strind != '-' && *strind != 'x') | ||
| 3932 | { | ||
| 3933 | tempWidth = strtoul (strind, &nextCharacter, 10); | ||
| 3934 | if (strind == nextCharacter) | ||
| 3935 | return 0; | ||
| 3936 | strind = nextCharacter; | ||
| 3937 | mask |= WidthValue; | ||
| 3938 | } | ||
| 3939 | |||
| 3940 | if (*strind == 'x' || *strind == 'X') | ||
| 3941 | { | ||
| 3942 | strind++; | ||
| 3943 | tempHeight = strtoul (strind, &nextCharacter, 10); | ||
| 3944 | if (strind == nextCharacter) | ||
| 3945 | return 0; | ||
| 3946 | strind = nextCharacter; | ||
| 3947 | mask |= HeightValue; | ||
| 3948 | } | ||
| 3949 | |||
| 3950 | if (*strind == '+' || *strind == '-') | ||
| 3951 | { | ||
| 3952 | if (*strind == '-') | ||
| 3953 | mask |= XNegative; | ||
| 3954 | tempX = strtol (strind, &nextCharacter, 10); | ||
| 3955 | if (strind == nextCharacter) | ||
| 3956 | return 0; | ||
| 3957 | strind = nextCharacter; | ||
| 3958 | mask |= XValue; | ||
| 3959 | if (*strind == '+' || *strind == '-') | ||
| 3960 | { | ||
| 3961 | if (*strind == '-') | ||
| 3962 | mask |= YNegative; | ||
| 3963 | tempY = strtol (strind, &nextCharacter, 10); | ||
| 3964 | if (strind == nextCharacter) | ||
| 3965 | return 0; | ||
| 3966 | strind = nextCharacter; | ||
| 3967 | mask |= YValue; | ||
| 3968 | } | ||
| 3969 | } | ||
| 3970 | |||
| 3971 | /* If strind isn't at the end of the string then it's an invalid | ||
| 3972 | geometry specification. */ | ||
| 3973 | |||
| 3974 | if (*strind != '\0') | ||
| 3975 | return 0; | ||
| 3976 | |||
| 3977 | if (mask & XValue) | ||
| 3978 | *x = clip_to_bounds (INT_MIN, tempX, INT_MAX); | ||
| 3979 | if (mask & YValue) | ||
| 3980 | *y = clip_to_bounds (INT_MIN, tempY, INT_MAX); | ||
| 3981 | if (mask & WidthValue) | ||
| 3982 | *width = min (tempWidth, UINT_MAX); | ||
| 3983 | if (mask & HeightValue) | ||
| 3984 | *height = min (tempHeight, UINT_MAX); | ||
| 3985 | return mask; | ||
| 3986 | } | ||
| 3987 | |||
| 3988 | #endif /* !defined (HAVE_X_WINDOWS) && defined (NoValue) */ | ||
| 3900 | 3989 | ||
| 3901 | 3990 | ||
| 3902 | /* NS used to define x-parse-geometry in ns-win.el, but that confused | 3991 | /* NS used to define x-parse-geometry in ns-win.el, but that confused |
| @@ -3917,15 +4006,16 @@ or a list (- N) meaning -N pixels relative to bottom/right corner. | |||
| 3917 | On Nextstep, this just calls `ns-parse-geometry'. */) | 4006 | On Nextstep, this just calls `ns-parse-geometry'. */) |
| 3918 | (Lisp_Object string) | 4007 | (Lisp_Object string) |
| 3919 | { | 4008 | { |
| 3920 | #ifdef HAVE_NS | ||
| 3921 | return call1 (Qns_parse_geometry, string); | ||
| 3922 | #else | ||
| 3923 | int geometry, x, y; | 4009 | int geometry, x, y; |
| 3924 | unsigned int width, height; | 4010 | unsigned int width, height; |
| 3925 | Lisp_Object result; | 4011 | Lisp_Object result; |
| 3926 | 4012 | ||
| 3927 | CHECK_STRING (string); | 4013 | CHECK_STRING (string); |
| 3928 | 4014 | ||
| 4015 | #ifdef HAVE_NS | ||
| 4016 | if (strchr (SSDATA (string), ' ') != NULL) | ||
| 4017 | return call1 (Qns_parse_geometry, string); | ||
| 4018 | #endif | ||
| 3929 | geometry = XParseGeometry (SSDATA (string), | 4019 | geometry = XParseGeometry (SSDATA (string), |
| 3930 | &x, &y, &width, &height); | 4020 | &x, &y, &width, &height); |
| 3931 | result = Qnil; | 4021 | result = Qnil; |
| @@ -3961,7 +4051,6 @@ On Nextstep, this just calls `ns-parse-geometry'. */) | |||
| 3961 | result = Fcons (Fcons (Qheight, make_number (height)), result); | 4051 | result = Fcons (Fcons (Qheight, make_number (height)), result); |
| 3962 | 4052 | ||
| 3963 | return result; | 4053 | return result; |
| 3964 | #endif /* HAVE_NS */ | ||
| 3965 | } | 4054 | } |
| 3966 | 4055 | ||
| 3967 | 4056 | ||