diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2009-10-21 18:29:46 +0000 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2009-10-21 18:29:46 +0000 |
commit | 5c646d5a31903acabeb267a69f6fa7d1f21dcad7 (patch) | |
tree | a1bd8fb98d92ac18f6d3584817c02f78807cac67 /src/gtkutil.c | |
parent | 8d106ea001f5a258da2a36a70587cc8fc9695b1c (diff) | |
download | emacs-5c646d5a31903acabeb267a69f6fa7d1f21dcad7.tar.gz emacs-5c646d5a31903acabeb267a69f6fa7d1f21dcad7.tar.bz2 emacs-5c646d5a31903acabeb267a69f6fa7d1f21dcad7.zip |
Fix resize due to font change on a maximized/xmonad-controlled frame.
* xterm.h (x_wait_for_event): Declare it.
* xterm.c (pending_event_wait): New variable.
(handle_one_xevent): Set pending_event_wait.eventtype to 0 if we
see pending_event_wait.eventtype.
(handle_one_xevent): Don't change gravity when parent changes.
(x_new_font): Call change_frame_size with new rows/columns before we try
to resize the frame.
(x_wait_for_event): New function.
(x_set_window_size_1): Don't change gravity unless change_gravity is set.
Call XResizeWindow with FRAME_OUTER_WINDOW. If we are visible,
don't change frame size, instead wait for the ConfigureNotify.
(x_set_window_size): Call x_set_window_size_1 for USE_X_TOOLKIT also.
(x_wm_set_size_hint): Remove ifdefs for USE_X_TOOLKIT.
(x_initialize): Initialize pending_event_wait.
* xmenu.c (set_frame_menubar): Add internal border width to menu bar
size.
* widget.c (EmacsFrameSetValues): Add comment.
(EmacsFrameSetCharSize): Just call x_set_window_size.
* gtkutil.c (xg_frame_set_char_size): Flush events and call
x_wait_for_event.
(flush_and_sync): Removed again.
(xg_get_font_name): Suggest monospace if no previous font is known.
Diffstat (limited to 'src/gtkutil.c')
-rw-r--r-- | src/gtkutil.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/gtkutil.c b/src/gtkutil.c index 8aa877a8f83..e95601c7fdd 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -665,20 +665,6 @@ xg_frame_resized (f, pixelwidth, pixelheight) } } -static void -flush_and_sync (f) - FRAME_PTR f; -{ - gdk_window_process_all_updates (); - x_sync (f); - while (gtk_events_pending ()) - { - gtk_main_iteration (); - gdk_window_process_all_updates (); - x_sync (f); - } -} - /* Resize the outer window of frame F after chainging the height. COLUMNS/ROWS is the size the edit area shall have after the resize. */ @@ -715,6 +701,9 @@ xg_frame_set_char_size (f, cols, rows) pixelwidth, pixelheight); x_wm_set_size_hint (f, 0, 0); + SET_FRAME_GARBAGED (f); + cancel_mouse_face (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. @@ -723,14 +712,17 @@ xg_frame_set_char_size (f, cols, rows) 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); + { + /* Must call this to flush out events */ + (void)gtk_events_pending (); + gdk_flush (); + x_wait_for_event (f, ConfigureNotify); + } else { + change_frame_size (f, rows, cols, 0, 1, 0); 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); } } @@ -1640,9 +1632,10 @@ xg_get_font_name (f, default_name) #endif /* HAVE_GTK_AND_PTHREAD */ w = gtk_font_selection_dialog_new ("Pick a font"); - if (default_name) - gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (w), - default_name); + if (!default_name) + default_name = "Monospace 10"; + gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG (w), + default_name); xg_set_screen (w, f); gtk_widget_set_name (w, "emacs-fontdialog"); |