aboutsummaryrefslogtreecommitdiffstats
path: root/src/widget.c
diff options
context:
space:
mode:
authorMartin Rudalics2013-12-31 10:48:54 +0100
committerMartin Rudalics2013-12-31 10:48:54 +0100
commit9b3c0a162e7876bab09c299ff4d803b632bf3ac8 (patch)
tree99d5899a5f57df9c1c1ba33cdb66cddafa4ae499 /src/widget.c
parentb29daf07584497968831af6687bf0fde2d216418 (diff)
downloademacs-9b3c0a162e7876bab09c299ff4d803b632bf3ac8.tar.gz
emacs-9b3c0a162e7876bab09c299ff4d803b632bf3ac8.zip
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.
Diffstat (limited to 'src/widget.c')
-rw-r--r--src/widget.c51
1 files changed, 40 insertions, 11 deletions
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,