diff options
| author | Eli Zaretskii | 2013-03-28 20:13:59 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-03-28 20:13:59 +0200 |
| commit | d76bf86f438d4f5f9fe493ab76f02ffc78f3ae2e (patch) | |
| tree | 04fa8bc7bd2058a316a7ee30f8741d25bfd0b060 /src/xterm.c | |
| parent | 2ef26ceb192c7683754cf0b4aa3087f501254332 (diff) | |
| parent | e74aeda863cd6896e06e92586f87b45d63d67d15 (diff) | |
| download | emacs-d76bf86f438d4f5f9fe493ab76f02ffc78f3ae2e.tar.gz emacs-d76bf86f438d4f5f9fe493ab76f02ffc78f3ae2e.zip | |
Merge from trunk and resolve conflicts.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 216 |
1 files changed, 97 insertions, 119 deletions
diff --git a/src/xterm.c b/src/xterm.c index 61e942e10d2..e4a681031ef 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* X Communication module for terminals which understand the X protocol. | 1 | /* X Communication module for terminals which understand the X protocol. |
| 2 | 2 | ||
| 3 | Copyright (C) 1989, 1993-2012 Free Software Foundation, Inc. | 3 | Copyright (C) 1989, 1993-2013 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -130,6 +130,10 @@ extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *); | |||
| 130 | 130 | ||
| 131 | #include "bitmaps/gray.xbm" | 131 | #include "bitmaps/gray.xbm" |
| 132 | 132 | ||
| 133 | #ifdef HAVE_XKB | ||
| 134 | #include <X11/XKBlib.h> | ||
| 135 | #endif | ||
| 136 | |||
| 133 | /* Default to using XIM if available. */ | 137 | /* Default to using XIM if available. */ |
| 134 | #ifdef USE_XIM | 138 | #ifdef USE_XIM |
| 135 | int use_xim = 1; | 139 | int use_xim = 1; |
| @@ -2019,7 +2023,8 @@ x_draw_relief_rect (struct frame *f, | |||
| 2019 | 2023 | ||
| 2020 | for (i = (width > 1 ? 1 : 0); i < width; ++i) | 2024 | for (i = (width > 1 ? 1 : 0); i < width; ++i) |
| 2021 | XDrawLine (dpy, window, gc, | 2025 | XDrawLine (dpy, window, gc, |
| 2022 | left_x + i, top_y + i, left_x + i, bottom_y - i + 1); | 2026 | left_x + i, top_y + (i + 1) * top_p, |
| 2027 | left_x + i, bottom_y + 1 - (i + 1) * bot_p); | ||
| 2023 | } | 2028 | } |
| 2024 | 2029 | ||
| 2025 | XSetClipMask (dpy, gc, None); | 2030 | XSetClipMask (dpy, gc, None); |
| @@ -2061,7 +2066,8 @@ x_draw_relief_rect (struct frame *f, | |||
| 2061 | XClearArea (dpy, window, right_x, bottom_y, 1, 1, False); | 2066 | XClearArea (dpy, window, right_x, bottom_y, 1, 1, False); |
| 2062 | for (i = 0; i < width; ++i) | 2067 | for (i = 0; i < width; ++i) |
| 2063 | XDrawLine (dpy, window, gc, | 2068 | XDrawLine (dpy, window, gc, |
| 2064 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i); | 2069 | right_x - i, top_y + (i + 1) * top_p, |
| 2070 | right_x - i, bottom_y + 1 - (i + 1) * bot_p); | ||
| 2065 | } | 2071 | } |
| 2066 | 2072 | ||
| 2067 | XSetClipMask (dpy, gc, None); | 2073 | XSetClipMask (dpy, gc, None); |
| @@ -2234,8 +2240,7 @@ x_draw_image_foreground (struct glyph_string *s) | |||
| 2234 | nothing here for mouse-face. */ | 2240 | nothing here for mouse-face. */ |
| 2235 | if (s->hl == DRAW_CURSOR) | 2241 | if (s->hl == DRAW_CURSOR) |
| 2236 | { | 2242 | { |
| 2237 | int relief = s->img->relief; | 2243 | int relief = eabs (s->img->relief); |
| 2238 | if (relief < 0) relief = -relief; | ||
| 2239 | XDrawRectangle (s->display, s->window, s->gc, | 2244 | XDrawRectangle (s->display, s->window, s->gc, |
| 2240 | x - relief, y - relief, | 2245 | x - relief, y - relief, |
| 2241 | s->slice.width + relief*2 - 1, | 2246 | s->slice.width + relief*2 - 1, |
| @@ -2255,8 +2260,7 @@ x_draw_image_foreground (struct glyph_string *s) | |||
| 2255 | static void | 2260 | static void |
| 2256 | x_draw_image_relief (struct glyph_string *s) | 2261 | x_draw_image_relief (struct glyph_string *s) |
| 2257 | { | 2262 | { |
| 2258 | int x0, y0, x1, y1, thick, raised_p; | 2263 | int x1, y1, thick, raised_p, top_p, bot_p, left_p, right_p; |
| 2259 | int extra_x, extra_y; | ||
| 2260 | XRectangle r; | 2264 | XRectangle r; |
| 2261 | int x = s->x; | 2265 | int x = s->x; |
| 2262 | int y = s->ybase - image_ascent (s->img, s->face, &s->slice); | 2266 | int y = s->ybase - image_ascent (s->img, s->face, &s->slice); |
| @@ -2287,33 +2291,23 @@ x_draw_image_relief (struct glyph_string *s) | |||
| 2287 | raised_p = s->img->relief > 0; | 2291 | raised_p = s->img->relief > 0; |
| 2288 | } | 2292 | } |
| 2289 | 2293 | ||
| 2290 | extra_x = extra_y = 0; | 2294 | x1 = x + s->slice.width - 1; |
| 2291 | if (s->face->id == TOOL_BAR_FACE_ID) | 2295 | y1 = y + s->slice.height - 1; |
| 2292 | { | 2296 | top_p = bot_p = left_p = right_p = 0; |
| 2293 | if (CONSP (Vtool_bar_button_margin) | ||
| 2294 | && INTEGERP (XCAR (Vtool_bar_button_margin)) | ||
| 2295 | && INTEGERP (XCDR (Vtool_bar_button_margin))) | ||
| 2296 | { | ||
| 2297 | extra_x = XINT (XCAR (Vtool_bar_button_margin)); | ||
| 2298 | extra_y = XINT (XCDR (Vtool_bar_button_margin)); | ||
| 2299 | } | ||
| 2300 | else if (INTEGERP (Vtool_bar_button_margin)) | ||
| 2301 | extra_x = extra_y = XINT (Vtool_bar_button_margin); | ||
| 2302 | } | ||
| 2303 | 2297 | ||
| 2304 | x0 = x - thick - extra_x; | 2298 | if (s->slice.x == 0) |
| 2305 | y0 = y - thick - extra_y; | 2299 | x -= thick, left_p = 1; |
| 2306 | x1 = x + s->slice.width + thick - 1 + extra_x; | 2300 | if (s->slice.y == 0) |
| 2307 | y1 = y + s->slice.height + thick - 1 + extra_y; | 2301 | y -= thick, top_p = 1; |
| 2302 | if (s->slice.x + s->slice.width == s->img->width) | ||
| 2303 | x1 += thick, right_p = 1; | ||
| 2304 | if (s->slice.y + s->slice.height == s->img->height) | ||
| 2305 | y1 += thick, bot_p = 1; | ||
| 2308 | 2306 | ||
| 2309 | x_setup_relief_colors (s); | 2307 | x_setup_relief_colors (s); |
| 2310 | get_glyph_string_clip_rect (s, &r); | 2308 | get_glyph_string_clip_rect (s, &r); |
| 2311 | x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, | 2309 | x_draw_relief_rect (s->f, x, y, x1, y1, thick, raised_p, |
| 2312 | s->slice.y == 0, | 2310 | top_p, bot_p, left_p, right_p, &r); |
| 2313 | s->slice.y + s->slice.height == s->img->height, | ||
| 2314 | s->slice.x == 0, | ||
| 2315 | s->slice.x + s->slice.width == s->img->width, | ||
| 2316 | &r); | ||
| 2317 | } | 2311 | } |
| 2318 | 2312 | ||
| 2319 | 2313 | ||
| @@ -2377,8 +2371,7 @@ x_draw_image_foreground_1 (struct glyph_string *s, Pixmap pixmap) | |||
| 2377 | nothing here for mouse-face. */ | 2371 | nothing here for mouse-face. */ |
| 2378 | if (s->hl == DRAW_CURSOR) | 2372 | if (s->hl == DRAW_CURSOR) |
| 2379 | { | 2373 | { |
| 2380 | int r = s->img->relief; | 2374 | int r = eabs (s->img->relief); |
| 2381 | if (r < 0) r = -r; | ||
| 2382 | XDrawRectangle (s->display, s->window, s->gc, x - r, y - r, | 2375 | XDrawRectangle (s->display, s->window, s->gc, x - r, y - r, |
| 2383 | s->slice.width + r*2 - 1, | 2376 | s->slice.width + r*2 - 1, |
| 2384 | s->slice.height + r*2 - 1); | 2377 | s->slice.height + r*2 - 1); |
| @@ -2642,14 +2635,14 @@ x_draw_stretch_glyph_string (struct glyph_string *s) | |||
| 2642 | static void | 2635 | static void |
| 2643 | x_draw_underwave (struct glyph_string *s) | 2636 | x_draw_underwave (struct glyph_string *s) |
| 2644 | { | 2637 | { |
| 2645 | int wave_height = 2, wave_length = 3; | 2638 | int wave_height = 3, wave_length = 2; |
| 2646 | int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax; | 2639 | int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax; |
| 2647 | XRectangle wave_clip, string_clip, final_clip; | 2640 | XRectangle wave_clip, string_clip, final_clip; |
| 2648 | 2641 | ||
| 2649 | dx = wave_length; | 2642 | dx = wave_length; |
| 2650 | dy = wave_height - 1; | 2643 | dy = wave_height - 1; |
| 2651 | x0 = s->x; | 2644 | x0 = s->x; |
| 2652 | y0 = s->ybase + 1; | 2645 | y0 = s->ybase - wave_height + 3; |
| 2653 | width = s->width; | 2646 | width = s->width; |
| 2654 | xmax = x0 + width; | 2647 | xmax = x0 + width; |
| 2655 | 2648 | ||
| @@ -2811,7 +2804,8 @@ x_draw_glyph_string (struct glyph_string *s) | |||
| 2811 | unsigned long thickness, position; | 2804 | unsigned long thickness, position; |
| 2812 | int y; | 2805 | int y; |
| 2813 | 2806 | ||
| 2814 | if (s->prev && s->prev->face->underline_p) | 2807 | if (s->prev && s->prev->face->underline_p |
| 2808 | && s->prev->face->underline_type == FACE_UNDER_LINE) | ||
| 2815 | { | 2809 | { |
| 2816 | /* We use the same underline style as the previous one. */ | 2810 | /* We use the same underline style as the previous one. */ |
| 2817 | thickness = s->prev->underline_thickness; | 2811 | thickness = s->prev->underline_thickness; |
| @@ -3228,7 +3222,11 @@ XTring_bell (struct frame *f) | |||
| 3228 | else | 3222 | else |
| 3229 | { | 3223 | { |
| 3230 | block_input (); | 3224 | block_input (); |
| 3225 | #ifdef HAVE_XKB | ||
| 3226 | XkbBell (FRAME_X_DISPLAY (f), None, 0, None); | ||
| 3227 | #else | ||
| 3231 | XBell (FRAME_X_DISPLAY (f), 0); | 3228 | XBell (FRAME_X_DISPLAY (f), 0); |
| 3229 | #endif | ||
| 3232 | XFlush (FRAME_X_DISPLAY (f)); | 3230 | XFlush (FRAME_X_DISPLAY (f)); |
| 3233 | unblock_input (); | 3231 | unblock_input (); |
| 3234 | } | 3232 | } |
| @@ -4812,21 +4810,24 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio | |||
| 4812 | 4810 | ||
| 4813 | #ifdef USE_MOTIF | 4811 | #ifdef USE_MOTIF |
| 4814 | 4812 | ||
| 4815 | /* We use an estimate of 30 chars per line rather than the real | 4813 | if (scroll_bar_adjust_thumb_portion_p) |
| 4816 | `portion' value. This has the disadvantage that the thumb size | 4814 | { |
| 4817 | is not very representative, but it makes our life a lot easier. | 4815 | /* We use an estimate of 30 chars per line rather than the real |
| 4818 | Otherwise, we have to constantly adjust the thumb size, which | 4816 | `portion' value. This has the disadvantage that the thumb size |
| 4819 | we can't always do quickly enough: while dragging, the size of | 4817 | is not very representative, but it makes our life a lot easier. |
| 4820 | the thumb might prevent the user from dragging the thumb all the | 4818 | Otherwise, we have to constantly adjust the thumb size, which |
| 4821 | way to the end. but Motif and some versions of Xaw3d don't allow | 4819 | we can't always do quickly enough: while dragging, the size of |
| 4822 | updating the thumb size while dragging. Also, even if we can update | 4820 | the thumb might prevent the user from dragging the thumb all the |
| 4823 | its size, the update will often happen too late. | 4821 | way to the end. but Motif and some versions of Xaw3d don't allow |
| 4824 | If you don't believe it, check out revision 1.650 of xterm.c to see | 4822 | updating the thumb size while dragging. Also, even if we can update |
| 4825 | what hoops we were going through and the still poor behavior we got. */ | 4823 | its size, the update will often happen too late. |
| 4826 | portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; | 4824 | If you don't believe it, check out revision 1.650 of xterm.c to see |
| 4827 | /* When the thumb is at the bottom, position == whole. | 4825 | what hoops we were going through and the still poor behavior we got. */ |
| 4828 | So we need to increase `whole' to make space for the thumb. */ | 4826 | portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30; |
| 4829 | whole += portion; | 4827 | /* When the thumb is at the bottom, position == whole. |
| 4828 | So we need to increase `whole' to make space for the thumb. */ | ||
| 4829 | whole += portion; | ||
| 4830 | } | ||
| 4830 | 4831 | ||
| 4831 | if (whole <= 0) | 4832 | if (whole <= 0) |
| 4832 | top = 0, shown = 1; | 4833 | top = 0, shown = 1; |
| @@ -4843,9 +4844,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio | |||
| 4843 | /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX | 4844 | /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX |
| 4844 | is the scroll bar's maximum and MIN is the scroll bar's minimum | 4845 | is the scroll bar's maximum and MIN is the scroll bar's minimum |
| 4845 | value. */ | 4846 | value. */ |
| 4846 | size = shown * XM_SB_MAX; | 4847 | size = clip_to_bounds (1, shown * XM_SB_MAX, XM_SB_MAX); |
| 4847 | size = min (size, XM_SB_MAX); | ||
| 4848 | size = max (size, 1); | ||
| 4849 | 4848 | ||
| 4850 | /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ | 4849 | /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ |
| 4851 | value = top * XM_SB_MAX; | 4850 | value = top * XM_SB_MAX; |
| @@ -5085,7 +5084,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild | |||
| 5085 | 5084 | ||
| 5086 | /* Draw the empty space above the handle. Note that we can't clear | 5085 | /* Draw the empty space above the handle. Note that we can't clear |
| 5087 | zero-height areas; that means "clear to end of window." */ | 5086 | zero-height areas; that means "clear to end of window." */ |
| 5088 | if (0 < start) | 5087 | if (start > 0) |
| 5089 | x_clear_area (FRAME_X_DISPLAY (f), w, | 5088 | x_clear_area (FRAME_X_DISPLAY (f), w, |
| 5090 | /* x, y, width, height, and exposures. */ | 5089 | /* x, y, width, height, and exposures. */ |
| 5091 | VERTICAL_SCROLL_BAR_LEFT_BORDER, | 5090 | VERTICAL_SCROLL_BAR_LEFT_BORDER, |
| @@ -6111,16 +6110,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6111 | last_user_time = event.xproperty.time; | 6110 | last_user_time = event.xproperty.time; |
| 6112 | f = x_top_window_to_frame (dpyinfo, event.xproperty.window); | 6111 | f = x_top_window_to_frame (dpyinfo, event.xproperty.window); |
| 6113 | if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state) | 6112 | if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state) |
| 6114 | if (x_handle_net_wm_state (f, &event.xproperty) && f->iconified | 6113 | if (x_handle_net_wm_state (f, &event.xproperty) |
| 6115 | && f->output_data.x->net_wm_state_hidden_seen) | 6114 | && FRAME_ICONIFIED_P (f) |
| 6115 | && f->output_data.x->net_wm_state_hidden_seen) | ||
| 6116 | { | 6116 | { |
| 6117 | /* Gnome shell does not iconify us when C-z is pressed. It hides | 6117 | /* Gnome shell does not iconify us when C-z is pressed. |
| 6118 | the frame. So if our state says we aren't hidden anymore, | 6118 | It hides the frame. So if our state says we aren't |
| 6119 | treat it as deiconified. */ | 6119 | hidden anymore, treat it as deiconified. */ |
| 6120 | if (! f->async_iconified) | 6120 | SET_FRAME_VISIBLE (f, 1); |
| 6121 | SET_FRAME_GARBAGED (f); | 6121 | SET_FRAME_ICONIFIED (f, 0); |
| 6122 | f->async_visible = 1; | ||
| 6123 | f->async_iconified = 0; | ||
| 6124 | f->output_data.x->has_been_visible = 1; | 6122 | f->output_data.x->has_been_visible = 1; |
| 6125 | f->output_data.x->net_wm_state_hidden_seen = 0; | 6123 | f->output_data.x->net_wm_state_hidden_seen = 0; |
| 6126 | inev.ie.kind = DEICONIFY_EVENT; | 6124 | inev.ie.kind = DEICONIFY_EVENT; |
| @@ -6161,10 +6159,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6161 | event.xexpose.width, event.xexpose.height, | 6159 | event.xexpose.width, event.xexpose.height, |
| 6162 | FALSE); | 6160 | FALSE); |
| 6163 | #endif | 6161 | #endif |
| 6164 | if (f->async_visible == 0) | 6162 | if (!FRAME_VISIBLE_P (f)) |
| 6165 | { | 6163 | { |
| 6166 | f->async_visible = 1; | 6164 | SET_FRAME_VISIBLE (f, 1); |
| 6167 | f->async_iconified = 0; | 6165 | SET_FRAME_ICONIFIED (f, 0); |
| 6168 | f->output_data.x->has_been_visible = 1; | 6166 | f->output_data.x->has_been_visible = 1; |
| 6169 | SET_FRAME_GARBAGED (f); | 6167 | SET_FRAME_GARBAGED (f); |
| 6170 | } | 6168 | } |
| @@ -6241,20 +6239,20 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6241 | if (f) /* F may no longer exist if | 6239 | if (f) /* F may no longer exist if |
| 6242 | the frame was deleted. */ | 6240 | the frame was deleted. */ |
| 6243 | { | 6241 | { |
| 6242 | bool visible = FRAME_VISIBLE_P (f); | ||
| 6244 | /* While a frame is unmapped, display generation is | 6243 | /* While a frame is unmapped, display generation is |
| 6245 | disabled; you don't want to spend time updating a | 6244 | disabled; you don't want to spend time updating a |
| 6246 | display that won't ever be seen. */ | 6245 | display that won't ever be seen. */ |
| 6247 | f->async_visible = 0; | 6246 | SET_FRAME_VISIBLE (f, 0); |
| 6248 | /* We can't distinguish, from the event, whether the window | 6247 | /* We can't distinguish, from the event, whether the window |
| 6249 | has become iconified or invisible. So assume, if it | 6248 | has become iconified or invisible. So assume, if it |
| 6250 | was previously visible, than now it is iconified. | 6249 | was previously visible, than now it is iconified. |
| 6251 | But x_make_frame_invisible clears both | 6250 | But x_make_frame_invisible clears both |
| 6252 | the visible flag and the iconified flag; | 6251 | the visible flag and the iconified flag; |
| 6253 | and that way, we know the window is not iconified now. */ | 6252 | and that way, we know the window is not iconified now. */ |
| 6254 | if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)) | 6253 | if (visible || FRAME_ICONIFIED_P (f)) |
| 6255 | { | 6254 | { |
| 6256 | f->async_iconified = 1; | 6255 | SET_FRAME_ICONIFIED (f, 1); |
| 6257 | |||
| 6258 | inev.ie.kind = ICONIFY_EVENT; | 6256 | inev.ie.kind = ICONIFY_EVENT; |
| 6259 | XSETFRAME (inev.ie.frame_or_window, f); | 6257 | XSETFRAME (inev.ie.frame_or_window, f); |
| 6260 | } | 6258 | } |
| @@ -6273,13 +6271,14 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6273 | f = x_top_window_to_frame (dpyinfo, event.xmap.window); | 6271 | f = x_top_window_to_frame (dpyinfo, event.xmap.window); |
| 6274 | if (f) | 6272 | if (f) |
| 6275 | { | 6273 | { |
| 6274 | bool iconified = FRAME_ICONIFIED_P (f); | ||
| 6276 | /* wait_reading_process_output will notice this and update | 6275 | /* wait_reading_process_output will notice this and update |
| 6277 | the frame's display structures. | 6276 | the frame's display structures. |
| 6278 | If we where iconified, we should not set garbaged, | 6277 | If we where iconified, we should not set garbaged, |
| 6279 | because that stops redrawing on Expose events. This looks | 6278 | because that stops redrawing on Expose events. This looks |
| 6280 | bad if we are called from a recursive event loop | 6279 | bad if we are called from a recursive event loop |
| 6281 | (x_dispatch_event), for example when a dialog is up. */ | 6280 | (x_dispatch_event), for example when a dialog is up. */ |
| 6282 | if (! f->async_iconified) | 6281 | if (!iconified) |
| 6283 | SET_FRAME_GARBAGED (f); | 6282 | SET_FRAME_GARBAGED (f); |
| 6284 | 6283 | ||
| 6285 | /* Check if fullscreen was specified before we where mapped the | 6284 | /* Check if fullscreen was specified before we where mapped the |
| @@ -6287,20 +6286,18 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6287 | if (!f->output_data.x->has_been_visible) | 6286 | if (!f->output_data.x->has_been_visible) |
| 6288 | x_check_fullscreen (f); | 6287 | x_check_fullscreen (f); |
| 6289 | 6288 | ||
| 6290 | f->async_visible = 1; | 6289 | SET_FRAME_VISIBLE (f, 1); |
| 6291 | f->async_iconified = 0; | 6290 | SET_FRAME_ICONIFIED (f, 0); |
| 6292 | f->output_data.x->has_been_visible = 1; | 6291 | f->output_data.x->has_been_visible = 1; |
| 6293 | 6292 | ||
| 6294 | if (f->iconified) | 6293 | if (iconified) |
| 6295 | { | 6294 | { |
| 6296 | inev.ie.kind = DEICONIFY_EVENT; | 6295 | inev.ie.kind = DEICONIFY_EVENT; |
| 6297 | XSETFRAME (inev.ie.frame_or_window, f); | 6296 | XSETFRAME (inev.ie.frame_or_window, f); |
| 6298 | } | 6297 | } |
| 6299 | else if (! NILP (Vframe_list) | 6298 | else if (! NILP (Vframe_list) && ! NILP (XCDR (Vframe_list))) |
| 6300 | && ! NILP (XCDR (Vframe_list))) | 6299 | /* Force a redisplay sooner or later to update the |
| 6301 | /* Force a redisplay sooner or later | 6300 | frame titles in case this is the second frame. */ |
| 6302 | to update the frame titles | ||
| 6303 | in case this is the second frame. */ | ||
| 6304 | record_asynch_buffer_change (); | 6301 | record_asynch_buffer_change (); |
| 6305 | 6302 | ||
| 6306 | #ifdef USE_GTK | 6303 | #ifdef USE_GTK |
| @@ -7911,7 +7908,6 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset) | |||
| 7911 | FRAME_FONT (f) = font; | 7908 | FRAME_FONT (f) = font; |
| 7912 | FRAME_BASELINE_OFFSET (f) = font->baseline_offset; | 7909 | FRAME_BASELINE_OFFSET (f) = font->baseline_offset; |
| 7913 | FRAME_COLUMN_WIDTH (f) = font->average_width; | 7910 | FRAME_COLUMN_WIDTH (f) = font->average_width; |
| 7914 | FRAME_SPACE_WIDTH (f) = font->space_width; | ||
| 7915 | FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (font); | 7911 | FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (font); |
| 7916 | 7912 | ||
| 7917 | compute_fringe_widths (f, 1); | 7913 | compute_fringe_widths (f, 1); |
| @@ -8427,7 +8423,7 @@ get_current_wm_state (struct frame *f, | |||
| 8427 | if (tmp_data) XFree (tmp_data); | 8423 | if (tmp_data) XFree (tmp_data); |
| 8428 | x_uncatch_errors (); | 8424 | x_uncatch_errors (); |
| 8429 | unblock_input (); | 8425 | unblock_input (); |
| 8430 | return ! f->iconified; | 8426 | return !FRAME_ICONIFIED_P (f); |
| 8431 | } | 8427 | } |
| 8432 | 8428 | ||
| 8433 | x_uncatch_errors (); | 8429 | x_uncatch_errors (); |
| @@ -8539,7 +8535,7 @@ do_ewmh_fullscreen (struct frame *f) | |||
| 8539 | static void | 8535 | static void |
| 8540 | XTfullscreen_hook (FRAME_PTR f) | 8536 | XTfullscreen_hook (FRAME_PTR f) |
| 8541 | { | 8537 | { |
| 8542 | if (f->async_visible) | 8538 | if (FRAME_VISIBLE_P (f)) |
| 8543 | { | 8539 | { |
| 8544 | block_input (); | 8540 | block_input (); |
| 8545 | x_check_fullscreen (f); | 8541 | x_check_fullscreen (f); |
| @@ -8803,7 +8799,7 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int cols, int rows) | |||
| 8803 | /* But the ConfigureNotify may in fact never arrive, and then this is | 8799 | /* But the ConfigureNotify may in fact never arrive, and then this is |
| 8804 | not right if the frame is visible. Instead wait (with timeout) | 8800 | not right if the frame is visible. Instead wait (with timeout) |
| 8805 | for the ConfigureNotify. */ | 8801 | for the ConfigureNotify. */ |
| 8806 | if (f->async_visible) | 8802 | if (FRAME_VISIBLE_P (f)) |
| 8807 | x_wait_for_event (f, ConfigureNotify); | 8803 | x_wait_for_event (f, ConfigureNotify); |
| 8808 | else | 8804 | else |
| 8809 | { | 8805 | { |
| @@ -8915,9 +8911,8 @@ void | |||
| 8915 | x_raise_frame (struct frame *f) | 8911 | x_raise_frame (struct frame *f) |
| 8916 | { | 8912 | { |
| 8917 | block_input (); | 8913 | block_input (); |
| 8918 | if (f->async_visible) | 8914 | if (FRAME_VISIBLE_P (f)) |
| 8919 | XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); | 8915 | XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); |
| 8920 | |||
| 8921 | XFlush (FRAME_X_DISPLAY (f)); | 8916 | XFlush (FRAME_X_DISPLAY (f)); |
| 8922 | unblock_input (); | 8917 | unblock_input (); |
| 8923 | } | 8918 | } |
| @@ -8927,7 +8922,7 @@ x_raise_frame (struct frame *f) | |||
| 8927 | static void | 8922 | static void |
| 8928 | x_lower_frame (struct frame *f) | 8923 | x_lower_frame (struct frame *f) |
| 8929 | { | 8924 | { |
| 8930 | if (f->async_visible) | 8925 | if (FRAME_VISIBLE_P (f)) |
| 8931 | { | 8926 | { |
| 8932 | block_input (); | 8927 | block_input (); |
| 8933 | XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); | 8928 | XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); |
| @@ -8943,7 +8938,7 @@ xembed_request_focus (FRAME_PTR f) | |||
| 8943 | { | 8938 | { |
| 8944 | /* See XEmbed Protocol Specification at | 8939 | /* See XEmbed Protocol Specification at |
| 8945 | http://freedesktop.org/wiki/Specifications/xembed-spec */ | 8940 | http://freedesktop.org/wiki/Specifications/xembed-spec */ |
| 8946 | if (f->async_visible) | 8941 | if (FRAME_VISIBLE_P (f)) |
| 8947 | xembed_send_message (f, CurrentTime, | 8942 | xembed_send_message (f, CurrentTime, |
| 8948 | XEMBED_REQUEST_FOCUS, 0, 0, 0); | 8943 | XEMBED_REQUEST_FOCUS, 0, 0, 0); |
| 8949 | } | 8944 | } |
| @@ -8957,16 +8952,14 @@ x_ewmh_activate_frame (FRAME_PTR f) | |||
| 8957 | http://freedesktop.org/wiki/Specifications/wm-spec */ | 8952 | http://freedesktop.org/wiki/Specifications/wm-spec */ |
| 8958 | 8953 | ||
| 8959 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 8954 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
| 8960 | if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window)) | 8955 | |
| 8956 | if (FRAME_VISIBLE_P (f) && wm_supports (f, dpyinfo->Xatom_net_active_window)) | ||
| 8961 | { | 8957 | { |
| 8962 | Lisp_Object frame; | 8958 | Lisp_Object frame; |
| 8963 | XSETFRAME (frame, f); | 8959 | XSETFRAME (frame, f); |
| 8964 | x_send_client_event (frame, make_number (0), frame, | 8960 | x_send_client_event (frame, make_number (0), frame, |
| 8965 | dpyinfo->Xatom_net_active_window, | 8961 | dpyinfo->Xatom_net_active_window, |
| 8966 | make_number (32), | 8962 | make_number (32), list2i (1, last_user_time)); |
| 8967 | Fcons (make_number (1), | ||
| 8968 | Fcons (make_number (last_user_time), | ||
| 8969 | Qnil))); | ||
| 8970 | } | 8963 | } |
| 8971 | } | 8964 | } |
| 8972 | 8965 | ||
| @@ -9169,9 +9162,6 @@ x_make_frame_visible (struct frame *f) | |||
| 9169 | poll_for_input_1 (); | 9162 | poll_for_input_1 (); |
| 9170 | poll_suppress_count = old_poll_suppress_count; | 9163 | poll_suppress_count = old_poll_suppress_count; |
| 9171 | } | 9164 | } |
| 9172 | |||
| 9173 | /* See if a MapNotify event has been processed. */ | ||
| 9174 | FRAME_SAMPLE_VISIBILITY (f); | ||
| 9175 | } | 9165 | } |
| 9176 | 9166 | ||
| 9177 | /* 2000-09-28: In | 9167 | /* 2000-09-28: In |
| @@ -9239,10 +9229,8 @@ x_make_frame_invisible (struct frame *f) | |||
| 9239 | So we can't win using the usual strategy of letting | 9229 | So we can't win using the usual strategy of letting |
| 9240 | FRAME_SAMPLE_VISIBILITY set this. So do it by hand, | 9230 | FRAME_SAMPLE_VISIBILITY set this. So do it by hand, |
| 9241 | and synchronize with the server to make sure we agree. */ | 9231 | and synchronize with the server to make sure we agree. */ |
| 9242 | f->visible = 0; | 9232 | SET_FRAME_VISIBLE (f, 0); |
| 9243 | FRAME_ICONIFIED_P (f) = 0; | 9233 | SET_FRAME_ICONIFIED (f, 0); |
| 9244 | f->async_visible = 0; | ||
| 9245 | f->async_iconified = 0; | ||
| 9246 | 9234 | ||
| 9247 | x_sync (f); | 9235 | x_sync (f); |
| 9248 | 9236 | ||
| @@ -9263,13 +9251,11 @@ x_iconify_frame (struct frame *f) | |||
| 9263 | if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f) | 9251 | if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f) |
| 9264 | FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0; | 9252 | FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0; |
| 9265 | 9253 | ||
| 9266 | if (f->async_iconified) | 9254 | if (FRAME_ICONIFIED_P (f)) |
| 9267 | return; | 9255 | return; |
| 9268 | 9256 | ||
| 9269 | block_input (); | 9257 | block_input (); |
| 9270 | 9258 | ||
| 9271 | FRAME_SAMPLE_VISIBILITY (f); | ||
| 9272 | |||
| 9273 | type = x_icon_type (f); | 9259 | type = x_icon_type (f); |
| 9274 | if (!NILP (type)) | 9260 | if (!NILP (type)) |
| 9275 | x_bitmap_icon (f, type); | 9261 | x_bitmap_icon (f, type); |
| @@ -9281,10 +9267,8 @@ x_iconify_frame (struct frame *f) | |||
| 9281 | gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f)); | 9267 | gtk_widget_show_all (FRAME_GTK_OUTER_WIDGET (f)); |
| 9282 | 9268 | ||
| 9283 | gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); | 9269 | gtk_window_iconify (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); |
| 9284 | f->iconified = 1; | 9270 | SET_FRAME_VISIBLE (f, 0); |
| 9285 | f->visible = 1; | 9271 | SET_FRAME_ICONIFIED (f, 1); |
| 9286 | f->async_iconified = 1; | ||
| 9287 | f->async_visible = 0; | ||
| 9288 | unblock_input (); | 9272 | unblock_input (); |
| 9289 | return; | 9273 | return; |
| 9290 | } | 9274 | } |
| @@ -9301,10 +9285,8 @@ x_iconify_frame (struct frame *f) | |||
| 9301 | /* The server won't give us any event to indicate | 9285 | /* The server won't give us any event to indicate |
| 9302 | that an invisible frame was changed to an icon, | 9286 | that an invisible frame was changed to an icon, |
| 9303 | so we have to record it here. */ | 9287 | so we have to record it here. */ |
| 9304 | f->iconified = 1; | 9288 | SET_FRAME_VISIBLE (f, 0); |
| 9305 | f->visible = 1; | 9289 | SET_FRAME_ICONIFIED (f, 1); |
| 9306 | f->async_iconified = 1; | ||
| 9307 | f->async_visible = 0; | ||
| 9308 | unblock_input (); | 9290 | unblock_input (); |
| 9309 | return; | 9291 | return; |
| 9310 | } | 9292 | } |
| @@ -9317,9 +9299,8 @@ x_iconify_frame (struct frame *f) | |||
| 9317 | if (!result) | 9299 | if (!result) |
| 9318 | error ("Can't notify window manager of iconification"); | 9300 | error ("Can't notify window manager of iconification"); |
| 9319 | 9301 | ||
| 9320 | f->async_iconified = 1; | 9302 | SET_FRAME_ICONIFIED (f, 1); |
| 9321 | f->async_visible = 0; | 9303 | SET_FRAME_VISIBLE (f, 0); |
| 9322 | |||
| 9323 | 9304 | ||
| 9324 | block_input (); | 9305 | block_input (); |
| 9325 | XFlush (FRAME_X_DISPLAY (f)); | 9306 | XFlush (FRAME_X_DISPLAY (f)); |
| @@ -9368,8 +9349,8 @@ x_iconify_frame (struct frame *f) | |||
| 9368 | XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); | 9349 | XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); |
| 9369 | } | 9350 | } |
| 9370 | 9351 | ||
| 9371 | f->async_iconified = 1; | 9352 | SET_FRAME_ICONIFIED (f, 1); |
| 9372 | f->async_visible = 0; | 9353 | SET_FRAME_VISIBLE (f, 0); |
| 9373 | 9354 | ||
| 9374 | XFlush (FRAME_X_DISPLAY (f)); | 9355 | XFlush (FRAME_X_DISPLAY (f)); |
| 9375 | unblock_input (); | 9356 | unblock_input (); |
| @@ -9918,10 +9899,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 9918 | 9899 | ||
| 9919 | /* Emacs can only handle core input events, so make sure | 9900 | /* Emacs can only handle core input events, so make sure |
| 9920 | Gtk doesn't use Xinput or Xinput2 extensions. */ | 9901 | Gtk doesn't use Xinput or Xinput2 extensions. */ |
| 9921 | { | 9902 | xputenv ("GDK_CORE_DEVICE_EVENTS=1"); |
| 9922 | static char fix_events[] = "GDK_CORE_DEVICE_EVENTS=1"; | ||
| 9923 | putenv (fix_events); | ||
| 9924 | } | ||
| 9925 | 9903 | ||
| 9926 | /* Work around GLib bug that outputs a faulty warning. See | 9904 | /* Work around GLib bug that outputs a faulty warning. See |
| 9927 | https://bugzilla.gnome.org/show_bug.cgi?id=563627. */ | 9905 | https://bugzilla.gnome.org/show_bug.cgi?id=563627. */ |