Mercurial > hg > xemacs-beta
comparison src/window.c @ 5047:07dcc7000bbf
put width before height consistently, fix a real bug found in the process
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-20 Ben Wing <ben@xemacs.org>
* EmacsFrame.c (EmacsFrameRecomputeCellSize):
* faces.c (default_face_font_info):
* faces.c (default_face_width_and_height):
* faces.c (Fface_list):
* faces.h:
* frame-gtk.c (gtk_set_initial_frame_size):
* frame-gtk.c (gtk_set_frame_size):
* frame-gtk.c (gtk_recompute_cell_sizes):
* frame.c:
* frame.c (frame_conversion_internal_1):
* frame.c (change_frame_size_1):
* frame.c (change_frame_size):
* glyphs-msw.c (mswindows_combo_box_instantiate):
* glyphs-widget.c (widget_instantiate):
* glyphs-widget.c (tree_view_query_geometry):
* glyphs-widget.c (Fwidget_logical_to_character_width):
* glyphs-widget.c (Fwidget_logical_to_character_height):
* indent.c (vmotion_pixels):
* redisplay-output.c (get_cursor_size_and_location):
* redisplay-xlike-inc.c (XLIKE_output_eol_cursor):
* redisplay-xlike-inc.c (XLIKE_flash):
* redisplay.c (calculate_baseline):
* redisplay.c (start_with_point_on_display_line):
* redisplay.c (glyph_to_pixel_translation):
* redisplay.c (pixel_to_glyph_translation):
* window.c (margin_width_internal):
* window.c (frame_size_valid_p):
* window.c (frame_pixsize_valid_p):
* window.c (check_frame_size):
* window.c (set_window_pixsize):
* window.c (window_pixel_height_to_char_height):
* window.c (window_char_height_to_pixel_height):
* window.c (window_displayed_height):
* window.c (window_pixel_width_to_char_width):
* window.c (window_char_width_to_pixel_width):
* window.c (change_window_height):
* window.c (window_scroll):
* window.h:
IMPORTANT: Aidan and Carbon Repo, please pay attention and fix
appropriately!
Rename: default_face_height_and_width -> default_face_width_and_height
and reverse width/height arguments.
Reverse width/height arguments to the following functions:
-- default_face_font_info
-- default_face_height_and_width (see above)
-- check_frame_size
-- frame_size_valid_p (made into a static function)
Fix a redisplay bug where args to default_face_height_and_width
were in the wrong order.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 20 Feb 2010 18:56:01 -0600 |
parents | d0c14ea98592 |
children | 92dc90c0bb40 |
comparison
equal
deleted
inserted
replaced
5046:d4f666cda5e6 | 5047:07dcc7000bbf |
---|---|
1177 | 1177 |
1178 window = wrap_window (w); | 1178 window = wrap_window (w); |
1179 margin_cwidth = (left_margin ? XINT (w->left_margin_width) : | 1179 margin_cwidth = (left_margin ? XINT (w->left_margin_width) : |
1180 XINT (w->right_margin_width)); | 1180 XINT (w->right_margin_width)); |
1181 | 1181 |
1182 default_face_height_and_width (window, 0, &font_width); | 1182 default_face_width_and_height (window, &font_width, 0); |
1183 | 1183 |
1184 /* The left margin takes precedence over the right margin so we | 1184 /* The left margin takes precedence over the right margin so we |
1185 subtract its width from the space available for the right | 1185 subtract its width from the space available for the right |
1186 margin. */ | 1186 margin. */ |
1187 if (!left_margin) | 1187 if (!left_margin) |
1660 | 1660 |
1661 start = marker_position (w->start[CURRENT_DISP]); | 1661 start = marker_position (w->start[CURRENT_DISP]); |
1662 hlimit = WINDOW_TEXT_HEIGHT (w); | 1662 hlimit = WINDOW_TEXT_HEIGHT (w); |
1663 eobuf = BUF_ZV (XBUFFER (w->buffer)); | 1663 eobuf = BUF_ZV (XBUFFER (w->buffer)); |
1664 | 1664 |
1665 default_face_height_and_width (window, &defheight, NULL); | 1665 default_face_width_and_height (window, NULL, &defheight); |
1666 | 1666 |
1667 /* guess lines needed in line start cache + a few extra */ | 1667 /* guess lines needed in line start cache + a few extra */ |
1668 needed = (hlimit + defheight-1) / defheight + 3; | 1668 needed = (hlimit + defheight-1) / defheight + 3; |
1669 | 1669 |
1670 while (1) { | 1670 while (1) { |
3480 : 2 * MIN_SAFE_WINDOW_HEIGHT - 1); | 3480 : 2 * MIN_SAFE_WINDOW_HEIGHT - 1); |
3481 } | 3481 } |
3482 | 3482 |
3483 /* Return non-zero if both frame sizes are less than or equal to | 3483 /* Return non-zero if both frame sizes are less than or equal to |
3484 minimal allowed values. ROWS and COLS are in characters */ | 3484 minimal allowed values. ROWS and COLS are in characters */ |
3485 int | 3485 static int |
3486 frame_size_valid_p (struct frame *frame, int rows, int cols) | 3486 frame_size_valid_p (struct frame *frame, int cols, int rows) |
3487 { | 3487 { |
3488 return (rows >= frame_min_height (frame) | 3488 return (rows >= frame_min_height (frame) |
3489 && cols >= MIN_SAFE_WINDOW_WIDTH); | 3489 && cols >= MIN_SAFE_WINDOW_WIDTH); |
3490 } | 3490 } |
3491 | 3491 |
3494 int | 3494 int |
3495 frame_pixsize_valid_p (struct frame *frame, int width, int height) | 3495 frame_pixsize_valid_p (struct frame *frame, int width, int height) |
3496 { | 3496 { |
3497 int rows, cols; | 3497 int rows, cols; |
3498 pixel_to_char_size (frame, width, height, &cols, &rows); | 3498 pixel_to_char_size (frame, width, height, &cols, &rows); |
3499 return frame_size_valid_p (frame, rows, cols); | 3499 return frame_size_valid_p (frame, cols, rows); |
3500 } | 3500 } |
3501 | 3501 |
3502 /* If *ROWS or *COLS are too small a size for FRAME, set them to the | 3502 /* If *ROWS or *COLS are too small a size for FRAME, set them to the |
3503 minimum allowable size. */ | 3503 minimum allowable size. */ |
3504 void | 3504 void |
3505 check_frame_size (struct frame *frame, int *rows, int *cols) | 3505 check_frame_size (struct frame *frame, int *cols, int *rows) |
3506 { | 3506 { |
3507 int min_height = frame_min_height (frame); | 3507 int min_height = frame_min_height (frame); |
3508 int min_pixwidth, min_pixheight; | 3508 int min_pixwidth, min_pixheight; |
3509 int min_geomwidth, min_geomheight; | 3509 int min_geomwidth, min_geomheight; |
3510 | 3510 |
3535 Lisp_Object child, minor_kid, major_kid; | 3535 Lisp_Object child, minor_kid, major_kid; |
3536 int minsize; | 3536 int minsize; |
3537 int line_size; | 3537 int line_size; |
3538 int defheight, defwidth; | 3538 int defheight, defwidth; |
3539 | 3539 |
3540 default_face_height_and_width (window, &defheight, &defwidth); | 3540 default_face_width_and_height (window, &defwidth, &defheight); |
3541 line_size = (set_height ? defheight : defwidth); | 3541 line_size = (set_height ? defheight : defwidth); |
3542 | 3542 |
3543 check_min_window_sizes (); | 3543 check_min_window_sizes (); |
3544 | 3544 |
3545 minsize = (set_height ? window_min_height : window_min_width); | 3545 minsize = (set_height ? window_min_height : window_min_width); |
4139 avail_height = (pixel_height - | 4139 avail_height = (pixel_height - |
4140 (include_gutters_p ? 0 : | 4140 (include_gutters_p ? 0 : |
4141 window_top_window_gutter_height (w) + | 4141 window_top_window_gutter_height (w) + |
4142 window_bottom_window_gutter_height (w))); | 4142 window_bottom_window_gutter_height (w))); |
4143 | 4143 |
4144 default_face_height_and_width (window, &defheight, &defwidth); | 4144 default_face_width_and_height (window, &defwidth, &defheight); |
4145 | 4145 |
4146 if (defheight) | 4146 if (defheight) |
4147 char_height = avail_height / defheight; | 4147 char_height = avail_height / defheight; |
4148 | 4148 |
4149 /* It's the calling function's responsibility to check these values | 4149 /* It's the calling function's responsibility to check these values |
4163 int pixel_height; | 4163 int pixel_height; |
4164 | 4164 |
4165 Lisp_Object window = wrap_window (w); | 4165 Lisp_Object window = wrap_window (w); |
4166 | 4166 |
4167 | 4167 |
4168 default_face_height_and_width (window, &defheight, &defwidth); | 4168 default_face_width_and_height (window, &defwidth, &defheight); |
4169 | 4169 |
4170 avail_height = char_height * defheight; | 4170 avail_height = char_height * defheight; |
4171 pixel_height = (avail_height + | 4171 pixel_height = (avail_height + |
4172 (include_gutters_p ? 0 : | 4172 (include_gutters_p ? 0 : |
4173 window_top_window_gutter_height (w) + | 4173 window_top_window_gutter_height (w) + |
4243 return num_lines - 1; | 4243 return num_lines - 1; |
4244 ypos1 = dl->ypos + dl->descent - dl->clip; | 4244 ypos1 = dl->ypos + dl->descent - dl->clip; |
4245 } | 4245 } |
4246 } | 4246 } |
4247 | 4247 |
4248 default_face_height_and_width (window, &defheight, &defwidth); | 4248 default_face_width_and_height (window, &defwidth, &defheight); |
4249 /* #### This probably needs to know about the clipping area once a | 4249 /* #### This probably needs to know about the clipping area once a |
4250 final definition is decided on. */ | 4250 final definition is decided on. */ |
4251 if (defheight) | 4251 if (defheight) |
4252 num_lines += ((ypos2 - ypos1) / defheight); | 4252 num_lines += ((ypos2 - ypos1) / defheight); |
4253 } | 4253 } |
4286 window_left_gutter_width (w, 0) - | 4286 window_left_gutter_width (w, 0) - |
4287 window_right_gutter_width (w, 0) - | 4287 window_right_gutter_width (w, 0) - |
4288 (include_margins_p ? 0 : window_left_margin_width (w)) - | 4288 (include_margins_p ? 0 : window_left_margin_width (w)) - |
4289 (include_margins_p ? 0 : window_right_margin_width (w))); | 4289 (include_margins_p ? 0 : window_right_margin_width (w))); |
4290 | 4290 |
4291 default_face_height_and_width (window, &defheight, &defwidth); | 4291 default_face_width_and_height (window, &defwidth, &defheight); |
4292 | 4292 |
4293 if (defwidth) | 4293 if (defwidth) |
4294 char_width = (avail_width / defwidth); | 4294 char_width = (avail_width / defwidth); |
4295 | 4295 |
4296 /* It's the calling function's responsibility to check these values | 4296 /* It's the calling function's responsibility to check these values |
4309 int pixel_width; | 4309 int pixel_width; |
4310 int defheight, defwidth; | 4310 int defheight, defwidth; |
4311 Lisp_Object window = wrap_window (w); | 4311 Lisp_Object window = wrap_window (w); |
4312 | 4312 |
4313 | 4313 |
4314 default_face_height_and_width (window, &defheight, &defwidth); | 4314 default_face_width_and_height (window, &defwidth, &defheight); |
4315 | 4315 |
4316 avail_width = char_width * defwidth; | 4316 avail_width = char_width * defwidth; |
4317 pixel_width = (avail_width + | 4317 pixel_width = (avail_width + |
4318 window_left_window_gutter_width (w, 0) + | 4318 window_left_window_gutter_width (w, 0) + |
4319 window_right_window_gutter_width (w, 0) + | 4319 window_right_window_gutter_width (w, 0) + |
4392 window = wrap_window (win); | 4392 window = wrap_window (win); |
4393 f = XFRAME (win->frame); | 4393 f = XFRAME (win->frame); |
4394 if (EQ (window, FRAME_ROOT_WINDOW (f))) | 4394 if (EQ (window, FRAME_ROOT_WINDOW (f))) |
4395 invalid_operation ("Won't change only window", Qunbound); | 4395 invalid_operation ("Won't change only window", Qunbound); |
4396 | 4396 |
4397 default_face_height_and_width (window, &defheight, &defwidth); | 4397 default_face_width_and_height (window, &defwidth, &defheight); |
4398 | 4398 |
4399 while (1) | 4399 while (1) |
4400 { | 4400 { |
4401 w = XWINDOW (window); | 4401 w = XWINDOW (window); |
4402 parent = w->parent; | 4402 parent = w->parent; |
4621 dla = window_display_lines (w, CURRENT_DISP); | 4621 dla = window_display_lines (w, CURRENT_DISP); |
4622 | 4622 |
4623 if (INTP (Vwindow_pixel_scroll_increment)) | 4623 if (INTP (Vwindow_pixel_scroll_increment)) |
4624 fheight = XINT (Vwindow_pixel_scroll_increment); | 4624 fheight = XINT (Vwindow_pixel_scroll_increment); |
4625 else if (!NILP (Vwindow_pixel_scroll_increment)) | 4625 else if (!NILP (Vwindow_pixel_scroll_increment)) |
4626 default_face_height_and_width (window, &fheight, &fwidth); | 4626 default_face_width_and_height (window, &fwidth, &fheight); |
4627 | 4627 |
4628 if (Dynarr_length (dla) >= 1) | 4628 if (Dynarr_length (dla) >= 1) |
4629 modeline = Dynarr_begin (dla)->modeline; | 4629 modeline = Dynarr_begin (dla)->modeline; |
4630 | 4630 |
4631 dl = Dynarr_atp (dla, modeline); | 4631 dl = Dynarr_atp (dla, modeline); |