summaryrefslogtreecommitdiff
path: root/src/gtkutil.c
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2009-07-02 12:27:23 +0000
committerJan Djärv <jan.h.d@swipnet.se>2009-07-02 12:27:23 +0000
commit9378787388490395c30b31e7ba40f57349d8d2d9 (patch)
tree7ead71736c02b0a1f8238ca58118c56f28ca5bc4 /src/gtkutil.c
parent35e6999c3c87931a0a87b8c647e427a0ac4bfcfa (diff)
downloademacs-9378787388490395c30b31e7ba40f57349d8d2d9.tar.gz
* 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/gtkutil.c')
-rw-r--r--src/gtkutil.c51
1 files changed, 35 insertions, 16 deletions
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)
FRAME_PTR f;
int pixelwidth, pixelheight;
{
- int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight);
- int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth);
-
- if (FRAME_GTK_WIDGET (f)
- && (columns != FRAME_COLS (f)
- || rows != FRAME_LINES (f)
- || pixelwidth != FRAME_PIXEL_WIDTH (f)
- || pixelheight != FRAME_PIXEL_HEIGHT (f)))
+ int rows, columns;
+
+ if (pixelwidth == -1 && pixelheight == -1)
+ {
+ if (FRAME_GTK_WIDGET (f) && GTK_WIDGET_MAPPED (FRAME_GTK_WIDGET (f)))
+ gdk_window_get_geometry(FRAME_GTK_WIDGET (f)->window, 0, 0,
+ &pixelwidth, &pixelheight, 0);
+ else return;
+ }
+
+
+ rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight);
+ columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth);
+
+ if (columns != FRAME_COLS (f)
+ || rows != FRAME_LINES (f)
+ || pixelwidth != FRAME_PIXEL_WIDTH (f)
+ || pixelheight != FRAME_PIXEL_HEIGHT (f))
{
FRAME_PIXEL_WIDTH (f) = pixelwidth;
FRAME_PIXEL_HEIGHT (f) = pixelheight;
@@ -704,14 +714,23 @@ xg_frame_set_char_size (f, cols, rows)
pixelwidth, pixelheight);
x_wm_set_size_hint (f, 0, 0);
- SET_FRAME_GARBAGED (f);
-
- /* We can not call change_frame_size here, we can not set pixel
- width/height either. The window manager may override our resize
- request, XMonad does this all the time. The best we can do
- is try to sync, so lisp code sees the updated size as fast as
- possible. */
- flush_and_sync (f);
+ /* We can not call change_frame_size for a mapped frame,
+ we can not set pixel width/height either. The window manager may
+ override our resize request, XMonad does this all the time.
+ The best we can do is try to sync, so lisp code sees the updated
+ size as fast as possible.
+ For unmapped windows, we can set rows/cols. When
+ the frame is mapped again we will (hopefully) get the correct size. */
+ if (f->async_visible)
+ flush_and_sync (f);
+ else
+ {
+ FRAME_PIXEL_WIDTH (f) = pixelwidth;
+ FRAME_PIXEL_HEIGHT (f) = pixelheight;
+ change_frame_size (f, rows, cols, 0, 1, 0);
+ SET_FRAME_GARBAGED (f);
+ cancel_mouse_face (f);
+ }
}
/* Handle height changes (i.e. add/remove menu/toolbar).