aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog21
-rw-r--r--src/gtkutil.c8
-rw-r--r--src/widget.c51
-rw-r--r--src/window.c10
-rw-r--r--src/xdisp.c6
-rw-r--r--src/xfns.c33
-rw-r--r--src/xterm.c17
7 files changed, 106 insertions, 40 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bfc4ac548c9..d7c772df2dd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,22 @@
12013-12-31 Martin Rudalics <rudalics@gmx.at>
2
3 Some more fixes following pixelwise resize changes including one
4 for Bug#16306.
5 * gtkutil.c (x_wm_set_size_hint): Have size hints respect value
6 of frame_resize_pixelwise.
7 * widget.c (pixel_to_text_size): New function.
8 (update_wm_hints): Have size hints respect value of
9 frame_resize_pixelwise.
10 (EmacsFrameResize): Alway process resize requests pixelwise.
11 * window.c (grow_mini_window): Make sure mini window is at least
12 one line tall.
13 * xdisp.c (display_menu_bar): Make sure menubar extends till
14 right end of frame.
15 * xfns.c (x_set_menu_bar_lines): Resize frame windows pixelwise.
16 (x_set_tool_bar_lines): Calculate pixelwise.
17 * xterm.c (x_wm_set_size_hint): Have size hints respect value of
18 frame_resize_pixelwise.
19
12013-12-30 Juanma Barranquero <lekktu@gmail.com> 202013-12-30 Juanma Barranquero <lekktu@gmail.com>
2 21
3 * fileio.c (Fcopy_file) [!WINDOWSNT]: Don't declare on Windows 22 * fileio.c (Fcopy_file) [!WINDOWSNT]: Don't declare on Windows
@@ -10,7 +29,7 @@
102013-12-30 Martin Rudalics <rudalics@gmx.at> 292013-12-30 Martin Rudalics <rudalics@gmx.at>
11 30
12 * dispnew.c (change_frame_size_1): Take old width of root window 31 * dispnew.c (change_frame_size_1): Take old width of root window
13 from that window's pixel width. Bug#16284. 32 from that window's pixel width. (Bug#16284)
14 33
152013-12-29 Paul Eggert <eggert@cs.ucla.edu> 342013-12-29 Paul Eggert <eggert@cs.ucla.edu>
16 35
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. */
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
192static void 192static void
193pixel_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
200static void
193char_to_pixel_size (EmacsFrame ew, int char_width, int char_height, Dimension *pixel_width, Dimension *pixel_height) 201char_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
690static Boolean 718static 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. */