aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-10-31 13:03:15 -0700
committerPaul Eggert2011-10-31 13:03:15 -0700
commit5b0d046d5b6a6743be6888d02352b878151e1d6c (patch)
treeb7ea751ee33c18d1b5f7fa9b94a5a9fe010c8468 /src
parent1fa2385302f5b2e5bb17c8aad3cb4e320512ca46 (diff)
parent07f3add98f088ff068aacb0429210900e95b90c3 (diff)
downloademacs-5b0d046d5b6a6743be6888d02352b878151e1d6c.tar.gz
emacs-5b0d046d5b6a6743be6888d02352b878151e1d6c.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog25
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/xdisp.c5
-rw-r--r--src/xterm.c54
-rw-r--r--src/xterm.h3
5 files changed, 74 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 272354c48d1..0b4da8f5e40 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -786,6 +786,31 @@
786 rather than rolling our own approximation. 786 rather than rolling our own approximation.
787 (SCROLL_BAR_VEC_SIZE): Remove; not used. 787 (SCROLL_BAR_VEC_SIZE): Remove; not used.
788 788
7892011-10-30 Eli Zaretskii <eliz@gnu.org>
790
791 * xdisp.c (try_cursor_movement): Make sure ROW isn't decremented
792 past the beginning of the current glyph matrix.
793
7942011-10-30 Adam Sjøgren <asjo@koldfront.dk> (tiny change)
795
796 * xterm.c: Include X11/Xproto.h if HAVE_GTK3.
797 (x_error_handler): Ignore BadMatch for X_SetInputFocus for
798 HAVE_GTK3 (Bug#9869).
799
800 * gtkutil.c (xg_win_to_widget, xg_event_is_for_menubar): Initialize
801 type to GDK_NOTHING so valgrind does not complain (Bug#9901).
802
803 * xterm.h (x_display_info): Add Xatom_net_wm_state_hidden (Bug#9893).
804
805 * xterm.c: Declare x_handle_net_wm_state to return int.
806 (handle_one_xevent): Check if we are iconified but don't have
807 _NET_WM_STATE_HIDDEN. If do, treat as deiconify (Bug#9893).
808 (get_current_wm_state): Return non-zero if not hidden,
809 check for _NET_WM_STATE_HIDDEN (Bug#9893).
810 (do_ewmh_fullscreen): Ignore return value from get_current_wm_state.
811 (x_handle_net_wm_state): Return what get_current_wm_state returns.
812 (x_term_init): Initialize dpyinfo->Xatom_net_wm_state_hidden.
813
7892011-10-29 Paul Eggert <eggert@cs.ucla.edu> 8142011-10-29 Paul Eggert <eggert@cs.ucla.edu>
790 815
791 * alloc.c (which_symbols): Declare EXTERNALLY_VISIBLE, 816 * alloc.c (which_symbols): Declare EXTERNALLY_VISIBLE,
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 2712297a5b2..e13a7540715 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -987,6 +987,7 @@ xg_win_to_widget (Display *dpy, Window wdesc)
987 { 987 {
988 GdkEvent event; 988 GdkEvent event;
989 event.any.window = gdkwin; 989 event.any.window = gdkwin;
990 event.any.type = GDK_NOTHING;
990 gwdesc = gtk_get_event_widget (&event); 991 gwdesc = gtk_get_event_widget (&event);
991 } 992 }
992 993
@@ -3254,6 +3255,7 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
3254 gw = gdk_x11_window_lookup_for_display (gdpy, event->xbutton.window); 3255 gw = gdk_x11_window_lookup_for_display (gdpy, event->xbutton.window);
3255 if (! gw) return 0; 3256 if (! gw) return 0;
3256 gevent.any.window = gw; 3257 gevent.any.window = gw;
3258 gevent.any.type = GDK_NOTHING;
3257 gwdesc = gtk_get_event_widget (&gevent); 3259 gwdesc = gtk_get_event_widget (&gevent);
3258 if (! gwdesc) return 0; 3260 if (! gwdesc) return 0;
3259 if (! GTK_IS_MENU_BAR (gwdesc) 3261 if (! GTK_IS_MENU_BAR (gwdesc)
diff --git a/src/xdisp.c b/src/xdisp.c
index 53e56e0bd7c..a177a8aca87 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -14836,8 +14836,6 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14836 bidi-reordered rows. */ 14836 bidi-reordered rows. */
14837 while (MATRIX_ROW_CONTINUATION_LINE_P (row)) 14837 while (MATRIX_ROW_CONTINUATION_LINE_P (row))
14838 { 14838 {
14839 xassert (row->enabled_p);
14840 --row;
14841 /* If we hit the beginning of the displayed portion 14839 /* If we hit the beginning of the displayed portion
14842 without finding the first row of a continued 14840 without finding the first row of a continued
14843 line, give up. */ 14841 line, give up. */
@@ -14846,7 +14844,8 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
14846 rc = CURSOR_MOVEMENT_MUST_SCROLL; 14844 rc = CURSOR_MOVEMENT_MUST_SCROLL;
14847 break; 14845 break;
14848 } 14846 }
14849 14847 xassert (row->enabled_p);
14848 --row;
14850 } 14849 }
14851 } 14850 }
14852 if (must_scroll) 14851 if (must_scroll)
diff --git a/src/xterm.c b/src/xterm.c
index df83941f0d1..9603c41fce2 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -93,6 +93,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
93 93
94#ifdef USE_GTK 94#ifdef USE_GTK
95#include "gtkutil.h" 95#include "gtkutil.h"
96#ifdef HAVE_GTK3
97#include <X11/Xproto.h>
98#endif
96#endif 99#endif
97 100
98#ifdef USE_LUCID 101#ifdef USE_LUCID
@@ -343,7 +346,7 @@ static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
343 enum scroll_bar_part *, 346 enum scroll_bar_part *,
344 Lisp_Object *, Lisp_Object *, 347 Lisp_Object *, Lisp_Object *,
345 Time *); 348 Time *);
346static void x_handle_net_wm_state (struct frame *, XPropertyEvent *); 349static int x_handle_net_wm_state (struct frame *, XPropertyEvent *);
347static void x_check_fullscreen (struct frame *); 350static void x_check_fullscreen (struct frame *);
348static void x_check_expected_move (struct frame *, int, int); 351static void x_check_expected_move (struct frame *, int, int);
349static void x_sync_with_move (struct frame *, int, int, int); 352static void x_sync_with_move (struct frame *, int, int, int);
@@ -6112,7 +6115,19 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6112 last_user_time = event.xproperty.time; 6115 last_user_time = event.xproperty.time;
6113 f = x_top_window_to_frame (dpyinfo, event.xproperty.window); 6116 f = x_top_window_to_frame (dpyinfo, event.xproperty.window);
6114 if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state) 6117 if (f && event.xproperty.atom == dpyinfo->Xatom_net_wm_state)
6115 x_handle_net_wm_state (f, &event.xproperty); 6118 if (x_handle_net_wm_state (f, &event.xproperty) && f->iconified)
6119 {
6120 /* Gnome shell does not iconify us when C-z is pressed. It hides
6121 the frame. So if our state says we aren't hidden anymore,
6122 treat is as deiconfied. */
6123 if (! f->async_iconified)
6124 SET_FRAME_GARBAGED (f);
6125 f->async_visible = 1;
6126 f->async_iconified = 0;
6127 f->output_data.x->has_been_visible = 1;
6128 inev.ie.kind = DEICONIFY_EVENT;
6129 XSETFRAME (inev.ie.frame_or_window, f);
6130 }
6116 6131
6117 x_handle_property_notify (&event.xproperty); 6132 x_handle_property_notify (&event.xproperty);
6118 xft_settings_event (dpyinfo, &event); 6133 xft_settings_event (dpyinfo, &event);
@@ -7857,6 +7872,15 @@ static void x_error_quitter (Display *, XErrorEvent *);
7857static int 7872static int
7858x_error_handler (Display *display, XErrorEvent *event) 7873x_error_handler (Display *display, XErrorEvent *event)
7859{ 7874{
7875#ifdef HAVE_GTK3
7876 if (event->error_code == BadMatch
7877 && event->request_code == X_SetInputFocus
7878 && event->minor_code == 0)
7879 {
7880 return 0;
7881 }
7882#endif
7883
7860 if (x_error_message) 7884 if (x_error_message)
7861 x_error_catcher (display, event); 7885 x_error_catcher (display, event);
7862 else 7886 else
@@ -8415,9 +8439,11 @@ x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
8415 8439
8416/* Return the current _NET_WM_STATE. 8440/* Return the current _NET_WM_STATE.
8417 SIZE_STATE is set to one of the FULLSCREEN_* values. 8441 SIZE_STATE is set to one of the FULLSCREEN_* values.
8418 STICKY is set to 1 if the sticky state is set, 0 if not. */ 8442 STICKY is set to 1 if the sticky state is set, 0 if not.
8419 8443
8420static void 8444 Return non-zero if we are not hidden, zero if we are. */
8445
8446static int
8421get_current_wm_state (struct frame *f, 8447get_current_wm_state (struct frame *f,
8422 Window window, 8448 Window window,
8423 int *size_state, 8449 int *size_state,
@@ -8425,7 +8451,7 @@ get_current_wm_state (struct frame *f,
8425{ 8451{
8426 Atom actual_type; 8452 Atom actual_type;
8427 unsigned long actual_size, bytes_remaining; 8453 unsigned long actual_size, bytes_remaining;
8428 int i, rc, actual_format; 8454 int i, rc, actual_format, is_hidden = 0;
8429 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 8455 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
8430 long max_len = 65536; 8456 long max_len = 65536;
8431 Display *dpy = FRAME_X_DISPLAY (f); 8457 Display *dpy = FRAME_X_DISPLAY (f);
@@ -8447,7 +8473,7 @@ get_current_wm_state (struct frame *f,
8447 if (tmp_data) XFree (tmp_data); 8473 if (tmp_data) XFree (tmp_data);
8448 x_uncatch_errors (); 8474 x_uncatch_errors ();
8449 UNBLOCK_INPUT; 8475 UNBLOCK_INPUT;
8450 return; 8476 return ! f->iconified;
8451 } 8477 }
8452 8478
8453 x_uncatch_errors (); 8479 x_uncatch_errors ();
@@ -8455,7 +8481,9 @@ get_current_wm_state (struct frame *f,
8455 for (i = 0; i < actual_size; ++i) 8481 for (i = 0; i < actual_size; ++i)
8456 { 8482 {
8457 Atom a = ((Atom*)tmp_data)[i]; 8483 Atom a = ((Atom*)tmp_data)[i];
8458 if (a == dpyinfo->Xatom_net_wm_state_maximized_horz) 8484 if (a == dpyinfo->Xatom_net_wm_state_hidden)
8485 is_hidden = 1;
8486 else if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
8459 { 8487 {
8460 if (*size_state == FULLSCREEN_HEIGHT) 8488 if (*size_state == FULLSCREEN_HEIGHT)
8461 *size_state = FULLSCREEN_MAXIMIZED; 8489 *size_state = FULLSCREEN_MAXIMIZED;
@@ -8477,6 +8505,7 @@ get_current_wm_state (struct frame *f,
8477 8505
8478 if (tmp_data) XFree (tmp_data); 8506 if (tmp_data) XFree (tmp_data);
8479 UNBLOCK_INPUT; 8507 UNBLOCK_INPUT;
8508 return ! is_hidden;
8480} 8509}
8481 8510
8482/* Do fullscreen as specified in extended window manager hints */ 8511/* Do fullscreen as specified in extended window manager hints */
@@ -8488,7 +8517,7 @@ do_ewmh_fullscreen (struct frame *f)
8488 int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state); 8517 int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state);
8489 int cur, dummy; 8518 int cur, dummy;
8490 8519
8491 get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy); 8520 (void)get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
8492 8521
8493 /* Some window managers don't say they support _NET_WM_STATE, but they do say 8522 /* Some window managers don't say they support _NET_WM_STATE, but they do say
8494 they support _NET_WM_STATE_FULLSCREEN. Try that also. */ 8523 they support _NET_WM_STATE_FULLSCREEN. Try that also. */
@@ -8563,14 +8592,14 @@ XTfullscreen_hook (FRAME_PTR f)
8563} 8592}
8564 8593
8565 8594
8566static void 8595static int
8567x_handle_net_wm_state (struct frame *f, XPropertyEvent *event) 8596x_handle_net_wm_state (struct frame *f, XPropertyEvent *event)
8568{ 8597{
8569 int value = FULLSCREEN_NONE; 8598 int value = FULLSCREEN_NONE;
8570 Lisp_Object lval; 8599 Lisp_Object lval;
8571 int sticky = 0; 8600 int sticky = 0;
8601 int not_hidden = get_current_wm_state (f, event->window, &value, &sticky);
8572 8602
8573 get_current_wm_state (f, event->window, &value, &sticky);
8574 lval = Qnil; 8603 lval = Qnil;
8575 switch (value) 8604 switch (value)
8576 { 8605 {
@@ -8590,6 +8619,8 @@ x_handle_net_wm_state (struct frame *f, XPropertyEvent *event)
8590 8619
8591 store_frame_param (f, Qfullscreen, lval); 8620 store_frame_param (f, Qfullscreen, lval);
8592 store_frame_param (f, Qsticky, sticky ? Qt : Qnil); 8621 store_frame_param (f, Qsticky, sticky ? Qt : Qnil);
8622
8623 return not_hidden;
8593} 8624}
8594 8625
8595/* Check if we need to resize the frame due to a fullscreen request. 8626/* Check if we need to resize the frame due to a fullscreen request.
@@ -9273,7 +9304,7 @@ x_iconify_frame (struct frame *f)
9273 if (!NILP (type)) 9304 if (!NILP (type))
9274 x_bitmap_icon (f, type); 9305 x_bitmap_icon (f, type);
9275 9306
9276#ifdef USE_GTK 9307#if defined (USE_GTK)
9277 if (FRAME_GTK_OUTER_WIDGET (f)) 9308 if (FRAME_GTK_OUTER_WIDGET (f))
9278 { 9309 {
9279 if (! FRAME_VISIBLE_P (f)) 9310 if (! FRAME_VISIBLE_P (f))
@@ -10253,6 +10284,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10253 { "_NET_WM_STATE_MAXIMIZED_VERT", 10284 { "_NET_WM_STATE_MAXIMIZED_VERT",
10254 &dpyinfo->Xatom_net_wm_state_maximized_vert }, 10285 &dpyinfo->Xatom_net_wm_state_maximized_vert },
10255 { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky }, 10286 { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky },
10287 { "_NET_WM_STATE_HIDDEN", &dpyinfo->Xatom_net_wm_state_hidden },
10256 { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type }, 10288 { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type },
10257 { "_NET_WM_WINDOW_TYPE_TOOLTIP", 10289 { "_NET_WM_WINDOW_TYPE_TOOLTIP",
10258 &dpyinfo->Xatom_net_window_type_tooltip }, 10290 &dpyinfo->Xatom_net_window_type_tooltip },
diff --git a/src/xterm.h b/src/xterm.h
index d244aa4be0b..af2e94ed112 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -341,7 +341,8 @@ struct x_display_info
341 /* Atoms dealing with EWMH (i.e. _NET_...) */ 341 /* Atoms dealing with EWMH (i.e. _NET_...) */
342 Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen, 342 Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen,
343 Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert, 343 Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert,
344 Xatom_net_wm_state_sticky, Xatom_net_frame_extents; 344 Xatom_net_wm_state_sticky, Xatom_net_wm_state_hidden,
345 Xatom_net_frame_extents;
345 346
346 /* XSettings atoms and windows. */ 347 /* XSettings atoms and windows. */
347 Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr; 348 Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;