diff options
| author | Jan Djärv | 2012-09-19 08:47:01 +0200 |
|---|---|---|
| committer | Jan Djärv | 2012-09-19 08:47:01 +0200 |
| commit | e543ae9174064c2820a4b9fe5ce30c9963afeb0b (patch) | |
| tree | b02f59b0019fb49f4c250bc06c75e312c45c0df3 /src | |
| parent | 2fd5e67d925be2b5fc945be5aaba27904cc65022 (diff) | |
| download | emacs-e543ae9174064c2820a4b9fe5ce30c9963afeb0b.tar.gz emacs-e543ae9174064c2820a4b9fe5ce30c9963afeb0b.zip | |
* lisp/startup.el (command-line-ns-option-alist): Add -g and --geometry.
* src/frame.c (read_integer, XParseGeometry): Moved from w32xfns.c.
(Fx_parse_geometry): If there is a space in string, call
Qns_parse_geometry, otherwise do as on other terms.
* src/w32xfns.c (read_integer, XParseGeometry): Move to frame.c.
* src/nsfns.m (XParseGeometry): Remove.
(Fx_create_frame): Call x_set_offset to correctly interpret
top_pos in geometry.
Fixes: debbugs:12368
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 12 | ||||
| -rw-r--r-- | src/frame.c | 142 | ||||
| -rw-r--r-- | src/nsfns.m | 13 | ||||
| -rw-r--r-- | src/w32xfns.c | 132 |
4 files changed, 153 insertions, 146 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 6c3041105f5..8c3af794ab1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2012-09-19 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * w32xfns.c (read_integer, XParseGeometry): Move to frame.c. | ||
| 4 | |||
| 5 | * nsfns.m (XParseGeometry): Remove. | ||
| 6 | (Fx_create_frame): Call x_set_offset to correctly interpret | ||
| 7 | top_pos in geometry. | ||
| 8 | |||
| 9 | * frame.c (read_integer, XParseGeometry): Moved from w32xfns.c. | ||
| 10 | (Fx_parse_geometry): If there is a space in string, call | ||
| 11 | Qns_parse_geometry, otherwise do as on other terms (Bug#12368). | ||
| 12 | |||
| 1 | 2012-09-17 Eli Zaretskii <eliz@gnu.org> | 13 | 2012-09-17 Eli Zaretskii <eliz@gnu.org> |
| 2 | 14 | ||
| 3 | * search.c (scan_buffer): Use character positions in calls to | 15 | * search.c (scan_buffer): Use character positions in calls to |
diff --git a/src/frame.c b/src/frame.c index 6930dac3ce8..28571310032 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3897,6 +3897,140 @@ 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 | read_integer (register char *string, char **NextString) | ||
| 3916 | { | ||
| 3917 | register int Result = 0; | ||
| 3918 | int Sign = 1; | ||
| 3919 | |||
| 3920 | if (*string == '+') | ||
| 3921 | string++; | ||
| 3922 | else if (*string == '-') | ||
| 3923 | { | ||
| 3924 | string++; | ||
| 3925 | Sign = -1; | ||
| 3926 | } | ||
| 3927 | for (; (*string >= '0') && (*string <= '9'); string++) | ||
| 3928 | { | ||
| 3929 | Result = (Result * 10) + (*string - '0'); | ||
| 3930 | } | ||
| 3931 | *NextString = string; | ||
| 3932 | if (Sign >= 0) | ||
| 3933 | return (Result); | ||
| 3934 | else | ||
| 3935 | return (-Result); | ||
| 3936 | } | ||
| 3937 | |||
| 3938 | int | ||
| 3939 | XParseGeometry (char *string, | ||
| 3940 | int *x, int *y, | ||
| 3941 | unsigned int *width, unsigned int *height) | ||
| 3942 | { | ||
| 3943 | int mask = NoValue; | ||
| 3944 | register char *strind; | ||
| 3945 | unsigned int tempWidth, tempHeight; | ||
| 3946 | int tempX, tempY; | ||
| 3947 | char *nextCharacter; | ||
| 3948 | |||
| 3949 | if ((string == NULL) || (*string == '\0')) return (mask); | ||
| 3950 | if (*string == '=') | ||
| 3951 | string++; /* ignore possible '=' at beg of geometry spec */ | ||
| 3952 | |||
| 3953 | strind = (char *)string; | ||
| 3954 | if (*strind != '+' && *strind != '-' && *strind != 'x') | ||
| 3955 | { | ||
| 3956 | tempWidth = read_integer (strind, &nextCharacter); | ||
| 3957 | if (strind == nextCharacter) | ||
| 3958 | return (0); | ||
| 3959 | strind = nextCharacter; | ||
| 3960 | mask |= WidthValue; | ||
| 3961 | } | ||
| 3962 | |||
| 3963 | if (*strind == 'x' || *strind == 'X') | ||
| 3964 | { | ||
| 3965 | strind++; | ||
| 3966 | tempHeight = read_integer (strind, &nextCharacter); | ||
| 3967 | if (strind == nextCharacter) | ||
| 3968 | return (0); | ||
| 3969 | strind = nextCharacter; | ||
| 3970 | mask |= HeightValue; | ||
| 3971 | } | ||
| 3972 | |||
| 3973 | if ((*strind == '+') || (*strind == '-')) | ||
| 3974 | { | ||
| 3975 | if (*strind == '-') | ||
| 3976 | { | ||
| 3977 | strind++; | ||
| 3978 | tempX = -read_integer (strind, &nextCharacter); | ||
| 3979 | if (strind == nextCharacter) | ||
| 3980 | return (0); | ||
| 3981 | strind = nextCharacter; | ||
| 3982 | mask |= XNegative; | ||
| 3983 | |||
| 3984 | } | ||
| 3985 | else | ||
| 3986 | { | ||
| 3987 | strind++; | ||
| 3988 | tempX = read_integer (strind, &nextCharacter); | ||
| 3989 | if (strind == nextCharacter) | ||
| 3990 | return (0); | ||
| 3991 | strind = nextCharacter; | ||
| 3992 | } | ||
| 3993 | mask |= XValue; | ||
| 3994 | if ((*strind == '+') || (*strind == '-')) | ||
| 3995 | { | ||
| 3996 | if (*strind == '-') | ||
| 3997 | { | ||
| 3998 | strind++; | ||
| 3999 | tempY = -read_integer (strind, &nextCharacter); | ||
| 4000 | if (strind == nextCharacter) | ||
| 4001 | return (0); | ||
| 4002 | strind = nextCharacter; | ||
| 4003 | mask |= YNegative; | ||
| 4004 | } | ||
| 4005 | else | ||
| 4006 | { | ||
| 4007 | strind++; | ||
| 4008 | tempY = read_integer (strind, &nextCharacter); | ||
| 4009 | if (strind == nextCharacter) | ||
| 4010 | return (0); | ||
| 4011 | strind = nextCharacter; | ||
| 4012 | } | ||
| 4013 | mask |= YValue; | ||
| 4014 | } | ||
| 4015 | } | ||
| 4016 | |||
| 4017 | /* If strind isn't at the end of the string then it's an invalid | ||
| 4018 | geometry specification. */ | ||
| 4019 | |||
| 4020 | if (*strind != '\0') return (0); | ||
| 4021 | |||
| 4022 | if (mask & XValue) | ||
| 4023 | *x = tempX; | ||
| 4024 | if (mask & YValue) | ||
| 4025 | *y = tempY; | ||
| 4026 | if (mask & WidthValue) | ||
| 4027 | *width = tempWidth; | ||
| 4028 | if (mask & HeightValue) | ||
| 4029 | *height = tempHeight; | ||
| 4030 | return (mask); | ||
| 4031 | } | ||
| 4032 | |||
| 4033 | #endif /* !defined (HAVE_X_WINDOWS) && defined (NoValue) */ | ||
| 3900 | 4034 | ||
| 3901 | 4035 | ||
| 3902 | /* NS used to define x-parse-geometry in ns-win.el, but that confused | 4036 | /* NS used to define x-parse-geometry in ns-win.el, but that confused |
| @@ -3917,15 +4051,16 @@ or a list (- N) meaning -N pixels relative to bottom/right corner. | |||
| 3917 | On Nextstep, this just calls `ns-parse-geometry'. */) | 4051 | On Nextstep, this just calls `ns-parse-geometry'. */) |
| 3918 | (Lisp_Object string) | 4052 | (Lisp_Object string) |
| 3919 | { | 4053 | { |
| 3920 | #ifdef HAVE_NS | ||
| 3921 | return call1 (Qns_parse_geometry, string); | ||
| 3922 | #else | ||
| 3923 | int geometry, x, y; | 4054 | int geometry, x, y; |
| 3924 | unsigned int width, height; | 4055 | unsigned int width, height; |
| 3925 | Lisp_Object result; | 4056 | Lisp_Object result; |
| 3926 | 4057 | ||
| 3927 | CHECK_STRING (string); | 4058 | CHECK_STRING (string); |
| 3928 | 4059 | ||
| 4060 | #ifdef HAVE_NS | ||
| 4061 | if (strchr (SSDATA (string), ' ') != NULL) | ||
| 4062 | return call1 (Qns_parse_geometry, string); | ||
| 4063 | #endif | ||
| 3929 | geometry = XParseGeometry (SSDATA (string), | 4064 | geometry = XParseGeometry (SSDATA (string), |
| 3930 | &x, &y, &width, &height); | 4065 | &x, &y, &width, &height); |
| 3931 | result = Qnil; | 4066 | result = Qnil; |
| @@ -3961,7 +4096,6 @@ On Nextstep, this just calls `ns-parse-geometry'. */) | |||
| 3961 | result = Fcons (Fcons (Qheight, make_number (height)), result); | 4096 | result = Fcons (Fcons (Qheight, make_number (height)), result); |
| 3962 | 4097 | ||
| 3963 | return result; | 4098 | return result; |
| 3964 | #endif /* HAVE_NS */ | ||
| 3965 | } | 4099 | } |
| 3966 | 4100 | ||
| 3967 | 4101 | ||
diff --git a/src/nsfns.m b/src/nsfns.m index 072005d2d3d..e2c8c3722c0 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -870,16 +870,6 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 870 | } | 870 | } |
| 871 | 871 | ||
| 872 | 872 | ||
| 873 | /* Xism; we stub out (we do implement this in ns-win.el) */ | ||
| 874 | int | ||
| 875 | XParseGeometry (char *string, int *x, int *y, | ||
| 876 | unsigned int *width, unsigned int *height) | ||
| 877 | { | ||
| 878 | message1 ("Warning: XParseGeometry not supported under NS.\n"); | ||
| 879 | return 0; | ||
| 880 | } | ||
| 881 | |||
| 882 | |||
| 883 | /* TODO: move to nsterm? */ | 873 | /* TODO: move to nsterm? */ |
| 884 | int | 874 | int |
| 885 | ns_lisp_to_cursor_type (Lisp_Object arg) | 875 | ns_lisp_to_cursor_type (Lisp_Object arg) |
| @@ -1399,6 +1389,9 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1399 | 1389 | ||
| 1400 | UNGCPRO; | 1390 | UNGCPRO; |
| 1401 | 1391 | ||
| 1392 | if (window_prompting & USPosition) | ||
| 1393 | x_set_offset (f, f->left_pos, f->top_pos, 1); | ||
| 1394 | |||
| 1402 | /* Make sure windows on this frame appear in calls to next-window | 1395 | /* Make sure windows on this frame appear in calls to next-window |
| 1403 | and similar functions. */ | 1396 | and similar functions. */ |
| 1404 | Vwindow_list = Qnil; | 1397 | Vwindow_list = Qnil; |
diff --git a/src/w32xfns.c b/src/w32xfns.c index 33f40fc7c01..018dd14cb80 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c | |||
| @@ -303,138 +303,6 @@ drain_message_queue (void) | |||
| 303 | } | 303 | } |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | |||
| 307 | /* | ||
| 308 | * XParseGeometry parses strings of the form | ||
| 309 | * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where | ||
| 310 | * width, height, xoffset, and yoffset are unsigned integers. | ||
| 311 | * Example: "=80x24+300-49" | ||
| 312 | * The equal sign is optional. | ||
| 313 | * It returns a bitmask that indicates which of the four values | ||
| 314 | * were actually found in the string. For each value found, | ||
| 315 | * the corresponding argument is updated; for each value | ||
| 316 | * not found, the corresponding argument is left unchanged. | ||
| 317 | */ | ||
| 318 | |||
| 319 | static int | ||
| 320 | read_integer (register char *string, char **NextString) | ||
| 321 | { | ||
| 322 | register int Result = 0; | ||
| 323 | int Sign = 1; | ||
| 324 | |||
| 325 | if (*string == '+') | ||
| 326 | string++; | ||
| 327 | else if (*string == '-') | ||
| 328 | { | ||
| 329 | string++; | ||
| 330 | Sign = -1; | ||
| 331 | } | ||
| 332 | for (; (*string >= '0') && (*string <= '9'); string++) | ||
| 333 | { | ||
| 334 | Result = (Result * 10) + (*string - '0'); | ||
| 335 | } | ||
| 336 | *NextString = string; | ||
| 337 | if (Sign >= 0) | ||
| 338 | return (Result); | ||
| 339 | else | ||
| 340 | return (-Result); | ||
| 341 | } | ||
| 342 | |||
| 343 | int | ||
| 344 | XParseGeometry (char *string, | ||
| 345 | int *x, int *y, | ||
| 346 | unsigned int *width, unsigned int *height) | ||
| 347 | { | ||
| 348 | int mask = NoValue; | ||
| 349 | register char *strind; | ||
| 350 | unsigned int tempWidth, tempHeight; | ||
| 351 | int tempX, tempY; | ||
| 352 | char *nextCharacter; | ||
| 353 | |||
| 354 | if ((string == NULL) || (*string == '\0')) return (mask); | ||
| 355 | if (*string == '=') | ||
| 356 | string++; /* ignore possible '=' at beg of geometry spec */ | ||
| 357 | |||
| 358 | strind = (char *)string; | ||
| 359 | if (*strind != '+' && *strind != '-' && *strind != 'x') | ||
| 360 | { | ||
| 361 | tempWidth = read_integer (strind, &nextCharacter); | ||
| 362 | if (strind == nextCharacter) | ||
| 363 | return (0); | ||
| 364 | strind = nextCharacter; | ||
| 365 | mask |= WidthValue; | ||
| 366 | } | ||
| 367 | |||
| 368 | if (*strind == 'x' || *strind == 'X') | ||
| 369 | { | ||
| 370 | strind++; | ||
| 371 | tempHeight = read_integer (strind, &nextCharacter); | ||
| 372 | if (strind == nextCharacter) | ||
| 373 | return (0); | ||
| 374 | strind = nextCharacter; | ||
| 375 | mask |= HeightValue; | ||
| 376 | } | ||
| 377 | |||
| 378 | if ((*strind == '+') || (*strind == '-')) | ||
| 379 | { | ||
| 380 | if (*strind == '-') | ||
| 381 | { | ||
| 382 | strind++; | ||
| 383 | tempX = -read_integer (strind, &nextCharacter); | ||
| 384 | if (strind == nextCharacter) | ||
| 385 | return (0); | ||
| 386 | strind = nextCharacter; | ||
| 387 | mask |= XNegative; | ||
| 388 | |||
| 389 | } | ||
| 390 | else | ||
| 391 | { | ||
| 392 | strind++; | ||
| 393 | tempX = read_integer (strind, &nextCharacter); | ||
| 394 | if (strind == nextCharacter) | ||
| 395 | return (0); | ||
| 396 | strind = nextCharacter; | ||
| 397 | } | ||
| 398 | mask |= XValue; | ||
| 399 | if ((*strind == '+') || (*strind == '-')) | ||
| 400 | { | ||
| 401 | if (*strind == '-') | ||
| 402 | { | ||
| 403 | strind++; | ||
| 404 | tempY = -read_integer (strind, &nextCharacter); | ||
| 405 | if (strind == nextCharacter) | ||
| 406 | return (0); | ||
| 407 | strind = nextCharacter; | ||
| 408 | mask |= YNegative; | ||
| 409 | } | ||
| 410 | else | ||
| 411 | { | ||
| 412 | strind++; | ||
| 413 | tempY = read_integer (strind, &nextCharacter); | ||
| 414 | if (strind == nextCharacter) | ||
| 415 | return (0); | ||
| 416 | strind = nextCharacter; | ||
| 417 | } | ||
| 418 | mask |= YValue; | ||
| 419 | } | ||
| 420 | } | ||
| 421 | |||
| 422 | /* If strind isn't at the end of the string then it's an invalid | ||
| 423 | geometry specification. */ | ||
| 424 | |||
| 425 | if (*strind != '\0') return (0); | ||
| 426 | |||
| 427 | if (mask & XValue) | ||
| 428 | *x = tempX; | ||
| 429 | if (mask & YValue) | ||
| 430 | *y = tempY; | ||
| 431 | if (mask & WidthValue) | ||
| 432 | *width = tempWidth; | ||
| 433 | if (mask & HeightValue) | ||
| 434 | *height = tempHeight; | ||
| 435 | return (mask); | ||
| 436 | } | ||
| 437 | |||
| 438 | /* x_sync is a no-op on W32. */ | 306 | /* x_sync is a no-op on W32. */ |
| 439 | void | 307 | void |
| 440 | x_sync (struct frame *f) | 308 | x_sync (struct frame *f) |