diff options
| author | Kenichi Handa | 2014-01-01 00:04:57 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2014-01-01 00:04:57 +0900 |
| commit | 6fc286aee5eb67bf4acb9f67c3b5d363ee4b427b (patch) | |
| tree | 596c420d60e3980a1195300a563efb6fe8404c86 /src | |
| parent | 04311a1648bd0ba44951f89557f5674dfa032376 (diff) | |
| parent | 0bbd0e0b1d5f358c85506dcc5451e14fb95864a8 (diff) | |
| download | emacs-6fc286aee5eb67bf4acb9f67c3b5d363ee4b427b.tar.gz emacs-6fc286aee5eb67bf4acb9f67c3b5d363ee4b427b.zip | |
merge trunk
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 34 | ||||
| -rw-r--r-- | src/gtkutil.c | 8 | ||||
| -rw-r--r-- | src/w32.c | 107 | ||||
| -rw-r--r-- | src/widget.c | 51 | ||||
| -rw-r--r-- | src/window.c | 10 | ||||
| -rw-r--r-- | src/xdisp.c | 6 | ||||
| -rw-r--r-- | src/xfns.c | 33 | ||||
| -rw-r--r-- | src/xterm.c | 17 |
8 files changed, 221 insertions, 45 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bfc4ac548c9..356d0b7bbf5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,35 @@ | |||
| 1 | 2013-12-31 Fabrice Popineau <fabrice.popineau@supelec.fr> | ||
| 2 | |||
| 3 | * w32.c (set_named_security_info): New function. | ||
| 4 | (acl_set_file): Fall back on set_named_security_info if | ||
| 5 | set_file_security fails. | ||
| 6 | (g_b_init_set_named_security_info_w) | ||
| 7 | (g_b_init_set_named_security_info_a): New static variables. | ||
| 8 | (globals_of_w32): Initialize them to zero. | ||
| 9 | (set_named_security_info): Set them to non-zero if the | ||
| 10 | corresponding API is available. | ||
| 11 | (SetNamedSecurityInfoW_Proc, SetNamedSecurityInfoA_Proc): New | ||
| 12 | function typedefs. | ||
| 13 | |||
| 14 | 2013-12-31 Martin Rudalics <rudalics@gmx.at> | ||
| 15 | |||
| 16 | Some more fixes following pixelwise resize changes including one | ||
| 17 | for Bug#16306. | ||
| 18 | * gtkutil.c (x_wm_set_size_hint): Have size hints respect value | ||
| 19 | of frame_resize_pixelwise. | ||
| 20 | * widget.c (pixel_to_text_size): New function. | ||
| 21 | (update_wm_hints): Have size hints respect value of | ||
| 22 | frame_resize_pixelwise. | ||
| 23 | (EmacsFrameResize): Alway process resize requests pixelwise. | ||
| 24 | * window.c (grow_mini_window): Make sure mini window is at least | ||
| 25 | one line tall. | ||
| 26 | * xdisp.c (display_menu_bar): Make sure menubar extends till | ||
| 27 | right end of frame. | ||
| 28 | * xfns.c (x_set_menu_bar_lines): Resize frame windows pixelwise. | ||
| 29 | (x_set_tool_bar_lines): Calculate pixelwise. | ||
| 30 | * xterm.c (x_wm_set_size_hint): Have size hints respect value of | ||
| 31 | frame_resize_pixelwise. | ||
| 32 | |||
| 1 | 2013-12-30 Juanma Barranquero <lekktu@gmail.com> | 33 | 2013-12-30 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 34 | ||
| 3 | * fileio.c (Fcopy_file) [!WINDOWSNT]: Don't declare on Windows | 35 | * fileio.c (Fcopy_file) [!WINDOWSNT]: Don't declare on Windows |
| @@ -10,7 +42,7 @@ | |||
| 10 | 2013-12-30 Martin Rudalics <rudalics@gmx.at> | 42 | 2013-12-30 Martin Rudalics <rudalics@gmx.at> |
| 11 | 43 | ||
| 12 | * dispnew.c (change_frame_size_1): Take old width of root window | 44 | * dispnew.c (change_frame_size_1): Take old width of root window |
| 13 | from that window's pixel width. Bug#16284. | 45 | from that window's pixel width. (Bug#16284) |
| 14 | 46 | ||
| 15 | 2013-12-29 Paul Eggert <eggert@cs.ucla.edu> | 47 | 2013-12-29 Paul Eggert <eggert@cs.ucla.edu> |
| 16 | 48 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index e5d6414cf75..3f4e44eb196 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -1354,8 +1354,8 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) | |||
| 1354 | hint_flags = f->output_data.x->hint_flags; | 1354 | hint_flags = f->output_data.x->hint_flags; |
| 1355 | 1355 | ||
| 1356 | hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE; | 1356 | hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE; |
| 1357 | size_hints.width_inc = FRAME_COLUMN_WIDTH (f); | 1357 | size_hints.width_inc = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f); |
| 1358 | size_hints.height_inc = FRAME_LINE_HEIGHT (f); | 1358 | size_hints.height_inc = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f); |
| 1359 | 1359 | ||
| 1360 | hint_flags |= GDK_HINT_BASE_SIZE; | 1360 | hint_flags |= GDK_HINT_BASE_SIZE; |
| 1361 | /* Use one row/col here so base_height/width does not become zero. | 1361 | /* Use one row/col here so base_height/width does not become zero. |
| @@ -1370,8 +1370,8 @@ x_wm_set_size_hint (struct frame *f, long int flags, bool user_position) | |||
| 1370 | 1370 | ||
| 1371 | size_hints.base_width = base_width; | 1371 | size_hints.base_width = base_width; |
| 1372 | size_hints.base_height = base_height; | 1372 | size_hints.base_height = base_height; |
| 1373 | size_hints.min_width = base_width + min_cols * size_hints.width_inc; | 1373 | size_hints.min_width = base_width + min_cols * FRAME_COLUMN_WIDTH (f);; |
| 1374 | size_hints.min_height = base_height + min_rows * size_hints.height_inc; | 1374 | size_hints.min_height = base_height + min_rows * FRAME_LINE_HEIGHT (f); |
| 1375 | 1375 | ||
| 1376 | /* These currently have a one to one mapping with the X values, but I | 1376 | /* These currently have a one to one mapping with the X values, but I |
| 1377 | don't think we should rely on that. */ | 1377 | don't think we should rely on that. */ |
| @@ -303,6 +303,8 @@ static BOOL g_b_init_convert_sddl_to_sd; | |||
| 303 | static BOOL g_b_init_is_valid_security_descriptor; | 303 | static BOOL g_b_init_is_valid_security_descriptor; |
| 304 | static BOOL g_b_init_set_file_security_w; | 304 | static BOOL g_b_init_set_file_security_w; |
| 305 | static BOOL g_b_init_set_file_security_a; | 305 | static BOOL g_b_init_set_file_security_a; |
| 306 | static BOOL g_b_init_set_named_security_info_w; | ||
| 307 | static BOOL g_b_init_set_named_security_info_a; | ||
| 306 | static BOOL g_b_init_get_adapters_info; | 308 | static BOOL g_b_init_get_adapters_info; |
| 307 | 309 | ||
| 308 | /* | 310 | /* |
| @@ -377,6 +379,22 @@ typedef BOOL (WINAPI *SetFileSecurityA_Proc) ( | |||
| 377 | LPCSTR lpFileName, | 379 | LPCSTR lpFileName, |
| 378 | SECURITY_INFORMATION SecurityInformation, | 380 | SECURITY_INFORMATION SecurityInformation, |
| 379 | PSECURITY_DESCRIPTOR pSecurityDescriptor); | 381 | PSECURITY_DESCRIPTOR pSecurityDescriptor); |
| 382 | typedef DWORD (WINAPI *SetNamedSecurityInfoW_Proc) ( | ||
| 383 | LPCWSTR lpObjectName, | ||
| 384 | SE_OBJECT_TYPE ObjectType, | ||
| 385 | SECURITY_INFORMATION SecurityInformation, | ||
| 386 | PSID psidOwner, | ||
| 387 | PSID psidGroup, | ||
| 388 | PACL pDacl, | ||
| 389 | PACL pSacl); | ||
| 390 | typedef DWORD (WINAPI *SetNamedSecurityInfoA_Proc) ( | ||
| 391 | LPCSTR lpObjectName, | ||
| 392 | SE_OBJECT_TYPE ObjectType, | ||
| 393 | SECURITY_INFORMATION SecurityInformation, | ||
| 394 | PSID psidOwner, | ||
| 395 | PSID psidGroup, | ||
| 396 | PACL pDacl, | ||
| 397 | PACL pSacl); | ||
| 380 | typedef BOOL (WINAPI * GetSecurityDescriptorOwner_Proc) ( | 398 | typedef BOOL (WINAPI * GetSecurityDescriptorOwner_Proc) ( |
| 381 | PSECURITY_DESCRIPTOR pSecurityDescriptor, | 399 | PSECURITY_DESCRIPTOR pSecurityDescriptor, |
| 382 | PSID *pOwner, | 400 | PSID *pOwner, |
| @@ -811,6 +829,69 @@ set_file_security (const char *lpFileName, | |||
| 811 | } | 829 | } |
| 812 | } | 830 | } |
| 813 | 831 | ||
| 832 | static DWORD WINAPI | ||
| 833 | set_named_security_info (LPCTSTR lpObjectName, | ||
| 834 | SE_OBJECT_TYPE ObjectType, | ||
| 835 | SECURITY_INFORMATION SecurityInformation, | ||
| 836 | PSID psidOwner, | ||
| 837 | PSID psidGroup, | ||
| 838 | PACL pDacl, | ||
| 839 | PACL pSacl) | ||
| 840 | { | ||
| 841 | static SetNamedSecurityInfoW_Proc s_pfn_Set_Named_Security_InfoW = NULL; | ||
| 842 | static SetNamedSecurityInfoA_Proc s_pfn_Set_Named_Security_InfoA = NULL; | ||
| 843 | HMODULE hm_advapi32 = NULL; | ||
| 844 | if (is_windows_9x () == TRUE) | ||
| 845 | { | ||
| 846 | errno = ENOTSUP; | ||
| 847 | return ENOTSUP; | ||
| 848 | } | ||
| 849 | if (w32_unicode_filenames) | ||
| 850 | { | ||
| 851 | wchar_t filename_w[MAX_PATH]; | ||
| 852 | |||
| 853 | if (g_b_init_set_named_security_info_w == 0) | ||
| 854 | { | ||
| 855 | g_b_init_set_named_security_info_w = 1; | ||
| 856 | hm_advapi32 = LoadLibrary ("Advapi32.dll"); | ||
| 857 | s_pfn_Set_Named_Security_InfoW = | ||
| 858 | (SetNamedSecurityInfoW_Proc) GetProcAddress (hm_advapi32, | ||
| 859 | "SetNamedSecurityInfoW"); | ||
| 860 | } | ||
| 861 | if (s_pfn_Set_Named_Security_InfoW == NULL) | ||
| 862 | { | ||
| 863 | errno = ENOTSUP; | ||
| 864 | return ENOTSUP; | ||
| 865 | } | ||
| 866 | filename_to_utf16 (lpObjectName, filename_w); | ||
| 867 | return (s_pfn_Set_Named_Security_InfoW (filename_w, ObjectType, | ||
| 868 | SecurityInformation, psidOwner, | ||
| 869 | psidGroup, pDacl, pSacl)); | ||
| 870 | } | ||
| 871 | else | ||
| 872 | { | ||
| 873 | char filename_a[MAX_PATH]; | ||
| 874 | |||
| 875 | if (g_b_init_set_named_security_info_a == 0) | ||
| 876 | { | ||
| 877 | g_b_init_set_named_security_info_a = 1; | ||
| 878 | hm_advapi32 = LoadLibrary ("Advapi32.dll"); | ||
| 879 | s_pfn_Set_Named_Security_InfoA = | ||
| 880 | (SetNamedSecurityInfoA_Proc) GetProcAddress (hm_advapi32, | ||
| 881 | "SetNamedSecurityInfoA"); | ||
| 882 | } | ||
| 883 | if (s_pfn_Set_Named_Security_InfoA == NULL) | ||
| 884 | { | ||
| 885 | errno = ENOTSUP; | ||
| 886 | return ENOTSUP; | ||
| 887 | } | ||
| 888 | filename_to_ansi (lpObjectName, filename_a); | ||
| 889 | return (s_pfn_Set_Named_Security_InfoA (filename_a, ObjectType, | ||
| 890 | SecurityInformation, psidOwner, | ||
| 891 | psidGroup, pDacl, pSacl)); | ||
| 892 | } | ||
| 893 | } | ||
| 894 | |||
| 814 | static BOOL WINAPI | 895 | static BOOL WINAPI |
| 815 | get_security_descriptor_owner (PSECURITY_DESCRIPTOR pSecurityDescriptor, | 896 | get_security_descriptor_owner (PSECURITY_DESCRIPTOR pSecurityDescriptor, |
| 816 | PSID *pOwner, | 897 | PSID *pOwner, |
| @@ -5903,7 +5984,7 @@ acl_set_file (const char *fname, acl_type_t type, acl_t acl) | |||
| 5903 | DWORD err; | 5984 | DWORD err; |
| 5904 | int st = 0, retval = -1; | 5985 | int st = 0, retval = -1; |
| 5905 | SECURITY_INFORMATION flags = 0; | 5986 | SECURITY_INFORMATION flags = 0; |
| 5906 | PSID psid; | 5987 | PSID psidOwner, psidGroup; |
| 5907 | PACL pacl; | 5988 | PACL pacl; |
| 5908 | BOOL dflt; | 5989 | BOOL dflt; |
| 5909 | BOOL dacl_present; | 5990 | BOOL dacl_present; |
| @@ -5929,11 +6010,13 @@ acl_set_file (const char *fname, acl_type_t type, acl_t acl) | |||
| 5929 | else | 6010 | else |
| 5930 | fname = filename; | 6011 | fname = filename; |
| 5931 | 6012 | ||
| 5932 | if (get_security_descriptor_owner ((PSECURITY_DESCRIPTOR)acl, &psid, &dflt) | 6013 | if (get_security_descriptor_owner ((PSECURITY_DESCRIPTOR)acl, &psidOwner, |
| 5933 | && psid) | 6014 | &dflt) |
| 6015 | && psidOwner) | ||
| 5934 | flags |= OWNER_SECURITY_INFORMATION; | 6016 | flags |= OWNER_SECURITY_INFORMATION; |
| 5935 | if (get_security_descriptor_group ((PSECURITY_DESCRIPTOR)acl, &psid, &dflt) | 6017 | if (get_security_descriptor_group ((PSECURITY_DESCRIPTOR)acl, &psidGroup, |
| 5936 | && psid) | 6018 | &dflt) |
| 6019 | && psidGroup) | ||
| 5937 | flags |= GROUP_SECURITY_INFORMATION; | 6020 | flags |= GROUP_SECURITY_INFORMATION; |
| 5938 | if (get_security_descriptor_dacl ((PSECURITY_DESCRIPTOR)acl, &dacl_present, | 6021 | if (get_security_descriptor_dacl ((PSECURITY_DESCRIPTOR)acl, &dacl_present, |
| 5939 | &pacl, &dflt) | 6022 | &pacl, &dflt) |
| @@ -5960,10 +6043,22 @@ acl_set_file (const char *fname, acl_type_t type, acl_t acl) | |||
| 5960 | 6043 | ||
| 5961 | e = errno; | 6044 | e = errno; |
| 5962 | errno = 0; | 6045 | errno = 0; |
| 6046 | /* SetFileSecurity is deprecated by MS, and sometimes fails when | ||
| 6047 | DACL inheritance is involved, but it seems to preserve ownership | ||
| 6048 | better than SetNamedSecurity, which is important e.g., in | ||
| 6049 | copy-file. */ | ||
| 5963 | if (!set_file_security (fname, flags, (PSECURITY_DESCRIPTOR)acl)) | 6050 | if (!set_file_security (fname, flags, (PSECURITY_DESCRIPTOR)acl)) |
| 5964 | { | 6051 | { |
| 5965 | err = GetLastError (); | 6052 | err = GetLastError (); |
| 5966 | 6053 | ||
| 6054 | if (errno != ENOTSUP) | ||
| 6055 | err = set_named_security_info (fname, SE_FILE_OBJECT, flags, | ||
| 6056 | psidOwner, psidGroup, pacl, NULL); | ||
| 6057 | } | ||
| 6058 | else | ||
| 6059 | err = ERROR_SUCCESS; | ||
| 6060 | if (err != ERROR_SUCCESS) | ||
| 6061 | { | ||
| 5967 | if (errno == ENOTSUP) | 6062 | if (errno == ENOTSUP) |
| 5968 | ; | 6063 | ; |
| 5969 | else if (err == ERROR_INVALID_OWNER | 6064 | else if (err == ERROR_INVALID_OWNER |
| @@ -8878,6 +8973,8 @@ globals_of_w32 (void) | |||
| 8878 | g_b_init_is_valid_security_descriptor = 0; | 8973 | g_b_init_is_valid_security_descriptor = 0; |
| 8879 | g_b_init_set_file_security_w = 0; | 8974 | g_b_init_set_file_security_w = 0; |
| 8880 | g_b_init_set_file_security_a = 0; | 8975 | g_b_init_set_file_security_a = 0; |
| 8976 | g_b_init_set_named_security_info_w = 0; | ||
| 8977 | g_b_init_set_named_security_info_a = 0; | ||
| 8881 | g_b_init_get_adapters_info = 0; | 8978 | g_b_init_get_adapters_info = 0; |
| 8882 | num_of_processors = 0; | 8979 | num_of_processors = 0; |
| 8883 | /* The following sets a handler for shutdown notifications for | 8980 | /* The following sets a handler for shutdown notifications for |
diff --git a/src/widget.c b/src/widget.c index 73c5149e2cd..7f6722f9ec7 100644 --- a/src/widget.c +++ b/src/widget.c | |||
| @@ -190,6 +190,14 @@ pixel_to_char_size (EmacsFrame ew, Dimension pixel_width, Dimension pixel_height | |||
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | static void | 192 | static void |
| 193 | pixel_to_text_size (EmacsFrame ew, Dimension pixel_width, Dimension pixel_height, int *text_width, int *text_height) | ||
| 194 | { | ||
| 195 | struct frame* f = ew->emacs_frame.frame; | ||
| 196 | *text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, (int) pixel_width); | ||
| 197 | *text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, (int) pixel_height); | ||
| 198 | } | ||
| 199 | |||
| 200 | static void | ||
| 193 | char_to_pixel_size (EmacsFrame ew, int char_width, int char_height, Dimension *pixel_width, Dimension *pixel_height) | 201 | char_to_pixel_size (EmacsFrame ew, int char_width, int char_height, Dimension *pixel_width, Dimension *pixel_height) |
| 194 | { | 202 | { |
| 195 | struct frame* f = ew->emacs_frame.frame; | 203 | struct frame* f = ew->emacs_frame.frame; |
| @@ -487,8 +495,8 @@ update_wm_hints (EmacsFrame ew) | |||
| 487 | XtVaSetValues (wmshell, | 495 | XtVaSetValues (wmshell, |
| 488 | XtNbaseWidth, (XtArgVal) base_width, | 496 | XtNbaseWidth, (XtArgVal) base_width, |
| 489 | XtNbaseHeight, (XtArgVal) base_height, | 497 | XtNbaseHeight, (XtArgVal) base_height, |
| 490 | XtNwidthInc, (XtArgVal) cw, | 498 | XtNwidthInc, (XtArgVal) (frame_resize_pixelwise ? 1 : cw), |
| 491 | XtNheightInc, (XtArgVal) ch, | 499 | XtNheightInc, (XtArgVal) (frame_resize_pixelwise ? 1 : ch), |
| 492 | XtNminWidth, (XtArgVal) (base_width + min_cols * cw), | 500 | XtNminWidth, (XtArgVal) (base_width + min_cols * cw), |
| 493 | XtNminHeight, (XtArgVal) (base_height + min_rows * ch), | 501 | XtNminHeight, (XtArgVal) (base_height + min_rows * ch), |
| 494 | NULL); | 502 | NULL); |
| @@ -670,21 +678,41 @@ EmacsFrameResize (Widget widget) | |||
| 670 | EmacsFrame ew = (EmacsFrame)widget; | 678 | EmacsFrame ew = (EmacsFrame)widget; |
| 671 | struct frame *f = ew->emacs_frame.frame; | 679 | struct frame *f = ew->emacs_frame.frame; |
| 672 | struct x_output *x = f->output_data.x; | 680 | struct x_output *x = f->output_data.x; |
| 673 | int columns; | 681 | |
| 674 | int rows; | 682 | #if 0 /* Always process resize requests pixelwise. Frame maximizing |
| 675 | 683 | should work even when frame_resize_pixelwise is nil. */ | |
| 676 | pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows); | 684 | if (frame_resize_pixelwise) |
| 677 | if (columns != FRAME_COLS (f) | ||
| 678 | || rows != FRAME_LINES (f) | ||
| 679 | || ew->core.width != FRAME_PIXEL_WIDTH (f) | ||
| 680 | || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f)) | ||
| 681 | { | 685 | { |
| 682 | change_frame_size (f, columns, rows, 0, 1, 0, 0); | 686 | #endif /* 0 */ |
| 687 | int width, height; | ||
| 688 | |||
| 689 | pixel_to_text_size (ew, ew->core.width, ew->core.height, &width, &height); | ||
| 690 | change_frame_size (f, width, height, 0, 1, 0, 1); | ||
| 691 | |||
| 683 | update_wm_hints (ew); | 692 | update_wm_hints (ew); |
| 684 | update_various_frame_slots (ew); | 693 | update_various_frame_slots (ew); |
| 685 | 694 | ||
| 686 | cancel_mouse_face (f); | 695 | cancel_mouse_face (f); |
| 696 | #if 0 /* See comment above. */ | ||
| 687 | } | 697 | } |
| 698 | else | ||
| 699 | { | ||
| 700 | int columns, rows; | ||
| 701 | |||
| 702 | pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows); | ||
| 703 | if (columns != FRAME_COLS (f) | ||
| 704 | || rows != FRAME_LINES (f) | ||
| 705 | || ew->core.width != FRAME_PIXEL_WIDTH (f) | ||
| 706 | || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f)) | ||
| 707 | { | ||
| 708 | change_frame_size (f, columns, rows, 0, 1, 0, 0); | ||
| 709 | update_wm_hints (ew); | ||
| 710 | update_various_frame_slots (ew); | ||
| 711 | |||
| 712 | cancel_mouse_face (f); | ||
| 713 | } | ||
| 714 | } | ||
| 715 | #endif /* 0 */ | ||
| 688 | } | 716 | } |
| 689 | 717 | ||
| 690 | static Boolean | 718 | static Boolean |
| @@ -724,6 +752,7 @@ EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, Ar | |||
| 724 | 752 | ||
| 725 | if (has_to_recompute_size) | 753 | if (has_to_recompute_size) |
| 726 | { | 754 | { |
| 755 | /* Don't do this pixelwise, hopefully. */ | ||
| 727 | pixel_width = new->core.width; | 756 | pixel_width = new->core.width; |
| 728 | pixel_height = new->core.height; | 757 | pixel_height = new->core.height; |
| 729 | pixel_to_char_size (new, pixel_width, pixel_height, &char_width, | 758 | pixel_to_char_size (new, pixel_width, pixel_height, &char_width, |
diff --git a/src/window.c b/src/window.c index 9bc95224f7c..1e3d70fd88d 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4582,14 +4582,16 @@ grow_mini_window (struct window *w, int delta, bool pixelwise) | |||
| 4582 | 4582 | ||
| 4583 | if (pixelwise) | 4583 | if (pixelwise) |
| 4584 | { | 4584 | { |
| 4585 | pixel_height = min (-XINT (height), INT_MAX - w->pixel_height); | 4585 | pixel_height = max (min (-XINT (height), INT_MAX - w->pixel_height), |
| 4586 | FRAME_LINE_HEIGHT (f)); | ||
| 4586 | line_height = pixel_height / FRAME_LINE_HEIGHT (f); | 4587 | line_height = pixel_height / FRAME_LINE_HEIGHT (f); |
| 4587 | } | 4588 | } |
| 4588 | else | 4589 | else |
| 4589 | { | 4590 | { |
| 4590 | line_height = min (-XINT (height), | 4591 | line_height = max (min (-XINT (height), |
| 4591 | ((INT_MAX - w->pixel_height) | 4592 | ((INT_MAX - w->pixel_height) |
| 4592 | / FRAME_LINE_HEIGHT (f))); | 4593 | / FRAME_LINE_HEIGHT (f))), |
| 4594 | 1); | ||
| 4593 | pixel_height = line_height * FRAME_LINE_HEIGHT (f); | 4595 | pixel_height = line_height * FRAME_LINE_HEIGHT (f); |
| 4594 | } | 4596 | } |
| 4595 | 4597 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 1c157c7be0a..8a0a714cdfc 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20882,8 +20882,7 @@ display_menu_bar (struct window *w) | |||
| 20882 | eassert (!FRAME_WINDOW_P (f)); | 20882 | eassert (!FRAME_WINDOW_P (f)); |
| 20883 | init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID); | 20883 | init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID); |
| 20884 | it.first_visible_x = 0; | 20884 | it.first_visible_x = 0; |
| 20885 | /* PXW: Use FRAME_PIXEL_WIDTH (f) here? */ | 20885 | it.last_visible_x = FRAME_PIXEL_WIDTH (f); |
| 20886 | it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); | ||
| 20887 | #elif defined (HAVE_X_WINDOWS) /* X without toolkit. */ | 20886 | #elif defined (HAVE_X_WINDOWS) /* X without toolkit. */ |
| 20888 | if (FRAME_WINDOW_P (f)) | 20887 | if (FRAME_WINDOW_P (f)) |
| 20889 | { | 20888 | { |
| @@ -20894,8 +20893,7 @@ display_menu_bar (struct window *w) | |||
| 20894 | init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows, | 20893 | init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows, |
| 20895 | MENU_FACE_ID); | 20894 | MENU_FACE_ID); |
| 20896 | it.first_visible_x = 0; | 20895 | it.first_visible_x = 0; |
| 20897 | /* PXW: Use FRAME_PIXEL_WIDTH (f) here? */ | 20896 | it.last_visible_x = FRAME_PIXEL_WIDTH (f); |
| 20898 | it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); | ||
| 20899 | } | 20897 | } |
| 20900 | else | 20898 | else |
| 20901 | #endif /* not USE_X_TOOLKIT and not USE_GTK */ | 20899 | #endif /* not USE_X_TOOLKIT and not USE_GTK */ |
diff --git a/src/xfns.c b/src/xfns.c index 7200c5fb2e7..3b49ab5af75 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -997,7 +997,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 997 | #else /* not USE_X_TOOLKIT && not USE_GTK */ | 997 | #else /* not USE_X_TOOLKIT && not USE_GTK */ |
| 998 | FRAME_MENU_BAR_LINES (f) = nlines; | 998 | FRAME_MENU_BAR_LINES (f) = nlines; |
| 999 | FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); | 999 | FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); |
| 1000 | resize_frame_windows (f, FRAME_LINES (f), 0, 0); | 1000 | resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1); |
| 1001 | 1001 | ||
| 1002 | /* If the menu bar height gets changed, the internal border below | 1002 | /* If the menu bar height gets changed, the internal border below |
| 1003 | the top margin has to be cleared. Also, if the menu bar gets | 1003 | the top margin has to be cleared. Also, if the menu bar gets |
| @@ -1052,7 +1052,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1052 | int nlines; | 1052 | int nlines; |
| 1053 | #if ! defined (USE_GTK) | 1053 | #if ! defined (USE_GTK) |
| 1054 | int delta, root_height; | 1054 | int delta, root_height; |
| 1055 | Lisp_Object root_window; | 1055 | int unit = FRAME_LINE_HEIGHT (f); |
| 1056 | #endif | 1056 | #endif |
| 1057 | 1057 | ||
| 1058 | /* Treat tool bars like menu bars. */ | 1058 | /* Treat tool bars like menu bars. */ |
| @@ -1089,20 +1089,29 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1089 | /* Make sure we redisplay all windows in this frame. */ | 1089 | /* Make sure we redisplay all windows in this frame. */ |
| 1090 | windows_or_buffers_changed = 60; | 1090 | windows_or_buffers_changed = 60; |
| 1091 | 1091 | ||
| 1092 | delta = nlines - FRAME_TOOL_BAR_LINES (f); | 1092 | /* DELTA is in pixels now. */ |
| 1093 | delta = (nlines - FRAME_TOOL_BAR_LINES (f)) * unit; | ||
| 1093 | 1094 | ||
| 1094 | /* Don't resize the tool-bar to more than we have room for. */ | 1095 | /* Don't resize the tool-bar to more than we have room for. Note: The |
| 1095 | root_window = FRAME_ROOT_WINDOW (f); | 1096 | calculations below and the subsequent call to resize_frame_windows |
| 1096 | root_height = WINDOW_TOTAL_LINES (XWINDOW (root_window)); | 1097 | are inherently flawed because they can make the toolbar higher than |
| 1097 | if (root_height - delta < 1) | 1098 | the containing frame. */ |
| 1099 | if (delta > 0) | ||
| 1098 | { | 1100 | { |
| 1099 | delta = root_height - 1; | 1101 | root_height = WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_ROOT_WINDOW (f))); |
| 1100 | nlines = FRAME_TOOL_BAR_LINES (f) + delta; | 1102 | if (root_height - delta < unit) |
| 1103 | { | ||
| 1104 | delta = root_height - unit; | ||
| 1105 | /* When creating a new frame and toolbar mode is enabled, we | ||
| 1106 | need at least one toolbar line. */ | ||
| 1107 | nlines = max (FRAME_TOOL_BAR_LINES (f) + delta / unit, 1); | ||
| 1108 | } | ||
| 1101 | } | 1109 | } |
| 1102 | 1110 | ||
| 1103 | FRAME_TOOL_BAR_LINES (f) = nlines; | 1111 | FRAME_TOOL_BAR_LINES (f) = nlines; |
| 1104 | FRAME_TOOL_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); | 1112 | FRAME_TOOL_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f); |
| 1105 | resize_frame_windows (f, FRAME_LINES (f), 0, 0); | 1113 | ++windows_or_buffers_changed; |
| 1114 | resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1); | ||
| 1106 | adjust_frame_glyphs (f); | 1115 | adjust_frame_glyphs (f); |
| 1107 | 1116 | ||
| 1108 | /* We also have to make sure that the internal border at the top of | 1117 | /* We also have to make sure that the internal border at the top of |
| @@ -1124,7 +1133,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1124 | { | 1133 | { |
| 1125 | int height = FRAME_INTERNAL_BORDER_WIDTH (f); | 1134 | int height = FRAME_INTERNAL_BORDER_WIDTH (f); |
| 1126 | int width = FRAME_PIXEL_WIDTH (f); | 1135 | int width = FRAME_PIXEL_WIDTH (f); |
| 1127 | int y = (FRAME_MENU_BAR_LINES (f) + nlines) * FRAME_LINE_HEIGHT (f); | 1136 | int y = nlines * unit; |
| 1128 | 1137 | ||
| 1129 | /* height can be zero here. */ | 1138 | /* height can be zero here. */ |
| 1130 | if (height > 0 && width > 0) | 1139 | if (height > 0 && width > 0) |
| @@ -1139,7 +1148,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1139 | clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); | 1148 | clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); |
| 1140 | } | 1149 | } |
| 1141 | 1150 | ||
| 1142 | run_window_configuration_change_hook (f); | 1151 | run_window_configuration_change_hook (f); |
| 1143 | #endif /* USE_GTK */ | 1152 | #endif /* USE_GTK */ |
| 1144 | } | 1153 | } |
| 1145 | 1154 | ||
diff --git a/src/xterm.c b/src/xterm.c index f634feb21f9..399262e0fb1 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -9293,8 +9293,9 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position) | |||
| 9293 | size_hints.height = FRAME_PIXEL_HEIGHT (f); | 9293 | size_hints.height = FRAME_PIXEL_HEIGHT (f); |
| 9294 | size_hints.width = FRAME_PIXEL_WIDTH (f); | 9294 | size_hints.width = FRAME_PIXEL_WIDTH (f); |
| 9295 | 9295 | ||
| 9296 | size_hints.width_inc = FRAME_COLUMN_WIDTH (f); | 9296 | size_hints.width_inc = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f); |
| 9297 | size_hints.height_inc = FRAME_LINE_HEIGHT (f); | 9297 | size_hints.height_inc = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f); |
| 9298 | |||
| 9298 | size_hints.max_width = x_display_pixel_width (FRAME_DISPLAY_INFO (f)) | 9299 | size_hints.max_width = x_display_pixel_width (FRAME_DISPLAY_INFO (f)) |
| 9299 | - FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); | 9300 | - FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); |
| 9300 | size_hints.max_height = x_display_pixel_height (FRAME_DISPLAY_INFO (f)) | 9301 | size_hints.max_height = x_display_pixel_height (FRAME_DISPLAY_INFO (f)) |
| @@ -9310,6 +9311,14 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position) | |||
| 9310 | 9311 | ||
| 9311 | check_frame_size (f, &min_cols, &min_rows, 0); | 9312 | check_frame_size (f, &min_cols, &min_rows, 0); |
| 9312 | 9313 | ||
| 9314 | if (frame_resize_pixelwise) | ||
| 9315 | /* Needed to prevent a bad protocol error crash when making the | ||
| 9316 | frame size very small. */ | ||
| 9317 | { | ||
| 9318 | min_cols = 2 * min_cols; | ||
| 9319 | min_rows = 2 * min_rows; | ||
| 9320 | } | ||
| 9321 | |||
| 9313 | /* The window manager uses the base width hints to calculate the | 9322 | /* The window manager uses the base width hints to calculate the |
| 9314 | current number of rows and columns in the frame while | 9323 | current number of rows and columns in the frame while |
| 9315 | resizing; min_width and min_height aren't useful for this | 9324 | resizing; min_width and min_height aren't useful for this |
| @@ -9323,8 +9332,8 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position) | |||
| 9323 | size_hints.flags |= PBaseSize; | 9332 | size_hints.flags |= PBaseSize; |
| 9324 | size_hints.base_width = base_width; | 9333 | size_hints.base_width = base_width; |
| 9325 | size_hints.base_height = base_height + FRAME_MENUBAR_HEIGHT (f); | 9334 | size_hints.base_height = base_height + FRAME_MENUBAR_HEIGHT (f); |
| 9326 | size_hints.min_width = base_width + min_cols * size_hints.width_inc; | 9335 | size_hints.min_width = base_width + min_cols * FRAME_COLUMN_WIDTH (f); |
| 9327 | size_hints.min_height = base_height + min_rows * size_hints.height_inc; | 9336 | size_hints.min_height = base_height + min_rows * FRAME_LINE_HEIGHT (f); |
| 9328 | } | 9337 | } |
| 9329 | 9338 | ||
| 9330 | /* If we don't need the old flags, we don't need the old hint at all. */ | 9339 | /* If we don't need the old flags, we don't need the old hint at all. */ |