X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/c44de18d7db9c038473c71d0708990c3b081402f..858e55f412a35ca8e2c0b68eef61c6c864e5ce24:/src/widget.c diff --git a/src/widget.c b/src/widget.c index 73c5149e2c..bd0fe826e6 100644 --- a/src/widget.c +++ b/src/widget.c @@ -1,5 +1,5 @@ /* The emacs frame widget. - Copyright (C) 1992-1993, 2000-2013 Free Software Foundation, Inc. + Copyright (C) 1992-1993, 2000-2014 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -189,6 +189,14 @@ pixel_to_char_size (EmacsFrame ew, Dimension pixel_width, Dimension pixel_height *char_height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, (int) pixel_height); } +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) { @@ -487,8 +495,8 @@ update_wm_hints (EmacsFrame ew) 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); @@ -590,11 +598,18 @@ static void update_various_frame_slots (EmacsFrame ew) { struct frame *f = ew->emacs_frame.frame; - struct x_output *x = f->output_data.x; - FRAME_PIXEL_HEIGHT (f) = ew->core.height + x->menubar_height; - FRAME_PIXEL_WIDTH (f) = ew->core.width; - f->internal_border_width = ew->emacs_frame.internal_border_width; + /* Don't do that: It confuses the check in change_frame_size_1 whether + the pixel size of the frame changed due to a change of the internal + border width. Bug#16736. */ + if (false) + { + struct x_output *x = f->output_data.x; + FRAME_PIXEL_HEIGHT (f) = ew->core.height + x->menubar_height; + FRAME_PIXEL_WIDTH (f) = ew->core.width; + } + + f->internal_border_width = ew->emacs_frame.internal_border_width; } static void @@ -669,22 +684,39 @@ EmacsFrameResize (Widget widget) { 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)) + + /* Always process resize requests pixelwise. Frame maximizing + should work even when frame_resize_pixelwise is nil. */ + if (true || frame_resize_pixelwise) { - change_frame_size (f, columns, rows, 0, 1, 0, 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); } + else + { + struct x_output *x = f->output_data.x; + 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); + } + } } static Boolean @@ -724,6 +756,7 @@ EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, Ar 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,