diff options
| author | Jan Djärv | 2010-01-05 15:16:30 +0100 |
|---|---|---|
| committer | Jan Djärv | 2010-01-05 15:16:30 +0100 |
| commit | 7c583cd8559846fc9537778e9c141cd85358302f (patch) | |
| tree | 593af9f94fd171fbe48d61d8da39933fb7bfbef4 /src/gtkutil.c | |
| parent | 798c9eb5600072c2558de7620ad69b06aee46de7 (diff) | |
| download | emacs-7c583cd8559846fc9537778e9c141cd85358302f.tar.gz emacs-7c583cd8559846fc9537778e9c141cd85358302f.zip | |
Handle change of internal-border width when maximized.
* xterm.c (x_new_font): Move code for setting rows/cols before
resizing ...
(x_set_window_size): ... to here. bug #2568.
* gtkutil.c (xg_clear_under_internal_border): New function.
(xg_frame_resized, xg_frame_set_char_size): Call
xg_clear_under_internal_border.
(xg_update_scrollbar_pos): Clear under old scroll bar position.
Diffstat (limited to 'src/gtkutil.c')
| -rw-r--r-- | src/gtkutil.c | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index cd9c930c7c2..1dab467a0ac 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -568,6 +568,42 @@ xg_set_geometry (f) | |||
| 568 | f->left_pos, f->top_pos); | 568 | f->left_pos, f->top_pos); |
| 569 | } | 569 | } |
| 570 | 570 | ||
| 571 | /* Clear under internal border if any. As we use a mix of Gtk+ and X calls | ||
| 572 | and use a GtkFixed widget, this doesn't happen automatically. */ | ||
| 573 | |||
| 574 | static void | ||
| 575 | xg_clear_under_internal_border (f) | ||
| 576 | FRAME_PTR f; | ||
| 577 | { | ||
| 578 | if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) | ||
| 579 | { | ||
| 580 | GtkWidget *wfixed = f->output_data.x->edit_widget; | ||
| 581 | gtk_widget_queue_draw (wfixed); | ||
| 582 | gdk_window_process_all_updates (); | ||
| 583 | x_clear_area (FRAME_X_DISPLAY (f), | ||
| 584 | FRAME_X_WINDOW (f), | ||
| 585 | 0, 0, | ||
| 586 | FRAME_PIXEL_WIDTH (f), | ||
| 587 | FRAME_INTERNAL_BORDER_WIDTH (f), 0); | ||
| 588 | x_clear_area (FRAME_X_DISPLAY (f), | ||
| 589 | FRAME_X_WINDOW (f), | ||
| 590 | 0, 0, | ||
| 591 | FRAME_INTERNAL_BORDER_WIDTH (f), | ||
| 592 | FRAME_PIXEL_HEIGHT (f), 0); | ||
| 593 | x_clear_area (FRAME_X_DISPLAY (f), | ||
| 594 | FRAME_X_WINDOW (f), | ||
| 595 | 0, FRAME_PIXEL_HEIGHT (f) - FRAME_INTERNAL_BORDER_WIDTH (f), | ||
| 596 | FRAME_PIXEL_WIDTH (f), | ||
| 597 | FRAME_INTERNAL_BORDER_WIDTH (f), 0); | ||
| 598 | x_clear_area (FRAME_X_DISPLAY (f), | ||
| 599 | FRAME_X_WINDOW (f), | ||
| 600 | FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f), | ||
| 601 | 0, | ||
| 602 | FRAME_INTERNAL_BORDER_WIDTH (f), | ||
| 603 | FRAME_PIXEL_HEIGHT (f), 0); | ||
| 604 | } | ||
| 605 | } | ||
| 606 | |||
| 571 | /* Function to handle resize of our frame. As we have a Gtk+ tool bar | 607 | /* Function to handle resize of our frame. As we have a Gtk+ tool bar |
| 572 | and a Gtk+ menu bar, we get resize events for the edit part of the | 608 | and a Gtk+ menu bar, we get resize events for the edit part of the |
| 573 | frame only. We let Gtk+ deal with the Gtk+ parts. | 609 | frame only. We let Gtk+ deal with the Gtk+ parts. |
| @@ -584,8 +620,8 @@ xg_frame_resized (f, pixelwidth, pixelheight) | |||
| 584 | if (pixelwidth == -1 && pixelheight == -1) | 620 | if (pixelwidth == -1 && pixelheight == -1) |
| 585 | { | 621 | { |
| 586 | if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f))) | 622 | if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f))) |
| 587 | gdk_window_get_geometry(FRAME_GTK_WIDGET (f)->window, 0, 0, | 623 | gdk_window_get_geometry (FRAME_GTK_WIDGET (f)->window, 0, 0, |
| 588 | &pixelwidth, &pixelheight, 0); | 624 | &pixelwidth, &pixelheight, 0); |
| 589 | else return; | 625 | else return; |
| 590 | } | 626 | } |
| 591 | 627 | ||
| @@ -601,6 +637,7 @@ xg_frame_resized (f, pixelwidth, pixelheight) | |||
| 601 | FRAME_PIXEL_WIDTH (f) = pixelwidth; | 637 | FRAME_PIXEL_WIDTH (f) = pixelwidth; |
| 602 | FRAME_PIXEL_HEIGHT (f) = pixelheight; | 638 | FRAME_PIXEL_HEIGHT (f) = pixelheight; |
| 603 | 639 | ||
| 640 | xg_clear_under_internal_border (f); | ||
| 604 | change_frame_size (f, rows, columns, 0, 1, 0); | 641 | change_frame_size (f, rows, columns, 0, 1, 0); |
| 605 | SET_FRAME_GARBAGED (f); | 642 | SET_FRAME_GARBAGED (f); |
| 606 | cancel_mouse_face (f); | 643 | cancel_mouse_face (f); |
| @@ -637,6 +674,10 @@ xg_frame_set_char_size (f, cols, rows) | |||
| 637 | after calculating that value. */ | 674 | after calculating that value. */ |
| 638 | pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); | 675 | pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols); |
| 639 | 676 | ||
| 677 | |||
| 678 | /* Do this before resize, as we don't know yet if we will be resized. */ | ||
| 679 | xg_clear_under_internal_border (f); | ||
| 680 | |||
| 640 | /* Must resize our top level widget. Font size may have changed, | 681 | /* Must resize our top level widget. Font size may have changed, |
| 641 | but not rows/cols. */ | 682 | but not rows/cols. */ |
| 642 | gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | 683 | gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), |
| @@ -3201,15 +3242,43 @@ xg_update_scrollbar_pos (f, scrollbar_id, top, left, width, height) | |||
| 3201 | { | 3242 | { |
| 3202 | GtkWidget *wfixed = f->output_data.x->edit_widget; | 3243 | GtkWidget *wfixed = f->output_data.x->edit_widget; |
| 3203 | GtkWidget *wparent = gtk_widget_get_parent (wscroll); | 3244 | GtkWidget *wparent = gtk_widget_get_parent (wscroll); |
| 3245 | GtkFixed *wf = GTK_FIXED (wfixed); | ||
| 3246 | |||
| 3247 | /* Clear out old position. */ | ||
| 3248 | GList *iter; | ||
| 3249 | int oldx = -1, oldy = -1, oldw, oldh; | ||
| 3250 | for (iter = wf->children; iter; iter = iter->next) | ||
| 3251 | if (((GtkFixedChild *)iter->data)->widget == wparent) | ||
| 3252 | { | ||
| 3253 | GtkFixedChild *ch = (GtkFixedChild *)iter->data; | ||
| 3254 | if (ch->x != left || ch->y != top) | ||
| 3255 | { | ||
| 3256 | oldx = ch->x; | ||
| 3257 | oldy = ch->y; | ||
| 3258 | gtk_widget_get_size_request (wscroll, &oldw, &oldh); | ||
| 3259 | } | ||
| 3260 | break; | ||
| 3261 | } | ||
| 3204 | 3262 | ||
| 3205 | /* Move and resize to new values. */ | 3263 | /* Move and resize to new values. */ |
| 3206 | gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top); | 3264 | gtk_fixed_move (GTK_FIXED (wfixed), wparent, left, top); |
| 3207 | gtk_widget_set_size_request (wscroll, width, height); | 3265 | gtk_widget_set_size_request (wscroll, width, height); |
| 3208 | gtk_widget_queue_draw (wparent); | 3266 | gtk_widget_queue_draw (wfixed); |
| 3209 | gdk_window_process_all_updates (); | 3267 | gdk_window_process_all_updates (); |
| 3268 | if (oldx != -1) | ||
| 3269 | { | ||
| 3270 | /* Clear under old scroll bar position. This must be done after | ||
| 3271 | the gtk_widget_queue_draw and gdk_window_process_all_updates | ||
| 3272 | above. */ | ||
| 3273 | x_clear_area (FRAME_X_DISPLAY (f), | ||
| 3274 | FRAME_X_WINDOW (f), | ||
| 3275 | oldx, oldy, oldw, oldh, 0); | ||
| 3276 | } | ||
| 3277 | |||
| 3210 | /* GTK does not redraw until the main loop is entered again, but | 3278 | /* GTK does not redraw until the main loop is entered again, but |
| 3211 | if there are no X events pending we will not enter it. So we sync | 3279 | if there are no X events pending we will not enter it. So we sync |
| 3212 | here to get some events. */ | 3280 | here to get some events. */ |
| 3281 | |||
| 3213 | x_sync (f); | 3282 | x_sync (f); |
| 3214 | SET_FRAME_GARBAGED (f); | 3283 | SET_FRAME_GARBAGED (f); |
| 3215 | cancel_mouse_face (f); | 3284 | cancel_mouse_face (f); |