Commit 747617c4049718b9bd3f5aac1054e9a17a98147d

Authored by Dmitry Shachnev
2 parents 283f1061 d69fba05

New upstream version 3.30.1

NEWS
  1 +Version 3.30.1
  2 +==============
  3 +- Improve focus tracking
  4 +
1 5 Version 3.30.0
2 6 ==============
3 7 - Fix build warnings
... ...
build-aux/ltmain.sh
... ... @@ -31,7 +31,7 @@
31 31  
32 32 PROGRAM=libtool
33 33 PACKAGE=libtool
34   -VERSION="2.4.6 Debian-2.4.6-2.1build1"
  34 +VERSION="2.4.6 Debian-2.4.6-3.1"
35 35 package_revision=2.4.6
36 36  
37 37  
... ... @@ -2237,7 +2237,7 @@ include the following information:
2237 2237 compiler: $LTCC
2238 2238 compiler flags: $LTCFLAGS
2239 2239 linker: $LD (gnu? $with_gnu_ld)
2240   - version: $progname $scriptversion Debian-2.4.6-2.1build1
  2240 + version: $progname $scriptversion Debian-2.4.6-3.1
2241 2241 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
2242 2242 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
2243 2243  
... ...
configure
1 1 #! /bin/sh
2 2 # Guess values for system-dependent variables and create Makefiles.
3   -# Generated by GNU Autoconf 2.69 for metacity 3.30.0.
  3 +# Generated by GNU Autoconf 2.69 for metacity 3.30.1.
4 4 #
5 5 # Report bugs to <https://bugzilla.gnome.org/enter_bug.cgi?product=metacity>.
6 6 #
... ... @@ -590,8 +590,8 @@ MAKEFLAGS=
590 590 # Identity of this package.
591 591 PACKAGE_NAME='metacity'
592 592 PACKAGE_TARNAME='metacity'
593   -PACKAGE_VERSION='3.30.0'
594   -PACKAGE_STRING='metacity 3.30.0'
  593 +PACKAGE_VERSION='3.30.1'
  594 +PACKAGE_STRING='metacity 3.30.1'
595 595 PACKAGE_BUGREPORT='https://bugzilla.gnome.org/enter_bug.cgi?product=metacity'
596 596 PACKAGE_URL=''
597 597  
... ... @@ -1414,7 +1414,7 @@ if test &quot;$ac_init_help&quot; = &quot;long&quot;; then
1414 1414 # Omit some internal or obsolete options to make the list less imposing.
1415 1415 # This message is too long to be a string in the A/UX 3.1 sh.
1416 1416 cat <<_ACEOF
1417   -\`configure' configures metacity 3.30.0 to adapt to many kinds of systems.
  1417 +\`configure' configures metacity 3.30.1 to adapt to many kinds of systems.
1418 1418  
1419 1419 Usage: $0 [OPTION]... [VAR=VALUE]...
1420 1420  
... ... @@ -1489,7 +1489,7 @@ fi
1489 1489  
1490 1490 if test -n "$ac_init_help"; then
1491 1491 case $ac_init_help in
1492   - short | recursive ) echo "Configuration of metacity 3.30.0:";;
  1492 + short | recursive ) echo "Configuration of metacity 3.30.1:";;
1493 1493 esac
1494 1494 cat <<\_ACEOF
1495 1495  
... ... @@ -1656,7 +1656,7 @@ fi
1656 1656 test -n "$ac_init_help" && exit $ac_status
1657 1657 if $ac_init_version; then
1658 1658 cat <<\_ACEOF
1659   -metacity configure 3.30.0
  1659 +metacity configure 3.30.1
1660 1660 generated by GNU Autoconf 2.69
1661 1661  
1662 1662 Copyright (C) 2012 Free Software Foundation, Inc.
... ... @@ -2208,7 +2208,7 @@ cat &gt;config.log &lt;&lt;_ACEOF
2208 2208 This file contains any messages produced by compilers while
2209 2209 running configure, to aid debugging if configure makes a mistake.
2210 2210  
2211   -It was created by metacity $as_me 3.30.0, which was
  2211 +It was created by metacity $as_me 3.30.1, which was
2212 2212 generated by GNU Autoconf 2.69. Invocation command line was
2213 2213  
2214 2214 $ $0 $@
... ... @@ -5796,7 +5796,7 @@ fi
5796 5796  
5797 5797 # Define the identity of the package.
5798 5798 PACKAGE='metacity'
5799   - VERSION='3.30.0'
  5799 + VERSION='3.30.1'
5800 5800  
5801 5801  
5802 5802 cat >>confdefs.h <<_ACEOF
... ... @@ -16602,7 +16602,7 @@ $as_echo &quot;#define METACITY_MAJOR_VERSION 3&quot; &gt;&gt;confdefs.h
16602 16602 $as_echo "#define METACITY_MINOR_VERSION 30" >>confdefs.h
16603 16603  
16604 16604  
16605   -$as_echo "#define METACITY_MICRO_VERSION 0" >>confdefs.h
  16605 +$as_echo "#define METACITY_MICRO_VERSION 1" >>confdefs.h
16606 16606  
16607 16607  
16608 16608  
... ... @@ -20572,7 +20572,7 @@ cat &gt;&gt;$CONFIG_STATUS &lt;&lt;\_ACEOF || ac_write_fail=1
20572 20572 # report actual input values of CONFIG_FILES etc. instead of their
20573 20573 # values after options handling.
20574 20574 ac_log="
20575   -This file was extended by metacity $as_me 3.30.0, which was
  20575 +This file was extended by metacity $as_me 3.30.1, which was
20576 20576 generated by GNU Autoconf 2.69. Invocation command line was
20577 20577  
20578 20578 CONFIG_FILES = $CONFIG_FILES
... ... @@ -20638,7 +20638,7 @@ _ACEOF
20638 20638 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
20639 20639 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
20640 20640 ac_cs_version="\\
20641   -metacity config.status 3.30.0
  20641 +metacity config.status 3.30.1
20642 20642 configured by $0, generated by GNU Autoconf 2.69,
20643 20643 with options \\"\$ac_cs_config\\"
20644 20644  
... ...
configure.ac
... ... @@ -4,7 +4,7 @@ dnl **************************************************************************
4 4  
5 5 m4_define([m_major_version], [3])
6 6 m4_define([m_minor_version], [30])
7   -m4_define([m_micro_version], [0])
  7 +m4_define([m_micro_version], [1])
8 8 m4_define([m_version], [m_major_version.m_minor_version.m_micro_version])
9 9  
10 10 dnl **************************************************************************
... ...
m4/libtool.m4
... ... @@ -6438,7 +6438,7 @@ if test yes != &quot;$_lt_caught_CXX_error&quot;; then
6438 6438 # Commands to make compiler produce verbose output that lists
6439 6439 # what "hidden" libraries, object files and flags are used when
6440 6440 # linking a shared library.
6441   - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
  6441 + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
6442 6442  
6443 6443 else
6444 6444 GXX=no
... ... @@ -6813,7 +6813,7 @@ if test yes != &quot;$_lt_caught_CXX_error&quot;; then
6813 6813 # explicitly linking system object files so we need to strip them
6814 6814 # from the output so that they don't get included in the library
6815 6815 # dependencies.
6816   - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
  6816 + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
6817 6817 ;;
6818 6818 *)
6819 6819 if test yes = "$GXX"; then
... ... @@ -6878,7 +6878,7 @@ if test yes != &quot;$_lt_caught_CXX_error&quot;; then
6878 6878 # explicitly linking system object files so we need to strip them
6879 6879 # from the output so that they don't get included in the library
6880 6880 # dependencies.
6881   - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
  6881 + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
6882 6882 ;;
6883 6883 *)
6884 6884 if test yes = "$GXX"; then
... ... @@ -7217,7 +7217,7 @@ if test yes != &quot;$_lt_caught_CXX_error&quot;; then
7217 7217 # Commands to make compiler produce verbose output that lists
7218 7218 # what "hidden" libraries, object files and flags are used when
7219 7219 # linking a shared library.
7220   - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
  7220 + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
7221 7221  
7222 7222 else
7223 7223 # FIXME: insert proper C++ library support
... ... @@ -7301,7 +7301,7 @@ if test yes != &quot;$_lt_caught_CXX_error&quot;; then
7301 7301 # Commands to make compiler produce verbose output that lists
7302 7302 # what "hidden" libraries, object files and flags are used when
7303 7303 # linking a shared library.
7304   - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
  7304 + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
7305 7305 else
7306 7306 # g++ 2.7 appears to require '-G' NOT '-shared' on this
7307 7307 # platform.
... ... @@ -7312,7 +7312,7 @@ if test yes != &quot;$_lt_caught_CXX_error&quot;; then
7312 7312 # Commands to make compiler produce verbose output that lists
7313 7313 # what "hidden" libraries, object files and flags are used when
7314 7314 # linking a shared library.
7315   - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
  7315 + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"'
7316 7316 fi
7317 7317  
7318 7318 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
... ...
src/core/atomnames.h
... ... @@ -62,6 +62,8 @@ item(_GTK_FRAME_EXTENTS)
62 62 item(_GNOME_PANEL_ACTION)
63 63 item(_GNOME_PANEL_ACTION_MAIN_MENU)
64 64 item(_GNOME_PANEL_ACTION_RUN_DIALOG)
  65 +item(_METACITY_TIMESTAMP_PING)
  66 +item(_METACITY_FOCUS_SET)
65 67 item(_METACITY_SENTINEL)
66 68 item(_METACITY_VERSION)
67 69 item(WM_CLIENT_MACHINE)
... ...
src/core/display-private.h
... ... @@ -127,6 +127,14 @@ struct _MetaDisplay
127 127 */
128 128 guint allow_terminal_deactivation : 1;
129 129  
  130 + /* If true, server->focus_serial refers to us changing the focus; in
  131 + * this case, we can ignore focus events that have exactly focus_serial,
  132 + * since we take care to make another request immediately afterwards.
  133 + * But if focus is being changed by another client, we have to accept
  134 + * multiple events with the same serial.
  135 + */
  136 + guint focused_by_us : 1;
  137 +
130 138 /*< private-ish >*/
131 139 guint error_trap_synced_at_last_pop : 1;
132 140 MetaScreen *screen;
... ...
src/core/display.c
... ... @@ -1210,6 +1210,17 @@ meta_display_get_current_time (MetaDisplay *display)
1210 1210 return display->current_time;
1211 1211 }
1212 1212  
  1213 +static Bool
  1214 +find_timestamp_predicate (Display *xdisplay,
  1215 + XEvent *ev,
  1216 + XPointer arg)
  1217 +{
  1218 + MetaDisplay *display = (MetaDisplay *) arg;
  1219 +
  1220 + return (ev->type == PropertyNotify &&
  1221 + ev->xproperty.atom == display->atom__METACITY_TIMESTAMP_PING);
  1222 +}
  1223 +
1213 1224 /* Get a timestamp, even if it means a roundtrip */
1214 1225 guint32
1215 1226 meta_display_get_current_time_roundtrip (MetaDisplay *display)
... ... @@ -1221,17 +1232,13 @@ meta_display_get_current_time_roundtrip (MetaDisplay *display)
1221 1232 {
1222 1233 XEvent property_event;
1223 1234  
1224   - /* Using the property XA_PRIMARY because it's safe; nothing
1225   - * would use it as a property. The type doesn't matter.
1226   - */
1227   - XChangeProperty (display->xdisplay,
1228   - display->timestamp_pinging_window,
1229   - XA_PRIMARY, XA_STRING, 8,
1230   - PropModeAppend, NULL, 0);
1231   - XWindowEvent (display->xdisplay,
1232   - display->timestamp_pinging_window,
1233   - PropertyChangeMask,
1234   - &property_event);
  1235 + XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
  1236 + display->atom__METACITY_TIMESTAMP_PING,
  1237 + XA_STRING, 8, PropModeAppend, NULL, 0);
  1238 + XIfEvent (display->xdisplay,
  1239 + &property_event,
  1240 + find_timestamp_predicate,
  1241 + (XPointer) display);
1235 1242 timestamp = property_event.xproperty.time;
1236 1243 }
1237 1244  
... ... @@ -1408,9 +1415,11 @@ button_press_event_new (XEvent *xevent,
1408 1415 static void
1409 1416 update_focus_window (MetaDisplay *display,
1410 1417 MetaWindow *window,
1411   - gulong serial)
  1418 + gulong serial,
  1419 + gboolean focused_by_us)
1412 1420 {
1413 1421 display->focus_serial = serial;
  1422 + display->focused_by_us = focused_by_us;
1414 1423  
1415 1424 if (window == display->focus_window)
1416 1425 return;
... ... @@ -1485,6 +1494,7 @@ request_xserver_input_focus_change (MetaDisplay *display,
1485 1494 guint32 timestamp)
1486 1495 {
1487 1496 MetaWindow *meta_window;
  1497 + gulong serial;
1488 1498  
1489 1499 if (timestamp_too_old (display, &timestamp))
1490 1500 return;
... ... @@ -1492,14 +1502,36 @@ request_xserver_input_focus_change (MetaDisplay *display,
1492 1502 meta_window = meta_display_lookup_x_window (display, xwindow);
1493 1503  
1494 1504 meta_error_trap_push (display);
1495   - update_focus_window (display,
1496   - meta_window,
1497   - XNextRequest (display->xdisplay));
  1505 +
  1506 + /* In order for mutter to know that the focus request succeeded, we track
  1507 + * the serial of the "focus request" we made, but if we take the serial
  1508 + * of the XSetInputFocus request, then there's no way to determine the
  1509 + * difference between focus events as a result of the SetInputFocus and
  1510 + * focus events that other clients send around the same time. Ensure that
  1511 + * we know which is which by making two requests that the server will
  1512 + * process at the same time.
  1513 + */
  1514 + XGrabServer (display->xdisplay);
  1515 +
  1516 + serial = XNextRequest (display->xdisplay);
1498 1517  
1499 1518 XSetInputFocus (display->xdisplay,
1500 1519 xwindow,
1501 1520 RevertToPointerRoot,
1502 1521 timestamp);
  1522 +
  1523 + XChangeProperty (display->xdisplay, display->timestamp_pinging_window,
  1524 + display->atom__METACITY_FOCUS_SET,
  1525 + XA_STRING, 8, PropModeAppend, NULL, 0);
  1526 +
  1527 + XUngrabServer (display->xdisplay);
  1528 + XFlush (display->xdisplay);
  1529 +
  1530 + update_focus_window (display,
  1531 + meta_window,
  1532 + serial,
  1533 + TRUE);
  1534 +
1503 1535 meta_error_trap_pop (display);
1504 1536  
1505 1537 display->last_focus_time = timestamp;
... ... @@ -1608,10 +1640,18 @@ handle_window_focus_event (MetaDisplay *display,
1608 1640 else
1609 1641 g_return_if_reached ();
1610 1642  
1611   - if (display->server_focus_serial >= display->focus_serial)
  1643 + /* If display->focused_by_us, then the focus_serial will be used only
  1644 + * for a focus change we made and have already accounted for.
  1645 + * (See request_xserver_input_focus_change().) Otherwise, we can get
  1646 + * multiple focus events with the same serial.
  1647 + */
  1648 + if (display->server_focus_serial > display->focus_serial ||
  1649 + (!display->focused_by_us &&
  1650 + display->server_focus_serial == display->focus_serial))
1612 1651 {
1613 1652 update_focus_window (display, focus_window,
1614   - display->server_focus_serial);
  1653 + display->server_focus_serial,
  1654 + FALSE);
1615 1655 }
1616 1656 }
1617 1657  
... ... @@ -1656,7 +1696,8 @@ event_callback (XEvent *event,
1656 1696 display->current_time = event_get_time (display, event);
1657 1697 display->monitor_cache_invalidated = TRUE;
1658 1698  
1659   - if (event->xany.serial > display->focus_serial &&
  1699 + if (display->focused_by_us &&
  1700 + event->xany.serial > display->focus_serial &&
1660 1701 display->focus_window &&
1661 1702 display->focus_window->xwindow != display->server_focus_window)
1662 1703 {
... ... @@ -1664,7 +1705,8 @@ event_callback (XEvent *event,
1664 1705 display->focus_window->desc);
1665 1706 update_focus_window (display,
1666 1707 meta_display_lookup_x_window (display, display->server_focus_window),
1667   - display->server_focus_serial);
  1708 + display->server_focus_serial,
  1709 + FALSE);
1668 1710 }
1669 1711  
1670 1712 modified = event_get_modified_window (display, event);
... ...