diff options
author | Juanma Barranquero <lekktu@gmail.com> | 2010-09-14 16:41:53 +0200 |
---|---|---|
committer | Juanma Barranquero <lekktu@gmail.com> | 2010-09-14 16:41:53 +0200 |
commit | 6664fc59a8f296117ea98b943f062c0cc0e907c1 (patch) | |
tree | b8e0bf218492291433d00a71122bc8cd2c662ea9 /src | |
parent | 74769e8b4c73f24e8f3356bd281a56a30000c648 (diff) | |
parent | f3a30a50fab486dcaafb9d897797794fe4c3c4b3 (diff) | |
download | emacs-6664fc59a8f296117ea98b943f062c0cc0e907c1.tar.gz |
Merge changes from emacs-23 branch.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 30 | ||||
-rw-r--r-- | src/coding.c | 7 | ||||
-rw-r--r-- | src/term.c | 1 | ||||
-rw-r--r-- | src/xterm.c | 156 |
4 files changed, 127 insertions, 67 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fa0dfc79c5b..29f410cad86 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,7 +1,29 @@ +2010-09-14 Jan Djärv <jan.h.d@swipnet.se> + + * xterm.c (get_current_vm_state): New function. + (do_ewmh_fullscreen): Call get_current_vm_state and compare with + want_fullscreen so set_wm_state calls are few (Bug#7013). + (x_handle_net_wm_state): Move code to get_current_vm_state and + call that function. + +2010-09-14 Courtney Bane <emacs-bugs-7626@cbane.org> (tiny change) + + * term.c (tty_set_terminal_modes): Don't initialize twice (bug#7002). + +2010-09-14 Kenichi Handa <handa@m17n.org> + + * coding.c (encode_coding_iso_2022): Don't optimize for ASCII if + we may use designation or locking-shift. + +2010-09-14 Kenichi Handa <handa@m17n.org> + + * coding.c (detect_coding_emacs_mule): Fix checking of multibyte + sequence when the source is multibyte. + 2010-09-14 Andreas Schwab <schwab@linux-m68k.org> - * xml.c (Fxml_parse_string, Fxml_parse_string): Revert last - change. Don't make first argument optional. Doc fix. + * xml.c (Fxml_parse_string, Fxml_parse_string): Revert last change. + Don't make first argument optional. Doc fix. 2010-09-14 Leo <sdl.web@gmail.com> (tiny change) @@ -111,8 +133,8 @@ (produce_stretch_glyph): Set it2.char_to_display too before calling x_produce_glyphs. (x_produce_glyphs): Simplify by using the same code for ASCII and - non-ASCII characters. Don't set it->char_to_display here. Don't - handle unibyte-display-via-language-environment here. For a + non-ASCII characters. Don't set it->char_to_display here. + Don't handle unibyte-display-via-language-environment here. For a charater of no glyph, use font->space_width instead of FONT_WIDTH. 2010-08-31 Stefan Monnier <monnier@iro.umontreal.ca> diff --git a/src/coding.c b/src/coding.c index 6012978b60a..d6285ed9245 100644 --- a/src/coding.c +++ b/src/coding.c @@ -2008,7 +2008,7 @@ detect_coding_emacs_mule (struct coding_system *coding, } else { - int more_bytes = emacs_mule_bytes[*src_base] - 1; + int more_bytes = emacs_mule_bytes[c] - 1; while (more_bytes > 0) { @@ -4490,7 +4490,10 @@ encode_coding_iso_2022 (struct coding_system *coding) charset_list = CODING_ATTR_CHARSET_LIST (attrs); coding->safe_charsets = SDATA (CODING_ATTR_SAFE_CHARSETS (attrs)); - ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); + ascii_compatible + = (! NILP (CODING_ATTR_ASCII_COMPAT (attrs)) + && ! (CODING_ISO_FLAGS (coding) & (CODING_ISO_FLAG_DESIGNATION + | CODING_ISO_FLAG_LOCKING_SHIFT))); while (charbuf < charbuf_end) { diff --git a/src/term.c b/src/term.c index f090cdd2792..2deca1014e8 100644 --- a/src/term.c +++ b/src/term.c @@ -247,7 +247,6 @@ tty_set_terminal_modes (struct terminal *terminal) cmputc ('\n'); } - OUTPUT_IF (tty, tty->TS_termcap_modes); OUTPUT_IF (tty, visible_cursor ? tty->TS_cursor_visible : tty->TS_cursor_normal); OUTPUT_IF (tty, tty->TS_keypad_mode); losecursor (tty); diff --git a/src/xterm.c b/src/xterm.c index 2ebe8a80378..c1d1aada530 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -8285,19 +8285,89 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value) "_NET_WM_STATE_STICKY", NULL); } +/* Return the current _NET_WM_STATE. + SIZE_STATE is set to one of the FULLSCREEN_* values. + STICKY is set to 1 if the sticky state is set, 0 if not. */ + +static void +get_current_vm_state (struct frame *f, + Window window, + int *size_state, + int *sticky) +{ + Atom actual_type; + unsigned long actual_size, bytes_remaining; + int i, rc, actual_format; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + long max_len = 65536; + Display *dpy = FRAME_X_DISPLAY (f); + unsigned char *tmp_data = NULL; + Atom target_type = XA_ATOM; + + *sticky = 0; + *size_state = FULLSCREEN_NONE; + + BLOCK_INPUT; + x_catch_errors (dpy); + rc = XGetWindowProperty (dpy, window, dpyinfo->Xatom_net_wm_state, + 0, max_len, False, target_type, + &actual_type, &actual_format, &actual_size, + &bytes_remaining, &tmp_data); + + if (rc != Success || actual_type != target_type || x_had_errors_p (dpy)) + { + if (tmp_data) XFree (tmp_data); + x_uncatch_errors (); + UNBLOCK_INPUT; + return; + } + + x_uncatch_errors (); + + for (i = 0; i < actual_size; ++i) + { + Atom a = ((Atom*)tmp_data)[i]; + if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) + { + if (*size_state == FULLSCREEN_HEIGHT) + *size_state = FULLSCREEN_MAXIMIZED; + else + *size_state = FULLSCREEN_WIDTH; + } + else if (a == dpyinfo->Xatom_net_wm_state_maximized_vert) + { + if (*size_state == FULLSCREEN_WIDTH) + *size_state = FULLSCREEN_MAXIMIZED; + else + *size_state = FULLSCREEN_HEIGHT; + } + else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom) + *size_state = FULLSCREEN_BOTH; + else if (a == dpyinfo->Xatom_net_wm_state_sticky) + *sticky = 1; + } + + if (tmp_data) XFree (tmp_data); + UNBLOCK_INPUT; +} + /* Do fullscreen as specified in extended window manager hints */ static int do_ewmh_fullscreen (struct frame *f) { int have_net_atom = wm_supports (f, "_NET_WM_STATE"); + Lisp_Object lval = get_frame_param (f, Qfullscreen); + int cur, dummy; + + get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); /* Some window managers don't say they support _NET_WM_STATE, but they do say they support _NET_WM_STATE_FULLSCREEN. Try that also. */ if (!have_net_atom) have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN"); - if (have_net_atom) + if (have_net_atom && cur != f->want_fullscreen) { Lisp_Object frame; const char *fs = "_NET_WM_STATE_FULLSCREEN"; @@ -8306,26 +8376,41 @@ do_ewmh_fullscreen (struct frame *f) XSETFRAME (frame, f); - set_wm_state (frame, 0, fs, NULL); - set_wm_state (frame, 0, fh, NULL); - set_wm_state (frame, 0, fw, NULL); - - /* If there are _NET_ atoms we assume we have extended window manager - hints. */ + /* Keep number of calls to set_wm_state as low as possible. + Some window managers, or possible Gtk+, hangs when too many + are sent at once. */ switch (f->want_fullscreen) { case FULLSCREEN_BOTH: + if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED + || cur == FULLSCREEN_HEIGHT) + set_wm_state (frame, 0, fw, fh); set_wm_state (frame, 1, fs, NULL); break; case FULLSCREEN_WIDTH: - set_wm_state (frame, 1, fw, NULL); + if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT + || cur == FULLSCREEN_MAXIMIZED) + set_wm_state (frame, 0, fs, fh); + if (cur != FULLSCREEN_MAXIMIZED) + set_wm_state (frame, 1, fw, NULL); break; case FULLSCREEN_HEIGHT: - set_wm_state (frame, 1, fh, NULL); + if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH + || cur == FULLSCREEN_MAXIMIZED) + set_wm_state (frame, 0, fs, fw); + if (cur != FULLSCREEN_MAXIMIZED) + set_wm_state (frame, 1, fh, NULL); break; case FULLSCREEN_MAXIMIZED: + if (cur == FULLSCREEN_BOTH) + set_wm_state (frame, 0, fs, NULL); set_wm_state (frame, 1, fw, fh); break; + case FULLSCREEN_NONE: + if (cur == FULLSCREEN_BOTH) + set_wm_state (frame, 0, fs, NULL); + else + set_wm_state (frame, 0, fw, fh); } f->want_fullscreen = FULLSCREEN_NONE; @@ -8351,57 +8436,11 @@ XTfullscreen_hook (FRAME_PTR f) static void x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) { - Atom actual_type; - unsigned long actual_size, bytes_remaining; - int i, rc, actual_format, value = FULLSCREEN_NONE; - struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); - long max_len = 65536; - Display *dpy = FRAME_X_DISPLAY (f); - unsigned char *tmp_data = NULL; - Atom target_type = XA_ATOM; + int value = FULLSCREEN_NONE; Lisp_Object lval; int sticky = 0; - BLOCK_INPUT; - x_catch_errors (dpy); - rc = XGetWindowProperty (dpy, event->window, - event->atom, 0, max_len, False, target_type, - &actual_type, &actual_format, &actual_size, - &bytes_remaining, &tmp_data); - - if (rc != Success || actual_type != target_type || x_had_errors_p (dpy)) - { - if (tmp_data) XFree (tmp_data); - x_uncatch_errors (); - UNBLOCK_INPUT; - return; - } - - x_uncatch_errors (); - - for (i = 0; i < actual_size; ++i) - { - Atom a = ((Atom*)tmp_data)[i]; - if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) - { - if (value == FULLSCREEN_HEIGHT) - value = FULLSCREEN_MAXIMIZED; - else - value = FULLSCREEN_WIDTH; - } - else if (a == dpyinfo->Xatom_net_wm_state_maximized_vert) - { - if (value == FULLSCREEN_WIDTH) - value = FULLSCREEN_MAXIMIZED; - else - value = FULLSCREEN_HEIGHT; - } - else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom) - value = FULLSCREEN_BOTH; - else if (a == dpyinfo->Xatom_net_wm_state_sticky) - sticky = 1; - } - + get_current_vm_state (f, event->window, &value, &sticky); lval = Qnil; switch (value) { @@ -8421,9 +8460,6 @@ x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) store_frame_param (f, Qfullscreen, lval); store_frame_param (f, Qsticky, sticky ? Qt : Qnil); - - if (tmp_data) XFree (tmp_data); - UNBLOCK_INPUT; } /* Check if we need to resize the frame due to a fullscreen request. |