[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115817: Some more fixes following pixelwise resize
From: |
Martin Rudalics |
Subject: |
[Emacs-diffs] trunk r115817: Some more fixes following pixelwise resize changes including one for Bug#16306. |
Date: |
Tue, 31 Dec 2013 09:49:24 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115817
revision-id: address@hidden
parent: address@hidden
committer: martin rudalics <address@hidden>
branch nick: trunk
timestamp: Tue 2013-12-31 10:48:54 +0100
message:
Some more fixes following pixelwise resize changes including one for
Bug#16306.
* gtkutil.c (x_wm_set_size_hint): Have size hints respect value
of frame_resize_pixelwise.
* widget.c (pixel_to_text_size): New function.
(update_wm_hints): Have size hints respect value of
frame_resize_pixelwise.
(EmacsFrameResize): Alway process resize requests pixelwise.
* window.c (grow_mini_window): Make sure mini window is at least
one line tall.
* xdisp.c (display_menu_bar): Make sure menubar extends till
right end of frame.
* xfns.c (x_set_menu_bar_lines): Resize frame windows pixelwise.
(x_set_tool_bar_lines): Calculate pixelwise.
* xterm.c (x_wm_set_size_hint): Have size hints respect value of
frame_resize_pixelwise.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/gtkutil.c gtkutil.c-20091113204419-o5vbwnq5f7feedwu-2527
src/widget.c widget.c-20091113204419-o5vbwnq5f7feedwu-676
src/window.c window.c-20091113204419-o5vbwnq5f7feedwu-231
src/xdisp.c xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
src/xfns.c xfns.c-20091113204419-o5vbwnq5f7feedwu-274
src/xterm.c xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-12-30 22:36:44 +0000
+++ b/src/ChangeLog 2013-12-31 09:48:54 +0000
@@ -1,3 +1,22 @@
+2013-12-31 Martin Rudalics <address@hidden>
+
+ Some more fixes following pixelwise resize changes including one
+ for Bug#16306.
+ * gtkutil.c (x_wm_set_size_hint): Have size hints respect value
+ of frame_resize_pixelwise.
+ * widget.c (pixel_to_text_size): New function.
+ (update_wm_hints): Have size hints respect value of
+ frame_resize_pixelwise.
+ (EmacsFrameResize): Alway process resize requests pixelwise.
+ * window.c (grow_mini_window): Make sure mini window is at least
+ one line tall.
+ * xdisp.c (display_menu_bar): Make sure menubar extends till
+ right end of frame.
+ * xfns.c (x_set_menu_bar_lines): Resize frame windows pixelwise.
+ (x_set_tool_bar_lines): Calculate pixelwise.
+ * xterm.c (x_wm_set_size_hint): Have size hints respect value of
+ frame_resize_pixelwise.
+
2013-12-30 Juanma Barranquero <address@hidden>
* fileio.c (Fcopy_file) [!WINDOWSNT]: Don't declare on Windows
@@ -10,7 +29,7 @@
2013-12-30 Martin Rudalics <address@hidden>
* dispnew.c (change_frame_size_1): Take old width of root window
- from that window's pixel width. Bug#16284.
+ from that window's pixel width. (Bug#16284)
2013-12-29 Paul Eggert <address@hidden>
=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c 2013-12-09 16:30:52 +0000
+++ b/src/gtkutil.c 2013-12-31 09:48:54 +0000
@@ -1354,8 +1354,8 @@
hint_flags = f->output_data.x->hint_flags;
hint_flags |= GDK_HINT_RESIZE_INC | GDK_HINT_MIN_SIZE;
- size_hints.width_inc = FRAME_COLUMN_WIDTH (f);
- size_hints.height_inc = FRAME_LINE_HEIGHT (f);
+ size_hints.width_inc = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
+ size_hints.height_inc = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f);
hint_flags |= GDK_HINT_BASE_SIZE;
/* Use one row/col here so base_height/width does not become zero.
@@ -1370,8 +1370,8 @@
size_hints.base_width = base_width;
size_hints.base_height = base_height;
- size_hints.min_width = base_width + min_cols * size_hints.width_inc;
- size_hints.min_height = base_height + min_rows * size_hints.height_inc;
+ size_hints.min_width = base_width + min_cols * FRAME_COLUMN_WIDTH (f);;
+ size_hints.min_height = base_height + min_rows * FRAME_LINE_HEIGHT (f);
/* These currently have a one to one mapping with the X values, but I
don't think we should rely on that. */
=== modified file 'src/widget.c'
--- a/src/widget.c 2013-12-20 10:48:36 +0000
+++ b/src/widget.c 2013-12-31 09:48:54 +0000
@@ -190,6 +190,14 @@
}
static void
+pixel_to_text_size (EmacsFrame ew, Dimension pixel_width, Dimension
pixel_height, int *text_width, int *text_height)
+{
+ struct frame* f = ew->emacs_frame.frame;
+ *text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, (int) pixel_width);
+ *text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, (int) pixel_height);
+}
+
+static void
char_to_pixel_size (EmacsFrame ew, int char_width, int char_height, Dimension
*pixel_width, Dimension *pixel_height)
{
struct frame* f = ew->emacs_frame.frame;
@@ -487,8 +495,8 @@
XtVaSetValues (wmshell,
XtNbaseWidth, (XtArgVal) base_width,
XtNbaseHeight, (XtArgVal) base_height,
- XtNwidthInc, (XtArgVal) cw,
- XtNheightInc, (XtArgVal) ch,
+ XtNwidthInc, (XtArgVal) (frame_resize_pixelwise ? 1 : cw),
+ XtNheightInc, (XtArgVal) (frame_resize_pixelwise ? 1 : ch),
XtNminWidth, (XtArgVal) (base_width + min_cols * cw),
XtNminHeight, (XtArgVal) (base_height + min_rows * ch),
NULL);
@@ -670,21 +678,41 @@
EmacsFrame ew = (EmacsFrame)widget;
struct frame *f = ew->emacs_frame.frame;
struct x_output *x = f->output_data.x;
- int columns;
- int rows;
- pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows);
- if (columns != FRAME_COLS (f)
- || rows != FRAME_LINES (f)
- || ew->core.width != FRAME_PIXEL_WIDTH (f)
- || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f))
+#if 0 /* Always process resize requests pixelwise. Frame maximizing
+ should work even when frame_resize_pixelwise is nil. */
+ if (frame_resize_pixelwise)
{
- change_frame_size (f, columns, rows, 0, 1, 0, 0);
+#endif /* 0 */
+ int width, height;
+
+ pixel_to_text_size (ew, ew->core.width, ew->core.height, &width,
&height);
+ change_frame_size (f, width, height, 0, 1, 0, 1);
+
update_wm_hints (ew);
update_various_frame_slots (ew);
cancel_mouse_face (f);
- }
+#if 0 /* See comment above. */
+ }
+ else
+ {
+ int columns, rows;
+
+ pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns,
&rows);
+ if (columns != FRAME_COLS (f)
+ || rows != FRAME_LINES (f)
+ || ew->core.width != FRAME_PIXEL_WIDTH (f)
+ || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f))
+ {
+ change_frame_size (f, columns, rows, 0, 1, 0, 0);
+ update_wm_hints (ew);
+ update_various_frame_slots (ew);
+
+ cancel_mouse_face (f);
+ }
+ }
+#endif /* 0 */
}
static Boolean
@@ -724,6 +752,7 @@
if (has_to_recompute_size)
{
+ /* Don't do this pixelwise, hopefully. */
pixel_width = new->core.width;
pixel_height = new->core.height;
pixel_to_char_size (new, pixel_width, pixel_height, &char_width,
=== modified file 'src/window.c'
--- a/src/window.c 2013-12-26 11:31:42 +0000
+++ b/src/window.c 2013-12-31 09:48:54 +0000
@@ -4582,14 +4582,16 @@
if (pixelwise)
{
- pixel_height = min (-XINT (height), INT_MAX - w->pixel_height);
+ pixel_height = max (min (-XINT (height), INT_MAX -
w->pixel_height),
+ FRAME_LINE_HEIGHT (f));
line_height = pixel_height / FRAME_LINE_HEIGHT (f);
}
else
{
- line_height = min (-XINT (height),
- ((INT_MAX - w->pixel_height)
- / FRAME_LINE_HEIGHT (f)));
+ line_height = max (min (-XINT (height),
+ ((INT_MAX - w->pixel_height)
+ / FRAME_LINE_HEIGHT (f))),
+ 1);
pixel_height = line_height * FRAME_LINE_HEIGHT (f);
}
=== modified file 'src/xdisp.c'
--- a/src/xdisp.c 2013-12-23 19:24:25 +0000
+++ b/src/xdisp.c 2013-12-31 09:48:54 +0000
@@ -20882,8 +20882,7 @@
eassert (!FRAME_WINDOW_P (f));
init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID);
it.first_visible_x = 0;
- /* PXW: Use FRAME_PIXEL_WIDTH (f) here? */
- it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
+ it.last_visible_x = FRAME_PIXEL_WIDTH (f);
#elif defined (HAVE_X_WINDOWS) /* X without toolkit. */
if (FRAME_WINDOW_P (f))
{
@@ -20894,8 +20893,7 @@
init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,
MENU_FACE_ID);
it.first_visible_x = 0;
- /* PXW: Use FRAME_PIXEL_WIDTH (f) here? */
- it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
+ it.last_visible_x = FRAME_PIXEL_WIDTH (f);
}
else
#endif /* not USE_X_TOOLKIT and not USE_GTK */
=== modified file 'src/xfns.c'
--- a/src/xfns.c 2013-12-11 10:03:46 +0000
+++ b/src/xfns.c 2013-12-31 09:48:54 +0000
@@ -997,7 +997,7 @@
#else /* not USE_X_TOOLKIT && not USE_GTK */
FRAME_MENU_BAR_LINES (f) = nlines;
FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f);
- resize_frame_windows (f, FRAME_LINES (f), 0, 0);
+ resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1);
/* If the menu bar height gets changed, the internal border below
the top margin has to be cleared. Also, if the menu bar gets
@@ -1052,7 +1052,7 @@
int nlines;
#if ! defined (USE_GTK)
int delta, root_height;
- Lisp_Object root_window;
+ int unit = FRAME_LINE_HEIGHT (f);
#endif
/* Treat tool bars like menu bars. */
@@ -1089,20 +1089,29 @@
/* Make sure we redisplay all windows in this frame. */
windows_or_buffers_changed = 60;
- delta = nlines - FRAME_TOOL_BAR_LINES (f);
+ /* DELTA is in pixels now. */
+ delta = (nlines - FRAME_TOOL_BAR_LINES (f)) * unit;
- /* Don't resize the tool-bar to more than we have room for. */
- root_window = FRAME_ROOT_WINDOW (f);
- root_height = WINDOW_TOTAL_LINES (XWINDOW (root_window));
- if (root_height - delta < 1)
+ /* Don't resize the tool-bar to more than we have room for. Note: The
+ calculations below and the subsequent call to resize_frame_windows
+ are inherently flawed because they can make the toolbar higher than
+ the containing frame. */
+ if (delta > 0)
{
- delta = root_height - 1;
- nlines = FRAME_TOOL_BAR_LINES (f) + delta;
+ root_height = WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_ROOT_WINDOW (f)));
+ if (root_height - delta < unit)
+ {
+ delta = root_height - unit;
+ /* When creating a new frame and toolbar mode is enabled, we
+ need at least one toolbar line. */
+ nlines = max (FRAME_TOOL_BAR_LINES (f) + delta / unit, 1);
+ }
}
FRAME_TOOL_BAR_LINES (f) = nlines;
FRAME_TOOL_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f);
- resize_frame_windows (f, FRAME_LINES (f), 0, 0);
+ ++windows_or_buffers_changed;
+ resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1);
adjust_frame_glyphs (f);
/* We also have to make sure that the internal border at the top of
@@ -1124,7 +1133,7 @@
{
int height = FRAME_INTERNAL_BORDER_WIDTH (f);
int width = FRAME_PIXEL_WIDTH (f);
- int y = (FRAME_MENU_BAR_LINES (f) + nlines) * FRAME_LINE_HEIGHT (f);
+ int y = nlines * unit;
/* height can be zero here. */
if (height > 0 && width > 0)
@@ -1139,7 +1148,7 @@
clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
}
- run_window_configuration_change_hook (f);
+ run_window_configuration_change_hook (f);
#endif /* USE_GTK */
}
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2013-12-20 10:48:36 +0000
+++ b/src/xterm.c 2013-12-31 09:48:54 +0000
@@ -9293,8 +9293,9 @@
size_hints.height = FRAME_PIXEL_HEIGHT (f);
size_hints.width = FRAME_PIXEL_WIDTH (f);
- size_hints.width_inc = FRAME_COLUMN_WIDTH (f);
- size_hints.height_inc = FRAME_LINE_HEIGHT (f);
+ size_hints.width_inc = frame_resize_pixelwise ? 1 : FRAME_COLUMN_WIDTH (f);
+ size_hints.height_inc = frame_resize_pixelwise ? 1 : FRAME_LINE_HEIGHT (f);
+
size_hints.max_width = x_display_pixel_width (FRAME_DISPLAY_INFO (f))
- FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
size_hints.max_height = x_display_pixel_height (FRAME_DISPLAY_INFO (f))
@@ -9310,6 +9311,14 @@
check_frame_size (f, &min_cols, &min_rows, 0);
+ if (frame_resize_pixelwise)
+ /* Needed to prevent a bad protocol error crash when making the
+ frame size very small. */
+ {
+ min_cols = 2 * min_cols;
+ min_rows = 2 * min_rows;
+ }
+
/* The window manager uses the base width hints to calculate the
current number of rows and columns in the frame while
resizing; min_width and min_height aren't useful for this
@@ -9323,8 +9332,8 @@
size_hints.flags |= PBaseSize;
size_hints.base_width = base_width;
size_hints.base_height = base_height + FRAME_MENUBAR_HEIGHT (f);
- size_hints.min_width = base_width + min_cols * size_hints.width_inc;
- size_hints.min_height = base_height + min_rows * size_hints.height_inc;
+ size_hints.min_width = base_width + min_cols * FRAME_COLUMN_WIDTH (f);
+ size_hints.min_height = base_height + min_rows * FRAME_LINE_HEIGHT (f);
}
/* If we don't need the old flags, we don't need the old hint at all. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115817: Some more fixes following pixelwise resize changes including one for Bug#16306.,
Martin Rudalics <=