diff options
| author | Jan Djärv | 2010-01-28 08:10:04 +0100 |
|---|---|---|
| committer | Jan Djärv | 2010-01-28 08:10:04 +0100 |
| commit | 45d45af5777faec2b0eb985f29b8751336fb0707 (patch) | |
| tree | 981b2a68210cf2a8f76c37d0ac67ff3616e559f6 /src | |
| parent | 7e5686f0e5721b10a43b677716c8e99c8d3fa127 (diff) | |
| download | emacs-45d45af5777faec2b0eb985f29b8751336fb0707.tar.gz emacs-45d45af5777faec2b0eb985f29b8751336fb0707.zip | |
xfns.c (Fx_create_frame): Remove window size matching code from
2010-01-15.
(x_get_current_desktop, x_get_desktop_workarea): Remove
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/xfns.c | 147 |
2 files changed, 7 insertions, 146 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e667cd7f392..96c0f8ff85a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-01-28 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xfns.c (Fx_create_frame): Remove window size matching code from | ||
| 4 | 2010-01-15. | ||
| 5 | (x_get_current_desktop, x_get_desktop_workarea): Remove | ||
| 6 | |||
| 1 | 2010-01-27 Jason Rumney <jasonr@gnu.org> | 7 | 2010-01-27 Jason Rumney <jasonr@gnu.org> |
| 2 | 8 | ||
| 3 | * w32inevt.c (w32_kbd_patch_key): Save the unicode character. | 9 | * w32inevt.c (w32_kbd_patch_key): Save the unicode character. |
diff --git a/src/xfns.c b/src/xfns.c index 905ed9c576a..0ebce8d1e24 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3145,91 +3145,6 @@ If FRAME is nil, use the selected frame. */) | |||
| 3145 | return Qnil; | 3145 | return Qnil; |
| 3146 | } | 3146 | } |
| 3147 | 3147 | ||
| 3148 | /* Return current desktop index for the display where frame F is. | ||
| 3149 | If we can't find out the current desktop, return 0. */ | ||
| 3150 | |||
| 3151 | static int | ||
| 3152 | x_get_current_desktop (f) | ||
| 3153 | struct frame *f; | ||
| 3154 | { | ||
| 3155 | Atom actual_type; | ||
| 3156 | unsigned long actual_size, bytes_remaining; | ||
| 3157 | int rc, actual_format; | ||
| 3158 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 3159 | long max_len = 10; | ||
| 3160 | Display *dpy = FRAME_X_DISPLAY (f); | ||
| 3161 | long *data = NULL; | ||
| 3162 | int current_desktop; | ||
| 3163 | |||
| 3164 | BLOCK_INPUT; | ||
| 3165 | x_catch_errors (dpy); | ||
| 3166 | rc = XGetWindowProperty (dpy, dpyinfo->root_window, | ||
| 3167 | XInternAtom (dpy, "_NET_CURRENT_DESKTOP", False), | ||
| 3168 | 0, max_len, False, XA_CARDINAL, | ||
| 3169 | &actual_type, &actual_format, &actual_size, | ||
| 3170 | &bytes_remaining, (unsigned char **)&data); | ||
| 3171 | |||
| 3172 | if (rc != Success || actual_type != XA_CARDINAL || x_had_errors_p (dpy) | ||
| 3173 | || actual_size == 0 || actual_format != 32) | ||
| 3174 | current_desktop = 0; | ||
| 3175 | else | ||
| 3176 | current_desktop = (int)*data; | ||
| 3177 | |||
| 3178 | if (data) XFree (data); | ||
| 3179 | x_uncatch_errors (); | ||
| 3180 | UNBLOCK_INPUT; | ||
| 3181 | return current_desktop; | ||
| 3182 | } | ||
| 3183 | |||
| 3184 | /* Return current size for DESKTOP_INDEX on the display where frame F is. | ||
| 3185 | If we can't find out the size, return 0, otherwise 1. */ | ||
| 3186 | |||
| 3187 | static int | ||
| 3188 | x_get_desktop_workarea (f, desktop_index, deskw, deskh) | ||
| 3189 | struct frame *f; | ||
| 3190 | int desktop_index; | ||
| 3191 | int *deskw, *deskh; | ||
| 3192 | { | ||
| 3193 | Atom actual_type; | ||
| 3194 | unsigned long actual_size, bytes_remaining; | ||
| 3195 | int rc, actual_format; | ||
| 3196 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 3197 | long max_len = 1000; /* This handles 250 desktops, who has that many? */ | ||
| 3198 | Display *dpy = FRAME_X_DISPLAY (f); | ||
| 3199 | long *data = NULL; | ||
| 3200 | int retval; | ||
| 3201 | |||
| 3202 | BLOCK_INPUT; | ||
| 3203 | x_catch_errors (dpy); | ||
| 3204 | rc = XGetWindowProperty (dpy, dpyinfo->root_window, | ||
| 3205 | XInternAtom (dpy, "_NET_WORKAREA", False), | ||
| 3206 | 0, max_len, False, XA_CARDINAL, | ||
| 3207 | &actual_type, &actual_format, &actual_size, | ||
| 3208 | &bytes_remaining, (unsigned char **)&data); | ||
| 3209 | |||
| 3210 | if (rc != Success || actual_type != XA_CARDINAL || x_had_errors_p (dpy) | ||
| 3211 | || actual_size < 3 || actual_format != 32) | ||
| 3212 | retval = 0; | ||
| 3213 | else | ||
| 3214 | { | ||
| 3215 | int idx; | ||
| 3216 | |||
| 3217 | if (actual_size == 4 /* Only one info for all desktops. */ | ||
| 3218 | || desktop_index*4 > actual_size) /* destop_index out of range. */ | ||
| 3219 | desktop_index = 0; | ||
| 3220 | |||
| 3221 | idx = desktop_index*4; | ||
| 3222 | *deskw = data[idx+2] - data[idx]; | ||
| 3223 | *deskh = data[idx+3] - data[idx+1]; | ||
| 3224 | retval = 1; | ||
| 3225 | } | ||
| 3226 | |||
| 3227 | if (data) XFree (data); | ||
| 3228 | x_uncatch_errors (); | ||
| 3229 | UNBLOCK_INPUT; | ||
| 3230 | return retval; | ||
| 3231 | } | ||
| 3232 | |||
| 3233 | DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, | 3148 | DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, |
| 3234 | 1, 1, 0, | 3149 | 1, 1, 0, |
| 3235 | doc: /* Make a new X window, which is called a "frame" in Emacs terms. | 3150 | doc: /* Make a new X window, which is called a "frame" in Emacs terms. |
| @@ -3249,7 +3164,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3249 | Lisp_Object name; | 3164 | Lisp_Object name; |
| 3250 | int minibuffer_only = 0; | 3165 | int minibuffer_only = 0; |
| 3251 | long window_prompting = 0; | 3166 | long window_prompting = 0; |
| 3252 | int width, height, deskw = -1, deskh = -1, current_desktop = -1; | 3167 | int width, height; |
| 3253 | int count = SPECPDL_INDEX (); | 3168 | int count = SPECPDL_INDEX (); |
| 3254 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 3169 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 3255 | Lisp_Object display; | 3170 | Lisp_Object display; |
| @@ -3517,66 +3432,6 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3517 | /* Compute the size of the X window. */ | 3432 | /* Compute the size of the X window. */ |
| 3518 | window_prompting = x_figure_window_size (f, parms, 1); | 3433 | window_prompting = x_figure_window_size (f, parms, 1); |
| 3519 | 3434 | ||
| 3520 | /* Don't make height higher than display height unless the user asked | ||
| 3521 | for it. Try sizes 24 and 10 if current is too large. */ | ||
| 3522 | height = FRAME_LINES (f); | ||
| 3523 | tem = x_get_arg (dpyinfo, parms, Qheight, 0, 0, RES_TYPE_NUMBER); | ||
| 3524 | if (EQ (tem, Qunbound)) | ||
| 3525 | { | ||
| 3526 | int h = FRAME_LINES (f) + FRAME_TOOL_BAR_LINES (f) | ||
| 3527 | + FRAME_MENU_BAR_LINES (f) + 2; | ||
| 3528 | int ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, h); | ||
| 3529 | int dph = DisplayHeight (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)); | ||
| 3530 | static int tryheight[] = { 24, 10, 0 } ; | ||
| 3531 | int i; | ||
| 3532 | |||
| 3533 | ph += (FRAME_EXTERNAL_TOOL_BAR (f) ? 32 : 0) /* Gtk toolbar size */ | ||
| 3534 | + (FRAME_EXTERNAL_MENU_BAR (f) ? 24 : 0); /* Arbitrary */ | ||
| 3535 | |||
| 3536 | /* Some desktops have fixed menus above and/or panels below. Try to | ||
| 3537 | figure out the usable size we have for emacs. */ | ||
| 3538 | current_desktop = x_get_current_desktop (f); | ||
| 3539 | x_get_desktop_workarea (f, current_desktop, &deskw, &deskh); | ||
| 3540 | if (deskh > 0 && deskh < dph) dph = deskh; | ||
| 3541 | |||
| 3542 | /* Allow 40 pixels for manager decorations. */ | ||
| 3543 | for (i = 0; ph+40 > dph && tryheight[i] != 0; ++i) | ||
| 3544 | { | ||
| 3545 | height = tryheight[i]; | ||
| 3546 | h = height + FRAME_TOOL_BAR_LINES (f) + FRAME_MENU_BAR_LINES (f) + 2; | ||
| 3547 | ph = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, h) | ||
| 3548 | + (FRAME_EXTERNAL_TOOL_BAR (f) ? 32 : 0) | ||
| 3549 | + (FRAME_EXTERNAL_MENU_BAR (f) ? 24 : 0); | ||
| 3550 | } | ||
| 3551 | } | ||
| 3552 | |||
| 3553 | /* Don't make width wider than display width unless the user asked | ||
| 3554 | for it. */ | ||
| 3555 | width = FRAME_COLS (f); | ||
| 3556 | tem = x_get_arg (dpyinfo, parms, Qwidth, 0, 0, RES_TYPE_NUMBER); | ||
| 3557 | if (EQ (tem, Qunbound)) | ||
| 3558 | { | ||
| 3559 | int pw = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, FRAME_COLS (f)); | ||
| 3560 | int dpw = DisplayWidth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)); | ||
| 3561 | if (deskw == -1) | ||
| 3562 | { | ||
| 3563 | current_desktop = x_get_current_desktop (f); | ||
| 3564 | x_get_desktop_workarea (f, current_desktop, &deskw, &deskh); | ||
| 3565 | } | ||
| 3566 | if (deskw > 0 && deskw < dpw) dpw = deskw; | ||
| 3567 | |||
| 3568 | if (pw > dpw) | ||
| 3569 | width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, dpw); | ||
| 3570 | } | ||
| 3571 | |||
| 3572 | if (height != FRAME_LINES (f) || width != FRAME_COLS (f)) | ||
| 3573 | { | ||
| 3574 | check_frame_size (f, &height, &width); | ||
| 3575 | FRAME_LINES (f) = height; | ||
| 3576 | SET_FRAME_COLS (f, width); | ||
| 3577 | } | ||
| 3578 | |||
| 3579 | |||
| 3580 | tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); | 3435 | tem = x_get_arg (dpyinfo, parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); |
| 3581 | f->no_split = minibuffer_only || EQ (tem, Qt); | 3436 | f->no_split = minibuffer_only || EQ (tem, Qt); |
| 3582 | 3437 | ||