diff options
| author | Jan Djärv | 2009-07-02 12:27:23 +0000 |
|---|---|---|
| committer | Jan Djärv | 2009-07-02 12:27:23 +0000 |
| commit | 7b5072481940df702c273797ed13aa2c805bf3d8 (patch) | |
| tree | e39a475e89d5a3e9455a27883468bdae86fa63c4 /src | |
| parent | c5c194aa928b9f3a1e0fdf9d1189bb16404b2c65 (diff) | |
| download | emacs-7b5072481940df702c273797ed13aa2c805bf3d8.tar.gz emacs-7b5072481940df702c273797ed13aa2c805bf3d8.zip | |
* gtkutil.c (xg_frame_set_char_size): Do set width/height if the
frame isn't visible.
(xg_frame_resized): If width/height is -1, get size of window
from X server.
* xterm.c (handle_one_xevent): Call xg_frame_resized for USE_GTK
for MapNotify.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/gtkutil.c | 51 | ||||
| -rw-r--r-- | src/xterm.c | 3 |
3 files changed, 46 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 673c716753d..52764078844 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | 2009-07-02 Jan Djärv <jan.h.d@swipnet.se> | 1 | 2009-07-02 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 2 | ||
| 3 | * gtkutil.c (xg_frame_set_char_size): Do set width/height if the | ||
| 4 | frame isn't visible. | ||
| 5 | (xg_frame_resized): If width/height is -1, get size of window | ||
| 6 | from X server. | ||
| 7 | |||
| 8 | * xterm.c (handle_one_xevent): Call xg_frame_resized for USE_GTK | ||
| 9 | for MapNotify. | ||
| 10 | |||
| 3 | * gtkutil.c (xg_frame_set_char_size): Do not set pixel width/height | 11 | * gtkutil.c (xg_frame_set_char_size): Do not set pixel width/height |
| 4 | here or call change_frame_size. Just call flush_and_sync. | 12 | here or call change_frame_size. Just call flush_and_sync. |
| 5 | (flush_and_sync): Reintroduced. | 13 | (flush_and_sync): Reintroduced. |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 2c5d31e571a..e18044f85e2 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -636,14 +636,24 @@ xg_frame_resized (f, pixelwidth, pixelheight) | |||
| 636 | FRAME_PTR f; | 636 | FRAME_PTR f; |
| 637 | int pixelwidth, pixelheight; | 637 | int pixelwidth, pixelheight; |
| 638 | { | 638 | { |
| 639 | int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); | 639 | int rows, columns; |
| 640 | int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); | 640 | |
| 641 | 641 | if (pixelwidth == -1 && pixelheight == -1) | |
| 642 | if (FRAME_GTK_WIDGET (f) | 642 | { |
| 643 | && (columns != FRAME_COLS (f) | 643 | if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f))) |
| 644 | || rows != FRAME_LINES (f) | 644 | gdk_window_get_geometry(FRAME_GTK_WIDGET (f)->window, 0, 0, |
| 645 | || pixelwidth != FRAME_PIXEL_WIDTH (f) | 645 | &pixelwidth, &pixelheight, 0); |
| 646 | || pixelheight != FRAME_PIXEL_HEIGHT (f))) | 646 | else return; |
| 647 | } | ||
| 648 | |||
| 649 | |||
| 650 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); | ||
| 651 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); | ||
| 652 | |||
| 653 | if (columns != FRAME_COLS (f) | ||
| 654 | || rows != FRAME_LINES (f) | ||
| 655 | || pixelwidth != FRAME_PIXEL_WIDTH (f) | ||
| 656 | || pixelheight != FRAME_PIXEL_HEIGHT (f)) | ||
| 647 | { | 657 | { |
| 648 | FRAME_PIXEL_WIDTH (f) = pixelwidth; | 658 | FRAME_PIXEL_WIDTH (f) = pixelwidth; |
| 649 | FRAME_PIXEL_HEIGHT (f) = pixelheight; | 659 | FRAME_PIXEL_HEIGHT (f) = pixelheight; |
| @@ -704,14 +714,23 @@ xg_frame_set_char_size (f, cols, rows) | |||
| 704 | pixelwidth, pixelheight); | 714 | pixelwidth, pixelheight); |
| 705 | x_wm_set_size_hint (f, 0, 0); | 715 | x_wm_set_size_hint (f, 0, 0); |
| 706 | 716 | ||
| 707 | SET_FRAME_GARBAGED (f); | 717 | /* We can not call change_frame_size for a mapped frame, |
| 708 | 718 | we can not set pixel width/height either. The window manager may | |
| 709 | /* We can not call change_frame_size here, we can not set pixel | 719 | override our resize request, XMonad does this all the time. |
| 710 | width/height either. The window manager may override our resize | 720 | The best we can do is try to sync, so lisp code sees the updated |
| 711 | request, XMonad does this all the time. The best we can do | 721 | size as fast as possible. |
| 712 | is try to sync, so lisp code sees the updated size as fast as | 722 | For unmapped windows, we can set rows/cols. When |
| 713 | possible. */ | 723 | the frame is mapped again we will (hopefully) get the correct size. */ |
| 714 | flush_and_sync (f); | 724 | if (f->async_visible) |
| 725 | flush_and_sync (f); | ||
| 726 | else | ||
| 727 | { | ||
| 728 | FRAME_PIXEL_WIDTH (f) = pixelwidth; | ||
| 729 | FRAME_PIXEL_HEIGHT (f) = pixelheight; | ||
| 730 | change_frame_size (f, rows, cols, 0, 1, 0); | ||
| 731 | SET_FRAME_GARBAGED (f); | ||
| 732 | cancel_mouse_face (f); | ||
| 733 | } | ||
| 715 | } | 734 | } |
| 716 | 735 | ||
| 717 | /* Handle height changes (i.e. add/remove menu/toolbar). | 736 | /* Handle height changes (i.e. add/remove menu/toolbar). |
diff --git a/src/xterm.c b/src/xterm.c index 168614069f5..77dc48f9a64 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6206,6 +6206,9 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 6206 | 6206 | ||
| 6207 | /* Check if fullscreen was specified before we where mapped. */ | 6207 | /* Check if fullscreen was specified before we where mapped. */ |
| 6208 | x_check_fullscreen (f); | 6208 | x_check_fullscreen (f); |
| 6209 | #ifdef USE_GTK | ||
| 6210 | xg_frame_resized (f, -1, -1); | ||
| 6211 | #endif | ||
| 6209 | } | 6212 | } |
| 6210 | goto OTHER; | 6213 | goto OTHER; |
| 6211 | 6214 | ||